diff options
| author | Fuwn <[email protected]> | 2026-02-10 20:39:43 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-10 20:39:43 -0800 |
| commit | 36e8a7ad5a40b95bd37136c498ce84b2247cde8e (patch) | |
| tree | 2a5266046b75836b955b666678ba327aba7c23d1 /apps | |
| parent | fix: mark-all-read undo only reverts affected entries (diff) | |
| download | asa.news-36e8a7ad5a40b95bd37136c498ce84b2247cde8e.tar.xz asa.news-36e8a7ad5a40b95bd37136c498ce84b2247cde8e.zip | |
feat: add previous/next navigation buttons on mobile detail view
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/web/app/reader/_components/reader-shell.tsx | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/apps/web/app/reader/_components/reader-shell.tsx b/apps/web/app/reader/_components/reader-shell.tsx index d063e8c..78ce8e3 100644 --- a/apps/web/app/reader/_components/reader-shell.tsx +++ b/apps/web/app/reader/_components/reader-shell.tsx @@ -52,6 +52,9 @@ export function ReaderShell({ const toggleShortcutsDialog = useUserInterfaceStore( (state) => state.toggleShortcutsDialog ) + const navigableEntryIdentifiers = useUserInterfaceStore( + (state) => state.navigableEntryIdentifiers + ) const toolbarPosition = useUserInterfaceStore( (state) => state.toolbarPosition ) @@ -188,15 +191,39 @@ export function ReaderShell({ "flex items-center justify-between border-border px-4 py-3", toolbarPosition === "top" ? "border-b" : "border-t" )}> - {isMobile && selectedEntryIdentifier ? ( - <button - type="button" - onClick={() => setSelectedEntryIdentifier(null)} - className="text-text-secondary transition-colors hover:text-text-primary" - > - ← back - </button> - ) : isRenamingTitle ? ( + {isMobile && selectedEntryIdentifier ? (() => { + const currentIndex = navigableEntryIdentifiers.indexOf(selectedEntryIdentifier) + const previousEntryIdentifier = currentIndex > 0 ? navigableEntryIdentifiers[currentIndex - 1] : null + const nextEntryIdentifier = currentIndex < navigableEntryIdentifiers.length - 1 ? navigableEntryIdentifiers[currentIndex + 1] : null + + return ( + <div className="flex items-center gap-3"> + <button + type="button" + onClick={() => setSelectedEntryIdentifier(null)} + className="text-text-secondary transition-colors hover:text-text-primary" + > + ← back + </button> + <button + type="button" + onClick={() => previousEntryIdentifier && setSelectedEntryIdentifier(previousEntryIdentifier)} + disabled={!previousEntryIdentifier} + className="text-text-secondary transition-colors hover:text-text-primary disabled:opacity-30" + > + ↑ previous + </button> + <button + type="button" + onClick={() => nextEntryIdentifier && setSelectedEntryIdentifier(nextEntryIdentifier)} + disabled={!nextEntryIdentifier} + className="text-text-secondary transition-colors hover:text-text-primary disabled:opacity-30" + > + ↓ next + </button> + </div> + ) + })() : isRenamingTitle ? ( <div className="flex items-center gap-2"> <input type="text" |