aboutsummaryrefslogtreecommitdiff
path: root/viewer/src
diff options
context:
space:
mode:
authorpacien2020-09-19 22:25:54 +0200
committerpacien2020-09-19 22:25:54 +0200
commitd9e51ff55ef494d37c5e23ef8fb79500fa5585c5 (patch)
treeae2c25614c71fe1c21489a5c7b5a83b718e9701e /viewer/src
parentab97f64575f1b51bacced6ce1bc6bf22e0354615 (diff)
downloadldgallery-d9e51ff55ef494d37c5e23ef8fb79500fa5585c5.tar.gz
viewer: rename title sort order
To avoid confusion with filenames.
Diffstat (limited to 'viewer/src')
-rw-r--r--viewer/src/@types/gallery.d.ts2
-rw-r--r--viewer/src/locales/en.json2
-rw-r--r--viewer/src/services/itemComparators.ts6
3 files changed, 5 insertions, 5 deletions
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 @@
18*/ 18*/
19 19
20declare namespace Gallery { 20declare namespace Gallery {
21 type ItemSortStr = "name_asc" | "date_asc" | "date_desc"; 21 type ItemSortStr = "title_asc" | "date_asc" | "date_desc";
22 22
23 interface Config { 23 interface Config {
24 galleryRoot: string; 24 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 @@
6 "command.search.search": "Search", 6 "command.search.search": "Search",
7 "command.sort.byDateAsc": "By date (oldest first)", 7 "command.sort.byDateAsc": "By date (oldest first)",
8 "command.sort.byDateDesc": "By date (most recent first)", 8 "command.sort.byDateDesc": "By date (most recent first)",
9 "command.sort.byNameAsc": "By name (A to Z)", 9 "command.sort.byTitleAsc": "By title (A to Z)",
10 "directory.no-results": "Empty directory", 10 "directory.no-results": "Empty directory",
11 "download.download-file-fmt": "Download {0}", 11 "download.download-file-fmt": "Download {0}",
12 "gallery.unknown-resource": "Resource not found", 12 "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
23export type ItemSort = { name: Gallery.ItemSortStr; text: TranslateResult; fn: ItemComparator }; 23export type ItemSort = { name: Gallery.ItemSortStr; text: TranslateResult; fn: ItemComparator };
24 24
25export default class ItemComparators { 25export default class ItemComparators {
26 static readonly DEFAULT = ItemComparators.sortByNameAsc; 26 static readonly DEFAULT = ItemComparators.sortByTitleAsc;
27 27
28 static readonly ITEM_SORTS: ItemSort[] = [ 28 static readonly ITEM_SORTS: ItemSort[] = [
29 { name: "name_asc", text: i18n.t("command.sort.byNameAsc"), fn: ItemComparators.sortByNameAsc }, 29 { name: "title_asc", text: i18n.t("command.sort.byTitleAsc"), fn: ItemComparators.sortByTitleAsc },
30 { name: "date_asc", text: i18n.t("command.sort.byDateAsc"), fn: ItemComparators.sortByDateAsc }, 30 { name: "date_asc", text: i18n.t("command.sort.byDateAsc"), fn: ItemComparators.sortByDateAsc },
31 { 31 {
32 name: "date_desc", 32 name: "date_desc",
@@ -35,7 +35,7 @@ export default class ItemComparators {
35 }, 35 },
36 ]; 36 ];
37 37
38 static sortByNameAsc(left: Gallery.Item, right: Gallery.Item): number { 38 static sortByTitleAsc(left: Gallery.Item, right: Gallery.Item): number {
39 return left.title.localeCompare(right.title, undefined, { 39 return left.title.localeCompare(right.title, undefined, {
40 sensitivity: "base", 40 sensitivity: "base",
41 ignorePunctuation: true, 41 ignorePunctuation: true,