From b359d663522f8f8de285d4e17d69fdf4ea765b2d Mon Sep 17 00:00:00 2001 From: Richard R Date: Sat, 30 May 2026 18:06:12 -0600 Subject: [PATCH] refactor(doclist): update GalleryView keyboard handling and icon visuals - Add Delete/Backspace keyboard shortcut for document deletion in GalleryView - Use buttonClass utility for consistent button styling - Simplify GalleryViewIcon SVG for improved clarity and alignment These changes streamline user interactions and enhance visual consistency in the document gallery view. --- src/components/doclist/views/GalleryView.tsx | 13 ++++++++++--- src/components/doclist/window/finderIcons.tsx | 6 ++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/doclist/views/GalleryView.tsx b/src/components/doclist/views/GalleryView.tsx index 862f523..339fa51 100644 --- a/src/components/doclist/views/GalleryView.tsx +++ b/src/components/doclist/views/GalleryView.tsx @@ -7,6 +7,7 @@ import type { DocumentListDocument } from '@/types/documents'; import { PDFIcon, EPUBIcon, FileIcon } from '@/components/icons/Icons'; import { DocumentPreview } from '@/components/doclist/DocumentPreview'; import { formatDocumentSize } from '@/components/doclist/formatSize'; +import { buttonClass } from '@/components/formPrimitives'; import { useDocumentSelection } from '../dnd/DocumentSelectionContext'; import { DND_DOCUMENT, documentIdentityKey, type DocumentDragItem } from '../dnd/dndTypes'; @@ -166,11 +167,17 @@ export function GalleryView({ setActiveIdx((i) => Math.min(documents.length - 1, i + 1)); } else if (e.key === 'ArrowLeft') { setActiveIdx((i) => Math.max(0, i - 1)); + } else if (e.key === 'Delete' || e.key === 'Backspace') { + const doc = documents[activeIdx]; + if (doc) { + e.preventDefault(); + onDeleteDoc(doc); + } } }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); - }, [documents.length]); + }, [documents, activeIdx, onDeleteDoc]); return (
@@ -194,14 +201,14 @@ export function GalleryView({ Open diff --git a/src/components/doclist/window/finderIcons.tsx b/src/components/doclist/window/finderIcons.tsx index f2f0fa3..dd376ad 100644 --- a/src/components/doclist/window/finderIcons.tsx +++ b/src/components/doclist/window/finderIcons.tsx @@ -62,10 +62,8 @@ export const ListViewIcon = (props: IconProps) => ( export const GalleryViewIcon = (props: IconProps) => ( - - - - + + );