Skip to content

Add the read-only analysis catalog panel - #234

Open
alex-rawlings-yyc wants to merge 17 commits into
mainfrom
analysis-catalog-panel
Open

Add the read-only analysis catalog panel#234
alex-rawlings-yyc wants to merge 17 commits into
mainfrom
analysis-catalog-panel

Conversation

@alex-rawlings-yyc

@alex-rawlings-yyc alex-rawlings-yyc commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Hoists the analysis store above the cross-book fade curtain so a jump to a
usage in another book cannot dim the panel. Search, sort, filter, and row
windowing are deferred to #231.


This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Added an Analysis Catalog accessible from the Interlinearizer View menu.
    • Browse usage-sorted analysis entries, expand morphemes and usages, and navigate to locations across books.
    • Resize the catalog with mouse or keyboard controls; width and view state are preserved.
    • Added localized labels, controls, empty states, and accessibility support.
  • Bug Fixes

    • Improved language handling with reliable locale fallbacks.
    • Preserved catalog and WebView state during loading and book changes.

@alex-rawlings-yyc alex-rawlings-yyc self-assigned this Aug 14, 2026
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eb0f7b30-310a-4622-b306-7eb4b9b9eab4

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a80cc977-fcd6-4b6b-82d4-bd017c1318bd

📥 Commits

Reviewing files that changed from the base of the PR and between 50f622e and cb6c39d.

📒 Files selected for processing (11)
  • REVIEW.md
  • src/__tests__/components/AnalysisCatalogPanel.test.tsx
  • src/__tests__/components/InterlinearizerLoader.test.tsx
  • src/__tests__/main.test.ts
  • src/__tests__/test-helpers.ts
  • src/components/AnalysisStore.tsx
  • src/components/CatalogRowView.tsx
  • src/components/InterlinearizerLoader.tsx
  • src/hooks/usePanelResize.ts
  • src/main.ts
  • src/types/interlinearizer.d.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/tests/main.test.ts
  • src/main.ts
  • src/types/interlinearizer.d.ts
  • REVIEW.md
  • src/tests/test-helpers.ts
  • src/components/AnalysisStore.tsx
  • src/tests/components/InterlinearizerLoader.test.tsx
  • src/components/InterlinearizerLoader.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Interlinearizer adds a localized, resizable Analysis Catalog with usage navigation, persisted panel state, command wiring, writing-system support, and expanded test coverage.

Changes

Analysis Catalog feature

Layer / File(s) Summary
Command and menu integration
contributions/menus.json, contributions/localizedStrings.json, src/main.ts, src/types/interlinearizer.d.ts, __mocks__/platform-bible-react.tsx, __mocks__/lucide-react.tsx, src/__tests__/main.test.ts
Adds the interlinearizer.openAnalysisCatalog command, View menu entry, localized strings, activation registration, icon mocks, and test support.
Catalog data and loader wiring
src/components/AnalysisStore.tsx, src/hooks/useInterlinearizerBookData.ts, src/components/InterlinearizerLoader.tsx
Exposes book-specific catalog rows and writing-system data. The loader manages provider placement, open state, panel width, fade behavior, and catalog rendering.
Catalog panel and row behavior
src/components/AnalysisCatalogPanel.tsx, src/components/CatalogRowView.tsx, src/hooks/usePanelResize.ts, src/utils/language-tags.ts, REVIEW.md
Adds localized catalog rendering, sorting, expandable row details, usage navigation, bounded resizing, locale collation, and tooltip guidance.
Catalog integration and behavior tests
src/__tests__/components/AnalysisCatalogPanel.test.tsx, src/__tests__/components/InterlinearizerLoader.test.tsx, src/__tests__/hooks/useInterlinearizerBookData.test.ts, src/__tests__/test-helpers.ts, src/__tests__/utils/language-tags.test.ts
Adds coverage for catalog behavior, navigation, resizing, persistence, writing-system fallback, reactive WebView state, and locale collation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🔵 Low · up to cb6c3

The panel behavior is localized, but resizing retains bounded RTL-direction and duplicate-write risks that warrant explicit owner awareness or follow-up before merge; no high-impact correctness or availability risk is indicated.

Sequence Diagram(s)

sequenceDiagram
  participant Menu
  participant InterlinearizerLoader
  participant AnalysisStore
  participant AnalysisCatalogPanel
  participant CatalogRowView
  Menu->>InterlinearizerLoader: openAnalysisCatalog
  InterlinearizerLoader->>AnalysisStore: provide book catalog state
  AnalysisCatalogPanel->>AnalysisStore: select catalog rows
  AnalysisStore-->>AnalysisCatalogPanel: return catalog rows
  AnalysisCatalogPanel->>CatalogRowView: render rows
  CatalogRowView->>InterlinearizerLoader: navigate to selected usage
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a read-only analysis catalog panel.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch analysis-catalog-panel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

imnasnainaec

This comment was marked as resolved.

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alex-rawlings-yyc made 10 comments.
Reviewable status: 0 of 20 files reviewed, 10 unresolved discussions (waiting on imnasnainaec).

Comment thread src/components/AnalysisStore.tsx Outdated
Comment thread src/components/AnalysisStore.tsx Outdated
Comment thread src/components/CatalogRowView.tsx Outdated
Comment thread src/components/CatalogRowView.tsx Outdated
Comment thread src/components/CatalogRowView.tsx
Comment thread src/components/InterlinearizerLoader.tsx Outdated
Comment thread src/hooks/usePanelResize.ts
Comment thread src/hooks/usePanelResize.ts Outdated
Comment thread src/hooks/usePanelResize.ts Outdated
Comment thread src/hooks/usePanelResize.ts Outdated
imnasnainaec

This comment was marked as resolved.

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alex-rawlings-yyc made 5 comments.
Reviewable status: 0 of 21 files reviewed, 15 unresolved discussions (waiting on imnasnainaec).

Comment thread src/components/CatalogRowView.tsx Outdated
Comment thread src/hooks/usePanelResize.ts Outdated
Comment thread src/hooks/usePanelResize.ts Outdated
Comment thread src/hooks/usePanelResize.ts
Comment thread src/hooks/usePanelResize.ts Outdated
@alex-rawlings-yyc
alex-rawlings-yyc force-pushed the analysis-catalog-panel branch 5 times, most recently from 81fcaab to 1f9d83d Compare August 20, 2026 18:51
@imnasnainaec

This comment was marked as resolved.

@alex-rawlings-yyc
alex-rawlings-yyc force-pushed the analysis-catalog-panel branch 2 times, most recently from 71e3428 to 3d122bb Compare August 20, 2026 23:13
imnasnainaec

This comment was marked as resolved.

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alex-rawlings-yyc made 1 comment.
Reviewable status: 0 of 21 files reviewed, 16 unresolved discussions (waiting on imnasnainaec).

Comment thread src/components/CatalogRowView.tsx Outdated
Hoists the analysis store above the cross-book fade curtain so a jump to
a
usage in another book cannot dim the panel. Search, sort, filter, and
row
windowing are deferred to #231.
Also commits a released drag width from a ref rather than from inside
the
setDragWidth updater, which React may run more than once.
An unparseable analysis-language tag threw out of Intl.Collator and
blanked
the whole view; the resize handle inverted in right-to-left interfaces;
and
the row toggle's aria-label suppressed the analysis it named. Rows now
share
one localization subscription instead of one apiece.
A pointer released where the window cannot see it — over a native menu,
which takes the pointer with it — left the drag running, so the panel
went
on resizing under a button-less pointer and committed that width at the
next click anywhere. A move reporting no button held now ends the drag
at
the width it had reached, since that move is the only word the window
gets
of such a release.

Arrow keys stand aside while a drag is in flight. They stepped off the
width the drag began at, reporting a width the panel was not showing
only
for the release to overwrite it; the pointer owns the width while it is
held.

The drag test helper now dispatches its moves with a held button, which
a
real one carries and jsdom does not.
The held-focus-request test left the reference on GEN while EXO's view
mounted, a state the host never produces; move it to EXO with the jump.
The simulated drag omitted `buttons`, so the move arrived reporting none
— which the resize hook reads as a release it never saw, ending the drag
before it recorded a width. The panel fell back to its default, and the
remount assertion compared that default against itself. Dropping width
persistence outright left the test green.

Carry `buttons` on the move so the drag resizes, and name the expected
width at both ends rather than checking the two renders agree, since the
default is what a dead drag and a dropped write alike leave behind.
Any button began a drag: the move handler asks only whether some button
is held, so a middle-button press followed the pointer to its release
and persisted the width it reached. A right-button press does the same
wherever the context menu opens on release rather than on press.

Also correct the loader's width-restore comment, which described a move
reporting no buttons held while the move beneath it carries one.
The splitter gains Home/End and commits a drag the panel is unmounted
holding; rows memoize and return to the inline usage cap when collapsed.
A drag seeded from a committed width outside the bounds drew the panel
past
its announced maximum on the press alone. The jump and arrow keys now
skip
writing a width the panel already holds.
Only writes notified subscribers, so a component reading a key another
component reset never re-rendered — a future test would have failed for
a reason the production code has nothing to do with. A reset also now
lands on the resetting caller's default rather than restoring the seed,
matching what the real hook leaves behind.
The widest width gives way to a container too narrow to hold the panel
and the text both, an arrow key steps from the width the panel is drawn
at rather than the committed one behind it, and a drag that ends where
it began commits nothing.
Also skip resizing on modified arrow and jump keys, re-clamp the drag
origin when the container shrinks mid-gesture, and resolve the rows'
shared book label once for the list.
The ignore claimed no test could interleave a move into the window
between the origin clearing and the listener's removal, which a move
dispatched in the same act() as the drag's end disproves.
A drag only ever reaches a clamped width, so comparing what it reached
against the raw committed width never matched when the bounds disallowed
that width. A panel that went away mid-gesture then committed the
container's clamp, overwriting a wider remembered width that a release
in
the same gesture would have kept.

Compare against the clamped width instead, as the release path does. The
comparison reads the bounds through a ref: listing clampWidth as a
dependency would tear the effect down on every bounds change and commit
part-way through a gesture.

Cover the focus request the navigation provider abandons once the reader
moves past the book it names. The existing probe claims from inside the
provider, where child effects run first, so no test reached that path;
routing through a third book leaves the request unclaimed long enough
for
it to run.

@imnasnainaec imnasnainaec left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@imnasnainaec reviewed 12 files and all commit messages, and resolved 16 discussions.
Reviewable status: 12 of 21 files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).

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.

Analysis catalog: read-only panel, command, and jump-to-usage navigation

2 participants