Skip to content

Stephen#238

Open
siyche wants to merge 26 commits intosillsdev:developfrom
markjpratt31:Stephen
Open

Stephen#238
siyche wants to merge 26 commits intosillsdev:developfrom
markjpratt31:Stephen

Conversation

@siyche
Copy link
Copy Markdown

@siyche siyche commented Mar 27, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PassageRef prop from ref to passageRef.

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';
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
const NEXT_BORDER_COLOR = 'red';

Copilot uses AI. Check for mistakes.
Comment on lines +58 to +61
segmentsRef.current =
suggestedSegments && suggestedSegments.length > 0
? suggestedSegments
: getSegments(allowSegment, segs);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Comment on lines 9 to +21
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) {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 806 to 810
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;
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
return rawData;
}

showMessage('TODO: multi-column paste not implemented');
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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."
);

Copilot uses AI. Check for mistakes.
</Dialog>
);
}
// test
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing // test comment before merge; it looks like leftover debug text and adds noise.

Suggested change
// test

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants