From dc825f01126b0d969abea9a155b30d3d2e8b1425 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:00:30 -0400 Subject: [PATCH] My Studies: show studies as a grid or a list A Grid / List toggle beside the sort and tag filters. List is one compact row per study (small book cover, title with Rename, passage, tags, date, Resume and Delete). The choice is remembered on the device. Co-Authored-By: Claude Sonnet 5.5 --- src/components/BookCover.jsx | 23 ++++++++++++++++------- src/pages/HomePage.jsx | 28 ++++++++++++++++++++++------ src/test/App.home.test.jsx | 19 +++++++++++++++++++ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/src/components/BookCover.jsx b/src/components/BookCover.jsx index 9188dd4..36283ba 100644 --- a/src/components/BookCover.jsx +++ b/src/components/BookCover.jsx @@ -1,13 +1,13 @@ // The picture on a study's card: a coloured cover for the kind of book, with the book's name. import { coverFor } from '../utils/bookCovers.js'; -export default function BookCover({ summary, className = '' }) { +export default function BookCover({ summary, className = '', compact = false }) { const { group, name, extra } = coverFor(summary); const [from, to] = group.colors; const id = `cover-${group.id}`; return (
-
); diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx index 6a63db8..55906ed 100644 --- a/src/pages/HomePage.jsx +++ b/src/pages/HomePage.jsx @@ -51,6 +51,12 @@ export default function HomePage() { try { return localStorage.getItem('homeSort') || 'recent'; } catch { return 'recent'; } }); // 'recent' | 'title' | 'passage' const [homeTagFilter, setHomeTagFilter] = useState(''); + const [homeView, setHomeView] = useState(() => { + try { return localStorage.getItem('homeView') === 'list' ? 'list' : 'grid'; } catch { return 'grid'; } + }); // 'grid' | 'list' + useEffect(() => { + try { localStorage.setItem('homeView', homeView); } catch {} + }, [homeView]); const [homeFullTextResults, setHomeFullTextResults] = useState(null); // null=idle, []=no match, [...]= results const fullTextTimerRef = useRef(null); const [renamingId, setRenamingId] = useState(null); @@ -163,6 +169,12 @@ export default function HomePage() { +
+ {[['grid', 'Grid'], ['list', 'List']].map(([id, label]) => ( + + ))} +
{allTags.length > 0 && (