From ad4ee5c737809e3207f3f5af6b0e6c7d6392014b Mon Sep 17 00:00:00 2001 From: Riccardo Giorato Date: Sat, 27 Dec 2025 11:54:28 +0100 Subject: [PATCH] Add arrow key navigation and 'C' shortcut to add page, update UI hints --- app/story/[storySlug]/story-editor-client.tsx | 20 ++++++++++++------- components/editor/comic-canvas.tsx | 16 +++++++-------- components/editor/editor-toolbar.tsx | 20 +++++++++---------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/app/story/[storySlug]/story-editor-client.tsx b/app/story/[storySlug]/story-editor-client.tsx index d2ac2dc..a744fd1 100644 --- a/app/story/[storySlug]/story-editor-client.tsx +++ b/app/story/[storySlug]/story-editor-client.tsx @@ -135,13 +135,19 @@ export function StoryEditorClient() { return; } - if (e.key === "ArrowRight") { - setCurrentPage((prev) => (prev < pages.length - 1 ? prev + 1 : prev)); - } else if (e.key === "ArrowLeft") { - setCurrentPage((prev) => (prev > 0 ? prev - 1 : prev)); - } else if (e.key === "i" || e.key === "I") { - setShowInfoSheet(true); - } + if (e.key === "ArrowRight") { + setCurrentPage((prev) => (prev < pages.length - 1 ? prev + 1 : prev)); + } else if (e.key === "ArrowLeft") { + setCurrentPage((prev) => (prev > 0 ? prev - 1 : prev)); + } else if (e.key === "ArrowUp") { + setCurrentPage((prev) => (prev > 0 ? prev - 1 : prev)); + } else if (e.key === "ArrowDown") { + setCurrentPage((prev) => (prev < pages.length - 1 ? prev + 1 : prev)); + } else if (e.key === "i" || e.key === "I") { + setShowInfoSheet(true); + } else if (e.key === "c" || e.key === "C") { + handleAddPage(); + } }; window.addEventListener("keydown", handleKeyDown); diff --git a/components/editor/comic-canvas.tsx b/components/editor/comic-canvas.tsx index 1a2c468..c7277cd 100644 --- a/components/editor/comic-canvas.tsx +++ b/components/editor/comic-canvas.tsx @@ -46,11 +46,11 @@ export function ComicCanvas({ {/* Dot grid background */}
-
-
+
+
Page {page.id}
-
-
+
+
- {/* Action buttons below the page image */} + {/* Action buttons below the page image */}
{onInfoClick && ( - {isOwner && onContinueStory && ( - - )} + {isOwner && onContinueStory && ( + + )}
);