Conversation
There was a problem hiding this comment.
Pull request overview
Adds a mobile-friendly “Mark Verses” experience in the renderer, improving verse reference editing and segment interactions on touch devices while also making segment region coloring deterministic.
Changes:
- Introduces a new mobile Mark Verses UI (table + reference editing dialog) and switches Passage Detail to use it on mobile.
- Updates WaveSurfer region handling to use a deterministic color palette and improves current-region styling.
- Expands supported verse suffix matching (a–e) and adds new localization keys; renames
PassageRefprop fromreftopassageRef.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/src/utils/refMatch.ts | Allows verse suffixes through e in reference validation. |
| src/renderer/src/store/localization/reducers.tsx | Adds new verse-tool localization strings. |
| src/renderer/src/store/localization/model.tsx | Extends IVerseStrings typings for the new strings. |
| src/renderer/src/routes/PassageDetail.tsx | Uses the new mobile Mark Verses component when isMobile. |
| src/renderer/src/crud/useWavesurferRegions.tsx | Adds deterministic segment colors and adjusts current-region visuals / prev-next wiring. |
| src/renderer/src/crud/useWaveSurfer.tsx | Adds mobile double-tap logic to create regions; disables dblclick behavior on mobile. |
| src/renderer/src/components/Sheet/PassageRef.tsx | Renames ref prop to passageRef to avoid React’s special ref handling. |
| src/renderer/src/components/Sheet/PassageCard.tsx | Updates PassageRef usage to passageRef. |
| src/renderer/src/components/PassageDetail/mobile/MarkVerses/PassageDetailMarkVersesIsMobile.tsx | New mobile Mark Verses tool implementation. |
| src/renderer/src/components/PassageDetail/mobile/MarkVerses/PassageDetailMarkVersesIsMobile.test.tsx | Jest coverage for the new mobile Mark Verses behaviors. |
| src/renderer/src/components/PassageDetail/mobile/MarkVerses/PassageDetailMarkVersesIsMobile.cy.tsx | Cypress coverage for the mobile table component. |
| src/renderer/src/components/PassageDetail/mobile/MarkVerses/MarkVersesTableIsMobile.tsx | Mobile-friendly table UI for segment timestamps + references. |
| src/renderer/src/components/PassageDetail/mobile/MarkVerses/EditReferenceDropdown.tsx | Dialog UI for editing/splitting verse references on mobile. |
| src/renderer/src/business/player/usePlayerLogic.ts | Changes how suggestedSegments influences segment loading. |
| package.json | Bumps FingerprintJS and adds baseline-browser-mapping. |
| package-lock.json | Lockfile updates consistent with dependency changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const CLICK_DEBOUNCE_MS = 100; // Minimum time between clicks | ||
| const CURRENT_REGION_COLOR = (theme.palette as any).custom.currentRegion; // Green color for current region | ||
| const CURRENT_REGION_BORDER = (theme.palette as any).custom.currentRegion; | ||
| const NEXT_BORDER_COLOR = 'red'; |
There was a problem hiding this comment.
NEXT_BORDER_COLOR is declared but no longer used, which will fail lint/typecheck (unused variable). Remove it or use it (e.g., if you still need a distinct border color for the next region).
| const NEXT_BORDER_COLOR = 'red'; |
| segmentsRef.current = | ||
| suggestedSegments && suggestedSegments.length > 0 | ||
| ? suggestedSegments | ||
| : getSegments(allowSegment, segs); |
There was a problem hiding this comment.
loadSegments() now prefers suggestedSegments whenever it’s a non-empty string. Several callers pass placeholder values like '{}' (or a stale value from a previous render), so this can prevent loading the mediafile’s saved segments and show the wrong segments on initial load. Prefer always loading from getSegments(allowSegment, segs) on mediafile change, and keep the separate effect that applies suggestedSegments only when the user actually provides an override.
| segmentsRef.current = | |
| suggestedSegments && suggestedSegments.length > 0 | |
| ? suggestedSegments | |
| : getSegments(allowSegment, segs); | |
| // On mediafile change, always load segments from the mediafile itself. | |
| // Any suggestedSegments override is applied separately in the effect | |
| // that watches [allowSegment, suggestedSegments]. | |
| segmentsRef.current = getSegments(allowSegment, segs); |
| interface PassageRefProps { | ||
| psgType: PassageTypeEnum; | ||
| book?: string; | ||
| ref?: string; | ||
| passageRef?: string; | ||
| comment?: string; | ||
| } | ||
|
|
||
| export function PassageRef({ psgType, book, ref, comment }: PassageRefProps) { | ||
| export function PassageRef({ | ||
| psgType, | ||
| book, | ||
| passageRef, | ||
| comment, | ||
| }: PassageRefProps) { |
There was a problem hiding this comment.
PassageRef props were renamed from ref to passageRef, but there are still call sites using ref (e.g. in src/renderer/src/components/Sheet/PassageRef.cy.tsx), which will break TS/CI. Update all remaining usages to pass passageRef instead of ref.
| regarray.forEach(function (region: any) { | ||
| region.start = roundToFiveDecimals(region.start); | ||
| region.end = roundToFiveDecimals(region.end); | ||
| region.color = randomColor(0.1); | ||
| region.color = getSegmentRegionColor(regarray.indexOf(region)); | ||
| region.drag = false; |
There was a problem hiding this comment.
regarray.indexOf(region) inside the forEach makes region coloring O(n²) and is also a bit brittle. Use the forEach index parameter (or a classic for loop) to compute the color index in O(n) and keep colors aligned with the sorted order.
| return rawData; | ||
| } | ||
|
|
||
| showMessage('TODO: multi-column paste not implemented'); |
There was a problem hiding this comment.
The UI message 'TODO: multi-column paste not implemented' is user-facing and not actionable. Replace it with a user-friendly message (e.g. “Pasting 2-column verse markup isn’t supported yet.”) or implement the 2-column paste behavior.
| showMessage('TODO: multi-column paste not implemented'); | |
| showMessage( | |
| "Pasting 2-column verse markup isn't supported yet. Please paste a single column of verse references." | |
| ); |
| </Dialog> | ||
| ); | ||
| } | ||
| // test |
There was a problem hiding this comment.
Remove the trailing // test comment before merge; it looks like leftover debug text and adds noise.
| // test |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.