Skip to content

feat(ui): add onFootnotePress callback to BibleCard#244

Merged
Dustin-Kelley merged 3 commits into
mainfrom
feat/bible-card-on-footnote-press
May 22, 2026
Merged

feat(ui): add onFootnotePress callback to BibleCard#244
Dustin-Kelley merged 3 commits into
mainfrom
feat/bible-card-on-footnote-press

Conversation

@Dustin-Kelley
Copy link
Copy Markdown
Collaborator

@Dustin-Kelley Dustin-Kelley commented May 21, 2026

Summary

  • Add optional onFootnotePress to BibleCardProps and forward it to the internal BibleTextView
  • Add unit test that clicks a footnote marker and asserts callback payload
  • Changeset for patch release of @youversion/platform-react-ui

Test plan

  • pnpm test bible-card.test.tsx in packages/ui
  • Consumer: platform-sdk-reactnative-expo links built package and verifies footnote sheet on dev client

Made with Cursor

Greptile Summary

This PR adds an optional onFootnotePress callback to BibleCard, mirroring the existing pattern from BibleReader, and threads it through to the internal BibleTextView. When provided, the callback replaces the built-in popover with a consumer-controlled handler receiving FootnoteData (verseNum, notes, verseHtml, reference).

  • bible-card.tsx: Adds onFootnotePress?: (data: FootnoteData) => void to BibleCardProps, destructures it in BibleCard, and forwards it to BibleTextView.
  • bible-card.test.tsx: New describe block renders a passage with a raw footnote span, waits for the footnote button, clicks it, and asserts the full FootnoteData payload including verseNum, reference, and the notes array content.
  • .changeset/bible-card-footnote-press.md: Changeset correctly marked as minor for the new optional public API addition.

Confidence Score: 5/5

Safe to merge — the change is additive and opt-in, with no modifications to existing behavior.

The new prop is optional and strictly additive: existing consumers who do not pass onFootnotePress continue to get the built-in Popover unchanged. The prop is already exported via FootnoteData in the package's public index, the test exercises the full click-to-callback path with payload assertions, and the changeset is correctly labeled minor.

No files require special attention.

Important Files Changed

Filename Overview
packages/ui/src/components/bible-card.tsx Adds optional onFootnotePress prop to BibleCardProps and forwards it to BibleTextView; change is minimal and follows the existing BibleReader pattern exactly.
packages/ui/src/components/bible-card.test.tsx New test suite correctly uses waitFor + userEvent to verify the footnote button click calls onFootnotePress with the full FootnoteData payload including notes content.
.changeset/bible-card-footnote-press.md Changeset correctly uses minor bump for the new optional public API prop.

Sequence Diagram

sequenceDiagram
    participant Consumer
    participant BibleCard
    participant BibleTextView
    participant VerseHtml as Verse.Html
    participant BibleTextHtml
    participant VerseFootnoteButton

    Consumer->>BibleCard: render with onFootnotePress
    BibleCard->>BibleTextView: passageState + onFootnotePress
    BibleTextView->>VerseHtml: html + onFootnotePress
    VerseHtml->>BibleTextHtml: transformedHtml + onFootnotePress
    BibleTextHtml->>BibleTextHtml: useLayoutEffect extracts footnote anchors
    BibleTextHtml->>VerseFootnoteButton: portal per anchor with onFootnotePress
    Note over VerseFootnoteButton: onFootnotePress present → plain button (no Popover)
    Consumer->>VerseFootnoteButton: click footnote button
    VerseFootnoteButton->>Consumer: "onFootnotePress({ verseNum, notes, verseHtml, reference })"
Loading

Reviews (3): Last reviewed commit: "fix(ui): address greptile review feedbac..." | Re-trigger Greptile

Expose optional onFootnotePress on BibleCardProps and pass through to
BibleTextView so hosts can handle footnotes externally (e.g. RN sheet).

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: 63ec262

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-react-ui Minor
vite-react Patch
@youversion/platform-core Minor
@youversion/platform-react-hooks Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread .changeset/bible-card-footnote-press.md
Comment thread packages/ui/src/components/bible-card.test.tsx
Dustin-Kelley and others added 2 commits May 21, 2026 13:38
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: Dustin Kelley <141975656+Dustin-Kelley@users.noreply.github.com>
Bump changeset to minor for new public API prop and assert notes
payload in BibleCard onFootnotePress test.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Collaborator

@cameronapak cameronapak left a comment

Choose a reason for hiding this comment

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

LGTM

@Dustin-Kelley Dustin-Kelley merged commit 3758009 into main May 22, 2026
6 checks passed
@Dustin-Kelley Dustin-Kelley deleted the feat/bible-card-on-footnote-press branch May 22, 2026 15:09
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.

2 participants