2025-12-25 11:19:43 +00:00
|
|
|
import { useEffect, useState } from 'react';
|
feat: Visual masterpiece - true light mode & premium UI
🎨 **True Light/Dark Mode**
- Implemented proper light mode with inverted color scheme
- Smooth theme transitions (0.3s ease)
- Light mode colors: white backgrounds, dark text, vibrant accents
- System theme detection with proper class application
🌈 **Enhanced Theme System**
- 4 color themes work in both light and dark modes
- Cyber (cyan/magenta), Ocean (blue/teal), Forest (green/lime), Sunset (orange/purple)
- Theme-specific glassmorphism effects
- Proper contrast in light mode
✨ **Premium Animations**
- Float, glow-pulse, slide-in, scale-in, rotate-in animations
- Smooth page transitions
- Hover effects with depth (lift, glow, scale)
- Micro-interactions on all interactive elements
🎯 **Visual Polish**
- Enhanced glassmorphism for light/dark modes
- Custom scrollbar with theme colors
- Beautiful text selection
- Focus indicators for accessibility
- Premium utility classes
🔧 **Technical Improvements**
- Updated UIStore to properly apply light/dark classes
- Added data-theme attribute for CSS targeting
- Smooth scroll behavior
- Optimized transitions
The app is now a visual masterpiece with perfect light/dark mode support!
2026-01-11 01:32:21 +00:00
|
|
|
import '@/styles/premium-utilities.css';
|
feat: Major visual improvements - premium design system
🎨 **Enhanced Glassmorphism**
- Added radial gradients to glass-hud
- Improved shadows with multiple layers
- Better light mode glass effects
- Inset highlights for depth
✨ **Premium Visual Effects**
- Neon glow effects (cyan, magenta)
- Premium gradients for all themes
- Enhanced borders with glow
- Depth shadows (3 levels)
- Frosted glass variants (strong, subtle)
🎯 **Interactive Components**
- Premium button with shine effect
- Enhanced card hover states
- Smooth transitions everywhere
- Text glow and shadow effects
💎 **New Utility Classes**
- .neon-glow-cyan, .neon-glow-magenta
- .gradient-cyber, ocean, forest, sunset
- .border-glow, .shadow-premium
- .depth-1, depth-2, depth-3
- .glass-strong, .glass-subtle
- .btn-premium, .card-premium
- .interactive, .text-glow
The app now has a truly premium, polished visual design!
2026-01-11 01:40:52 +00:00
|
|
|
import '@/styles/visual-enhancements.css';
|
2025-12-08 18:57:54 +00:00
|
|
|
|
2026-01-15 16:56:26 +00:00
|
|
|
import { useQueryClient } from '@tanstack/react-query';
|
2025-12-26 08:11:41 +00:00
|
|
|
import { useAuthStore } from '@/features/auth/store/authStore';
|
2026-01-07 18:39:21 +00:00
|
|
|
|
2025-12-03 21:56:50 +00:00
|
|
|
import { useUIStore } from '@/stores/ui';
|
|
|
|
|
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
2025-12-17 14:15:45 +00:00
|
|
|
import { ToastProvider } from '@/components/feedback/ToastProvider';
|
2026-01-26 13:12:17 +00:00
|
|
|
import { AstralBackground } from '@/components/ui/AstralBackground';
|
2026-01-11 15:30:43 +00:00
|
|
|
import { OfflineIndicator } from '@/components/OfflineIndicator';
|
2025-12-03 21:56:50 +00:00
|
|
|
import { AppRouter } from '@/router';
|
2025-12-22 21:56:37 +00:00
|
|
|
import { csrfService } from '@/services/csrf';
|
2025-12-25 11:19:43 +00:00
|
|
|
import { useGlobalKeyboardShortcuts } from '@/hooks/useGlobalKeyboardShortcuts';
|
feat(ui): profile page premium polish + keyboard shortcuts panel
Profile page:
- Hero: gradient upgrade, animated shimmer sweep, pulsing glow orb, bottom fade
- Header card: avatar ring glow, stats with icons (data-driven), tabular-nums
- Tabs: stagger animation on grid items, tab trigger transitions
- Skeleton: consistent with loaded state styling
- Page entry animation (fade-in)
Keyboard shortcuts panel (Discord-style):
- New KeyboardShortcutsPanel component with framer-motion animations
- Groups: General, Playback, Navigation
- Styled kbd badges with semantic tokens
- ARIA: role=dialog, aria-modal, aria-label
- Replaces old KeyboardShortcutsHelp component
- Fix: ? key handler no longer blocked by !e.shiftKey guard
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 23:15:50 +00:00
|
|
|
import { KeyboardShortcutsPanel } from '@/components/ui/KeyboardShortcutsPanel';
|
2025-12-25 12:43:01 +00:00
|
|
|
import { useStateHydration } from '@/utils/stateHydration';
|
2025-12-25 12:45:49 +00:00
|
|
|
import { useQueryInvalidation } from '@/hooks/useQueryInvalidation';
|
2026-01-15 16:56:26 +00:00
|
|
|
import { setupReactQuerySync } from '@/utils/reactQuerySync';
|
2026-01-07 09:35:43 +00:00
|
|
|
import { logger } from '@/utils/logger';
|
2026-01-22 16:23:11 +00:00
|
|
|
import { AudioProvider } from '@/context/AudioContext';
|
2025-12-03 21:56:50 +00:00
|
|
|
|
|
|
|
|
export function App() {
|
|
|
|
|
const { refreshUser } = useAuthStore();
|
2025-12-25 11:15:58 +00:00
|
|
|
const { theme, setTheme, language, setLanguage } = useUIStore();
|
2025-12-25 11:19:43 +00:00
|
|
|
const [showKeyboardHelp, setShowKeyboardHelp] = useState(false);
|
2026-01-29 22:19:01 +00:00
|
|
|
// P1.2: Auth initialization state to prevent race condition
|
|
|
|
|
const [isAuthReady, setIsAuthReady] = useState(false);
|
2026-01-15 16:56:26 +00:00
|
|
|
const queryClient = useQueryClient();
|
2025-12-25 11:19:43 +00:00
|
|
|
|
|
|
|
|
// FE-COMP-022: Enable global keyboard shortcuts
|
|
|
|
|
useGlobalKeyboardShortcuts({
|
|
|
|
|
enabled: true,
|
|
|
|
|
onHelpOpen: () => setShowKeyboardHelp(true),
|
|
|
|
|
});
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2025-12-25 12:43:01 +00:00
|
|
|
// FE-STATE-003: Hydrate state from server on app load
|
feat: Visual masterpiece - true light mode & premium UI
🎨 **True Light/Dark Mode**
- Implemented proper light mode with inverted color scheme
- Smooth theme transitions (0.3s ease)
- Light mode colors: white backgrounds, dark text, vibrant accents
- System theme detection with proper class application
🌈 **Enhanced Theme System**
- 4 color themes work in both light and dark modes
- Cyber (cyan/magenta), Ocean (blue/teal), Forest (green/lime), Sunset (orange/purple)
- Theme-specific glassmorphism effects
- Proper contrast in light mode
✨ **Premium Animations**
- Float, glow-pulse, slide-in, scale-in, rotate-in animations
- Smooth page transitions
- Hover effects with depth (lift, glow, scale)
- Micro-interactions on all interactive elements
🎯 **Visual Polish**
- Enhanced glassmorphism for light/dark modes
- Custom scrollbar with theme colors
- Beautiful text selection
- Focus indicators for accessibility
- Premium utility classes
🔧 **Technical Improvements**
- Updated UIStore to properly apply light/dark classes
- Added data-theme attribute for CSS targeting
- Smooth scroll behavior
- Optimized transitions
The app is now a visual masterpiece with perfect light/dark mode support!
2026-01-11 01:32:21 +00:00
|
|
|
useStateHydration({
|
2025-12-25 12:43:01 +00:00
|
|
|
hydrateAuth: true,
|
|
|
|
|
hydrateLibrary: false, // Can be enabled if needed
|
|
|
|
|
hydrateChat: false, // Can be enabled if needed
|
|
|
|
|
requireAuth: false, // Hydrate auth even if not authenticated (to check status)
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-25 12:45:49 +00:00
|
|
|
// FE-STATE-004: Listen for query invalidation events
|
|
|
|
|
useQueryInvalidation();
|
|
|
|
|
|
2026-01-15 16:56:26 +00:00
|
|
|
// Action 2.3.1.2: Initialize React Query cache synchronization across tabs
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const cleanup = setupReactQuerySync(queryClient, {
|
|
|
|
|
enabled: true,
|
|
|
|
|
channelName: 'veza-react-query-sync',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return cleanup;
|
|
|
|
|
}, [queryClient]);
|
|
|
|
|
|
2025-12-03 21:56:50 +00:00
|
|
|
// Initialiser l'application
|
|
|
|
|
useEffect(() => {
|
2026-01-07 09:35:43 +00:00
|
|
|
// CRITIQUE FIX #18: refreshUser est maintenant appelé par useStateHydration
|
|
|
|
|
// Ne pas appeler refreshUser ici pour éviter les appels multiples
|
|
|
|
|
// useStateHydration gère déjà l'hydratation de l'état d'authentification
|
|
|
|
|
// Ce useEffect ne fait plus qu'initialiser les autres aspects de l'app
|
2026-01-07 18:39:21 +00:00
|
|
|
|
2025-12-22 21:56:37 +00:00
|
|
|
// Récupérer le token CSRF si l'utilisateur est déjà authentifié
|
|
|
|
|
// (refreshUser() est asynchrone, donc on vérifie après un court délai)
|
|
|
|
|
const checkAndFetchCSRF = async () => {
|
|
|
|
|
// Attendre un peu pour que refreshUser() se termine
|
2026-01-13 18:47:57 +00:00
|
|
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
2025-12-22 21:56:37 +00:00
|
|
|
const { isAuthenticated } = useAuthStore.getState();
|
|
|
|
|
if (isAuthenticated) {
|
|
|
|
|
csrfService.refreshToken().catch((error) => {
|
2026-01-07 09:35:43 +00:00
|
|
|
logger.warn('Failed to fetch CSRF token on app init', {
|
2026-01-07 18:39:21 +00:00
|
|
|
error: error instanceof Error ? error.message : String(error),
|
|
|
|
|
stack: error instanceof Error ? error.stack : undefined,
|
2026-01-07 09:35:43 +00:00
|
|
|
});
|
2025-12-22 21:56:37 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
checkAndFetchCSRF();
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2025-12-25 11:13:29 +00:00
|
|
|
// Appliquer le thème au chargement (le store persist le fait déjà, mais on s'assure qu'il est appliqué)
|
2026-01-11 15:30:43 +00:00
|
|
|
// Forcer dark mode par défaut si pas encore défini
|
|
|
|
|
if (!theme || theme === 'system') {
|
|
|
|
|
const root = document.documentElement;
|
2026-01-13 18:47:57 +00:00
|
|
|
if (
|
|
|
|
|
!root.classList.contains('dark') &&
|
|
|
|
|
!root.classList.contains('light')
|
|
|
|
|
) {
|
2026-01-11 15:30:43 +00:00
|
|
|
setTheme('dark');
|
|
|
|
|
} else {
|
|
|
|
|
setTheme(theme);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setTheme(theme);
|
|
|
|
|
}
|
2025-12-25 11:15:58 +00:00
|
|
|
|
|
|
|
|
// Synchroniser la langue avec i18n au chargement
|
|
|
|
|
if (typeof window !== 'undefined' && window.i18n) {
|
|
|
|
|
const currentLang = window.i18n.language || language;
|
|
|
|
|
if (currentLang !== language) {
|
|
|
|
|
window.i18n.changeLanguage(language);
|
|
|
|
|
} else if (language !== currentLang) {
|
|
|
|
|
setLanguage(currentLang as 'en' | 'fr');
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-29 22:19:01 +00:00
|
|
|
}, [setTheme, theme, language, setLanguage]);
|
|
|
|
|
|
|
|
|
|
// P1.2: Initialize auth state before rendering app
|
2026-02-07 19:36:48 +00:00
|
|
|
// With httpOnly cookies we cannot read tokens in JS; always call refreshUser()
|
|
|
|
|
// so getMe() is used to verify auth (cookies sent automatically).
|
2026-01-29 22:19:01 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
const initAuth = async () => {
|
|
|
|
|
try {
|
2026-02-07 19:36:48 +00:00
|
|
|
await refreshUser();
|
2026-01-29 22:19:01 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
logger.error('[App] Auth initialization failed', {
|
|
|
|
|
error: error instanceof Error ? error.message : String(error),
|
|
|
|
|
stack: error instanceof Error ? error.stack : undefined,
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
setIsAuthReady(true);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
initAuth();
|
|
|
|
|
}, [refreshUser]);
|
2025-12-25 11:13:29 +00:00
|
|
|
|
|
|
|
|
// Écouter les changements de préférence système pour le mode 'system'
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (theme !== 'system') return;
|
|
|
|
|
|
|
|
|
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
|
|
|
const handleChange = (e: MediaQueryListEvent) => {
|
|
|
|
|
const root = document.documentElement;
|
|
|
|
|
if (e.matches) {
|
|
|
|
|
root.classList.add('dark');
|
|
|
|
|
} else {
|
|
|
|
|
root.classList.remove('dark');
|
2025-12-03 21:56:50 +00:00
|
|
|
}
|
2025-12-25 11:13:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Écouter les changements
|
|
|
|
|
if (mediaQuery.addEventListener) {
|
|
|
|
|
mediaQuery.addEventListener('change', handleChange);
|
|
|
|
|
} else {
|
|
|
|
|
// Fallback pour les navigateurs plus anciens
|
|
|
|
|
mediaQuery.addListener(handleChange);
|
2025-12-03 21:56:50 +00:00
|
|
|
}
|
2025-12-25 11:13:29 +00:00
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
if (mediaQuery.removeEventListener) {
|
|
|
|
|
mediaQuery.removeEventListener('change', handleChange);
|
|
|
|
|
} else {
|
|
|
|
|
mediaQuery.removeListener(handleChange);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, [theme]);
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2026-01-29 22:19:01 +00:00
|
|
|
// P1.2: Show loading screen while auth is initializing
|
|
|
|
|
if (!isAuthReady) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center min-h-screen bg-background">
|
|
|
|
|
<div className="text-center">
|
|
|
|
|
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"></div>
|
|
|
|
|
<p className="text-muted-foreground">Chargement...</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-03 21:56:50 +00:00
|
|
|
return (
|
|
|
|
|
<ErrorBoundary>
|
2025-12-17 14:15:45 +00:00
|
|
|
<ToastProvider>
|
2026-01-22 16:23:11 +00:00
|
|
|
<AudioProvider>
|
2026-01-26 13:12:17 +00:00
|
|
|
<AstralBackground />
|
2026-01-22 16:23:11 +00:00
|
|
|
{/* Offline/Online Status Indicator */}
|
|
|
|
|
<OfflineIndicator />
|
|
|
|
|
<AppRouter />
|
2026-01-26 13:12:17 +00:00
|
|
|
{/* PWA Install Banner - Disabled for now as it is too intrusive */}
|
|
|
|
|
{/* <PWAInstallBanner /> */}
|
feat(ui): profile page premium polish + keyboard shortcuts panel
Profile page:
- Hero: gradient upgrade, animated shimmer sweep, pulsing glow orb, bottom fade
- Header card: avatar ring glow, stats with icons (data-driven), tabular-nums
- Tabs: stagger animation on grid items, tab trigger transitions
- Skeleton: consistent with loaded state styling
- Page entry animation (fade-in)
Keyboard shortcuts panel (Discord-style):
- New KeyboardShortcutsPanel component with framer-motion animations
- Groups: General, Playback, Navigation
- Styled kbd badges with semantic tokens
- ARIA: role=dialog, aria-modal, aria-label
- Replaces old KeyboardShortcutsHelp component
- Fix: ? key handler no longer blocked by !e.shiftKey guard
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 23:15:50 +00:00
|
|
|
{/* Keyboard Shortcuts Panel (Discord-style overlay) */}
|
|
|
|
|
<KeyboardShortcutsPanel
|
|
|
|
|
isOpen={showKeyboardHelp}
|
2026-01-22 16:23:11 +00:00
|
|
|
onClose={() => setShowKeyboardHelp(false)}
|
|
|
|
|
/>
|
|
|
|
|
</AudioProvider>
|
2025-12-17 14:15:45 +00:00
|
|
|
</ToastProvider>
|
2025-12-03 21:56:50 +00:00
|
|
|
</ErrorBoundary>
|
|
|
|
|
);
|
|
|
|
|
}
|