Skip to content

Commit da10cc4

Browse files
Add UI that enables user to gloss tokens and add render window for ContinuousView (#77)
- Add gloss input to TokenChip (word tokens only): bordered chip now stacks surface text above an editable gloss field - Thread `glosses` (Record<string, string>) and `onGlossChange(tokenId, value)` props down through TokenChip → PhraseBox → SegmentView → ContinuousView - Introduce a phrase-window around the focused index in ContinuousView to cap rendered PhraseBoxes and reduce overhead on large books - Replace SegmentView's `onClick` with `onSelect(ref, tokenId?)` so the clicked token id propagates up to Interlinearizer - Add `activePhraseIndex` prop to ContinuousView for external phrase jumps when a segment-view token is clicked in continuous-scroll mode - Update tests to cover gloss propagation, `activePhraseIndex` jumps, and both phrase-window boundary branches
1 parent 328dd75 commit da10cc4

30 files changed

Lines changed: 2796 additions & 501 deletions

__mocks__/lucide-react.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,32 @@
55
import type { ReactElement } from 'react';
66

77
/**
8-
* Stub for the Trash2 icon; renders a bare SVG element so tests can locate the icon by test ID.
8+
* Stub for the LocateFixed icon; renders a bare SVG element so tests can locate the icon by test
9+
* ID.
910
*
10-
* @param props - SVG props forwarded from the component, including optional className and size.
11-
* @returns A ReactElement SVG element used as a trash icon stub in tests.
11+
* @param props - SVG props forwarded from the component, including optional className.
12+
* @returns A ReactElement SVG element used as a locate-fixed icon stub in tests.
1213
*/
13-
export function Trash2(props: Readonly<{ className?: string; size?: number }>): ReactElement {
14-
return <svg data-testid="trash-icon" {...props} />;
14+
export function LocateFixed(props: Readonly<{ className?: string }>): ReactElement {
15+
return <svg data-testid="locate-fixed-icon" {...props} />;
1516
}
1617

1718
/**
18-
* Stub for the Info icon; renders a bare SVG element so tests can locate the icon by test ID.
19+
* Stub for the Info icon.
1920
*
20-
* @param props - SVG props forwarded from the component, including optional className and size.
21+
* @param props - SVG props forwarded from the component.
2122
* @returns A ReactElement SVG element used as an info icon stub in tests.
2223
*/
23-
export function Info(props: Readonly<{ className?: string; size?: number }>): ReactElement {
24+
export function Info(props: Readonly<{ size?: number; className?: string }>): ReactElement {
2425
return <svg data-testid="info-icon" {...props} />;
2526
}
27+
28+
/**
29+
* Stub for the Trash2 icon.
30+
*
31+
* @param props - SVG props forwarded from the component.
32+
* @returns A ReactElement SVG element used as a trash icon stub in tests.
33+
*/
34+
export function Trash2(props: Readonly<{ size?: number; className?: string }>): ReactElement {
35+
return <svg data-testid="trash2-icon" {...props} />;
36+
}

jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const config: Config = {
3838
'!src/**/*.spec.{ts,tsx}',
3939
'!src/types/**',
4040
'!src/utils/interlinear-project-summary.ts',
41+
'!src/components/component-types.ts',
4142
],
4243

4344
/** Directory for coverage output. */

0 commit comments

Comments
 (0)