feat: add user settings save and reading plans with progress tracking

User Settings:
- Add /api/user/settings endpoint for persisting theme and fontSize preferences
- Update settings page with working save functionality
- Add validation and localized error messages

Reading Plans:
- Add database schema with ReadingPlan, UserReadingPlan, and UserReadingProgress models
- Create CRUD API endpoints for reading plans and progress tracking
- Build UI for browsing available plans and managing user enrollments
- Implement progress tracking with daily reading schedule
- Add streak calculation and statistics display
- Create seed data with 5 predefined plans (Bible in 1 year, 90 days, NT 30 days, Psalms 30, Gospels 30)
- Add navigation link with internationalization support

Technical:
- Update to MUI v7 Grid API (using size prop instead of xs/sm/md and removing item prop)
- Fix Next.js 15 dynamic route params (await params pattern)
- Add translations for readingPlans in all languages (en, ro, es, it)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-12 23:07:47 +00:00
parent 9d82e719ed
commit 63082c825a
15 changed files with 2065 additions and 3 deletions

View File

@@ -126,11 +126,37 @@ export default function SettingsPage() {
}
const handleSave = async () => {
const token = localStorage.getItem('authToken')
if (!token) {
setMessage(t('settingsError'))
return
}
try {
// TODO: Implement settings update API
await new Promise(resolve => setTimeout(resolve, 1000)) // Placeholder
setMessage(t('settingsSaved'))
const response = await fetch(`/api/user/settings?locale=${locale}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
theme: settings.theme,
fontSize: settings.fontSize,
notifications: settings.notifications,
emailUpdates: settings.emailUpdates,
language: settings.language
})
})
const data = await response.json()
if (response.ok && data.success) {
setMessage(t('settingsSaved'))
} else {
setMessage(data.error || t('settingsError'))
}
} catch (error) {
console.error('Error saving settings:', error)
setMessage(t('settingsError'))
}
}