-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: When friendly dates are enabled, group elements use friendly dat…
…es (#717) * Adds missing `import` statement * Gentle refactoring in `updateAttributes()` * Removes redundant assignment of `attributes` to itself In more detail, it assigns to `attributes` a new Object whose keys are all the values of `sorting[i].value`. These values should be all the possible attributes, so in effect, the keys don't change. The value assigned to each of these keys is `attributes[key]`, in other words, the value which that key **already has** in `attributes`. So, `attributes` should not change. So the line is redundant. As it prevents `attributes` from being made `const`, I've removed it. * Const-ifies `attributes` * Adds AttributeKey and DateAttributeKey types Also gently refactors updateAttributes() to take advantage of the stronger typing * Adds FriendlyDateGroup type * Refactors friendlyDate() Separates out the step which find the right translation key for the friendly date from the stage which translates that key. In particular, adds a new function, `friendlyDateTranslationKey()`, which just finds the right translation key. `friendlyDate()` now just calls the first function and applies the translation function from i18next. * Defines `friendlyDateGroup()` * Refactors DateAttribute and DateAttributeKey types * Defines `getDateAttributes()` This will be useful for grouping by friendly date, since we need to identify whether the attribute key associated with a given group is a date attribute key. * Groups date attributes by friendly date translation key when friendly dates are enabled. As before, when the user hasn't got friendly dates enabled, todo objects will be grouped by the raw value of date attributes, hopefully an ISO string like `2024-07-10`. But when the user enables friendly dates, todos will instead be grouped by the friendly date translation key, such as `drawer.attributes.today`. * Group titles in UI use friendly dates when enabled --------- Co-authored-by: Joe Carstairs <me@joeac.net> Co-authored-by: ransome <11188741+ransome1@users.noreply.github.com>
- Loading branch information
1 parent
f975507
commit c3fceea
Showing
7 changed files
with
197 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.