Skip to content

feat(notes): badge Save with the note count on the selected verses - #303

Draft
Dustin-Kelley wants to merge 1 commit into
dk/note-edit-deletefrom
claude/bold-hopper-699i8h
Draft

Dustin-Kelley wants to merge 1 commit into
dk/note-edit-deletefrom
claude/bold-hopper-699i8h

Conversation

@Dustin-Kelley

Copy link
Copy Markdown
Collaborator

Stacked on #301 (dk/note-edit-delete). Merge that first; this PR's diff is only the badge.

What

When you tap a verse, the action sheet's Save tile now shows a small round badge on its bookmark icon with the number of notes already saved on that selection.

Spec

  • What counts. Saved notes covering any selected verse, each note counted once. A range note across verses 1–3 counts once whether you select 1, 2, or all three. Same rules as the note markers: same version, ranges, gapped passages, and notes that run across chapters.
  • When it shows. Only when the count is above zero. Signed out, or without read_notes, there are no notes loaded, so no badge.
  • Display. A 1–2 digit count, then 99+. A circle at one digit, widening to a pill. It hangs off the icon's top-trailing corner, so the tile does not change size.
  • Look. The solid-button pair: foreground fill with the surface color for the number (dark badge in light mode, light badge in dark mode), plus a 2pt ring in the tile color so it reads apart from the icon. Ignores Dynamic Type so it cannot outgrow the tile.
  • Live updates. A deleted note leaves the count at once (same optimistic set the Previously Saved list uses). New and edited notes show after the reload the reader already does.
  • Accessibility. Save's label becomes "Save, 3 notes". The badge itself is hidden from screen readers so the count is not read twice.

How

  • lib/note-passages.ts: new pure helper countNotesOnVerses(notes, scope, verses, excludeIds).
  • BibleReader counts the current selection against the chapter notes it already loads. No new fetch.
  • BibleVerseActionSheet gets an optional saveNoteCount prop and renders the badge.

Open questions

  • Color. I went monochrome to match the sheet. The other option is the note-marker blue (noteIndicator), which links the badge to the markers in the text but has weaker contrast for white numerals (about 3:1).
  • Localization. "1 note" / "N notes" in the accessibility label is inline English with a TODO, the same as "Edit" in feat(notes): edit and delete saved notes in the Reader (YPE-6790) #301, until platform-localization adds a plural key.
  • Tapping Save with notes. The composer opened from Save still shows no Previously Saved list. Only a marker tap shows it. Should Save on a single verse that has notes also show them? That would be a follow-up.

Testing

  • Unit: countNotesOnVerses with one verse, overlapping selections (counted once), excluded IDs, other version or chapter, and an empty selection.
  • Sheet: no badge at 0 or with no prop; 1, 12, 99, and 99+; label text; badge hidden from screen readers; only Save is badged.
  • Reader: selecting verses 1, 2, and 4 with three overlapping notes shows 3; a note outside the selection shows no badge.
  • pnpm lint, pnpm typecheck, and pnpm test pass (core 882, ui 1465).
  • Not checked: on a simulator or device. Badge placement and ring need a visual check on iOS and Android, light and dark.

Generated by Claude Code

The verse action sheet's Save tile carries a round badge with the number
of saved notes on the selection. A note across several selected verses
counts once, deleted notes drop out at once, and counts past 99 read 99+.
Save's accessibility label speaks the count; the badge stays silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H78afR7NqjJQVotevDP43N
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