From d9e51ff55ef494d37c5e23ef8fb79500fa5585c5 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 19 Sep 2020 22:25:54 +0200 Subject: viewer: rename title sort order To avoid confusion with filenames. --- viewer/src/@types/gallery.d.ts | 2 +- viewer/src/locales/en.json | 2 +- viewer/src/services/itemComparators.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'viewer') diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 41ad5bb..e9b80e6 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts @@ -18,7 +18,7 @@ */ declare namespace Gallery { - type ItemSortStr = "name_asc" | "date_asc" | "date_desc"; + type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; interface Config { galleryRoot: string; diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json index 41088da..b21262a 100644 --- a/viewer/src/locales/en.json +++ b/viewer/src/locales/en.json @@ -6,7 +6,7 @@ "command.search.search": "Search", "command.sort.byDateAsc": "By date (oldest first)", "command.sort.byDateDesc": "By date (most recent first)", - "command.sort.byNameAsc": "By name (A to Z)", + "command.sort.byTitleAsc": "By title (A to Z)", "directory.no-results": "Empty directory", "download.download-file-fmt": "Download {0}", "gallery.unknown-resource": "Resource not found", diff --git a/viewer/src/services/itemComparators.ts b/viewer/src/services/itemComparators.ts index 64ce288..e131b8b 100644 --- a/viewer/src/services/itemComparators.ts +++ b/viewer/src/services/itemComparators.ts @@ -23,10 +23,10 @@ export type ItemComparator = (left: Gallery.Item, right: Gallery.Item) => number export type ItemSort = { name: Gallery.ItemSortStr; text: TranslateResult; fn: ItemComparator }; export default class ItemComparators { - static readonly DEFAULT = ItemComparators.sortByNameAsc; + static readonly DEFAULT = ItemComparators.sortByTitleAsc; static readonly ITEM_SORTS: ItemSort[] = [ - { name: "name_asc", text: i18n.t("command.sort.byNameAsc"), fn: ItemComparators.sortByNameAsc }, + { name: "title_asc", text: i18n.t("command.sort.byTitleAsc"), fn: ItemComparators.sortByTitleAsc }, { name: "date_asc", text: i18n.t("command.sort.byDateAsc"), fn: ItemComparators.sortByDateAsc }, { name: "date_desc", @@ -35,7 +35,7 @@ export default class ItemComparators { }, ]; - static sortByNameAsc(left: Gallery.Item, right: Gallery.Item): number { + static sortByTitleAsc(left: Gallery.Item, right: Gallery.Item): number { return left.title.localeCompare(right.title, undefined, { sensitivity: "base", ignorePunctuation: true, -- cgit v1.2.3