From 14810d6737d7c9e334e11cdc75516b9fdf810606 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 20 May 2025 22:58:04 +0800 Subject: [PATCH] feat: add select all button in select mode, closes #1202 (#1209) --- .../public/locales/ar/translation.json | 13 ++++++-- .../public/locales/de/translation.json | 9 +++-- .../public/locales/el/translation.json | 9 +++-- .../public/locales/es/translation.json | 10 ++++-- .../public/locales/fr/translation.json | 10 ++++-- .../public/locales/hi/translation.json | 9 +++-- .../public/locales/id/translation.json | 8 +++-- .../public/locales/it/translation.json | 10 ++++-- .../public/locales/ja/translation.json | 8 +++-- .../public/locales/ko/translation.json | 8 +++-- .../public/locales/nl/translation.json | 9 +++-- .../public/locales/pl/translation.json | 11 +++++-- .../public/locales/pt/translation.json | 10 ++++-- .../public/locales/ru/translation.json | 11 +++++-- .../public/locales/tr/translation.json | 9 +++-- .../public/locales/uk/translation.json | 11 +++++-- .../public/locales/vi/translation.json | 8 +++-- .../public/locales/zh-CN/translation.json | 8 +++-- .../public/locales/zh-TW/translation.json | 8 +++-- .../src/app/library/components/Bookshelf.tsx | 33 ++++++++++++++++--- .../app/library/components/LibraryHeader.tsx | 25 ++++++++++---- apps/readest-app/src/app/library/page.tsx | 28 +++++++++++----- apps/readest-app/src/components/Alert.tsx | 10 +++--- .../src/components/BookDetailModal.tsx | 2 +- 24 files changed, 195 insertions(+), 82 deletions(-) diff --git a/apps/readest-app/public/locales/ar/translation.json b/apps/readest-app/public/locales/ar/translation.json index 1f162c0a..44d92451 100644 --- a/apps/readest-app/public/locales/ar/translation.json +++ b/apps/readest-app/public/locales/ar/translation.json @@ -5,7 +5,6 @@ "Animation": "الرسوم المتحركة", "Annotate": "إضافة ملاحظة", "Apply": "تطبيق", - "Are you sure to delete the selected books?": "هل أنت متأكد من رغبتك في حذف الكتب المحددة؟", "Auto Mode": "الوضع التلقائي", "Behavior": "السلوك", "Book": "الكتاب", @@ -304,7 +303,6 @@ "Checking for updates...": "جارٍ التحقق من التحديثات...", "Error checking for updates": "خطأ في التحقق من التحديثات", "Details": "التفاصيل", - "Cancel Selection": "إلغاء التحديد", "File Size:": "حجم الملف:", "Auto Detect": "الكشف التلقائي", "Touch": "اللمس", @@ -312,5 +310,14 @@ "Next Section": "القسم التالي", "Previous Section": "القسم السابق", "Next Page": "الصفحة التالية", - "Previous Page": "الصفحة السابقة" + "Previous Page": "الصفحة السابقة", + "Are you sure to delete {{count}} selected book(s)?_zero": "هل أنت متأكد من حذف الكتب المحددة؟", + "Are you sure to delete {{count}} selected book(s)?_one": "هل أنت متأكد من حذف الكتاب المحدد؟", + "Are you sure to delete {{count}} selected book(s)?_two": "هل أنت متأكد من حذف الكتابين المحددين؟", + "Are you sure to delete {{count}} selected book(s)?_few": "هل أنت متأكد من حذف {{count}} كتب محددة؟", + "Are you sure to delete {{count}} selected book(s)?_many": "هل أنت متأكد من حذف {{count}} كتابًا محددًا؟", + "Are you sure to delete {{count}} selected book(s)?_other": "هل أنت متأكد من حذف {{count}} من الكتب المحددة؟", + "Are you sure to delete the selected book?": "هل أنت متأكد من حذف الكتاب المحدد؟", + "Deselect": "إلغاء", + "Select All": "الكل" } diff --git a/apps/readest-app/public/locales/de/translation.json b/apps/readest-app/public/locales/de/translation.json index 89cc2efd..97d9dbae 100644 --- a/apps/readest-app/public/locales/de/translation.json +++ b/apps/readest-app/public/locales/de/translation.json @@ -5,7 +5,6 @@ "Animation": "Animation", "Annotate": "Annotieren", "Apply": "Anwenden", - "Are you sure to delete the selected books?": "Möchten Sie die ausgewählten Bücher wirklich löschen?", "Auto Mode": "Automatischer Modus", "Behavior": "Verhalten", "Book": "Buch", @@ -304,7 +303,6 @@ "Checking for updates...": "Auf Updates prüfen...", "Error checking for updates": "Fehler beim Überprüfen auf Updates", "Details": "Details", - "Cancel Selection": "Auswahl abbrechen", "File Size:": "Dateigröße:", "Auto Detect": "Automatisch erkennen", "Touch": "Berührung", @@ -312,5 +310,10 @@ "Next Section": "Nächster Abschnitt", "Previous Section": "Vorheriger Abschnitt", "Next Page": "Nächste Seite", - "Previous Page": "Vorherige Seite" + "Previous Page": "Vorherige Seite", + "Are you sure to delete {{count}} selected book(s)?_one": "Möchtest du das ausgewählte Buch wirklich löschen?", + "Are you sure to delete {{count}} selected book(s)?_other": "Möchtest du die {{count}} ausgewählten Bücher wirklich löschen?", + "Are you sure to delete the selected book?": "Möchtest du das ausgewählte Buch wirklich löschen?", + "Deselect": "Aufheben", + "Select All": "Alle" } diff --git a/apps/readest-app/public/locales/el/translation.json b/apps/readest-app/public/locales/el/translation.json index cbc3eded..1f80ab23 100644 --- a/apps/readest-app/public/locales/el/translation.json +++ b/apps/readest-app/public/locales/el/translation.json @@ -5,7 +5,6 @@ "Animation": "Κινούμενα σχέδια", "Annotate": "Σχολιασμός", "Apply": "Εφαρμογή", - "Are you sure to delete the selected books?": "Είστε βέβαιοι ότι θέλετε να διαγράψετε τα επιλεγμένα βιβλία;", "Auto Mode": "Αυτόματη λειτουργία", "Behavior": "Συμπεριφορά", "Book": "Βιβλίο", @@ -304,7 +303,6 @@ "Checking for updates...": "Έλεγχος για ενημερώσεις...", "Error checking for updates": "Σφάλμα κατά τον έλεγχο για ενημερώσεις", "Details": "Πληρ.", - "Cancel Selection": "Ακύρωση επιλογής", "File Size:": "Μέγεθος αρχείου:", "Auto Detect": "Αυτόματη ανίχνευση", "Touch": "Αφή", @@ -312,5 +310,10 @@ "Next Section": "Επόμενη ενότητα", "Previous Section": "Προηγούμενη ενότητα", "Next Page": "Επόμενη σελίδα", - "Previous Page": "Προηγούμενη σελίδα" + "Previous Page": "Προηγούμενη σελίδα", + "Are you sure to delete {{count}} selected book(s)?_one": "Είστε σίγουροι ότι θέλετε να διαγράψετε το επιλεγμένο βιβλίο;", + "Are you sure to delete {{count}} selected book(s)?_other": "Είστε σίγουροι ότι θέλετε να διαγράψετε τα {{count}} επιλεγμένα βιβλία;", + "Are you sure to delete the selected book?": "Είστε σίγουροι ότι θέλετε να διαγράψετε το επιλεγμένο βιβλίο;", + "Deselect": "Άρση", + "Select All": "Όλα" } diff --git a/apps/readest-app/public/locales/es/translation.json b/apps/readest-app/public/locales/es/translation.json index d223e6ea..3d595bfa 100644 --- a/apps/readest-app/public/locales/es/translation.json +++ b/apps/readest-app/public/locales/es/translation.json @@ -5,7 +5,6 @@ "Animation": "Animación", "Annotate": "Anotar", "Apply": "Aplicar", - "Are you sure to delete the selected books?": "¿Estás seguro de eliminar los libros seleccionados?", "Auto Mode": "Modo automático", "Behavior": "Comportamiento", "Book": "Libro", @@ -304,7 +303,6 @@ "Checking for updates...": "Comprobando actualizaciones...", "Error checking for updates": "Error al comprobar actualizaciones", "Details": "Detalles", - "Cancel Selection": "Cancelar selección", "File Size:": "Peso del archivo:", "Auto Detect": "Detección automática", "Touch": "Toque", @@ -312,5 +310,11 @@ "Next Section": "Siguiente sección", "Previous Section": "Sección anterior", "Next Page": "Página siguiente", - "Previous Page": "Página anterior" + "Previous Page": "Página anterior", + "Are you sure to delete {{count}} selected book(s)?_one": "¿Seguro que quieres eliminar el libro seleccionado?", + "Are you sure to delete {{count}} selected book(s)?_many": "¿Seguro que quieres eliminar los {{count}} libros seleccionados?", + "Are you sure to delete {{count}} selected book(s)?_other": "¿Seguro que quieres eliminar los {{count}} libros seleccionados?", + "Are you sure to delete the selected book?": "¿Seguro que quieres eliminar el libro seleccionado?", + "Deselect": "Quitar", + "Select All": "Todo" } diff --git a/apps/readest-app/public/locales/fr/translation.json b/apps/readest-app/public/locales/fr/translation.json index c72cde11..5beab8e0 100644 --- a/apps/readest-app/public/locales/fr/translation.json +++ b/apps/readest-app/public/locales/fr/translation.json @@ -5,7 +5,6 @@ "Animation": "Animation", "Annotate": "Annoter", "Apply": "Appliquer", - "Are you sure to delete the selected books?": "Êtes-vous sûr de vouloir supprimer les livres sélectionnés ?", "Auto Mode": "Mode automatique", "Behavior": "Comportement", "Book": "Livre", @@ -304,7 +303,6 @@ "Checking for updates...": "Vérification des mises à jour...", "Error checking for updates": "Erreur lors de la vérification des mises à jour", "Details": "Détails", - "Cancel Selection": "Annuler la sélection", "File Size:": "Taille du fichier :", "Auto Detect": "Détection automatique", "Touch": "Touch", @@ -312,5 +310,11 @@ "Next Section": "Section suivante", "Previous Section": "Section précédente", "Next Page": "Page suivante", - "Previous Page": "Page précédente" + "Previous Page": "Page précédente", + "Are you sure to delete {{count}} selected book(s)?_one": "Supprimer le livre sélectionné ?", + "Are you sure to delete {{count}} selected book(s)?_many": "Supprimer les {{count}} livres sélectionnés ?", + "Are you sure to delete {{count}} selected book(s)?_other": "Supprimer les {{count}} livres sélectionnés ?", + "Are you sure to delete the selected book?": "Supprimer le livre sélectionné ?", + "Deselect": "Annuler", + "Select All": "Tous" } diff --git a/apps/readest-app/public/locales/hi/translation.json b/apps/readest-app/public/locales/hi/translation.json index ec357724..132b3c9f 100644 --- a/apps/readest-app/public/locales/hi/translation.json +++ b/apps/readest-app/public/locales/hi/translation.json @@ -5,7 +5,6 @@ "Animation": "एनीमेशन", "Annotate": "टिप्पणी", "Apply": "लागू करें", - "Are you sure to delete the selected books?": "क्या आप चयनित पुस्तकों को हटाना चाहते हैं?", "Auto Mode": "स्वचालित मोड", "Behavior": "व्यवहार", "Book": "पुस्तक", @@ -304,7 +303,6 @@ "Checking for updates...": "अपडेट की जांच कर रहा है...", "Error checking for updates": "अपडेट की जांच करते समय त्रुटि", "Details": "विवरण", - "Cancel Selection": "चयन रद्द करें", "File Size:": "फ़ाइल आकार:", "Auto Detect": "स्वचालित पहचान", "Touch": "स्पर्श", @@ -312,5 +310,10 @@ "Next Section": "अगला अनुभाग", "Previous Section": "पिछला अनुभाग", "Next Page": "अगला पृष्ठ", - "Previous Page": "पिछला पृष्ठ" + "Previous Page": "पिछला पृष्ठ", + "Are you sure to delete {{count}} selected book(s)?_one": "क्या आप चयनित पुस्तक हटाना चाहते हैं?", + "Are you sure to delete {{count}} selected book(s)?_other": "क्या आप चयनित {{count}} पुस्तकें हटाना चाहते हैं?", + "Are you sure to delete the selected book?": "क्या आप चयनित पुस्तक हटाना चाहते हैं?", + "Deselect": "रद्द करें", + "Select All": "सब चुनें" } diff --git a/apps/readest-app/public/locales/id/translation.json b/apps/readest-app/public/locales/id/translation.json index 2ca3e9e3..7d0c4451 100644 --- a/apps/readest-app/public/locales/id/translation.json +++ b/apps/readest-app/public/locales/id/translation.json @@ -5,7 +5,6 @@ "Animation": "Animasi", "Annotate": "Anotasi", "Apply": "Terapkan", - "Are you sure to delete the selected books?": "Apakah Anda yakin ingin menghapus buku yang dipilih?", "Auto Mode": "Mode Otomatis", "Behavior": "Perilaku", "Book": "Buku", @@ -304,7 +303,6 @@ "Checking for updates...": "Memeriksa pembaruan...", "Error checking for updates": "Kesalahan saat memeriksa pembaruan", "Details": "Detail", - "Cancel Selection": "Batalkan Pilihan", "File Size:": "Ukuran File:", "Auto Detect": "Deteksi Otomatis", "Touch": "Sentuh", @@ -312,5 +310,9 @@ "Next Section": "Bagian Selanjutnya", "Previous Section": "Bagian Sebelumnya", "Next Page": "Halaman Berikutnya", - "Previous Page": "Halaman Sebelumnya" + "Previous Page": "Halaman Sebelumnya", + "Are you sure to delete {{count}} selected book(s)?_other": "Apakah Anda yakin ingin menghapus {{count}} buku yang dipilih?", + "Are you sure to delete the selected book?": "Apakah Anda yakin ingin menghapus buku yang dipilih?", + "Deselect": "Batal", + "Select All": "Pilih Semua" } diff --git a/apps/readest-app/public/locales/it/translation.json b/apps/readest-app/public/locales/it/translation.json index 33ab811e..ca562f29 100644 --- a/apps/readest-app/public/locales/it/translation.json +++ b/apps/readest-app/public/locales/it/translation.json @@ -5,7 +5,6 @@ "Animation": "Animazione", "Annotate": "Annota", "Apply": "Applica", - "Are you sure to delete the selected books?": "Sei sicuro di voler eliminare i libri selezionati?", "Auto Mode": "Modalità automatica", "Behavior": "Comportamento", "Book": "Libro", @@ -304,7 +303,6 @@ "Checking for updates...": "Controllo aggiornamenti...", "Error checking for updates": "Errore durante il controllo degli aggiornamenti", "Details": "Dettagli", - "Cancel Selection": "Annulla selezione", "File Size:": "Dimensione file:", "Auto Detect": "Rilevamento automatico", "Touch": "Touch", @@ -312,5 +310,11 @@ "Next Section": "Sezione successiva", "Previous Section": "Sezione precedente", "Next Page": "Pagina successiva", - "Previous Page": "Pagina precedente" + "Previous Page": "Pagina precedente", + "Are you sure to delete {{count}} selected book(s)?_one": "Sei sicuro di voler eliminare {{count}} libro selezionato?", + "Are you sure to delete {{count}} selected book(s)?_many": "Sei sicuro di voler eliminare {{count}} libri selezionati?", + "Are you sure to delete {{count}} selected book(s)?_other": "Sei sicuro di voler eliminare {{count}} libri selezionati?", + "Are you sure to delete the selected book?": "Sei sicuro di voler eliminare il libro selezionato?", + "Deselect": "Annulla", + "Select All": "Tutti" } diff --git a/apps/readest-app/public/locales/ja/translation.json b/apps/readest-app/public/locales/ja/translation.json index 7210de69..8788fadf 100644 --- a/apps/readest-app/public/locales/ja/translation.json +++ b/apps/readest-app/public/locales/ja/translation.json @@ -5,7 +5,6 @@ "Animation": "アニメーション", "Annotate": "注釈", "Apply": "適用", - "Are you sure to delete the selected books?": "選択した書籍を削除してもよろしいですか?", "Auto Mode": "自動モード", "Behavior": "動作", "Book": "書籍", @@ -304,7 +303,6 @@ "Checking for updates...": "更新を確認中...", "Error checking for updates": "更新の確認中にエラーが発生しました", "Details": "詳細", - "Cancel Selection": "選択をキャンセル", "File Size:": "ファイルサイズ:", "Auto Detect": "自動検出", "Touch": "タッチ", @@ -312,5 +310,9 @@ "Next Section": "次のセクション", "Previous Section": "前のセクション", "Next Page": "次のページ", - "Previous Page": "前のページ" + "Previous Page": "前のページ", + "Are you sure to delete {{count}} selected book(s)?_other": "選択した{{count}}冊の本を削除してもよろしいですか?", + "Are you sure to delete the selected book?": "選択した本を削除してもよろしいですか?", + "Deselect": "解除", + "Select All": "全選択" } diff --git a/apps/readest-app/public/locales/ko/translation.json b/apps/readest-app/public/locales/ko/translation.json index 78972013..85aaa817 100644 --- a/apps/readest-app/public/locales/ko/translation.json +++ b/apps/readest-app/public/locales/ko/translation.json @@ -5,7 +5,6 @@ "Animation": "애니메이션", "Annotate": "주석", "Apply": "적용", - "Are you sure to delete the selected books?": "선택한 책을 삭제하시겠습니까?", "Auto Mode": "자동 모드", "Behavior": "동작", "Book": "책", @@ -304,7 +303,6 @@ "Checking for updates...": "업데이트 확인 중...", "Error checking for updates": "업데이트 확인 중 오류 발생", "Details": "세부정보", - "Cancel Selection": "선택 취소", "File Size:": "파일 크기:", "Auto Detect": "자동 감지", "Touch": "터치", @@ -312,5 +310,9 @@ "Next Section": "다음 섹션", "Previous Section": "이전 섹션", "Next Page": "다음 페이지", - "Previous Page": "이전 페이지" + "Previous Page": "이전 페이지", + "Are you sure to delete {{count}} selected book(s)?_other": "선택한 {{count}}권의 책을 삭제하시겠습니까?", + "Are you sure to delete the selected book?": "선택한 책을 삭제하시겠습니까?", + "Deselect": "해제", + "Select All": "전체선택" } diff --git a/apps/readest-app/public/locales/nl/translation.json b/apps/readest-app/public/locales/nl/translation.json index 4c682d4c..b12211e5 100644 --- a/apps/readest-app/public/locales/nl/translation.json +++ b/apps/readest-app/public/locales/nl/translation.json @@ -37,7 +37,6 @@ "Delete": "Verwijderen", "Cancel": "Annuleren", "Confirm Deletion": "Verwijdering bevestigen", - "Are you sure to delete the selected books?": "Weet u zeker dat u de geselecteerde boeken wilt verwijderen?", "Deselect Book": "Boek deselecteren", "Select Book": "Boek selecteren", "Show Book Details": "Boekdetails weergeven", @@ -58,7 +57,6 @@ "Import Books": "Boeken importeren", "Select Multiple Books": "Meerdere boeken selecteren", "Select Books": "Boeken selecteren", - "Cancel Selection": "Selectie annuleren", "Storage": "Opslag", "{{percentage}}% of Cloud Storage Used.": "{{percentage}}% van cloudopslag gebruikt.", "Logged in as {{userDisplayName}}": "Ingelogd als {{userDisplayName}}", @@ -312,5 +310,10 @@ "Next Section": "Volgende sectie", "Previous Section": "Vorige sectie", "Next Page": "Volgende pagina", - "Previous Page": "Vorige pagina" + "Previous Page": "Vorige pagina", + "Are you sure to delete {{count}} selected book(s)?_one": "Weet je zeker dat je {{count}} geselecteerd boek wilt verwijderen?", + "Are you sure to delete {{count}} selected book(s)?_other": "Weet je zeker dat je {{count}} geselecteerde boeken wilt verwijderen?", + "Are you sure to delete the selected book?": "Weet je zeker dat je het geselecteerde boek wilt verwijderen?", + "Deselect": "Deselecteer", + "Select All": "Alles" } diff --git a/apps/readest-app/public/locales/pl/translation.json b/apps/readest-app/public/locales/pl/translation.json index 35029be0..1d7707b5 100644 --- a/apps/readest-app/public/locales/pl/translation.json +++ b/apps/readest-app/public/locales/pl/translation.json @@ -5,7 +5,6 @@ "Animation": "Animacja", "Annotate": "Adnotacja", "Apply": "Zastosuj", - "Are you sure to delete the selected books?": "Czy na pewno chcesz usunąć wybrane książki?", "Auto Mode": "Tryb automatyczny", "Behavior": "Zachowanie", "Book": "Książka", @@ -304,7 +303,6 @@ "Checking for updates...": "Sprawdzanie aktualizacji...", "Error checking for updates": "Błąd podczas sprawdzania aktualizacji", "Details": "Szczegóły", - "Cancel Selection": "Anuluj zaznaczenie", "File Size:": "Rozmiar pliku:", "Auto Detect": "Automatyczne wykrywanie", "Touch": "Dotyk", @@ -312,5 +310,12 @@ "Next Section": "Następna sekcja", "Previous Section": "Poprzednia sekcja", "Next Page": "Następna strona", - "Previous Page": "Poprzednia strona" + "Previous Page": "Poprzednia strona", + "Are you sure to delete {{count}} selected book(s)?_one": "Czy na pewno chcesz usunąć {{count}} wybraną książkę?", + "Are you sure to delete {{count}} selected book(s)?_few": "Czy na pewno chcesz usunąć {{count}} wybrane książki?", + "Are you sure to delete {{count}} selected book(s)?_many": "Czy na pewno chcesz usunąć {{count}} wybranych książek?", + "Are you sure to delete {{count}} selected book(s)?_other": "Czy na pewno chcesz usunąć {{count}} wybranych książek?", + "Are you sure to delete the selected book?": "Czy na pewno chcesz usunąć wybraną książkę?", + "Deselect": "Odznacz", + "Select All": "Zaznacz" } diff --git a/apps/readest-app/public/locales/pt/translation.json b/apps/readest-app/public/locales/pt/translation.json index 5a93d4da..85a381cb 100644 --- a/apps/readest-app/public/locales/pt/translation.json +++ b/apps/readest-app/public/locales/pt/translation.json @@ -5,7 +5,6 @@ "Animation": "Animação", "Annotate": "Anotar", "Apply": "Aplicar", - "Are you sure to delete the selected books?": "Tem certeza de que deseja excluir os livros selecionados?", "Auto Mode": "Modo Automático", "Behavior": "Comportamento", "Book": "Livro", @@ -304,7 +303,6 @@ "Checking for updates...": "Verificando atualizações...", "Error checking for updates": "Erro ao verificar atualizações", "Details": "Detalhes", - "Cancel Selection": "Cancelar Seleção", "File Size:": "Tamanho do arquivo:", "Auto Detect": "Detectar Automaticamente", "Touch": "Toque", @@ -312,5 +310,11 @@ "Next Section": "Próxima seção", "Previous Section": "Seção anterior", "Next Page": "Próxima página", - "Previous Page": "Página anterior" + "Previous Page": "Página anterior", + "Are you sure to delete {{count}} selected book(s)?_one": "Tem certeza que deseja excluir {{count}} livro selecionado?", + "Are you sure to delete {{count}} selected book(s)?_many": "Tem certeza que deseja excluir {{count}} livros selecionados?", + "Are you sure to delete {{count}} selected book(s)?_other": "Tem certeza que deseja excluir {{count}} livros selecionados?", + "Are you sure to delete the selected book?": "Tem certeza que deseja excluir o livro selecionado?", + "Deselect": "Desmarcar", + "Select All": "Marcar tudo" } diff --git a/apps/readest-app/public/locales/ru/translation.json b/apps/readest-app/public/locales/ru/translation.json index 6961e67f..28dcc475 100644 --- a/apps/readest-app/public/locales/ru/translation.json +++ b/apps/readest-app/public/locales/ru/translation.json @@ -5,7 +5,6 @@ "Animation": "Анимация", "Annotate": "Аннотация", "Apply": "Применить", - "Are you sure to delete the selected books?": "Вы уверены, что хотите удалить выбранные книги?", "Auto Mode": "Автоматический режим", "Behavior": "Поведение", "Book": "Книга", @@ -304,7 +303,6 @@ "Checking for updates...": "Проверка обновлений...", "Error checking for updates": "Ошибка при проверке обновлений", "Details": "Инфо", - "Cancel Selection": "Отменить выбор", "File Size:": "Размер файла:", "Auto Detect": "Автоопределение", "Touch": "Сенсорный экран", @@ -312,5 +310,12 @@ "Next Section": "Следующий раздел", "Previous Section": "Предыдущий раздел", "Next Page": "Следующая страница", - "Previous Page": "Предыдущая страница" + "Previous Page": "Предыдущая страница", + "Are you sure to delete {{count}} selected book(s)?_one": "Вы уверены, что хотите удалить {{count}} выбранную книгу?", + "Are you sure to delete {{count}} selected book(s)?_few": "Вы уверены, что хотите удалить {{count}} выбранные книги?", + "Are you sure to delete {{count}} selected book(s)?_many": "Вы уверены, что хотите удалить {{count}} выбранных книг?", + "Are you sure to delete {{count}} selected book(s)?_other": "Вы уверены, что хотите удалить {{count}} выбранных книг?", + "Are you sure to delete the selected book?": "Вы уверены, что хотите удалить выбранную книгу?", + "Deselect": "Снять", + "Select All": "Выбрать все" } diff --git a/apps/readest-app/public/locales/tr/translation.json b/apps/readest-app/public/locales/tr/translation.json index 58c497c0..97843624 100644 --- a/apps/readest-app/public/locales/tr/translation.json +++ b/apps/readest-app/public/locales/tr/translation.json @@ -5,7 +5,6 @@ "Animation": "Animasyon", "Annotate": "Not Ekle", "Apply": "Uygula", - "Are you sure to delete the selected books?": "Seçili kitapları silmek istediğinizden emin misiniz?", "Auto Mode": "Otomatik Mod", "Behavior": "Davranış", "Book": "Kitap", @@ -304,7 +303,6 @@ "Checking for updates...": "Yenilikler kontrol ediliyor...", "Error checking for updates": "Güncellemeleri kontrol ederken hata oluştu", "Details": "Detaylar", - "Cancel Selection": "Işaretlemeyi İptal Et", "File Size:": "Dosya Boyutu:", "Auto Detect": "Algıla", "Touch": "Dokunmatik", @@ -312,5 +310,10 @@ "Next Section": "Sonraki Bölüm", "Previous Section": "Önceki Bölüm", "Next Page": "Sonraki Sayfa", - "Previous Page": "Önceki Sayfa" + "Previous Page": "Önceki Sayfa", + "Are you sure to delete {{count}} selected book(s)?_one": "{{count}} seçili kitabı silmek istediğinize emin misiniz?", + "Are you sure to delete {{count}} selected book(s)?_other": "{{count}} seçili kitabı silmek istediğinize emin misiniz?", + "Are you sure to delete the selected book?": "Seçili kitabı silmek istediğinize emin misiniz?", + "Deselect": "Kaldır", + "Select All": "Hepsi" } diff --git a/apps/readest-app/public/locales/uk/translation.json b/apps/readest-app/public/locales/uk/translation.json index 08d8cc97..0815b021 100644 --- a/apps/readest-app/public/locales/uk/translation.json +++ b/apps/readest-app/public/locales/uk/translation.json @@ -5,7 +5,6 @@ "Animation": "Анімація", "Annotate": "Анотація", "Apply": "Застосувати", - "Are you sure to delete the selected books?": "Ви впевнені, що хочете видалити вибрані книги?", "Auto Mode": "Автоматичний режим", "Behavior": "Поведінка", "Book": "Книга", @@ -304,7 +303,6 @@ "Checking for updates...": "Перевірка наявності оновлень...", "Error checking for updates": "Помилка перевірки наявності оновлень", "Details": "Деталі", - "Cancel Selection": "Скасувати вибір", "File Size:": "Розмір файлу:", "Auto Detect": "Авто виявлення", "Touch": "Дотик", @@ -312,5 +310,12 @@ "Next Section": "Наступний розділ", "Previous Section": "Попередній розділ", "Next Page": "Наступна сторінка", - "Previous Page": "Попередня сторінка" + "Previous Page": "Попередня сторінка", + "Are you sure to delete {{count}} selected book(s)?_one": "Ви впевнені, що хочете видалити {{count}} вибрану книгу?", + "Are you sure to delete {{count}} selected book(s)?_few": "Ви впевнені, що хочете видалити {{count}} вибрані книги?", + "Are you sure to delete {{count}} selected book(s)?_many": "Ви впевнені, що хочете видалити {{count}} вибраних книг?", + "Are you sure to delete {{count}} selected book(s)?_other": "Ви впевнені, що хочете видалити {{count}} вибраних книг?", + "Are you sure to delete the selected book?": "Ви впевнені, що хочете видалити вибрану книгу?", + "Deselect": "Зняти", + "Select All": "Усі" } diff --git a/apps/readest-app/public/locales/vi/translation.json b/apps/readest-app/public/locales/vi/translation.json index f5818c76..8b8f8aee 100644 --- a/apps/readest-app/public/locales/vi/translation.json +++ b/apps/readest-app/public/locales/vi/translation.json @@ -5,7 +5,6 @@ "Animation": "Hiệu ứng động", "Annotate": "Chú thích", "Apply": "Áp dụng", - "Are you sure to delete the selected books?": "Bạn có chắc chắn muốn xóa các sách đã chọn?", "Auto Mode": "Chế độ tự động", "Behavior": "Hành vi", "Book": "Sách", @@ -304,7 +303,6 @@ "Checking for updates...": "Đang kiểm tra cập nhật...", "Error checking for updates": "Lỗi khi kiểm tra cập nhật", "Details": "Chi tiết", - "Cancel Selection": "Hủy chọn", "File Size:": "Kích thước tệp:", "Auto Detect": "Phát hiện tự động", "Touch": "Chạm", @@ -312,5 +310,9 @@ "Next Section": "Phần tiếp theo", "Previous Section": "Phần trước", "Next Page": "Trang tiếp theo", - "Previous Page": "Trang trước" + "Previous Page": "Trang trước", + "Are you sure to delete {{count}} selected book(s)?_other": "Bạn có chắc muốn xóa {{count}} cuốn sách đã chọn không?", + "Are you sure to delete the selected book?": "Bạn có chắc muốn xóa cuốn sách đã chọn không?", + "Deselect": "Bỏ chọn", + "Select All": "Chọn tất" } diff --git a/apps/readest-app/public/locales/zh-CN/translation.json b/apps/readest-app/public/locales/zh-CN/translation.json index 17c73bc7..d53aa0fc 100644 --- a/apps/readest-app/public/locales/zh-CN/translation.json +++ b/apps/readest-app/public/locales/zh-CN/translation.json @@ -5,7 +5,6 @@ "Animation": "动画", "Annotate": "笔记", "Apply": "应用", - "Are you sure to delete the selected books?": "您确定要删除所选书籍吗?", "Auto Mode": "自动主题", "Behavior": "行为", "Book": "书籍", @@ -304,7 +303,6 @@ "Checking for updates...": "检查更新中...", "Error checking for updates": "检查更新时出错", "Details": "详情", - "Cancel Selection": "取消选择", "File Size:": "文件大小", "Auto Detect": "自动检测", "Touch": "触控", @@ -312,5 +310,9 @@ "Next Section": "下一章", "Previous Section": "上一章", "Next Page": "下一页", - "Previous Page": "上一页" + "Previous Page": "上一页", + "Are you sure to delete {{count}} selected book(s)?_other": "您确定要删除 {{count}} 本选中的书籍吗?", + "Are you sure to delete the selected book?": "您确定要删除选中的书籍吗?", + "Deselect": "取消选择", + "Select All": "全选" } diff --git a/apps/readest-app/public/locales/zh-TW/translation.json b/apps/readest-app/public/locales/zh-TW/translation.json index 4647c3d1..a37ead1a 100644 --- a/apps/readest-app/public/locales/zh-TW/translation.json +++ b/apps/readest-app/public/locales/zh-TW/translation.json @@ -5,7 +5,6 @@ "Animation": "動畫", "Annotate": "筆記", "Apply": "應用", - "Are you sure to delete the selected books?": "您確定要刪除所選書籍嗎?", "Auto Mode": "自動主題", "Behavior": "行為", "Book": "書籍", @@ -304,7 +303,6 @@ "Checking for updates...": "檢查更新中...", "Error checking for updates": "檢查更新時出錯", "Details": "詳情", - "Cancel Selection": "取消選擇", "File Size:": "檔案大小", "Auto Detect": "自動檢測", "Touch": "觸控", @@ -312,5 +310,9 @@ "Next Section": "下一章", "Previous Section": "上一章", "Next Page": "下一頁", - "Previous Page": "上一頁" + "Previous Page": "上一頁", + "Are you sure to delete {{count}} selected book(s)?_other": "確定要刪除已選擇的 {{count}} 本書嗎?", + "Are you sure to delete the selected book?": "確定要刪除已選擇的書籍嗎?", + "Deselect": "取消選取", + "Select All": "全選" } diff --git a/apps/readest-app/src/app/library/components/Bookshelf.tsx b/apps/readest-app/src/app/library/components/Bookshelf.tsx index d31adf7c..a2bcc761 100644 --- a/apps/readest-app/src/app/library/components/Bookshelf.tsx +++ b/apps/readest-app/src/app/library/components/Bookshelf.tsx @@ -24,6 +24,8 @@ import GroupingModal from './GroupingModal'; interface BookshelfProps { libraryBooks: Book[]; isSelectMode: boolean; + isSelectAll: boolean; + isSelectNone: boolean; handleImportBooks: () => void; handleBookUpload: (book: Book) => Promise; handleBookDownload: (book: Book) => Promise; @@ -36,6 +38,8 @@ interface BookshelfProps { const Bookshelf: React.FC = ({ libraryBooks, isSelectMode, + isSelectAll, + isSelectNone, handleImportBooks, handleBookUpload, handleBookDownload, @@ -68,14 +72,24 @@ const Bookshelf: React.FC = ({ const allBookshelfItems = viewMode === 'grid' ? generateGridItems(libraryBooks) : generateListItems(libraryBooks); + const currentBookshelfItems = navBooksGroup ? navBooksGroup.books : allBookshelfItems; + useEffect(() => { if (isSelectMode) { setShowSelectModeActions(true); + if (isSelectAll) { + setSelectedBooks( + currentBookshelfItems.map((item) => ('hash' in item ? item.hash : item.id)), + ); + } else if (isSelectNone) { + setSelectedBooks([]); + } } else { setSelectedBooks([]); setShowSelectModeActions(false); } - }, [isSelectMode]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isSelectMode, isSelectAll, isSelectNone]); useEffect(() => { if (isImportingBook.current) return; @@ -170,14 +184,22 @@ const Bookshelf: React.FC = ({ } }; - const confirmDelete = async () => { + const getBooksToDelete = () => { + const booksToDelete: Book[] = []; selectedBooks.forEach((id) => { for (const book of libraryBooks.filter((book) => book.hash === id || book.groupId === id)) { if (book && !book.deletedAt) { - handleBookDelete(book); + booksToDelete.push(book); } } }); + return booksToDelete; + }; + + const confirmDelete = async () => { + for (const book of getBooksToDelete()) { + handleBookDelete(book); + } setSelectedBooks([]); setShowDeleteAlert(false); setShowSelectModeActions(true); @@ -193,7 +215,6 @@ const Bookshelf: React.FC = ({ setShowGroupingModal(true); }; - const currentBookshelfItems = navBooksGroup ? navBooksGroup.books : allBookshelfItems; const bookFilter = (item: Book, queryTerm: string) => { if (item.deletedAt) return false; const searchTerm = new RegExp(queryTerm, 'i'); @@ -379,7 +400,9 @@ const Bookshelf: React.FC = ({ > { setShowDeleteAlert(false); setShowSelectModeActions(true); diff --git a/apps/readest-app/src/app/library/components/LibraryHeader.tsx b/apps/readest-app/src/app/library/components/LibraryHeader.tsx index 70a1d3d7..35e36633 100644 --- a/apps/readest-app/src/app/library/components/LibraryHeader.tsx +++ b/apps/readest-app/src/app/library/components/LibraryHeader.tsx @@ -24,14 +24,20 @@ import SortMenu from './SortMenu'; interface LibraryHeaderProps { isSelectMode: boolean; + isSelectAll: boolean; onImportBooks: () => void; onToggleSelectMode: () => void; + onSelectAll: () => void; + onDeselectAll: () => void; } const LibraryHeader: React.FC = ({ isSelectMode, + isSelectAll, onImportBooks, onToggleSelectMode, + onSelectAll, + onDeselectAll, }) => { const _ = useTranslation(); const router = useRouter(); @@ -182,14 +188,21 @@ const LibraryHeader: React.FC = ({ )} - {appService?.isMobile && isSelectMode ? ( -
+ {isSelectMode ? ( +
) : ( diff --git a/apps/readest-app/src/app/library/page.tsx b/apps/readest-app/src/app/library/page.tsx index 69575b64..7912102d 100644 --- a/apps/readest-app/src/app/library/page.tsx +++ b/apps/readest-app/src/app/library/page.tsx @@ -75,6 +75,8 @@ const LibraryPageContent = ({ searchParams }: { searchParams: ReadonlyURLSearchP const isInitiating = useRef(false); const [libraryLoaded, setLibraryLoaded] = useState(false); const [isSelectMode, setIsSelectMode] = useState(false); + const [isSelectAll, setIsSelectAll] = useState(false); + const [isSelectNone, setIsSelectNone] = useState(false); const [showDetailsBook, setShowDetailsBook] = useState(null); const [booksTransferProgress, setBooksTransferProgress] = useState<{ [key: string]: number | null; @@ -526,18 +528,23 @@ const LibraryPageContent = ({ searchParams }: { searchParams: ReadonlyURLSearchP importBooks(files); }; - const handleToggleSelectMode = () => { - if (!isSelectMode && appService?.hasHaptics) { - impactFeedback('medium'); - } - setIsSelectMode((pre) => !pre); - }; - const handleSetSelectMode = (selectMode: boolean) => { if (selectMode && appService?.hasHaptics) { impactFeedback('medium'); } setIsSelectMode(selectMode); + setIsSelectAll(false); + setIsSelectNone(false); + }; + + const handleSelectAll = () => { + setIsSelectAll(true); + setIsSelectNone(false); + }; + + const handleDeselectAll = () => { + setIsSelectNone(true); + setIsSelectAll(false); }; const handleShowDetailsBook = (book: Book) => { @@ -570,8 +577,11 @@ const LibraryPageContent = ({ searchParams }: { searchParams: ReadonlyURLSearchP
handleSetSelectMode(!isSelectMode)} + onSelectAll={handleSelectAll} + onDeselectAll={handleDeselectAll} />
{loading && ( @@ -599,6 +609,8 @@ const LibraryPageContent = ({ searchParams }: { searchParams: ReadonlyURLSearchP -
+
-
-

{title}

-
{message}
+
+

{title}

+
{message}
-
+
diff --git a/apps/readest-app/src/components/BookDetailModal.tsx b/apps/readest-app/src/components/BookDetailModal.tsx index fd5d6ec2..f651066a 100644 --- a/apps/readest-app/src/components/BookDetailModal.tsx +++ b/apps/readest-app/src/components/BookDetailModal.tsx @@ -215,7 +215,7 @@ const BookDetailModal = ({ > { setShowDeleteAlert(false); }}