From 89af1fc5975b42d77e95bd4150712d2017cc2f31 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Sat, 4 Oct 2025 10:53:57 +0200 Subject: [PATCH] feat: refactor theme handling and update TODO.md - Replaced references from theme-config to ui-config for better organization and clarity in theme management. - Updated Solarized icon in ui-config to a pill emoji for improved visual representation. - Marked the Solarized icon correction task as complete in TODO.md. - Deleted the now redundant theme-config file to streamline the codebase. --- TODO.md | 2 +- src/actions/preferences.ts | 2 +- src/app/login/page.tsx | 2 +- src/lib/theme-config.ts | 76 -------------------------------------- src/lib/types.ts | 2 +- src/lib/ui-config.ts | 2 +- 6 files changed, 5 insertions(+), 81 deletions(-) delete mode 100644 src/lib/theme-config.ts diff --git a/TODO.md b/TODO.md index 411d09c..812ada5 100644 --- a/TODO.md +++ b/TODO.md @@ -20,11 +20,11 @@ - [x] **Légende calendrier et padding** - Corriger l'espacement et la légende du calendrier dans daily - [x] **EditModal task couleur calendrier** - Problème de couleur en ajout de taches dans tous les icones calendriers; colmler au thème - [x] **Weekly deux boutons actualiser** - Corriger la duplication des boutons d'actualisation +- [x] **Solarized ne doit pas être un soleil** - Corriger l'icône du thème Solarized - [ ] **Settings : tag icônes actions** - Icônes trop petites dans les actions des tags - [ ] **Settings intégration : icônes** - Problème avec les icônes "Arrêté" et "Actif" : doivent etre les memes - [ ] **Settings backup UI** - Revoir l'UI pour coller au style des intégrations - [ ] **Emoji interdit dans UI** - Vérifier et supprimer toutes les emojis dans l'interface, remplacer par lib d'icone -- [ ] **Solarized ne doit pas être un soleil** - Corriger l'icône du thème Solarized - [ ] **AlertBanner : hover et bug** - Corriger les problèmes de hover et bugs - [ ] **Deux modales** - Problème de duplication de modales - [ ] **Control panel et select** - Problème avec les contrôles et sélecteurs diff --git a/src/actions/preferences.ts b/src/actions/preferences.ts index e9c9a5b..16fb43f 100644 --- a/src/actions/preferences.ts +++ b/src/actions/preferences.ts @@ -2,7 +2,7 @@ import { userPreferencesService } from '@/services/core/user-preferences'; import { KanbanFilters, ViewPreferences, ColumnVisibility, TaskStatus } from '@/lib/types'; -import { Theme } from '@/lib/theme-config'; +import { Theme } from '@/lib/ui-config'; import { revalidatePath } from 'next/cache'; import { getServerSession } from 'next-auth'; import { authOptions } from '@/lib/auth'; diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index b7b161e..6c74dbb 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -8,7 +8,7 @@ import { Button } from '@/components/ui/Button' import { Input } from '@/components/ui/Input' import { TowerLogo } from '@/components/TowerLogo' import { TowerBackground } from '@/components/TowerBackground' -import { THEME_CONFIG } from '@/lib/theme-config' +import { THEME_CONFIG } from '@/lib/ui-config' import { useTheme } from '@/contexts/ThemeContext' import { PRESET_BACKGROUNDS } from '@/lib/ui-config' diff --git a/src/lib/theme-config.ts b/src/lib/theme-config.ts deleted file mode 100644 index 569f52b..0000000 --- a/src/lib/theme-config.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Types de thèmes -export type Theme = 'light' | 'dark' | 'dracula' | 'monokai' | 'nord' | 'gruvbox' | 'tokyo_night' | 'catppuccin' | 'rose_pine' | 'one_dark' | 'material' | 'solarized'; - -// Configuration des thèmes -export const THEME_CONFIG = { - // Thème par défaut - default: 'dark' as Theme, - - // Thème light - light: 'light' as Theme, - - // Liste de tous les thèmes dark disponibles - darkThemes: [ - 'dark', - 'dracula', - 'monokai', - 'nord', - 'gruvbox', - 'tokyo_night', - 'catppuccin', - 'rose_pine', - 'one_dark', - 'material', - 'solarized' - ] as Theme[], - - // Tous les thèmes disponibles - allThemes: [ - 'light', - 'dark', - 'dracula', - 'monokai', - 'nord', - 'gruvbox', - 'tokyo_night', - 'catppuccin', - 'rose_pine', - 'one_dark', - 'material', - 'solarized' - ] as Theme[], - - // Métadonnées des thèmes (déplacées vers ui-config.ts) - metadata: { - light: { name: 'Light', description: 'Thème clair par défaut', icon: '☀️' }, - dark: { name: 'Dark', description: 'Thème sombre classique', icon: '🌙' }, - dracula: { name: 'Dracula', description: 'Inspiré du thème Dracula', icon: '🧛' }, - monokai: { name: 'Monokai', description: 'Inspiré du thème Monokai', icon: '🎨' }, - nord: { name: 'Nord', description: 'Palette Nord arctique', icon: '❄️' }, - gruvbox: { name: 'Gruvbox', description: 'Palette Gruvbox retro', icon: '🎭' }, - tokyo_night: { name: 'Tokyo Night', description: 'Nuit tokyoïte', icon: '🌃' }, - catppuccin: { name: 'Catppuccin', description: 'Palette pastel douce', icon: '🐱' }, - rose_pine: { name: 'Rose Pine', description: 'Palette rose et pin', icon: '🌹' }, - one_dark: { name: 'One Dark', description: 'Inspiré d\'Atom One Dark', icon: '🌑' }, - material: { name: 'Material', description: 'Inspiré de Material Design', icon: '📱' }, - solarized: { name: 'Solarized', description: 'Palette Solarized', icon: '☀️' } - } -} as const; - -// Fonctions utilitaires -export const getNextDarkTheme = (currentTheme: Theme): Theme => { - const currentIndex = THEME_CONFIG.darkThemes.indexOf(currentTheme); - if (currentIndex === -1) { - return THEME_CONFIG.darkThemes[0]; - } - const nextIndex = (currentIndex + 1) % THEME_CONFIG.darkThemes.length; - return THEME_CONFIG.darkThemes[nextIndex]; -}; - -export const isDarkTheme = (theme: Theme): boolean => { - return THEME_CONFIG.darkThemes.includes(theme); -}; - -export const getThemeMetadata = (theme: Theme) => { - return THEME_CONFIG.metadata[theme] || { name: theme, description: 'Thème personnalisé', icon: '🎨' }; -}; diff --git a/src/lib/types.ts b/src/lib/types.ts index 8a2a211..db1ca9e 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,5 +1,5 @@ import { TfsConfig } from '@/services/integrations/tfs/tfs'; -import { Theme } from './theme-config'; +import { Theme } from './ui-config'; // Réexporter Theme pour les autres modules export type { Theme }; diff --git a/src/lib/ui-config.ts b/src/lib/ui-config.ts index 5db52fc..be4a493 100644 --- a/src/lib/ui-config.ts +++ b/src/lib/ui-config.ts @@ -56,7 +56,7 @@ export const THEME_METADATA: Record