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

Add alphabetical ordering options to series blocks #742

Merged

Conversation

owi92
Copy link
Member

@owi92 owi92 commented Mar 15, 2023

New ordering options are from a to z and z to a.
Ordering is now also applied for upcoming events.

@github-actions github-actions bot temporarily deployed to test-deployment-pr742 March 15, 2023 12:16 Destroyed
@owi92 owi92 added the changelog:user User facing changes label Mar 15, 2023
@owi92 owi92 force-pushed the alphabetic-ordering-for-events branch from 68527f8 to 544fe56 Compare March 15, 2023 13:36
@github-actions github-actions bot temporarily deployed to test-deployment-pr742 March 15, 2023 13:40 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Just a few small things

Comment on lines 175 to 176
"A-Z": () => a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1,
"Z-A": () => a.title.toLowerCase() > b.title.toLowerCase() ? -1 : 1,
Copy link
Member

Choose a reason for hiding this comment

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

This should use localeCompare as the expected string order actually depends on the locale: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare

I think this also already deals with casing (in that it ignores it, if the locale says so)

Copy link
Member

Choose a reason for hiding this comment

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

You still need to pass in the correct language thats set in Tobira. You can compare sortRealms in routes/util.tsx. There we also create an Intl.Collator as MDN says thats better for performance: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#performance

You can const { t, i18n } = useTranslation() and then use i18n.language or something like that.

frontend/src/ui/Blocks/Series.tsx Outdated Show resolved Hide resolved
frontend/src/ui/Blocks/Series.tsx Outdated Show resolved Hide resolved
@owi92 owi92 force-pushed the alphabetic-ordering-for-events branch from 544fe56 to c3fe46f Compare March 15, 2023 21:16
@github-actions github-actions bot temporarily deployed to test-deployment-pr742 March 15, 2023 21:21 Destroyed
@owi92 owi92 force-pushed the alphabetic-ordering-for-events branch from c3fe46f to 8bb94f5 Compare March 16, 2023 09:02
@github-actions github-actions bot temporarily deployed to test-deployment-pr742 March 16, 2023 09:07 Destroyed
@LukasKalbertodt LukasKalbertodt merged commit 61d3c21 into elan-ev:master Mar 16, 2023
@owi92 owi92 deleted the alphabetic-ordering-for-events branch March 4, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:user User facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants