forked from akai/readest
* added current time to desktop bar * added time prototype to footer, needs code cleanup and settings toggle * fixed settings toggle, added translations and code cleanup * added battery support and moved Statusbar to own Component * #3306 added 24 hour clock support * refactored code styling and getting rid of any type in battery hook * Add battery info for Tauri Apps --------- Co-authored-by: Huang Xin <chrox.huang@gmail.com>
This commit is contained in:
Generated
+605
-31
File diff suppressed because it is too large
Load Diff
@@ -146,6 +146,7 @@
|
||||
"stripe": "^18.2.1",
|
||||
"styled-jsx": "^5.1.7",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tauri-plugin-device-info-api": "^1.0.1",
|
||||
"tinycolor2": "^1.6.0",
|
||||
"uuid": "^11.1.0",
|
||||
"ws": "^8.18.3",
|
||||
|
||||
@@ -872,6 +872,9 @@
|
||||
"Clear search": "مسح البحث",
|
||||
"Clear search history": "مسح سجل البحث",
|
||||
"Tap to Toggle Footer": "انقر لتبديل التذييل",
|
||||
"Show Current Time": "عرض الوقت الحالي",
|
||||
"Use 24 Hour Clock": "استخدام نظام 24 ساعة",
|
||||
"Show Current Battery Status": "عرض حالة البطارية الحالية",
|
||||
"Exported successfully": "تم التصدير بنجاح",
|
||||
"Book exported successfully.": "تم تصدير الكتاب بنجاح.",
|
||||
"Failed to export the book.": "فشل تصدير الكتاب.",
|
||||
@@ -1108,5 +1111,6 @@
|
||||
"Page:": "صفحة:",
|
||||
"Page: {{number}}": "صفحة: {{number}}",
|
||||
"Annotation page number": "رقم صفحة التعליق",
|
||||
"Translating...": "جارٍ الترجمة..."
|
||||
"Translating...": "جارٍ الترجمة...",
|
||||
"Show Battery Percentage": "عرض نسبة البطارية"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "অনুসন্ধান সাফ করুন",
|
||||
"Clear search history": "অনুসন্ধান ইতিহাস সাফ করুন",
|
||||
"Tap to Toggle Footer": "ফুটার টগল করতে আলতো চাপুন",
|
||||
"Show Current Time": "বর্তমান সময় দেখান",
|
||||
"Use 24 Hour Clock": "২৪ ঘণ্টার ঘড়ি ব্যবহার করুন",
|
||||
"Show Current Battery Status": "বর্তমান ব্যাটারি অবস্থা দেখান",
|
||||
"Exported successfully": "সফলভাবে রপ্তানি হয়েছে",
|
||||
"Book exported successfully.": "বইটি সফলভাবে রপ্তানি হয়েছে।",
|
||||
"Failed to export the book.": "বই রপ্তানি করতে ব্যর্থ।",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "পৃষ্ঠা:",
|
||||
"Page: {{number}}": "পৃষ্ঠা: {{number}}",
|
||||
"Annotation page number": "টীকা পৃষ্ঠা নম্বর",
|
||||
"Translating...": "অনুবাদ করা হচ্ছে..."
|
||||
"Translating...": "অনুবাদ করা হচ্ছে...",
|
||||
"Show Battery Percentage": "ব্যাটারি শতাংশ দেখান"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "འཚོལ་བཤེར་གཙང་སེལ།",
|
||||
"Clear search history": "འཚོལ་བཤེར་ལོ་རྒྱུས་གཙང་སེལ།",
|
||||
"Tap to Toggle Footer": "ཞབས་མཇུག་སྒོ་འབྱེད་བྱེད་པར་གནོན།",
|
||||
"Show Current Time": "ད་ལྟའི་དུས་ཚོད་སྟོན་པ།",
|
||||
"Use 24 Hour Clock": "ཆུ་ཚོད་ ༢༤ ཅན་གྱི་ཟློས་འཁོར་བཀོལ་བ།",
|
||||
"Show Current Battery Status": "ད་ལྟའི་གློག་རྫས་གནས་བབ་སྟོན་པ།",
|
||||
"Exported successfully": "ཕྱིར་འདོན་ལེགས་གྲུབ་བྱུང་།",
|
||||
"Book exported successfully.": "དཔེ་དེབ་ཕྱིར་འདོན་ལེགས་གྲུབ་བྱུང་།",
|
||||
"Failed to export the book.": "དཔེ་དེབ་ཕྱིར་འདོན་མི་ཐུབ།",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "ཤོག་ལྷེ།:",
|
||||
"Page: {{number}}": "ཤོག་ལྷེ།: {{number}}",
|
||||
"Annotation page number": "མཆན་འགྲེལ་ཤོག་ཨང་།",
|
||||
"Translating...": "ཡིག་བསྒྱུར་བྱེད་བཞིན་པ།..."
|
||||
"Translating...": "ཡིག་བསྒྱུར་བྱེད་བཞིན་པ།...",
|
||||
"Show Battery Percentage": "གློག་རྫས་བརྒྱ་ཆ་སྟོན།"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "Suche löschen",
|
||||
"Clear search history": "Suchverlauf löschen",
|
||||
"Tap to Toggle Footer": "Tippen, um Fußzeile umzuschalten",
|
||||
"Show Current Time": "Aktuelle Uhrzeit anzeigen",
|
||||
"Use 24 Hour Clock": "24-Stunden-Format verwenden",
|
||||
"Show Current Battery Status": "Aktuellen Akkustand anzeigen",
|
||||
"Exported successfully": "Erfolgreich exportiert",
|
||||
"Book exported successfully.": "Buch erfolgreich exportiert.",
|
||||
"Failed to export the book.": "Buch konnte nicht exportiert werden.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "Seite:",
|
||||
"Page: {{number}}": "Seite: {{number}}",
|
||||
"Annotation page number": "Seitenzahl der Anmerkung",
|
||||
"Translating...": "Übersetzen..."
|
||||
"Translating...": "Übersetzen...",
|
||||
"Show Battery Percentage": "Akkustand in Prozent anzeigen"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "Εκκαθάριση αναζήτησης",
|
||||
"Clear search history": "Εκκαθάριση ιστορικού αναζήτησης",
|
||||
"Tap to Toggle Footer": "Πατήστε για εναλλαγή υποσέλιδου",
|
||||
"Show Current Time": "Εμφάνιση τρέχουσας ώρας",
|
||||
"Use 24 Hour Clock": "Χρήση 24ωρης μορφής ώρας",
|
||||
"Show Current Battery Status": "Εμφάνιση τρέχουσας κατάστασης μπαταρίας",
|
||||
"Exported successfully": "Εξαγωγή επιτυχής",
|
||||
"Book exported successfully.": "Το βιβλίο εξήχθη επιτυχώς.",
|
||||
"Failed to export the book.": "Αποτυχία εξαγωγής του βιβλίου.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "Σελίδα:",
|
||||
"Page: {{number}}": "Σελίδα: {{number}}",
|
||||
"Annotation page number": "Αριθμός σελίδας σχολίου",
|
||||
"Translating...": "Μετάφραση..."
|
||||
"Translating...": "Μετάφραση...",
|
||||
"Show Battery Percentage": "Εμφάνιση ποσοστού μπαταρίας"
|
||||
}
|
||||
|
||||
@@ -842,6 +842,9 @@
|
||||
"Clear search": "Borrar búsqueda",
|
||||
"Clear search history": "Borrar historial de búsqueda",
|
||||
"Tap to Toggle Footer": "Toca para alternar pie de página",
|
||||
"Show Current Time": "Mostrar hora actual",
|
||||
"Use 24 Hour Clock": "Usar formato de 24 horas",
|
||||
"Show Current Battery Status": "Mostrar el estado actual de la batería",
|
||||
"Exported successfully": "Exportado con éxito",
|
||||
"Book exported successfully.": "Libro exportado con éxito.",
|
||||
"Failed to export the book.": "Error al exportar el libro.",
|
||||
@@ -1072,5 +1075,6 @@
|
||||
"Page:": "Página:",
|
||||
"Page: {{number}}": "Página: {{number}}",
|
||||
"Annotation page number": "Número de página de la anotación",
|
||||
"Translating...": "Traduciendo..."
|
||||
"Translating...": "Traduciendo...",
|
||||
"Show Battery Percentage": "Mostrar porcentaje de batería"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "پاک کردن جستجو",
|
||||
"Clear search history": "پاک کردن تاریخچه جستجو",
|
||||
"Tap to Toggle Footer": "برای تغییر پاورقی ضربه بزنید",
|
||||
"Show Current Time": "نمایش زمان فعلی",
|
||||
"Use 24 Hour Clock": "استفاده از ساعت ۲۴ ساعته",
|
||||
"Show Current Battery Status": "نمایش وضعیت فعلی باتری",
|
||||
"Exported successfully": "صادرات موفق",
|
||||
"Book exported successfully.": "کتاب با موفقیت صادر شد.",
|
||||
"Failed to export the book.": "صادر کردن کتاب ناموفق بود.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "صفحه:",
|
||||
"Page: {{number}}": "صفحه: {{number}}",
|
||||
"Annotation page number": "شماره صفحه یادداشت",
|
||||
"Translating...": "در حال ترجمه..."
|
||||
"Translating...": "در حال ترجمه...",
|
||||
"Show Battery Percentage": "نمایش درصد باتری"
|
||||
}
|
||||
|
||||
@@ -842,6 +842,9 @@
|
||||
"Clear search": "Effacer la recherche",
|
||||
"Clear search history": "Effacer l'historique de recherche",
|
||||
"Tap to Toggle Footer": "Appuyez pour afficher/masquer le pied de page",
|
||||
"Show Current Time": "Afficher l'heure actuelle",
|
||||
"Use 24 Hour Clock": "Utiliser le format 24 heures",
|
||||
"Show Current Battery Status": "Afficher l'état actuel de la batterie",
|
||||
"Exported successfully": "Exporté avec succès",
|
||||
"Book exported successfully.": "Livre exporté avec succès.",
|
||||
"Failed to export the book.": "Échec de l'exportation du livre.",
|
||||
@@ -1072,5 +1075,6 @@
|
||||
"Page:": "Page :",
|
||||
"Page: {{number}}": "Page : {{number}}",
|
||||
"Annotation page number": "Numéro de page de l'annotation",
|
||||
"Translating...": "Traduction en cours..."
|
||||
"Translating...": "Traduction en cours...",
|
||||
"Show Battery Percentage": "Afficher le pourcentage de batterie"
|
||||
}
|
||||
|
||||
@@ -966,6 +966,9 @@
|
||||
"Page Number": "מספר דף",
|
||||
"Percentage": "אחוזים",
|
||||
"Tap to Toggle Footer": "הקש להצגת/הסתרת כותרת תחתונה",
|
||||
"Show Current Time": "הצגת השעה הנוכחית",
|
||||
"Use 24 Hour Clock": "השתמש בשעון 24 שעות",
|
||||
"Show Current Battery Status": "הצג מצב סוללה נוכחי",
|
||||
"Screen": "מסך",
|
||||
"Orientation": "כיוון מסך (Orientation)",
|
||||
"Portrait": "לאורך (Portrait)",
|
||||
@@ -1072,5 +1075,6 @@
|
||||
"Page:": "עמוד:",
|
||||
"Page: {{number}}": "עמוד: {{number}}",
|
||||
"Annotation page number": "מספר עמוד הערה",
|
||||
"Translating...": "מתרגם..."
|
||||
"Translating...": "מתרגם...",
|
||||
"Show Battery Percentage": "הצג אחוזי סוללה"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "खोज साफ़ करें",
|
||||
"Clear search history": "खोज इतिहास साफ़ करें",
|
||||
"Tap to Toggle Footer": "फुटर टॉगल करने के लिए टैप करें",
|
||||
"Show Current Time": "वर्तमान समय दिखाएं",
|
||||
"Use 24 Hour Clock": "24 घंटे की घड़ी का उपयोग करें",
|
||||
"Show Current Battery Status": "वर्तमान बैटरी स्थिति दिखाएं",
|
||||
"Exported successfully": "सफलतापूर्वक निर्यात किया गया",
|
||||
"Book exported successfully.": "पुस्तक सफलतापूर्वक निर्यात की गई।",
|
||||
"Failed to export the book.": "पुस्तक निर्यात करने में विफल।",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "पृष्ठ:",
|
||||
"Page: {{number}}": "पृष्ठ: {{number}}",
|
||||
"Annotation page number": "व्याख्या पृष्ठ संख्या",
|
||||
"Translating...": "अनुवाद हो रहा है..."
|
||||
"Translating...": "अनुवाद हो रहा है...",
|
||||
"Show Battery Percentage": "बैटरी प्रतिशत दिखाएं"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "Hapus pencarian",
|
||||
"Clear search history": "Hapus riwayat pencarian",
|
||||
"Tap to Toggle Footer": "Ketuk untuk beralih footer",
|
||||
"Show Current Time": "Tampilkan Waktu Sekarang",
|
||||
"Use 24 Hour Clock": "Gunakan Format 24 Jam",
|
||||
"Show Current Battery Status": "Tampilkan Status Baterai Saat Ini",
|
||||
"Exported successfully": "Berhasil diekspor",
|
||||
"Book exported successfully.": "Buku berhasil diekspor.",
|
||||
"Failed to export the book.": "Gagal mengekspor buku.",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "Halaman:",
|
||||
"Page: {{number}}": "Halaman: {{number}}",
|
||||
"Annotation page number": "Nomor halaman anotasi",
|
||||
"Translating...": "Menerjemahkan..."
|
||||
"Translating...": "Menerjemahkan...",
|
||||
"Show Battery Percentage": "Tampilkan Persentase Baterai"
|
||||
}
|
||||
|
||||
@@ -842,6 +842,9 @@
|
||||
"Clear search": "Cancella ricerca",
|
||||
"Clear search history": "Cancella cronologia ricerche",
|
||||
"Tap to Toggle Footer": "Tocca per mostrare/nascondere il piè di pagina",
|
||||
"Show Current Time": "Mostra ora attuale",
|
||||
"Use 24 Hour Clock": "Usa formato 24 ore",
|
||||
"Show Current Battery Status": "Mostra lo stato attuale della batteria",
|
||||
"Exported successfully": "Esportato con successo",
|
||||
"Book exported successfully.": "Libro esportato con successo.",
|
||||
"Failed to export the book.": "Impossibile esportare il libro.",
|
||||
@@ -1072,5 +1075,6 @@
|
||||
"Page:": "Pagina:",
|
||||
"Page: {{number}}": "Pagina: {{number}}",
|
||||
"Annotation page number": "Numero di pagina dell'annotazione",
|
||||
"Translating...": "Traduzione..."
|
||||
"Translating...": "Traduzione...",
|
||||
"Show Battery Percentage": "Mostra percentuale batteria"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "検索をクリア",
|
||||
"Clear search history": "検索履歴をクリア",
|
||||
"Tap to Toggle Footer": "タップでフッターを切り替え",
|
||||
"Show Current Time": "現在時刻を表示",
|
||||
"Use 24 Hour Clock": "24時間表示を使用",
|
||||
"Show Current Battery Status": "バッテリー残量を表示",
|
||||
"Exported successfully": "エクスポート成功",
|
||||
"Book exported successfully.": "書籍のエクスポートに成功しました。",
|
||||
"Failed to export the book.": "書籍のエクスポートに失敗しました。",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "ページ:",
|
||||
"Page: {{number}}": "ページ: {{number}}",
|
||||
"Annotation page number": "注釈のページ番号",
|
||||
"Translating...": "翻訳中..."
|
||||
"Translating...": "翻訳中...",
|
||||
"Show Battery Percentage": "バッテリー残量を表示"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "검색 지우기",
|
||||
"Clear search history": "검색 기록 지우기",
|
||||
"Tap to Toggle Footer": "탭하여 바닥글 전환",
|
||||
"Show Current Time": "현재 시간 표시",
|
||||
"Use 24 Hour Clock": "24시간제 사용",
|
||||
"Show Current Battery Status": "현재 배터리 상태 표시",
|
||||
"Exported successfully": "내보내기 성공",
|
||||
"Book exported successfully.": "책을 성공적으로 내보냈습니다.",
|
||||
"Failed to export the book.": "책 내보내기에 실패했습니다.",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "페이지:",
|
||||
"Page: {{number}}": "페이지: {{number}}",
|
||||
"Annotation page number": "주석 페이지 번호",
|
||||
"Translating...": "번역 중..."
|
||||
"Translating...": "번역 중...",
|
||||
"Show Battery Percentage": "배터리 백분율 표시"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "Kosongkan carian",
|
||||
"Clear search history": "Kosongkan sejarah carian",
|
||||
"Tap to Toggle Footer": "Ketik untuk togol pengaki",
|
||||
"Show Current Time": "Tunjukkan Waktu Sekarang",
|
||||
"Use 24 Hour Clock": "Gunakan Format 24 Jam",
|
||||
"Show Current Battery Status": "Paparkan Status Bateri Semasa",
|
||||
"Exported successfully": "Berjaya dieksport",
|
||||
"Book exported successfully.": "Buku berjaya dieksport.",
|
||||
"Failed to export the book.": "Gagal mengeksport buku.",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "Halaman:",
|
||||
"Page: {{number}}": "Halaman: {{number}}",
|
||||
"Annotation page number": "Nombor halaman anotasi",
|
||||
"Translating...": "Menterjemah..."
|
||||
"Translating...": "Menterjemah...",
|
||||
"Show Battery Percentage": "Tunjukkan Peratusan Bateri"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "Zoekopdracht wissen",
|
||||
"Clear search history": "Zoekgeschiedenis wissen",
|
||||
"Tap to Toggle Footer": "Tik om voettekst te wisselen",
|
||||
"Show Current Time": "Huidige tijd weergeven",
|
||||
"Use 24 Hour Clock": "24-uurs klok gebruike",
|
||||
"Show Current Battery Status": "Toon huidige batterijstatus",
|
||||
"Exported successfully": "Succesvol geëxporteerd",
|
||||
"Book exported successfully.": "Boek succesvol geëxporteerd.",
|
||||
"Failed to export the book.": "Exporteren van het boek mislukt.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "Pagina:",
|
||||
"Page: {{number}}": "Pagina: {{number}}",
|
||||
"Annotation page number": "Annotatiepaginanummer",
|
||||
"Translating...": "Vertalen..."
|
||||
"Translating...": "Vertalen...",
|
||||
"Show Battery Percentage": "Batterijpercentage weergeven"
|
||||
}
|
||||
|
||||
@@ -852,6 +852,9 @@
|
||||
"Clear search": "Wyczyść wyszukiwanie",
|
||||
"Clear search history": "Wyczyść historię wyszukiwania",
|
||||
"Tap to Toggle Footer": "Dotknij, aby przełączyć stopkę",
|
||||
"Show Current Time": "Pokaż aktualny czas",
|
||||
"Use 24 Hour Clock": "Używaj formatu 24-godzinnego",
|
||||
"Show Current Battery Status": "Pokaż aktualny stan baterii",
|
||||
"Exported successfully": "Wyeksportowano pomyślnie",
|
||||
"Book exported successfully.": "Książka została wyeksportowana pomyślnie.",
|
||||
"Failed to export the book.": "Nie udało się wyeksportować książki.",
|
||||
@@ -1084,5 +1087,6 @@
|
||||
"Page:": "Strona:",
|
||||
"Page: {{number}}": "Strona: {{number}}",
|
||||
"Annotation page number": "Numer strony adnotacji",
|
||||
"Translating...": "Tłumaczenie..."
|
||||
"Translating...": "Tłumaczenie...",
|
||||
"Show Battery Percentage": "Pokaż procent baterii"
|
||||
}
|
||||
|
||||
@@ -842,6 +842,9 @@
|
||||
"Clear search": "Limpar pesquisa",
|
||||
"Clear search history": "Limpar histórico de pesquisa",
|
||||
"Tap to Toggle Footer": "Toque para alternar rodapé",
|
||||
"Show Current Time": "Mostrar hora atual",
|
||||
"Use 24 Hour Clock": "Usar formato de 24 horas",
|
||||
"Show Current Battery Status": "Mostrar o estado atual da bateria",
|
||||
"Exported successfully": "Exportado com sucesso",
|
||||
"Book exported successfully.": "Livro exportado com sucesso.",
|
||||
"Failed to export the book.": "Falha ao exportar o livro.",
|
||||
@@ -1072,5 +1075,6 @@
|
||||
"Page:": "Página:",
|
||||
"Page: {{number}}": "Página: {{number}}",
|
||||
"Annotation page number": "Número de página da anotação",
|
||||
"Translating...": "Traduzindo..."
|
||||
"Translating...": "Traduzindo...",
|
||||
"Show Battery Percentage": "Mostrar porcentagem da bateria"
|
||||
}
|
||||
|
||||
@@ -852,6 +852,9 @@
|
||||
"Clear search": "Очистить поиск",
|
||||
"Clear search history": "Очистить историю поиска",
|
||||
"Tap to Toggle Footer": "Нажмите для переключения нижнего колонтитула",
|
||||
"Show Current Time": "Показать текущее время",
|
||||
"Use 24 Hour Clock": "Использовать 24-часовой формат",
|
||||
"Show Current Battery Status": "Показать текущее состояние батареи",
|
||||
"Exported successfully": "Успешно экспортировано",
|
||||
"Book exported successfully.": "Книга успешно экспортирована.",
|
||||
"Failed to export the book.": "Не удалось экспортировать книгу.",
|
||||
@@ -1084,5 +1087,6 @@
|
||||
"Page:": "Страница:",
|
||||
"Page: {{number}}": "Страница: {{number}}",
|
||||
"Annotation page number": "Номер страницы аннотации",
|
||||
"Translating...": "Перевод..."
|
||||
"Translating...": "Перевод...",
|
||||
"Show Battery Percentage": "Показывать процент заряда батареи"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "සෙවුම හිස් කරන්න",
|
||||
"Clear search history": "සෙවුම් ඉතිහාසය හිස් කරන්න",
|
||||
"Tap to Toggle Footer": "පාදකය ටොගල් කිරීමට තට්ටු කරන්න",
|
||||
"Show Current Time": "වත්මන් වේලාව පෙන්වන්න",
|
||||
"Use 24 Hour Clock": "පැය 24 ඔරලෝසුව භාවිතා කරන්න",
|
||||
"Show Current Battery Status": "වත්මන් බැටරි තත්ත්වය පෙන්වන්න",
|
||||
"Exported successfully": "සාර්ථකව අපනයනය කරන ලදී",
|
||||
"Book exported successfully.": "පොත සාර්ථකව අපනයනය කරන ලදී.",
|
||||
"Failed to export the book.": "පොත අපනයනය කිරීමට අසමත් විය.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "පිටුව:",
|
||||
"Page: {{number}}": "පිටුව: {{number}}",
|
||||
"Annotation page number": "විවරණ පිටු අංකය",
|
||||
"Translating...": "පරිවර්තනය වෙමින් පවතී..."
|
||||
"Translating...": "පරිවර්තනය වෙමින් පවතී...",
|
||||
"Show Battery Percentage": "බැටරි ප්රතිශතය පෙන්වන්න"
|
||||
}
|
||||
|
||||
@@ -1084,5 +1084,9 @@
|
||||
"Sunset": "Sončni zahod",
|
||||
"Reveal in Finder": "Prikaži v Finderju",
|
||||
"Reveal in File Explorer": "Prikaži v File Explorerju",
|
||||
"Reveal in Folder": "Prikaži v mapi"
|
||||
"Reveal in Folder": "Prikaži v mapi",
|
||||
"Show Current Time": "Prikaži trenutni čas",
|
||||
"Use 24 Hour Clock": "Uporabi 24-urni zapis časa",
|
||||
"Show Current Battery Status": "Prikaži trenutno stanje baterije",
|
||||
"Show Battery Percentage": "Prikaži odstotek baterije"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "Rensa sökning",
|
||||
"Clear search history": "Rensa sökhistorik",
|
||||
"Tap to Toggle Footer": "Tryck för att växla sidfot",
|
||||
"Show Current Time": "Visa aktuell tid",
|
||||
"Use 24 Hour Clock": "Använd 24-timmarsklocka",
|
||||
"Show Current Battery Status": "Visa aktuell batteristatus",
|
||||
"Exported successfully": "Exporterad",
|
||||
"Book exported successfully.": "Boken har exporterats.",
|
||||
"Failed to export the book.": "Det gick inte att exportera boken.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "Sida:",
|
||||
"Page: {{number}}": "Sida: {{number}}",
|
||||
"Annotation page number": "Annoteringssidnummer",
|
||||
"Translating...": "Översätter..."
|
||||
"Translating...": "Översätter...",
|
||||
"Show Battery Percentage": "Visa batteriprocent"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "தேடலை அழி",
|
||||
"Clear search history": "தேடல் வரலாற்றை அழி",
|
||||
"Tap to Toggle Footer": "அடிக்குறிப்பை மாற்ற தட்டவும்",
|
||||
"Show Current Time": "தற்போதைய நேரத்தைக் காண்பி",
|
||||
"Use 24 Hour Clock": "24 மணிநேர கடிகாரத்தைப் பயன்படுத்து",
|
||||
"Show Current Battery Status": "தற்போதைய பேட்டரி நிலையைக் காண்பி",
|
||||
"Exported successfully": "ஏற்றுமதி வெற்றி",
|
||||
"Book exported successfully.": "புத்தகம் வெற்றிகரமாக ஏற்றுமதி செய்யப்பட்டது.",
|
||||
"Failed to export the book.": "புத்தகத்தை ஏற்றுமதி செய்ய இயலவில்லை.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "பக்கம்:",
|
||||
"Page: {{number}}": "பக்கம்: {{number}}",
|
||||
"Annotation page number": "சிறுகுறிப்புப் பக்க எண்",
|
||||
"Translating...": "மொழிபெயர்க்கிறது..."
|
||||
"Translating...": "மொழிபெயர்க்கிறது...",
|
||||
"Show Battery Percentage": "பேட்டரி சதவீதத்தைக் காண்பி"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "ล้างการค้นหา",
|
||||
"Clear search history": "ล้างประวัติการค้นหา",
|
||||
"Tap to Toggle Footer": "แตะเพื่อสลับส่วนท้าย",
|
||||
"Show Current Time": "แสดงเวลาปัจจุบัน",
|
||||
"Use 24 Hour Clock": "ใช้รูปแบบเวลา 24 ชั่วโมง",
|
||||
"Show Current Battery Status": "แสดงสถานะแบตเตอรี่ปัจจุบัน",
|
||||
"Exported successfully": "ส่งออกสำเร็จ",
|
||||
"Book exported successfully.": "ส่งออกหนังสือสำเร็จ",
|
||||
"Failed to export the book.": "ส่งออกหนังสือล้มเหลว",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "หน้า:",
|
||||
"Page: {{number}}": "หน้า: {{number}}",
|
||||
"Annotation page number": "หมายเลขหน้าคำอธิบายประกอบ",
|
||||
"Translating...": "กำลังแปล..."
|
||||
"Translating...": "กำลังแปล...",
|
||||
"Show Battery Percentage": "แสดงเปอร์เซ็นต์แบตเตอรี่"
|
||||
}
|
||||
|
||||
@@ -832,6 +832,9 @@
|
||||
"Clear search": "Aramayı temizle",
|
||||
"Clear search history": "Arama geçmişini temizle",
|
||||
"Tap to Toggle Footer": "Altbilgiyi değiştirmek için dokunun",
|
||||
"Show Current Time": "Şu anki saati göster",
|
||||
"Use 24 Hour Clock": "24 Saatlik Saati Kullan",
|
||||
"Show Current Battery Status": "Mevcut Pil Durumunu Göster",
|
||||
"Exported successfully": "Başarıyla dışa aktarıldı",
|
||||
"Book exported successfully.": "Kitap başarıyla dışa aktarıldı.",
|
||||
"Failed to export the book.": "Kitap dışa aktarılamadı.",
|
||||
@@ -1060,5 +1063,6 @@
|
||||
"Page:": "Sayfa:",
|
||||
"Page: {{number}}": "Sayfa: {{number}}",
|
||||
"Annotation page number": "Açıklama sayfa numarası",
|
||||
"Translating...": "Çevriliyor..."
|
||||
"Translating...": "Çevriliyor...",
|
||||
"Show Battery Percentage": "Pil Yüzdesini Göster"
|
||||
}
|
||||
|
||||
@@ -852,6 +852,9 @@
|
||||
"Clear search": "Очистити пошук",
|
||||
"Clear search history": "Очистити історію пошуку",
|
||||
"Tap to Toggle Footer": "Нижній колонтитул",
|
||||
"Show Current Time": "Показати поточний час",
|
||||
"Use 24 Hour Clock": "Використовувати 24-годинний формат",
|
||||
"Show Current Battery Status": "Показати поточний стан батареї",
|
||||
"Exported successfully": "Успішно експортовано",
|
||||
"Book exported successfully.": "Книгу успішно експортовано.",
|
||||
"Failed to export the book.": "Не вдалося експортувати книгу.",
|
||||
@@ -1084,5 +1087,6 @@
|
||||
"Page:": "Сторінка:",
|
||||
"Page: {{number}}": "Сторінка: {{number}}",
|
||||
"Annotation page number": "Номер сторінки анотації",
|
||||
"Translating...": "Переклад..."
|
||||
"Translating...": "Переклад...",
|
||||
"Show Battery Percentage": "Показувати відсоток заряду батареї"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "Xóa tìm kiếm",
|
||||
"Clear search history": "Xóa lịch sử tìm kiếm",
|
||||
"Tap to Toggle Footer": "Nhấn để bật/tắt chân trang",
|
||||
"Show Current Time": "Hiển thị thời gian hiện tại",
|
||||
"Use 24 Hour Clock": "Sử dụng định dạng 24 giờ",
|
||||
"Show Current Battery Status": "Hiển thị trạng thái pin hiện tại",
|
||||
"Exported successfully": "Xuất thành công",
|
||||
"Book exported successfully.": "Sách đã được xuất thành công.",
|
||||
"Failed to export the book.": "Xuất sách thất bại.",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "Trang:",
|
||||
"Page: {{number}}": "Trang: {{number}}",
|
||||
"Annotation page number": "Số trang chú thích",
|
||||
"Translating...": "Đang dịch..."
|
||||
"Translating...": "Đang dịch...",
|
||||
"Show Battery Percentage": "Hiển thị phần trăm pin"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "清除搜索",
|
||||
"Clear search history": "清除搜索历史",
|
||||
"Tap to Toggle Footer": "点击切换页脚",
|
||||
"Show Current Time": "显示当前时间",
|
||||
"Use 24 Hour Clock": "使用 24 小时制",
|
||||
"Show Current Battery Status": "显示当前电量",
|
||||
"Exported successfully": "导出成功",
|
||||
"Book exported successfully.": "书籍导出成功。",
|
||||
"Failed to export the book.": "书籍导出失败。",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "页面:",
|
||||
"Page: {{number}}": "页面: {{number}}",
|
||||
"Annotation page number": "批注页码",
|
||||
"Translating...": "翻译中..."
|
||||
"Translating...": "翻译中...",
|
||||
"Show Battery Percentage": "显示电量百分比"
|
||||
}
|
||||
|
||||
@@ -822,6 +822,9 @@
|
||||
"Clear search": "清除搜尋",
|
||||
"Clear search history": "清除搜尋歷史",
|
||||
"Tap to Toggle Footer": "點擊切換頁尾",
|
||||
"Show Current Time": "顯示目前時間",
|
||||
"Use 24 Hour Clock": "使用 24 小時制",
|
||||
"Show Current Battery Status": "顯示當前電池狀態",
|
||||
"Exported successfully": "匯出成功",
|
||||
"Book exported successfully.": "書籍匯出成功。",
|
||||
"Failed to export the book.": "書籍匯出失敗。",
|
||||
@@ -1048,5 +1051,6 @@
|
||||
"Page:": "頁面:",
|
||||
"Page: {{number}}": "頁面: {{number}}",
|
||||
"Annotation page number": "註解頁碼",
|
||||
"Translating...": "翻譯中..."
|
||||
"Translating...": "翻譯中...",
|
||||
"Show Battery Percentage": "顯示電池百分比"
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ tauri-plugin-native-bridge = { path = "./plugins/tauri-plugin-native-bridge" }
|
||||
tauri-plugin-native-tts = { path = "./plugins/tauri-plugin-native-tts" }
|
||||
tauri-plugin-websocket = "2"
|
||||
tauri-plugin-sharekit = "0.3"
|
||||
tauri-plugin-device-info = "1.0.1"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
rand = "0.8"
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
"haptics:allow-selection-feedback",
|
||||
"deep-link:default",
|
||||
"sharekit:default",
|
||||
"device-info:default",
|
||||
"native-tts:default",
|
||||
"native-bridge:default"
|
||||
]
|
||||
|
||||
@@ -184,6 +184,7 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_sharekit::init())
|
||||
.plugin(tauri_plugin_device_info::init())
|
||||
.plugin(tauri_plugin_native_bridge::init())
|
||||
.plugin(tauri_plugin_native_tts::init());
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import SectionInfo from './SectionInfo';
|
||||
import HeaderBar from './HeaderBar';
|
||||
import PageNavigationButtons from './PageNavigationButtons';
|
||||
import FooterBar from './footerbar/FooterBar';
|
||||
import ProgressInfoView from './ProgressInfo';
|
||||
import ProgressBar from './ProgressBar';
|
||||
import Ribbon from './Ribbon';
|
||||
import Annotator from './annotator/Annotator';
|
||||
import FootnotePopup from './FootnotePopup';
|
||||
@@ -210,7 +210,7 @@ const BooksGrid: React.FC<BooksGridProps> = ({ bookKeys, onCloseBook, onGoToLibr
|
||||
/>
|
||||
)}
|
||||
{showFooter && (
|
||||
<ProgressInfoView
|
||||
<ProgressBar
|
||||
bookKey={bookKey}
|
||||
horizontalGap={horizontalGapPercent}
|
||||
contentInsets={contentInsets}
|
||||
|
||||
+103
-53
@@ -9,15 +9,17 @@ import { useBookDataStore } from '@/store/bookDataStore';
|
||||
import { formatNumber, formatProgress } from '@/utils/progress';
|
||||
import { saveViewSettings } from '@/helpers/settings';
|
||||
import { SIZE_PER_LOC, SIZE_PER_TIME_UNIT } from '@/services/constants';
|
||||
import type { ProgressBarMode } from '@/types/book.ts';
|
||||
import StatusInfo from './StatusInfo.tsx';
|
||||
|
||||
interface PageInfoProps {
|
||||
interface ProgressBarProps {
|
||||
bookKey: string;
|
||||
horizontalGap: number;
|
||||
contentInsets: Insets;
|
||||
gridInsets: Insets;
|
||||
}
|
||||
|
||||
const ProgressInfoView: React.FC<PageInfoProps> = ({
|
||||
const ProgressBar: React.FC<ProgressBarProps> = ({
|
||||
bookKey,
|
||||
horizontalGap,
|
||||
contentInsets,
|
||||
@@ -78,49 +80,73 @@ const ProgressInfoView: React.FC<PageInfoProps> = ({
|
||||
|
||||
const showPagesLeft = total - 1 > current;
|
||||
|
||||
const [progressInfoMode, setProgressInfoMode] = useState(viewSettings.progressInfoMode);
|
||||
const [progressBarMode, setProgressBarMode] = useState<string>(viewSettings.progressInfoMode);
|
||||
|
||||
const hasRemainingInfo = viewSettings.showRemainingTime || viewSettings.showRemainingPages;
|
||||
const hasProgressInfo = viewSettings.showProgressInfo;
|
||||
const hasTimeInfo = viewSettings.showCurrentTime;
|
||||
const hasBatteryInfo = viewSettings.showCurrentBatteryStatus;
|
||||
const cycleProgressInfoModes = () => {
|
||||
if (!viewSettings.tapToToggleFooter) return;
|
||||
|
||||
const hasRemainingInfo = viewSettings.showRemainingTime || viewSettings.showRemainingPages;
|
||||
const hasProgressInfo = viewSettings.showProgressInfo;
|
||||
const modeSequence: (typeof progressInfoMode)[] = ['all', 'remaining', 'progress', 'none'];
|
||||
const currentIndex = modeSequence.indexOf(progressInfoMode);
|
||||
const modeSequence: string[] = [
|
||||
'all',
|
||||
`${hasRemainingInfo ? 'remaining+' : ''}${hasProgressInfo ? 'progress' : ''}`,
|
||||
`${hasRemainingInfo ? 'remaining' : ''}`,
|
||||
`${hasProgressInfo ? 'progress' : ''}`,
|
||||
`${hasBatteryInfo ? 'battery+' : ''}${hasTimeInfo ? 'time' : ''}`,
|
||||
`${hasBatteryInfo ? 'battery' : ''}`,
|
||||
`${hasTimeInfo ? 'time' : ''}`,
|
||||
'none',
|
||||
]
|
||||
.map((mode) => mode.replace(/^\+|\+$/g, ''))
|
||||
.filter((mode) => mode !== '')
|
||||
.filter((mode, index, self) => self.indexOf(mode) === index);
|
||||
|
||||
const currentMode = progressBarMode;
|
||||
const currentIndex = modeSequence.indexOf(currentMode);
|
||||
for (let i = 1; i <= modeSequence.length; i++) {
|
||||
const nextIndex = (currentIndex + i) % modeSequence.length;
|
||||
const nextMode = modeSequence[nextIndex]!;
|
||||
|
||||
const currentRenders = {
|
||||
remaining:
|
||||
progressInfoMode === 'all' || progressInfoMode === 'remaining' ? hasRemainingInfo : false,
|
||||
currentMode === 'all' || currentMode.includes('remaining') ? hasRemainingInfo : false,
|
||||
progress:
|
||||
progressInfoMode === 'all' || progressInfoMode === 'progress' ? hasProgressInfo : false,
|
||||
currentMode === 'all' || currentMode.includes('progress') ? hasProgressInfo : false,
|
||||
battery: currentMode === 'all' || currentMode.includes('battery') ? hasBatteryInfo : false,
|
||||
time: currentMode === 'all' || currentMode.includes('time') ? hasTimeInfo : false,
|
||||
none: currentMode === 'none',
|
||||
};
|
||||
|
||||
const nextRenders = {
|
||||
remaining: nextMode === 'all' || nextMode === 'remaining' ? hasRemainingInfo : false,
|
||||
progress: nextMode === 'all' || nextMode === 'progress' ? hasProgressInfo : false,
|
||||
remaining: nextMode === 'all' || nextMode.includes('remaining') ? hasRemainingInfo : false,
|
||||
progress: nextMode === 'all' || nextMode.includes('progress') ? hasProgressInfo : false,
|
||||
battery: nextMode === 'all' || nextMode.includes('battery') ? hasBatteryInfo : false,
|
||||
time: nextMode === 'all' || nextMode.includes('time') ? hasTimeInfo : false,
|
||||
none: nextMode === 'none',
|
||||
};
|
||||
|
||||
const isDifferent =
|
||||
currentRenders.remaining !== nextRenders.remaining ||
|
||||
currentRenders.progress !== nextRenders.progress;
|
||||
|
||||
currentRenders.progress !== nextRenders.progress ||
|
||||
currentRenders.battery !== nextRenders.battery ||
|
||||
currentRenders.time !== nextRenders.time ||
|
||||
currentRenders.none !== nextRenders.none;
|
||||
if (isDifferent) {
|
||||
setProgressInfoMode(nextMode);
|
||||
setProgressBarMode(nextMode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const nextIndex = (currentIndex + 1) % modeSequence.length;
|
||||
setProgressInfoMode(modeSequence[nextIndex]!);
|
||||
setProgressBarMode(modeSequence[nextIndex]!);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(envConfig, bookKey, 'progressInfoMode', progressInfoMode);
|
||||
saveViewSettings(envConfig, bookKey, 'progressInfoMode', progressBarMode as ProgressBarMode);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [progressInfoMode]);
|
||||
}, [progressBarMode]);
|
||||
|
||||
const isMobile = appService?.isMobile || window.innerWidth < 640;
|
||||
|
||||
@@ -171,45 +197,69 @@ const ProgressInfoView: React.FC<PageInfoProps> = ({
|
||||
isVertical ? 'h-full' : 'h-[52px] w-full',
|
||||
)}
|
||||
>
|
||||
{(progressInfoMode === 'all' || progressInfoMode === 'remaining') && (
|
||||
<>
|
||||
{viewSettings.showRemainingTime ? (
|
||||
<span className='time-left-label text-start'>{timeLeftStr}</span>
|
||||
) : viewSettings.showRemainingPages && showPagesLeft ? (
|
||||
<span className='text-start'>
|
||||
{localize ? (
|
||||
<Trans
|
||||
i18nKey='{{number}} pages left in chapter'
|
||||
values={{ number: formatNumber(pagesLeft, localize, lang) }}
|
||||
>
|
||||
<span className='pages-left-number'>{'{{number}}'}</span>
|
||||
<span className='pages-left-label'>{' pages left in chapter'}</span>
|
||||
</Trans>
|
||||
) : (
|
||||
<Trans i18nKey='{{count}} pages left in chapter' count={pagesLeft}>
|
||||
<span className='pages-left-number'>{'{{count}}'}</span>
|
||||
<span className='pages-left-label'>{' pages left in chapter'}</span>
|
||||
</Trans>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
{(progressBarMode === 'all' || progressBarMode.includes('remaining')) &&
|
||||
hasRemainingInfo && (
|
||||
<div className='remaining-info flex-1 overflow-hidden whitespace-nowrap text-start'>
|
||||
{viewSettings.showRemainingTime ? (
|
||||
<span className='time-left-label text-start'>{timeLeftStr}</span>
|
||||
) : viewSettings.showRemainingPages && showPagesLeft ? (
|
||||
<span className='text-start'>
|
||||
{localize ? (
|
||||
<Trans
|
||||
i18nKey='{{number}} pages left in chapter'
|
||||
values={{ number: formatNumber(pagesLeft, localize, lang) }}
|
||||
>
|
||||
<span className='pages-left-number'>{'{{number}}'}</span>
|
||||
<span className='pages-left-label'>{' pages left in chapter'}</span>
|
||||
</Trans>
|
||||
) : (
|
||||
<Trans i18nKey='{{count}} pages left in chapter' count={pagesLeft}>
|
||||
<span className='pages-left-number'>{'{{count}}'}</span>
|
||||
<span className='pages-left-label'>{' pages left in chapter'}</span>
|
||||
</Trans>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(progressInfoMode === 'all' || progressInfoMode === 'progress') && (
|
||||
<>
|
||||
{viewSettings.showProgressInfo && (
|
||||
<span
|
||||
className={clsx('progress-info-label text-end', isVertical ? 'mt-auto' : 'ms-auto')}
|
||||
>
|
||||
{progressInfo}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{(progressBarMode === 'all' ||
|
||||
progressBarMode.includes('battery') ||
|
||||
progressBarMode.includes('time')) &&
|
||||
progressInfo && (
|
||||
<StatusInfo
|
||||
showTime={
|
||||
(progressBarMode === 'all' || progressBarMode.includes('time')) && hasTimeInfo
|
||||
}
|
||||
use24Hour={viewSettings.use24HourClock}
|
||||
showBattery={
|
||||
(progressBarMode === 'all' || progressBarMode.includes('battery')) && hasBatteryInfo
|
||||
}
|
||||
showBatteryPercentage={viewSettings.showBatteryPercentage}
|
||||
isVertical={isVertical}
|
||||
isEink={isEink}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className='progress-info flex-1 items-center overflow-hidden whitespace-nowrap text-end tabular-nums'>
|
||||
{(progressBarMode === 'all' || progressBarMode.includes('progress')) && (
|
||||
<>
|
||||
{viewSettings.showProgressInfo && (
|
||||
<span
|
||||
className={clsx(
|
||||
'progress-info-label text-end',
|
||||
isVertical ? 'mt-auto' : 'ms-auto',
|
||||
)}
|
||||
>
|
||||
{progressInfo}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProgressInfoView;
|
||||
export default ProgressBar;
|
||||
@@ -0,0 +1,81 @@
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import { useCurrentTime } from '../hooks/useCurrentTime';
|
||||
import { useCurrentBatteryStatus } from '../hooks/useCurrentBattery';
|
||||
|
||||
interface StatusInfoProps {
|
||||
showTime: boolean;
|
||||
showBattery: boolean;
|
||||
showBatteryPercentage: boolean;
|
||||
use24Hour?: boolean;
|
||||
isVertical?: boolean;
|
||||
isEink?: boolean;
|
||||
}
|
||||
|
||||
const StatusInfo: React.FC<StatusInfoProps> = ({
|
||||
showTime,
|
||||
use24Hour = true,
|
||||
showBattery,
|
||||
showBatteryPercentage,
|
||||
isVertical,
|
||||
isEink,
|
||||
}) => {
|
||||
const formattedTime = useCurrentTime(showTime, use24Hour);
|
||||
const batteryLevel = useCurrentBatteryStatus(showBattery);
|
||||
|
||||
if (!showTime && !showBattery) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
'status-bar flex shrink-0 items-center gap-2 whitespace-nowrap tabular-nums',
|
||||
isVertical ? 'my-auto flex-col' : 'flex-row',
|
||||
)}
|
||||
>
|
||||
{showTime && <span>{formattedTime}</span>}
|
||||
{showBattery && batteryLevel !== null && (
|
||||
<span className='relative inline-flex translate-y-[-0.5px] items-center justify-center'>
|
||||
<svg width='25' height='12' viewBox='0 0 25 12' fill='none'>
|
||||
<rect
|
||||
x='0.5'
|
||||
y='0.5'
|
||||
width='21'
|
||||
height='11'
|
||||
rx='2'
|
||||
stroke='currentColor'
|
||||
strokeWidth='1'
|
||||
opacity={isEink ? 1.0 : 0.75}
|
||||
/>
|
||||
<rect
|
||||
x='1.5'
|
||||
y='1.5'
|
||||
width={(batteryLevel / 100) * 19}
|
||||
height='9'
|
||||
rx='1'
|
||||
fill='currentColor'
|
||||
opacity={isEink ? 1.0 : 0.3}
|
||||
/>
|
||||
<path
|
||||
d='M23 4V8C23.8 8 24 7 24 6C24 5 23.8 4 23 4Z'
|
||||
fill='currentColor'
|
||||
opacity={isEink ? 1.0 : 0.75}
|
||||
/>
|
||||
</svg>
|
||||
{showBatteryPercentage && batteryLevel !== null && (
|
||||
<span
|
||||
className={clsx(
|
||||
'absolute text-[8px] font-medium leading-none invert',
|
||||
isEink ? 'text-black mix-blend-difference' : 'text-base-300 mix-blend-luminosity',
|
||||
)}
|
||||
style={{ left: '11px', transform: 'translateX(-50%)' }}
|
||||
>
|
||||
{batteryLevel}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusInfo;
|
||||
@@ -0,0 +1,66 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEnv } from '@/context/EnvContext';
|
||||
import { getBatteryInfo } from 'tauri-plugin-device-info-api';
|
||||
import { isTauriAppPlatform } from '@/services/environment';
|
||||
|
||||
interface BatteryManager extends EventTarget {
|
||||
level: number;
|
||||
charging: boolean;
|
||||
chargingTime: number;
|
||||
dischargingTime: number;
|
||||
}
|
||||
export function useCurrentBatteryStatus(enabled: boolean) {
|
||||
const { appService } = useEnv();
|
||||
const [batteryLevel, setBatteryLevel] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled || typeof navigator === 'undefined' || !('getBattery' in navigator)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let battery: BatteryManager | null = null;
|
||||
|
||||
const updateBatteryInfo = (batt: BatteryManager) => {
|
||||
const level = Math.round(batt.level * 100);
|
||||
setBatteryLevel(level);
|
||||
};
|
||||
|
||||
const handleLevelChange = (event: Event) => {
|
||||
updateBatteryInfo(event.currentTarget as BatteryManager);
|
||||
};
|
||||
|
||||
(navigator as unknown as { getBattery: () => Promise<BatteryManager> })
|
||||
.getBattery()
|
||||
.then((batt) => {
|
||||
battery = batt;
|
||||
updateBatteryInfo(batt);
|
||||
batt.addEventListener('levelchange', handleLevelChange);
|
||||
});
|
||||
|
||||
return () => {
|
||||
if (battery) {
|
||||
battery.removeEventListener('levelchange', handleLevelChange);
|
||||
}
|
||||
};
|
||||
}, [enabled]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled || !appService || !isTauriAppPlatform()) return;
|
||||
|
||||
const fetchBatteryInfo = async () => {
|
||||
try {
|
||||
const info = await getBatteryInfo();
|
||||
if (info.level !== undefined) {
|
||||
setBatteryLevel(Math.round(info.level));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch battery info:', error);
|
||||
}
|
||||
};
|
||||
fetchBatteryInfo();
|
||||
const interval = setInterval(fetchBatteryInfo, 60_000);
|
||||
return () => clearInterval(interval);
|
||||
}, [appService, enabled]);
|
||||
|
||||
return batteryLevel;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useEffect, useState, useMemo } from 'react';
|
||||
|
||||
export function useCurrentTime(enabled: boolean, use24Hour = true, intervalMs = 10000) {
|
||||
const [currentTime, setCurrentTime] = useState(() => new Date());
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled) return;
|
||||
|
||||
const timer = setInterval(() => {
|
||||
setCurrentTime(new Date());
|
||||
}, intervalMs);
|
||||
|
||||
return () => clearInterval(timer);
|
||||
}, [enabled, intervalMs]);
|
||||
|
||||
return useMemo(() => {
|
||||
if (!enabled) return '';
|
||||
|
||||
return currentTime.toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: !use24Hour,
|
||||
});
|
||||
}, [currentTime, enabled, use24Hour]);
|
||||
}
|
||||
@@ -70,6 +70,14 @@ const LayoutPanel: React.FC<SettingsPanelPanelProp> = ({ bookKey, onRegisterRese
|
||||
const [showRemainingTime, setShowRemainingTime] = useState(viewSettings.showRemainingTime);
|
||||
const [showRemainingPages, setShowRemainingPages] = useState(viewSettings.showRemainingPages);
|
||||
const [showProgressInfo, setShowProgressInfo] = useState(viewSettings.showProgressInfo);
|
||||
const [showCurrentTime, setShowCurrentTime] = useState(viewSettings.showCurrentTime);
|
||||
const [use24HourClock, setUse24HourClock] = useState(viewSettings.use24HourClock);
|
||||
const [showCurrentBatteryStatus, setShowCurrentBatteryStatus] = useState(
|
||||
viewSettings.showCurrentBatteryStatus,
|
||||
);
|
||||
const [showBatteryPercentage, setShowBatteryPercentage] = useState(
|
||||
viewSettings.showBatteryPercentage,
|
||||
);
|
||||
const [tapToToggleFooter, setTapToToggleFooter] = useState(viewSettings.tapToToggleFooter);
|
||||
const [progressStyle, setProgressStyle] = useState(viewSettings.progressStyle);
|
||||
const [screenOrientation, setScreenOrientation] = useState(viewSettings.screenOrientation);
|
||||
@@ -106,6 +114,10 @@ const LayoutPanel: React.FC<SettingsPanelPanelProp> = ({ bookKey, onRegisterRese
|
||||
showRemainingTime: setShowRemainingTime,
|
||||
showRemainingPages: setShowRemainingPages,
|
||||
showProgressInfo: setShowProgressInfo,
|
||||
showCurrentTime: setShowCurrentTime,
|
||||
use24HourClock: setUse24HourClock,
|
||||
showCurrentBatteryStatus: setShowCurrentBatteryStatus,
|
||||
showBatteryPercentage: setShowBatteryPercentage,
|
||||
tapToToggleFooter: setTapToToggleFooter,
|
||||
showMarginsOnScroll: setShowMarginsOnScroll,
|
||||
});
|
||||
@@ -339,6 +351,40 @@ const LayoutPanel: React.FC<SettingsPanelPanelProp> = ({ bookKey, onRegisterRese
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [showProgressInfo]);
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(envConfig, bookKey, 'showCurrentTime', showCurrentTime, false, false);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [showCurrentTime]);
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(envConfig, bookKey, 'use24HourClock', use24HourClock, false, false);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [use24HourClock]);
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(
|
||||
envConfig,
|
||||
bookKey,
|
||||
'showCurrentBatteryStatus',
|
||||
showCurrentBatteryStatus,
|
||||
false,
|
||||
false,
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [showCurrentBatteryStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(
|
||||
envConfig,
|
||||
bookKey,
|
||||
'showBatteryPercentage',
|
||||
showBatteryPercentage,
|
||||
false,
|
||||
false,
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [showBatteryPercentage]);
|
||||
|
||||
useEffect(() => {
|
||||
saveViewSettings(envConfig, bookKey, 'progressStyle', progressStyle, false, false);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -721,6 +767,48 @@ const LayoutPanel: React.FC<SettingsPanelPanelProp> = ({ bookKey, onRegisterRese
|
||||
disabled={!showProgressInfo}
|
||||
/>
|
||||
</div>
|
||||
<div className='config-item'>
|
||||
<span className=''>{_('Show Current Time')}</span>
|
||||
<input
|
||||
type='checkbox'
|
||||
className='toggle'
|
||||
checked={showCurrentTime}
|
||||
disabled={!showFooter}
|
||||
onChange={() => setShowCurrentTime(!showCurrentTime)}
|
||||
/>
|
||||
</div>
|
||||
{showCurrentTime && (
|
||||
<div className='config-item'>
|
||||
<span className=''>{_('Use 24 Hour Clock')}</span>
|
||||
<input
|
||||
type='checkbox'
|
||||
className='toggle'
|
||||
checked={use24HourClock}
|
||||
disabled={!showFooter}
|
||||
onChange={() => setUse24HourClock(!use24HourClock)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className='config-item'>
|
||||
<span className=''>{_('Show Current Battery Status')}</span>
|
||||
<input
|
||||
type='checkbox'
|
||||
className='toggle'
|
||||
checked={showCurrentBatteryStatus}
|
||||
disabled={!showFooter}
|
||||
onChange={() => setShowCurrentBatteryStatus(!showCurrentBatteryStatus)}
|
||||
/>
|
||||
</div>
|
||||
<div className='config-item'>
|
||||
<span className=''>{_('Show Battery Percentage')}</span>
|
||||
<input
|
||||
type='checkbox'
|
||||
className='toggle'
|
||||
checked={showBatteryPercentage}
|
||||
disabled={!showFooter || !showCurrentBatteryStatus}
|
||||
onChange={() => setShowBatteryPercentage(!showBatteryPercentage)}
|
||||
/>
|
||||
</div>
|
||||
<div className='config-item'>
|
||||
<span className=''>{_('Tap to Toggle Footer')}</span>
|
||||
<input
|
||||
|
||||
@@ -267,6 +267,10 @@ export const DEFAULT_VIEW_CONFIG: ViewConfig = {
|
||||
showRemainingTime: false,
|
||||
showRemainingPages: false,
|
||||
showProgressInfo: true,
|
||||
showCurrentTime: false,
|
||||
showCurrentBatteryStatus: false,
|
||||
showBatteryPercentage: true,
|
||||
use24HourClock: false,
|
||||
tapToToggleFooter: false,
|
||||
showMarginsOnScroll: false,
|
||||
showPaginationButtons: false,
|
||||
|
||||
@@ -189,6 +189,7 @@ export interface BookLanguage {
|
||||
convertChineseVariant: ConvertChineseVariant;
|
||||
}
|
||||
|
||||
export type ProgressBarMode = 'remaining' | 'progress' | 'battery' | 'time' | 'all' | 'none';
|
||||
export interface ViewConfig {
|
||||
sideBarTab: string;
|
||||
uiLanguage: string;
|
||||
@@ -202,12 +203,16 @@ export interface ViewConfig {
|
||||
showRemainingTime: boolean;
|
||||
showRemainingPages: boolean;
|
||||
showProgressInfo: boolean;
|
||||
showCurrentTime: boolean;
|
||||
use24HourClock: boolean;
|
||||
showCurrentBatteryStatus: boolean;
|
||||
showBatteryPercentage: boolean;
|
||||
tapToToggleFooter: boolean;
|
||||
showBarsOnScroll: boolean;
|
||||
showMarginsOnScroll: boolean;
|
||||
showPaginationButtons: boolean;
|
||||
progressStyle: 'percentage' | 'fraction';
|
||||
progressInfoMode: 'remaining' | 'progress' | 'all' | 'none';
|
||||
progressInfoMode: ProgressBarMode;
|
||||
|
||||
animated: boolean;
|
||||
isEink: boolean;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css,json,md,html,yml}\"",
|
||||
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,css,json,md,html,yml}\""
|
||||
},
|
||||
"packageManager": "pnpm@10.28.1",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.9.1",
|
||||
|
||||
Generated
+10
@@ -335,6 +335,9 @@ importers:
|
||||
tailwind-merge:
|
||||
specifier: ^3.4.0
|
||||
version: 3.4.0
|
||||
tauri-plugin-device-info-api:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
tinycolor2:
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.0
|
||||
@@ -7760,6 +7763,9 @@ packages:
|
||||
resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
tauri-plugin-device-info-api@1.0.1:
|
||||
resolution: {integrity: sha512-d2QoatWeQ6X09fdEDdWSKzBVSZv9x8LpksJP/gfv4WeRmZwJRsLLMf1++qOw7PdOmQlNoKHFcKXPZlr2n4irdg==}
|
||||
|
||||
teex@1.0.1:
|
||||
resolution: {integrity: sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==}
|
||||
|
||||
@@ -17353,6 +17359,10 @@ snapshots:
|
||||
|
||||
tapable@2.3.0: {}
|
||||
|
||||
tauri-plugin-device-info-api@1.0.1:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.9.1
|
||||
|
||||
teex@1.0.1:
|
||||
dependencies:
|
||||
streamx: 2.23.0
|
||||
|
||||
Reference in New Issue
Block a user