feat: add user favorite Bible version preference system

- Add favoriteBibleVersion field to User schema in Prisma
- Create API endpoint (/api/user/favorite-version) to get/set favorite version
  - GET: retrieve user's favorite Bible version
  - POST: save/update user's favorite Bible version

- Enhance Bible reader functionality
  - Automatically load user's favorite version on mount (logged-in users)
  - Add star button () next to version selector to set current version as default
  - Display success message when favorite version is saved
  - Fall back to default version if no favorite is set

- Add Bible Preferences section to Settings page
  - Display user's current favorite Bible version in dropdown
  - Allow users to view and change favorite version
  - Load all Bible versions (removed 200 limit) to ensure favorite is found
  - Show confirmation message when version is selected
  - Add loading state while fetching versions

- Fix renderValue in Select component to properly display version names
- Add comprehensive debug logging for troubleshooting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-30 09:50:01 +00:00
parent fee36dfdad
commit 2ae2f029ec
4 changed files with 326 additions and 28 deletions

View File

@@ -8,16 +8,17 @@ datasource db {
}
model User {
id String @id @default(uuid())
email String @unique
passwordHash String
name String?
role String @default("user") // "user", "admin", "moderator"
theme String @default("light")
fontSize String @default("medium")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
lastLoginAt DateTime?
id String @id @default(uuid())
email String @unique
passwordHash String
name String?
role String @default("user") // "user", "admin", "moderator"
theme String @default("light")
fontSize String @default("medium")
favoriteBibleVersion String? // User's preferred Bible version ID
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
lastLoginAt DateTime?
sessions Session[]
bookmarks Bookmark[]