Files
biblical-guide.com/scripts/reset-web-version.ts
andupetcu 686f498300 Create comprehensive bookmarks management page
Add complete bookmarks page with navigation functionality:

Features:
- Dedicated /bookmarks page for viewing all saved bookmarks
- Support for both chapter and verse bookmarks in unified view
- Statistics dashboard showing total, chapter, and verse bookmark counts
- Tabbed filtering (All, Chapters, Verses) for easy organization
- Direct navigation to Bible reading page with URL parameters
- Delete functionality for individual bookmarks
- Empty state with call-to-action to start reading

Navigation Integration:
- Add Bookmarks to main navigation menu (authenticated users only)
- Add Bookmarks to user profile dropdown menu
- Dynamic navigation based on authentication state

Bible Page Enhancements:
- URL parameter support for bookmark navigation (book, chapter, verse)
- Verse highlighting when navigating from bookmarks
- Auto-clear highlight after 3 seconds for better UX

API Endpoints:
- /api/bookmarks/all - Unified endpoint for all user bookmarks
- Returns transformed data optimized for frontend consumption

Multilingual Support:
- Full Romanian and English translations
- Consistent messaging across all bookmark interfaces

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 01:29:46 +03:00

41 lines
1.5 KiB
TypeScript

import { PrismaClient } from '@prisma/client'
import path from 'path'
import fs from 'fs'
const prisma = new PrismaClient()
async function main() {
try {
const abbr = (process.env.EN_ABBR || 'WEB').toUpperCase()
const lang = 'en'
const dir = process.env.INPUT_DIR || path.join('data', 'en_bible', abbr)
if (!fs.existsSync(path.join(dir, 'old_testament.json')) || !fs.existsSync(path.join(dir, 'new_testament.json'))) {
console.error('Missing OT/NT JSON in', dir)
process.exit(1)
}
// Ensure version exists
let version = await prisma.bibleVersion.findUnique({ where: { abbreviation_language: { abbreviation: abbr, language: lang } } })
if (!version) {
version = await prisma.bibleVersion.create({ data: { name: abbr, abbreviation: abbr, language: lang, description: `English Bible (${abbr})`, isDefault: true } })
console.log('Created version', version.id)
} else {
// Make this the default and disable others
await prisma.bibleVersion.updateMany({ where: { language: lang }, data: { isDefault: false } })
await prisma.bibleVersion.update({ where: { id: version.id }, data: { isDefault: true } })
}
// Wipe current WEB content for a clean import
const delVerses = await prisma.bibleVerse.deleteMany({ where: { chapter: { book: { versionId: version.id } } } })
console.log('Deleted verses for', abbr, ':', delVerses.count)
} catch (e) {
console.error('Reset failed:', e)
process.exit(1)
} finally {
await prisma.$disconnect()
}
}
main()