feat: integrate ToastProvider and enhance theme management

- Added `ToastProvider` to `RootLayout` for improved user feedback on theme changes.
- Updated `ThemeProvider` to display toast notifications with theme names and icons upon theme changes.
- Refactored theme-related imports to streamline code and improve maintainability.
- Simplified background cycling logic in `useBackgroundCycle` to utilize centralized background definitions.
- Cleaned up unused background definitions in `BackgroundContext` for better clarity and performance.
This commit is contained in:
Julien Froidefond
2025-10-02 17:24:37 +02:00
parent 99377ee38d
commit 10c1f811ce
10 changed files with 405 additions and 189 deletions

View File

@@ -4,83 +4,7 @@ import { useState, useEffect } from 'react';
import { Button } from '@/components/ui/Button';
import { Card, CardContent } from '@/components/ui/Card';
import { useUserPreferences } from '@/contexts/UserPreferencesContext';
// Images de fond prédéfinies basées sur le thème actuel
const PRESET_BACKGROUNDS = [
{
id: 'none',
name: 'Aucune',
description: 'Fond uni par défaut',
preview: 'linear-gradient(135deg, var(--background) 0%, var(--card) 100%)'
},
{
id: 'theme-subtle',
name: 'Dégradé subtil',
description: 'Dégradé doux avec les couleurs du thème',
preview: 'linear-gradient(135deg, var(--background) 0%, color-mix(in srgb, var(--primary) 15%, var(--background)) 100%)'
},
{
id: 'theme-primary',
name: 'Dégradé primaire',
description: 'Dégradé marqué avec la couleur primaire',
preview: 'linear-gradient(135deg, var(--background) 0%, color-mix(in srgb, var(--primary) 25%, var(--background)) 100%)'
},
{
id: 'theme-accent',
name: 'Dégradé accent',
description: 'Dégradé marqué avec la couleur d\'accent',
preview: 'linear-gradient(135deg, var(--background) 0%, color-mix(in srgb, var(--accent) 25%, var(--background)) 100%)'
},
{
id: 'theme-success',
name: 'Dégradé succès',
description: 'Dégradé marqué avec la couleur de succès',
preview: 'linear-gradient(135deg, var(--background) 0%, color-mix(in srgb, var(--success) 25%, var(--background)) 100%)'
},
{
id: 'theme-purple',
name: 'Dégradé violet',
description: 'Dégradé marqué avec la couleur violette',
preview: 'linear-gradient(135deg, var(--background) 0%, color-mix(in srgb, var(--purple) 25%, var(--background)) 100%)'
},
{
id: 'theme-diagonal',
name: 'Dégradé diagonal',
description: 'Dégradé diagonal avec plusieurs couleurs',
preview: 'linear-gradient(45deg, var(--background) 0%, color-mix(in srgb, var(--primary) 20%, var(--background)) 50%, color-mix(in srgb, var(--accent) 20%, var(--background)) 100%)'
},
{
id: 'theme-radial',
name: 'Dégradé radial',
description: 'Dégradé radial centré avec les couleurs du thème',
preview: 'radial-gradient(circle at center, var(--background) 0%, color-mix(in srgb, var(--primary) 20%, var(--background)) 100%)'
},
{
id: 'theme-sunset',
name: 'Dégradé coucher de soleil',
description: 'Dégradé orange-rouge intense',
preview: 'linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, var(--background)) 0%, color-mix(in srgb, var(--destructive) 20%, var(--background)) 100%)'
},
{
id: 'theme-ocean',
name: 'Dégradé océan',
description: 'Dégradé bleu profond',
preview: 'linear-gradient(135deg, color-mix(in srgb, var(--blue) 25%, var(--background)) 0%, color-mix(in srgb, var(--primary) 15%, var(--background)) 100%)'
},
{
id: 'theme-forest',
name: 'Dégradé forêt',
description: 'Dégradé vert naturel',
preview: 'linear-gradient(135deg, color-mix(in srgb, var(--green) 25%, var(--background)) 0%, color-mix(in srgb, var(--success) 15%, var(--background)) 100%)'
},
{
id: 'theme-galaxy',
name: 'Dégradé galaxie',
description: 'Dégradé violet-bleu mystique',
preview: 'linear-gradient(135deg, color-mix(in srgb, var(--purple) 25%, var(--background)) 0%, color-mix(in srgb, var(--blue) 20%, var(--background)) 100%)'
}
];
import { PRESET_BACKGROUNDS } from '@/lib/ui-config';
export function BackgroundImageSelector() {
const { preferences, updateViewPreferences } = useUserPreferences();