YPE-1204: Fix verse error states + display reference#165
YPE-1204: Fix verse error states + display reference#165jaredhightower-youversion wants to merge 2 commits intomainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Greptile SummaryImproved user experience by ensuring Bible references are always visible and error states are clear and accessible. Core changes:
UI improvements:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[BibleCard Component] --> B{passage?.reference available?}
B -->|Yes| C[Display server reference]
B -->|No| D{reference prop exists?}
D -->|Yes| E[formatUsfmForDisplay reference]
D -->|No| F[Display nothing]
E --> G[Show formatted USFM]
C --> H[Render header with reference]
G --> H
I[BibleTextView Component] --> J{API State?}
J -->|Loading| K[Show Loading...]
J -->|Error| L[VerseUnavailableMessage]
J -->|Success| M[Render Bible HTML]
L --> N[ExclamationCircle Icon + Error Text]
O[formatUsfmForDisplay] --> P[Split USFM by dots]
P --> Q{Has chapter & verse?}
Q -->|Yes| R[Format: BOOK C:V]
Q -->|No| S{Has chapter only?}
S -->|Yes| T[Format: BOOK C]
S -->|No| U[Format: BOOK]
Last reviewed commit: 980d393 |
Summary
Problem
When using
passage?.referencedirectly inBibleCard, the reference header showed nothing while the API was loading or if the request failed. Users saw a blank space where the reference (e.g. "JOHN 3:16 NIV") should be.The error state in
BibleTextViewalso displayed a generic"We have run into an error..."message styled as Bible text, which was confusing and didn't match design specs.Solution
Core (
@youversion/platform-core)formatUsfmForDisplayutility that converts raw USFM strings (e.g."JHN.3.16") into human-readable references (e.g."JOHN 3:16")UsfmBookCodeandUsfmReferencetypes for type-safe USFM handling with IDE autocompleteUI (
@youversion/platform-react-ui)BibleCard: UsesdisplayReferencefallback pattern — shows server reference when available, falls back to client-formatted USFM during loading/error so the header is always visibleBibleTextView: Replaced generic error string with a dedicatedVerseUnavailableMessagecomponent featuring anExclamationCircleicon matching the Figma designExclamationCircleicon componentHow it works