Files
biblical-guide.com/types/index.ts
Andrei 0e2167ade7 feat: add TypeScript types for highlights and sync system
Added highlight system types with strict color and sync status validation:
- HighlightColor type with 4 valid colors (yellow, orange, pink, blue)
- SyncStatus type for tracking sync state (pending, syncing, synced, error)
- BibleHighlight interface with full metadata support
- HighlightSyncQueueItem for offline sync queue management
- CrossReference interface for verse cross-referencing

Includes comprehensive test coverage validating type constraints.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 06:55:10 +00:00

127 lines
2.5 KiB
TypeScript

export interface User {
id: string
email: string
name: string | null
role: string
theme: string
fontSize: string
createdAt: Date
updatedAt: Date
lastLoginAt: Date | null
}
export interface BibleVerse {
id: string
chapterId: string
verseNum: number
text: string
version: string
chapter: {
chapterNum: number
book: {
name: string
}
}
}
export interface ChatMessage {
id: string
userId: string
role: 'user' | 'assistant'
content: string
metadata?: any
createdAt: Date
}
export interface Bookmark {
id: string
userId: string
verseId: string
note: string | null
color: string
createdAt: Date
verse: BibleVerse
}
export interface PrayerRequest {
id: string
userId: string | null
content: string
isAnonymous: boolean
isPublic: boolean
language: string
prayerCount: number
createdAt: Date
updatedAt: Date
}
// Bible Reader 2025 Types
export interface BibleChapter {
id: string
bookId: number
bookName: string
chapter: number
verses: BibleVerse[]
timestamp?: number
}
export interface ReadingPreference {
fontFamily: string // 'georgia', 'inter', 'atkinson', etc.
fontSize: number // 12-32
lineHeight: number // 1.4-2.2
letterSpacing: number // 0-0.15
textAlign: 'left' | 'center' | 'justify'
backgroundColor: string // color code
textColor: string // color code
margin: 'narrow' | 'normal' | 'wide'
preset: 'default' | 'dyslexia' | 'highContrast' | 'minimal' | 'custom'
}
export interface UserAnnotation {
id: string
verseId: string
chapterId: string
type: 'bookmark' | 'highlight' | 'note' | 'crossRef'
content?: string
color?: string // for highlights
timestamp: number
synced: boolean
}
export interface CacheEntry {
chapterId: string
data: BibleChapter
timestamp: number
expiresAt: number
}
// Highlight system types
export type HighlightColor = 'yellow' | 'orange' | 'pink' | 'blue'
export type SyncStatus = 'pending' | 'syncing' | 'synced' | 'error'
export interface BibleHighlight {
id: string // UUID
verseId: string
userId?: string // Optional, added by backend
color: HighlightColor
createdAt: number // timestamp
updatedAt: number // timestamp
syncStatus: SyncStatus
syncErrorMsg?: string
}
export interface HighlightSyncQueueItem {
highlightId: string
action: 'create' | 'update' | 'delete'
highlight: BibleHighlight
retryCount: number
}
export interface CrossReference {
refVerseId: string
bookName: string
chapter: number
verse: number
preview: string
}