fix: unify theme system - fix theme switching persistence
- Unified localStorage key to 'theme-preference' across all components
- Fixed header.tsx using wrong localStorage key ('theme' instead of 'theme-preference')
- Added localStorage hybrid persistence for instant theme changes
- Removed router.refresh() which was causing stale data revert
- Replaced Blue theme with Sepia
- Consolidated auth() calls to prevent race conditions
- Updated UserSettingsData types to include all themes
This commit is contained in:
@@ -125,7 +125,7 @@ export function ProfileForm({ user, userAISettings }: { user: any; userAISetting
|
||||
const handleShowRecentNotesChange = async (enabled: boolean) => {
|
||||
setIsUpdatingRecentNotes(true)
|
||||
const previousValue = showRecentNotes
|
||||
|
||||
|
||||
try {
|
||||
const result = await updateShowRecentNotes(enabled)
|
||||
if (result?.error) {
|
||||
@@ -209,56 +209,7 @@ export function ProfileForm({ user, userAISettings }: { user: any; userAISetting
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t('profile.displaySettings')}</CardTitle>
|
||||
<CardDescription>{t('profile.displaySettingsDescription')}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="fontSize">{t('profile.fontSize')}</Label>
|
||||
<Select
|
||||
value={fontSize}
|
||||
onValueChange={handleFontSizeChange}
|
||||
disabled={isUpdatingFontSize}
|
||||
>
|
||||
<SelectTrigger id="fontSize">
|
||||
<SelectValue placeholder={t('profile.selectFontSize')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{FONT_SIZES.map((size) => (
|
||||
<SelectItem key={size.value} value={size.value}>
|
||||
<span className="flex items-center gap-2">
|
||||
<span>{size.label}</span>
|
||||
<span className="text-xs text-muted-foreground">({size.size})</span>
|
||||
</span>
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('profile.fontSizeDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between pt-4 border-t">
|
||||
<div className="space-y-0.5">
|
||||
<Label htmlFor="showRecentNotes" className="text-base font-medium">
|
||||
{t('profile.showRecentNotes') || 'Afficher la section Récent'}
|
||||
</Label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('profile.showRecentNotesDescription') || 'Afficher les notes récentes (7 derniers jours) sur la page principale'}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
id="showRecentNotes"
|
||||
checked={showRecentNotes}
|
||||
onCheckedChange={handleShowRecentNotesChange}
|
||||
disabled={isUpdatingRecentNotes}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
|
||||
Reference in New Issue
Block a user