YPE-1434: Add a demo/example app of the React SDK that is more aligned with the Swift & Kotlin demo apps#189
Conversation
- Delete examples/nextjs (kitchen-sink style app) - Add examples/vite-react with Vite, Tailwind v4, and shadcn/ui - 3 pages: Bible Reader (JHN.1), Verse of the Day, Bible Card (JHN.3.16) - Responsive navbar with mobile hamburger menu (shadcn Sheet) - Dark mode toggle with system/light/dark support - Auth integrated into navbar (sign in/sign out + user info) - All components use Bible version 3034 BREAKING CHANGE: examples/nextjs has been removed Amp-Thread-ID: https://ampcode.com/threads/T-019cbee2-c92a-74a8-9150-5378fa196155 Co-authored-by: Amp <amp@ampcode.com>
Refactor the global CSS to correctly implement Tailwind v4's CSS layer strategy. This ensures SDK styles are properly cascaded and do not override consumer styles. Custom `@layer yv-sdk-*` directives are introduced, and standard Tailwind layers are imported before SDK layers to maintain the correct order of precedence. The `:where()` pseudo-class is used to scope Tailwind's reset CSS to `[data-yv-sdk]`, preventing it from affecting the host application.
Refactor the theme provider to correctly handle the 'system' theme. This includes listening for system theme changes and applying the correct class to the document element. Additionally, the `YouVersionProvider` now receives the theme directly from the `useTheme` hook.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `YouVersionProvider` import was moved after the `ThemeProvider` and `App` imports to ensure correct CSS loading order.
🦋 Changeset detectedLatest commit: 6d86548 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
Greptile SummaryThis PR replaces the old Next.js example app with a new Vite + React demo that more closely mirrors the Swift and Kotlin SDK demo apps. It bundles a CSS cascade isolation fix for Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant main.tsx
participant ThemeProvider
participant ThemedApp
participant YouVersionProvider
participant App
participant Navbar
participant Pages
Browser->>main.tsx: Load app
main.tsx->>ThemeProvider: Wrap (reads localStorage theme)
ThemeProvider->>ThemedApp: Provide theme context
ThemedApp->>ThemedApp: useTheme() → 'light' | 'dark' | 'system'
ThemedApp->>ThemedApp: Read env vars (VITE_YVP_APP_KEY, VITE_YVP_API_HOST, VITE_YVP_AUTH_REDIRECT_URL)
ThemedApp->>YouVersionProvider: theme, appKey, apiHost, authRedirectUrl, includeAuth
YouVersionProvider->>YouVersionProvider: Resolve 'system' → 'light'|'dark' via matchMedia
YouVersionProvider->>YouVersionProvider: Set data-yv-theme on root element
YouVersionProvider->>App: Render children
App->>Navbar: currentPage, onNavigate
Navbar->>Navbar: useYVAuth() → auth, userInfo, signOut
Navbar-->>Browser: Show auth state (SignIn button or username + Sign out)
App->>Pages: Render BibleReaderPage / VotdPage / BibleCardPage
Last reviewed commit: 810ebe6 |
…heme guard works Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ensure that the initial theme read from localStorage is a valid theme before setting it. This prevents unexpected behavior if localStorage contains an invalid theme value.
Include the `VITE_YVP_AUTH_REDIRECT_URL` environment variable in the Vite example to allow for proper authentication redirection. This also updates the default value to use `window.location.origin`.
|
Muh dawg, the great, the deterministic function known as an LLM, or better known as @greptile, please re-review this. I've made all the changes you've specified. |
Integrates the YouVersionProvider into the example application to demonstrate its usage with theme and environment variables. This change moves the provider logic to a new `ThemedApp.tsx` component and updates `main.tsx` to use it.
The `useTheme` hook now returns an object with a `theme` property, which needs to be destructured for correct usage.
Extract useTheme hook and ThemeProviderContext to separate files, stop exporting unused buttonVariants from button.tsx. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hey @greptile, the reptile, do you want 15% or more off your car insurance?? JK. Please re-re-review this and then if not 5/5, please tell me why |
|
3.5/5 You've addressed the previous review comments well, but there's a critical issue that will cause runtime errors: 🚨 Critical Issueexamples/vite-react/src/components/ui/sheet.tsx:3 - Broken Radix UI import The import pattern is fundamentally incorrect: import { Dialog as SheetPrimitive } from 'radix-ui';Then using it as: <SheetPrimitive.Root ...>
<SheetPrimitive.Trigger ...>This won't work. The problems:
Fix: And update package.json: "@radix-ui/react-dialog": "^1.1.2"Remove the ✅ What's Good
Why Not 5/5?This is a demo app meant to showcase the SDK. A broken Sheet component that throws runtime errors undermines that purpose. Fix the Radix import and you're golden! 🦎 |
|
@greptile, here's a response for your response: |
|
You're absolutely right—thanks for the clarification and the documentation links! I wasn't aware that Radix UI now recommends the unified No changes needed here. Appreciate you taking the time to explain! |
@greptile, can you update your confidence score then?? |
|
@greptile, please re-re-re-review this PR |
Replaced double quotes with single quotes for CSS imports. Updated CSS variables to use single quotes for consistency.
|
@greptile, please update your original review. You last said, "Safe to merge; only a minor missing newline issue in index.css.", but I've since fixed that |
|
@greptile, I've made all the changes you've asked. Please update your review |
The `.superset` directory and its configuration were not being used and have been removed from the project.
dsilva609
left a comment
There was a problem hiding this comment.
This looks awesome! Nice work 🎉
bmanquen
left a comment
There was a problem hiding this comment.
Just one comment/question on versioning.
| "@youversion/platform-core": minor | ||
| "@youversion/platform-react-hooks": minor | ||
| "@youversion/platform-react-ui": minor |
There was a problem hiding this comment.
This feels more like a patch because to me it feels more like a bug fix than a new feature.
Feel free to push back if I am wrong on this.
| {auth.isAuthenticated ? ( | ||
| <div className="flex items-center gap-2"> | ||
| <span className="text-sm text-muted-foreground hidden sm:block"> | ||
| {userInfo?.name || 'User'} |
There was a problem hiding this comment.
This is probably where you are getting "User" in the nav. It must be defaulting to "User" here.


https://lifechurch.atlassian.net/browse/YPE-1434
Warning
There's lots of lines of code changed. However, there's actually a lot less because the main code diff monster is the pnpm lock file.
If you want the best way to get an understanding of this PR, please watch this video:
Click Watch Video Overview