Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort catalog items alphabetically in the E&A modal and the data catalog #1039

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

dzole0311
Copy link
Collaborator

Related Ticket: #1038

Description of Changes

Add fix that sorts catalog content alphabetically by default for the Data Catalog view and the E&A modal. This behavior was there for the Data Catalog before the last release, but not for the old E&A modal (due to it using horizontal cards).

Notes & Questions About Changes

{Add additonal notes and outstanding questions here related to changes in this pull request}

Validation / Testing

  1. The filtering, sorting and search work as before for the Data Catalog and the E&A modal

Copy link

netlify bot commented Jul 9, 2024

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit 8baf558
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/668d34f6f4f39800092b7b75
😎 Deploy Preview https://deploy-preview-1039--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

isDatasetData(d) &&
d.layers.sort((a, b) => a[sortField]?.localeCompare(b[sortField]) || 0)
})) as DatasetData[];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think

sortField &&
/* eslint-disable-next-line fp/no-mutating-methods */
filtered.sort((a, b) => {
if (!a[sortField]) return Infinity;
return a[sortField]?.localeCompare(b[sortField]);
});
should already work?

Copy link
Collaborator Author

@dzole0311 dzole0311 Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that this will only work for the Data Catalog, where we show the datasets. But in the E&A Modal we show the layers within those datasets, so we have to go one level down (to the layers prop) to sort them. Showing the layers in the new E&A Modal makes it more obvious that they are unsorted as opposed to the old modal when we showed them horizontally and it was not as obvious.

Copy link
Collaborator

@sandrahoang686 sandrahoang686 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🚀 thanks for getting on this quick!

@dzole0311 dzole0311 merged commit 38bbb62 into main Jul 9, 2024
8 checks passed
@dzole0311 dzole0311 deleted the 1038-catalog-sorting branch July 9, 2024 13:30
sandrahoang686 added a commit that referenced this pull request Jul 17, 2024
## 🎉 Features
* 🦗 

## 🚀 Improvements
- Base setup for using react-uswds in the veda-ui
#1029
- Consolidate utils/veda-data(-no-faux-module) methods into new dir and
remove faux module dependencies for Library build
#1030
- Upgrade to Parcel 2.12 and make library build work
#1045
- Update E&A Date Picker to react-calendar with USWDS tokens
#1048

## 🐛 Fixes
- Sort catalog items alphabetically in the E&A modal and the data
catalog #1039
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants