From bf02e071fa401f2947eab889b021f1b32a2d1cf9 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Tue, 22 Sep 2026 14:59:22 -0400 Subject: [PATCH] Move study editor state into StudyPage and hooks - StudyPage owns layout/tabs/collapsed sections, tags, DOCX script import, chunk navigation, keyboard shortcuts, and the selected-chunk values derived from the project. - useStudyResources: commentary + interlinear for the selected chunk's chapter. These now load only on the study page (they previously also fetched while on Setup). - useCrossRefs: typed refs, dataset suggestions, verse text. - useWordStudy: word entries, Strong's lookups, suggestion picker. - Fix: study-page messages (word suggestions, DOCX import, lookups) set a status that only SetupPage displayed, so they were never seen. They now show as a toast on the study page. - copyVerse moves into ReaderPage. - Tests: toast, arrow-key navigation, cross-refs, tags. Co-Authored-By: Claude Opus 5.5 --- SUGGESTIONS.md | 68 ---- src/App.jsx | 671 +-------------------------------- src/App.test.jsx | 40 ++ src/hooks/useCrossRefs.js | 129 +++++++ src/hooks/useStudyResources.js | 76 ++++ src/hooks/useWordStudy.js | 341 +++++++++++++++++ src/pages/ReaderPage.jsx | 6 +- src/pages/StudyPage.jsx | 189 ++++++++-- 8 files changed, 749 insertions(+), 771 deletions(-) delete mode 100644 SUGGESTIONS.md create mode 100644 src/hooks/useCrossRefs.js create mode 100644 src/hooks/useStudyResources.js create mode 100644 src/hooks/useWordStudy.js diff --git a/SUGGESTIONS.md b/SUGGESTIONS.md deleted file mode 100644 index 8f7f285..0000000 --- a/SUGGESTIONS.md +++ /dev/null @@ -1,68 +0,0 @@ -# Study App Improvement Suggestions - -_Refreshed 2026-07-06 (multiple passes) — items already shipped have been removed; this reflects what's actually still open. Recent additions: multi-user auth with per-account data scoping, TOTP 2FA with backup codes, podcast terminology generalized to "Session" for study-only users (with a configurable podcast/show name), auto-restore on new devices, study templates (richer OIA guiding prompts), PDF/print export, Markdown export, a passage breadcrumb, whole-Bible search, better bookmark UX (always-visible SVG icons + a jump-to panel), read-only share links, and an admin panel (`server/auth.js` `ADMIN_EMAIL`, hardcoded to the site owner's account) showing every user/project with view/delete controls._ - -## Features - -### Study Tools -- **Bible comparison mode** — show two translations side-by-side. `availableTranslations` is already fetched and a translation is already selectable per project, but only one renders at a time — no split/parallel view -- **Verse-level notes** — annotations are still chunk-level only (OIA fields); no way to attach a note to a single verse within a chunk -- **Progress tracking** — no "in progress"/"complete" marker per chunk and no progress bar on the home project card - -### Export / Sharing -- **Episode length estimate** — Final Script field exists per chunk; a word-count-based "~X minutes read aloud" estimate would help podcast planning -- **Share link is single-use-case** — one share token per project, all-or-nothing (whole project, all chunks). A per-chunk or per-chapter share might be worth it for someone who only wants to share one episode's notes rather than the whole series - -### Chunk Builder (Setup Page) -- **Drag-to-select verses** — still click-then-shift-click; no click-and-drag range selection -- **Auto-chunk** — no "split by paragraph/section" button; every chunk boundary is manual or typed - ---- - -## UX / UI - -### Study Page - -### Reader -- **Bookmark color picker is still an emoji button** (🎨) — the bookmark/copy icons became proper SVGs, but color-cycling didn't get the same treatment - -### Home Page -- Search/filter/sort/rename are all implemented — nothing open here currently - ---- - -## Code Architecture - -### State Management -- **`App.jsx` is now ~5,700+ lines** — still one component. Splitting into `pages/HomePage.jsx`, `pages/SetupPage.jsx`, `pages/StudyPage.jsx`, `pages/BibleReaderPage.jsx`, plus extracted hooks (`useProject`, `useGreekLookup`, `useAutosave`) is more valuable now than ever given the continued size growth - -### Sync / Persistence -- No rate-limiting on `/api/auth/*` — a determined attacker could brute-force a weak password or 2FA code; worth adding if this is ever reachable beyond a small trusted group -- **Conflict resolution is still last-write-wins** — only `lastEdited` timestamps are compared; no "which version do you want to keep?" UI -- **Offline-first** — still no service worker; app requires a live connection to `bible.helloao.org` for chapter/audio/commentary loads with no cached fallback if that API is down - -### Security (OWASP) -- **No input validation on server** — still no max-length/character validation on `id`/`title` in `server/index.js` -- **CORS** — still no CORS headers configured -- **Shared HTML view is sandboxed but not escaped** — `buildExportHtml` interpolates OIA notes into HTML without escaping `<`/`>`/`&`; the public share view mitigates this by rendering in a `sandbox="allow-popups"` iframe (no `allow-scripts`, so injected `