-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add alphabetical ordering options to series blocks #742
Conversation
68527f8
to
544fe56
Compare
There was a problem hiding this 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
frontend/src/ui/Blocks/Series.tsx
Outdated
"A-Z": () => a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1, | ||
"Z-A": () => a.title.toLowerCase() > b.title.toLowerCase() ? -1 : 1, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
544fe56
to
c3fe46f
Compare
c3fe46f
to
8bb94f5
Compare
New ordering options are from
a to z
andz to a
.Ordering is now also applied for upcoming events.