From 9c9c79176dd358aaf953f17a7188b1b8d050f956 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 14 Jan 2026 13:40:07 +0100 Subject: [PATCH] feat(bookshelf): add an option to sort books by publish date, closes #2925 (#2949) --- .../public/locales/ar/translation.json | 3 ++- .../public/locales/bn/translation.json | 3 ++- .../public/locales/bo/translation.json | 3 ++- .../public/locales/de/translation.json | 3 ++- .../public/locales/el/translation.json | 3 ++- .../public/locales/es/translation.json | 3 ++- .../public/locales/fa/translation.json | 3 ++- .../public/locales/fr/translation.json | 3 ++- .../public/locales/hi/translation.json | 3 ++- .../public/locales/id/translation.json | 3 ++- .../public/locales/it/translation.json | 3 ++- .../public/locales/ja/translation.json | 3 ++- .../public/locales/ko/translation.json | 3 ++- .../public/locales/ms/translation.json | 3 ++- .../public/locales/nl/translation.json | 3 ++- .../public/locales/pl/translation.json | 3 ++- .../public/locales/pt/translation.json | 3 ++- .../public/locales/ru/translation.json | 3 ++- .../public/locales/si/translation.json | 3 ++- .../public/locales/sv/translation.json | 3 ++- .../public/locales/ta/translation.json | 3 ++- .../public/locales/th/translation.json | 3 ++- .../public/locales/tr/translation.json | 3 ++- .../public/locales/uk/translation.json | 3 ++- .../public/locales/vi/translation.json | 3 ++- .../public/locales/zh-CN/translation.json | 3 ++- .../public/locales/zh-TW/translation.json | 3 ++- .../src/app/library/components/ViewMenu.tsx | 1 + .../src/app/library/utils/libraryUtils.ts | 21 +++++++++++++++++++ apps/readest-app/src/types/settings.ts | 2 +- 30 files changed, 77 insertions(+), 28 deletions(-) diff --git a/apps/readest-app/public/locales/ar/translation.json b/apps/readest-app/public/locales/ar/translation.json index f463a036..a2183c77 100644 --- a/apps/readest-app/public/locales/ar/translation.json +++ b/apps/readest-app/public/locales/ar/translation.json @@ -884,5 +884,6 @@ "Whole word:": "كلمة كاملة:", "Error": "خطأ", "Unable to load the article. Try searching directly on {{link}}.": "تعذر تحميل المقال. حاول البحث مباشرة على {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "تعذر تحميل الكلمة. حاول البحث مباشرة على {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "تعذر تحميل الكلمة. حاول البحث مباشرة على {{link}}.", + "Date Published": "تاريخ النشر" } diff --git a/apps/readest-app/public/locales/bn/translation.json b/apps/readest-app/public/locales/bn/translation.json index 4a9abd3c..11f10f81 100644 --- a/apps/readest-app/public/locales/bn/translation.json +++ b/apps/readest-app/public/locales/bn/translation.json @@ -844,5 +844,6 @@ "Whole word:": "সম্পূর্ণ শব্দ:", "Error": "ত্রুটি", "Unable to load the article. Try searching directly on {{link}}.": "নিবন্ধ লোড করতে অক্ষম। সরাসরি {{link}} এ অনুসন্ধান করার চেষ্টা করুন।", - "Unable to load the word. Try searching directly on {{link}}.": "শব্দ লোড করতে অক্ষম। সরাসরি {{link}} এ অনুসন্ধান করার চেষ্টা করুন।" + "Unable to load the word. Try searching directly on {{link}}.": "শব্দ লোড করতে অক্ষম। সরাসরি {{link}} এ অনুসন্ধান করার চেষ্টা করুন।", + "Date Published": "প্রকাশনার তারিখ" } diff --git a/apps/readest-app/public/locales/bo/translation.json b/apps/readest-app/public/locales/bo/translation.json index 939a437b..9b0ed267 100644 --- a/apps/readest-app/public/locales/bo/translation.json +++ b/apps/readest-app/public/locales/bo/translation.json @@ -834,5 +834,6 @@ "Whole word:": "ཚིག་གྲུབ་ཆ་ཚང་:", "Error": "ནོར་འཁྲུལ།", "Unable to load the article. Try searching directly on {{link}}.": "རྩོམ་ཡིག་མངོན་མི་ཐུབ། {{link}} ཐད་ཀར་འཚོལ་བ་བྱོས།", - "Unable to load the word. Try searching directly on {{link}}.": "ཚིག་མངོན་མི་ཐུབ། {{link}} ཐད་ཀར་འཚོལ་བ་བྱོས།" + "Unable to load the word. Try searching directly on {{link}}.": "ཚིག་མངོན་མི་ཐུབ། {{link}} ཐད་ཀར་འཚོལ་བ་བྱོས།", + "Date Published": "པར་སྐྲུན་ཚེས་གྲངས།" } diff --git a/apps/readest-app/public/locales/de/translation.json b/apps/readest-app/public/locales/de/translation.json index 91e50af4..a82ecd5c 100644 --- a/apps/readest-app/public/locales/de/translation.json +++ b/apps/readest-app/public/locales/de/translation.json @@ -844,5 +844,6 @@ "Whole word:": "Ganzes Wort:", "Error": "Fehler", "Unable to load the article. Try searching directly on {{link}}.": "Artikel kann nicht geladen werden. Versuchen Sie die direkte Suche auf {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Wort kann nicht geladen werden. Versuchen Sie die direkte Suche auf {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Wort kann nicht geladen werden. Versuchen Sie die direkte Suche auf {{link}}.", + "Date Published": "Veröffentlichungsdatum" } diff --git a/apps/readest-app/public/locales/el/translation.json b/apps/readest-app/public/locales/el/translation.json index d0ee829f..df58301d 100644 --- a/apps/readest-app/public/locales/el/translation.json +++ b/apps/readest-app/public/locales/el/translation.json @@ -844,5 +844,6 @@ "Whole word:": "Ολόκληρη λέξη:", "Error": "Σφάλμα", "Unable to load the article. Try searching directly on {{link}}.": "Αδυναμία φόρτωσης του άρθρου. Δοκιμάστε να αναζητήσετε απευθείας στο {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Αδυναμία φόρτωσης της λέξης. Δοκιμάστε να αναζητήσετε απευθείας στο {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Αδυναμία φόρτωσης της λέξης. Δοκιμάστε να αναζητήσετε απευθείας στο {{link}}.", + "Date Published": "Ημερομηνία δημοσίευσης" } diff --git a/apps/readest-app/public/locales/es/translation.json b/apps/readest-app/public/locales/es/translation.json index c201bad6..13e9a4d6 100644 --- a/apps/readest-app/public/locales/es/translation.json +++ b/apps/readest-app/public/locales/es/translation.json @@ -854,5 +854,6 @@ "Whole word:": "Palabra completa:", "Error": "Error", "Unable to load the article. Try searching directly on {{link}}.": "No se puede cargar el artículo. Intenta buscar directamente en {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "No se puede cargar la palabra. Intenta buscar directamente en {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "No se puede cargar la palabra. Intenta buscar directamente en {{link}}.", + "Date Published": "Fecha de publicación" } diff --git a/apps/readest-app/public/locales/fa/translation.json b/apps/readest-app/public/locales/fa/translation.json index 7b5730c7..a2042a12 100644 --- a/apps/readest-app/public/locales/fa/translation.json +++ b/apps/readest-app/public/locales/fa/translation.json @@ -844,5 +844,6 @@ "Whole word:": "کلمه کامل:", "Error": "خطا", "Unable to load the article. Try searching directly on {{link}}.": "بارگذاری مقاله امکان‌پذیر نیست. سعی کنید مستقیماً در {{link}} جستجو کنید.", - "Unable to load the word. Try searching directly on {{link}}.": "بارگذاری کلمه امکان‌پذیر نیست. سعی کنید مستقیماً در {{link}} جستجو کنید." + "Unable to load the word. Try searching directly on {{link}}.": "بارگذاری کلمه امکان‌پذیر نیست. سعی کنید مستقیماً در {{link}} جستجو کنید.", + "Date Published": "تاریخ انتشار" } diff --git a/apps/readest-app/public/locales/fr/translation.json b/apps/readest-app/public/locales/fr/translation.json index b787cd27..a675b65e 100644 --- a/apps/readest-app/public/locales/fr/translation.json +++ b/apps/readest-app/public/locales/fr/translation.json @@ -854,5 +854,6 @@ "Whole word:": "Mot entier :", "Error": "Erreur", "Unable to load the article. Try searching directly on {{link}}.": "Impossible de charger l'article. Essayez de rechercher directement sur {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Impossible de charger le mot. Essayez de rechercher directement sur {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Impossible de charger le mot. Essayez de rechercher directement sur {{link}}.", + "Date Published": "Date de publication" } diff --git a/apps/readest-app/public/locales/hi/translation.json b/apps/readest-app/public/locales/hi/translation.json index 044e71fb..8130917b 100644 --- a/apps/readest-app/public/locales/hi/translation.json +++ b/apps/readest-app/public/locales/hi/translation.json @@ -844,5 +844,6 @@ "Whole word:": "पूरा शब्द:", "Error": "त्रुटि", "Unable to load the article. Try searching directly on {{link}}.": "लेख लोड करने में असमर्थ। सीधे {{link}} पर खोजने का प्रयास करें।", - "Unable to load the word. Try searching directly on {{link}}.": "शब्द लोड करने में असमर्थ। सीधे {{link}} पर खोजने का प्रयास करें।" + "Unable to load the word. Try searching directly on {{link}}.": "शब्द लोड करने में असमर्थ। सीधे {{link}} पर खोजने का प्रयास करें।", + "Date Published": "प्रकाशन तिथि" } diff --git a/apps/readest-app/public/locales/id/translation.json b/apps/readest-app/public/locales/id/translation.json index 7bc78903..7e0382f5 100644 --- a/apps/readest-app/public/locales/id/translation.json +++ b/apps/readest-app/public/locales/id/translation.json @@ -834,5 +834,6 @@ "Whole word:": "Kata utuh:", "Error": "Kesalahan", "Unable to load the article. Try searching directly on {{link}}.": "Tidak dapat memuat artikel. Coba cari langsung di {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Tidak dapat memuat kata. Coba cari langsung di {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Tidak dapat memuat kata. Coba cari langsung di {{link}}.", + "Date Published": "Tanggal terbit" } diff --git a/apps/readest-app/public/locales/it/translation.json b/apps/readest-app/public/locales/it/translation.json index 4fa30d1a..59569aad 100644 --- a/apps/readest-app/public/locales/it/translation.json +++ b/apps/readest-app/public/locales/it/translation.json @@ -854,5 +854,6 @@ "Whole word:": "Parola intera:", "Error": "Errore", "Unable to load the article. Try searching directly on {{link}}.": "Impossibile caricare l'articolo. Prova a cercare direttamente su {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Impossibile caricare la parola. Prova a cercare direttamente su {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Impossibile caricare la parola. Prova a cercare direttamente su {{link}}.", + "Date Published": "Data di pubblicazione" } diff --git a/apps/readest-app/public/locales/ja/translation.json b/apps/readest-app/public/locales/ja/translation.json index aedb62eb..fdc59662 100644 --- a/apps/readest-app/public/locales/ja/translation.json +++ b/apps/readest-app/public/locales/ja/translation.json @@ -834,5 +834,6 @@ "Whole word:": "単語全体:", "Error": "エラー", "Unable to load the article. Try searching directly on {{link}}.": "記事を読み込めません。{{link}}で直接検索してみてください。", - "Unable to load the word. Try searching directly on {{link}}.": "単語を読み込めません。{{link}}で直接検索してみてください。" + "Unable to load the word. Try searching directly on {{link}}.": "単語を読み込めません。{{link}}で直接検索してみてください。", + "Date Published": "出版日" } diff --git a/apps/readest-app/public/locales/ko/translation.json b/apps/readest-app/public/locales/ko/translation.json index 4c04e8cc..50083381 100644 --- a/apps/readest-app/public/locales/ko/translation.json +++ b/apps/readest-app/public/locales/ko/translation.json @@ -834,5 +834,6 @@ "Whole word:": "전체 단어:", "Error": "오류", "Unable to load the article. Try searching directly on {{link}}.": "문서를 로드할 수 없습니다. {{link}}에서 직접 검색해 보세요.", - "Unable to load the word. Try searching directly on {{link}}.": "단어를 로드할 수 없습니다. {{link}}에서 직접 검색해 보세요." + "Unable to load the word. Try searching directly on {{link}}.": "단어를 로드할 수 없습니다. {{link}}에서 직접 검색해 보세요.", + "Date Published": "출판일" } diff --git a/apps/readest-app/public/locales/ms/translation.json b/apps/readest-app/public/locales/ms/translation.json index 17e35f0d..b8f2f8c9 100644 --- a/apps/readest-app/public/locales/ms/translation.json +++ b/apps/readest-app/public/locales/ms/translation.json @@ -834,5 +834,6 @@ "Whole word:": "Perkataan penuh:", "Error": "Ralat", "Unable to load the article. Try searching directly on {{link}}.": "Tidak dapat memuatkan artikel. Cuba cari terus di {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Tidak dapat memuatkan perkataan. Cuba cari terus di {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Tidak dapat memuatkan perkataan. Cuba cari terus di {{link}}.", + "Date Published": "Tarikh diterbitkan" } diff --git a/apps/readest-app/public/locales/nl/translation.json b/apps/readest-app/public/locales/nl/translation.json index 36370a87..402368bb 100644 --- a/apps/readest-app/public/locales/nl/translation.json +++ b/apps/readest-app/public/locales/nl/translation.json @@ -844,5 +844,6 @@ "Whole word:": "Heel woord:", "Error": "Fout", "Unable to load the article. Try searching directly on {{link}}.": "Kan het artikel niet laden. Probeer direct te zoeken op {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Kan het woord niet laden. Probeer direct te zoeken op {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Kan het woord niet laden. Probeer direct te zoeken op {{link}}.", + "Date Published": "Publicatiedatum" } diff --git a/apps/readest-app/public/locales/pl/translation.json b/apps/readest-app/public/locales/pl/translation.json index ee56c75e..162a1ba5 100644 --- a/apps/readest-app/public/locales/pl/translation.json +++ b/apps/readest-app/public/locales/pl/translation.json @@ -864,5 +864,6 @@ "Whole word:": "Całe słowo:", "Error": "Błąd", "Unable to load the article. Try searching directly on {{link}}.": "Nie można załadować artykułu. Spróbuj wyszukać bezpośrednio na {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Nie można załadować słowa. Spróbuj wyszukać bezpośrednio na {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Nie można załadować słowa. Spróbuj wyszukać bezpośrednio na {{link}}.", + "Date Published": "Data wydania" } diff --git a/apps/readest-app/public/locales/pt/translation.json b/apps/readest-app/public/locales/pt/translation.json index 7ba6635b..0408e54d 100644 --- a/apps/readest-app/public/locales/pt/translation.json +++ b/apps/readest-app/public/locales/pt/translation.json @@ -854,5 +854,6 @@ "Whole word:": "Palavra inteira:", "Error": "Erro", "Unable to load the article. Try searching directly on {{link}}.": "Não foi possível carregar o artigo. Tente pesquisar diretamente em {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Não foi possível carregar a palavra. Tente pesquisar diretamente em {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Não foi possível carregar a palavra. Tente pesquisar diretamente em {{link}}.", + "Date Published": "Data de publicação" } diff --git a/apps/readest-app/public/locales/ru/translation.json b/apps/readest-app/public/locales/ru/translation.json index 5b00c393..fb7c39c9 100644 --- a/apps/readest-app/public/locales/ru/translation.json +++ b/apps/readest-app/public/locales/ru/translation.json @@ -864,5 +864,6 @@ "Whole word:": "Слово целиком:", "Error": "Ошибка", "Unable to load the article. Try searching directly on {{link}}.": "Не удалось загрузить статью. Попробуйте искать напрямую на {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Не удалось загрузить слово. Попробуйте искать напрямую на {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Не удалось загрузить слово. Попробуйте искать напрямую на {{link}}.", + "Date Published": "Дата публикации" } diff --git a/apps/readest-app/public/locales/si/translation.json b/apps/readest-app/public/locales/si/translation.json index 3ed376ca..6dd839e2 100644 --- a/apps/readest-app/public/locales/si/translation.json +++ b/apps/readest-app/public/locales/si/translation.json @@ -844,5 +844,6 @@ "Whole word:": "සම්පූර්ණ වචනය:", "Error": "දෝෂය", "Unable to load the article. Try searching directly on {{link}}.": "ලිපිය පූරණය කළ නොහැක. {{link}} හි කෙලින්ම සෙවීමට උත්සාහ කරන්න.", - "Unable to load the word. Try searching directly on {{link}}.": "වචනය පූරණය කළ නොහැක. {{link}} හි කෙලින්ම සෙවීමට උත්සාහ කරන්න." + "Unable to load the word. Try searching directly on {{link}}.": "වචනය පූරණය කළ නොහැක. {{link}} හි කෙලින්ම සෙවීමට උත්සාහ කරන්න.", + "Date Published": "ප්‍රකාශන දිනය" } diff --git a/apps/readest-app/public/locales/sv/translation.json b/apps/readest-app/public/locales/sv/translation.json index d30ab803..98ab4af2 100644 --- a/apps/readest-app/public/locales/sv/translation.json +++ b/apps/readest-app/public/locales/sv/translation.json @@ -844,5 +844,6 @@ "Whole word:": "Hela ordet:", "Error": "Fel", "Unable to load the article. Try searching directly on {{link}}.": "Kan inte ladda artikeln. Försök söka direkt på {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Kan inte ladda ordet. Försök söka direkt på {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Kan inte ladda ordet. Försök söka direkt på {{link}}.", + "Date Published": "Publiceringsdatum" } diff --git a/apps/readest-app/public/locales/ta/translation.json b/apps/readest-app/public/locales/ta/translation.json index 41c1ddd5..b024760a 100644 --- a/apps/readest-app/public/locales/ta/translation.json +++ b/apps/readest-app/public/locales/ta/translation.json @@ -844,5 +844,6 @@ "Whole word:": "முழு சொல்:", "Error": "பிழை", "Unable to load the article. Try searching directly on {{link}}.": "கட்டுரையை ஏற்ற முடியவில்லை. நேரடியாக {{link}} இல் தேடவும்.", - "Unable to load the word. Try searching directly on {{link}}.": "சொல்லை ஏற்ற முடியவில்லை. நேரடியாக {{link}} இல் தேடவும்." + "Unable to load the word. Try searching directly on {{link}}.": "சொல்லை ஏற்ற முடியவில்லை. நேரடியாக {{link}} இல் தேடவும்.", + "Date Published": "வெளியீட்டு தேதி" } diff --git a/apps/readest-app/public/locales/th/translation.json b/apps/readest-app/public/locales/th/translation.json index 99dfedce..b5ad7aea 100644 --- a/apps/readest-app/public/locales/th/translation.json +++ b/apps/readest-app/public/locales/th/translation.json @@ -834,5 +834,6 @@ "Whole word:": "คำทั้งคำ:", "Error": "ข้อผิดพลาด", "Unable to load the article. Try searching directly on {{link}}.": "ไม่สามารถโหลดบทความได้ ลองค้นหาโดยตรงที่ {{link}}", - "Unable to load the word. Try searching directly on {{link}}.": "ไม่สามารถโหลดคำได้ ลองค้นหาโดยตรงที่ {{link}}" + "Unable to load the word. Try searching directly on {{link}}.": "ไม่สามารถโหลดคำได้ ลองค้นหาโดยตรงที่ {{link}}", + "Date Published": "วันที่เผยแพร่" } diff --git a/apps/readest-app/public/locales/tr/translation.json b/apps/readest-app/public/locales/tr/translation.json index 0ceb1b31..48290276 100644 --- a/apps/readest-app/public/locales/tr/translation.json +++ b/apps/readest-app/public/locales/tr/translation.json @@ -844,5 +844,6 @@ "Whole word:": "Tam kelime:", "Error": "Hata", "Unable to load the article. Try searching directly on {{link}}.": "Makale yüklenemiyor. Doğrudan {{link}} üzerinde arama yapmayı deneyin.", - "Unable to load the word. Try searching directly on {{link}}.": "Kelime yüklenemiyor. Doğrudan {{link}} üzerinde arama yapmayı deneyin." + "Unable to load the word. Try searching directly on {{link}}.": "Kelime yüklenemiyor. Doğrudan {{link}} üzerinde arama yapmayı deneyin.", + "Date Published": "Yayın tarihi" } diff --git a/apps/readest-app/public/locales/uk/translation.json b/apps/readest-app/public/locales/uk/translation.json index 60994464..904909bb 100644 --- a/apps/readest-app/public/locales/uk/translation.json +++ b/apps/readest-app/public/locales/uk/translation.json @@ -864,5 +864,6 @@ "Whole word:": "Ціле слово:", "Error": "Помилка", "Unable to load the article. Try searching directly on {{link}}.": "Не вдалося завантажити статтю. Спробуйте шукати безпосередньо на {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Не вдалося завантажити слово. Спробуйте шукати безпосередньо на {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Не вдалося завантажити слово. Спробуйте шукати безпосередньо на {{link}}.", + "Date Published": "Дата публікації" } diff --git a/apps/readest-app/public/locales/vi/translation.json b/apps/readest-app/public/locales/vi/translation.json index 686e64f6..b834f2d3 100644 --- a/apps/readest-app/public/locales/vi/translation.json +++ b/apps/readest-app/public/locales/vi/translation.json @@ -834,5 +834,6 @@ "Whole word:": "Toàn bộ từ:", "Error": "Lỗi", "Unable to load the article. Try searching directly on {{link}}.": "Không thể tải bài viết. Hãy thử tìm kiếm trực tiếp trên {{link}}.", - "Unable to load the word. Try searching directly on {{link}}.": "Không thể tải từ. Hãy thử tìm kiếm trực tiếp trên {{link}}." + "Unable to load the word. Try searching directly on {{link}}.": "Không thể tải từ. Hãy thử tìm kiếm trực tiếp trên {{link}}.", + "Date Published": "Ngày xuất bản" } diff --git a/apps/readest-app/public/locales/zh-CN/translation.json b/apps/readest-app/public/locales/zh-CN/translation.json index 89827f6c..fd51b761 100644 --- a/apps/readest-app/public/locales/zh-CN/translation.json +++ b/apps/readest-app/public/locales/zh-CN/translation.json @@ -834,5 +834,6 @@ "Whole word:": "全词匹配:", "Error": "错误", "Unable to load the article. Try searching directly on {{link}}.": "无法加载文章。请直接在 {{link}} 上搜索。", - "Unable to load the word. Try searching directly on {{link}}.": "无法加载词汇。请直接在 {{link}} 上搜索。" + "Unable to load the word. Try searching directly on {{link}}.": "无法加载词汇。请直接在 {{link}} 上搜索。", + "Date Published": "出版日期" } diff --git a/apps/readest-app/public/locales/zh-TW/translation.json b/apps/readest-app/public/locales/zh-TW/translation.json index d72df3c2..d7784ee2 100644 --- a/apps/readest-app/public/locales/zh-TW/translation.json +++ b/apps/readest-app/public/locales/zh-TW/translation.json @@ -834,5 +834,6 @@ "Whole word:": "全詞匹配:", "Error": "錯誤", "Unable to load the article. Try searching directly on {{link}}.": "無法載入文章。請直接在 {{link}} 上搜尋。", - "Unable to load the word. Try searching directly on {{link}}.": "無法載入詞彙。請直接在 {{link}} 上搜尋。" + "Unable to load the word. Try searching directly on {{link}}.": "無法載入詞彙。請直接在 {{link}} 上搜尋。", + "Date Published": "出版日期" } diff --git a/apps/readest-app/src/app/library/components/ViewMenu.tsx b/apps/readest-app/src/app/library/components/ViewMenu.tsx index 6acd0612..116d3438 100644 --- a/apps/readest-app/src/app/library/components/ViewMenu.tsx +++ b/apps/readest-app/src/app/library/components/ViewMenu.tsx @@ -44,6 +44,7 @@ const ViewMenu: React.FC = ({ setIsDropdownOpen }) => { { label: _('Format'), value: 'format' }, { label: _('Date Read'), value: 'updated' }, { label: _('Date Added'), value: 'created' }, + { label: _('Date Published'), value: 'published' }, ]; const sortingOptions = [ diff --git a/apps/readest-app/src/app/library/utils/libraryUtils.ts b/apps/readest-app/src/app/library/utils/libraryUtils.ts index 5e40908c..087adc7c 100644 --- a/apps/readest-app/src/app/library/utils/libraryUtils.ts +++ b/apps/readest-app/src/app/library/utils/libraryUtils.ts @@ -47,6 +47,27 @@ export const createBookSorter = (sortBy: string, uiLanguage: string) => (a: Book return new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime(); case 'format': return a.format.localeCompare(b.format, uiLanguage || navigator.language); + case 'published': + const aPublished = a.metadata?.published || '0001-01-01'; + const bPublished = b.metadata?.published || '0001-01-01'; + + // Handle cases where published date might not exist + if (!aPublished && !bPublished) return 0; + if (!aPublished) return 1; // Books without published date go to the end + if (!bPublished) return -1; + + // Try to parse dates - handle various date formats + const aDate = new Date(aPublished).getTime(); + const bDate = new Date(bPublished).getTime(); + + // If dates are invalid (NaN), fall back to string comparison + if (isNaN(aDate) && isNaN(bDate)) { + return aPublished.localeCompare(bPublished, uiLanguage || navigator.language); + } + if (isNaN(aDate)) return 1; + if (isNaN(bDate)) return -1; + + return aDate - bDate; default: return new Date(a.updatedAt).getTime() - new Date(b.updatedAt).getTime(); } diff --git a/apps/readest-app/src/types/settings.ts b/apps/readest-app/src/types/settings.ts index 009aa527..f8c177d3 100644 --- a/apps/readest-app/src/types/settings.ts +++ b/apps/readest-app/src/types/settings.ts @@ -6,7 +6,7 @@ import { OPDSCatalog } from './opds'; export type ThemeType = 'light' | 'dark' | 'auto'; export type LibraryViewModeType = 'grid' | 'list'; -export type LibrarySortByType = 'title' | 'author' | 'updated' | 'created' | 'size' | 'format'; +export type LibrarySortByType = 'title' | 'author' | 'updated' | 'created' | 'size' | 'format' | 'published'; export type LibraryCoverFitType = 'crop' | 'fit'; export type KOSyncChecksumMethod = 'binary' | 'filename';