2025-12-25 11:19:43 +00:00
|
|
|
import { useEffect, useState } from 'react';
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
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';
|
2026-02-09 23:33:21 +00:00
|
|
|
import { ErrorBoundary } from '@/components/ui/ErrorBoundary';
|
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';
|
feat: UI components, services, utils, i18n, and routing
Update shared components (ComingSoon, SelectTrigger, AnnouncementBanner,
modals, social cards). Add usePatina hook. Refine API services, error
handling, query invalidation, state management. Update i18n strings
(en/fr/es). Update routing and app configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 14:46:42 +00:00
|
|
|
import { usePatina } from '@/hooks/usePatina';
|
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() {
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
const { t } = useTranslation();
|
2025-12-03 21:56:50 +00:00
|
|
|
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();
|
|
|
|
|
|
feat: UI components, services, utils, i18n, and routing
Update shared components (ComingSoon, SelectTrigger, AnnouncementBanner,
modals, social cards). Add usePatina hook. Refine API services, error
handling, query invalidation, state management. Update i18n strings
(en/fr/es). Update routing and app configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 14:46:42 +00:00
|
|
|
// SUMI v3: Apply patina level based on user profile data
|
|
|
|
|
usePatina();
|
|
|
|
|
|
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]);
|
|
|
|
|
|
2026-03-31 23:40:54 +00:00
|
|
|
// P1.2: Initialize auth state before rendering app
|
|
|
|
|
// With httpOnly cookies we cannot read tokens in JS; always call refreshUser()
|
|
|
|
|
// so getMe() is used to verify auth (cookies sent automatically).
|
|
|
|
|
// CSRF token is fetched AFTER auth succeeds (no timing hack needed).
|
2025-12-03 21:56:50 +00:00
|
|
|
useEffect(() => {
|
2026-03-31 23:40:54 +00:00
|
|
|
const initAuth = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await refreshUser();
|
|
|
|
|
// Fetch CSRF only after auth is confirmed
|
|
|
|
|
const { isAuthenticated } = useAuthStore.getState();
|
|
|
|
|
if (isAuthenticated) {
|
|
|
|
|
csrfService.refreshToken().catch((error) => {
|
|
|
|
|
const msg = error instanceof Error ? error.message : String(error);
|
|
|
|
|
if (!msg.includes('HTML page instead of JSON')) {
|
|
|
|
|
logger.warn('Failed to fetch CSRF token on app init', { message: msg });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
logger.error('[App] Auth initialization failed', {
|
|
|
|
|
error: error instanceof Error ? error.message : String(error),
|
|
|
|
|
stack: error instanceof Error ? error.stack : undefined,
|
2025-12-22 21:56:37 +00:00
|
|
|
});
|
2026-03-31 23:40:54 +00:00
|
|
|
} finally {
|
|
|
|
|
setIsAuthReady(true);
|
2025-12-22 21:56:37 +00:00
|
|
|
}
|
|
|
|
|
};
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2026-03-31 23:40:54 +00:00
|
|
|
initAuth();
|
|
|
|
|
}, [refreshUser]);
|
|
|
|
|
|
|
|
|
|
// Apply theme on load
|
|
|
|
|
useEffect(() => {
|
2026-01-11 15:30:43 +00:00
|
|
|
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
|
|
|
|
2026-03-31 23:40:54 +00:00
|
|
|
// Sync language with i18n on load
|
2025-12-25 11:15:58 +00:00
|
|
|
if (typeof window !== 'undefined' && window.i18n) {
|
|
|
|
|
const currentLang = window.i18n.language || language;
|
|
|
|
|
if (currentLang !== language) {
|
|
|
|
|
window.i18n.changeLanguage(language);
|
|
|
|
|
} else if (language !== currentLang) {
|
2026-03-12 13:29:22 +00:00
|
|
|
setLanguage(currentLang as 'en' | 'fr' | 'es');
|
2025-12-25 11:15:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-29 22:19:01 +00:00
|
|
|
}, [setTheme, theme, language, setLanguage]);
|
|
|
|
|
|
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
|
|
|
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
// S5.1: Branded loading screen (Spotify-like splash)
|
2026-01-29 22:19:01 +00:00
|
|
|
if (!isAuthReady) {
|
|
|
|
|
return (
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
<div className="flex flex-col items-center justify-center min-h-screen bg-[var(--sumi-bg-void)]">
|
|
|
|
|
{/* Logo mark */}
|
|
|
|
|
<div className="relative mb-8 animate-[sumi-fade-in_0.6s_ease-out]">
|
|
|
|
|
<svg
|
|
|
|
|
width="56"
|
|
|
|
|
height="56"
|
|
|
|
|
viewBox="0 0 56 56"
|
|
|
|
|
fill="none"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
className="text-primary"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
>
|
|
|
|
|
<rect width="56" height="56" rx="16" fill="currentColor" fillOpacity="0.15" />
|
|
|
|
|
<path
|
|
|
|
|
d="M18 38V18l20 10-20 10z"
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
className="animate-pulse"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
{/* Brand name */}
|
|
|
|
|
<h1 className="text-2xl font-heading font-bold text-foreground mb-6 animate-[sumi-fade-in_0.8s_ease-out_0.2s_both]">
|
|
|
|
|
Veza
|
|
|
|
|
</h1>
|
|
|
|
|
{/* Progress bar */}
|
|
|
|
|
<div className="w-48 h-0.5 bg-muted/30 rounded-full overflow-hidden animate-[sumi-fade-in_1s_ease-out_0.4s_both]">
|
|
|
|
|
<div className="h-full bg-primary rounded-full animate-[loading-progress_1.5s_ease-in-out_infinite]" />
|
2026-01-29 22:19:01 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-03 21:56:50 +00:00
|
|
|
return (
|
|
|
|
|
<ErrorBoundary>
|
2026-02-14 20:45:15 +00:00
|
|
|
<AudioProvider>
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
{/* S3.1: Skip navigation link for keyboard/screen-reader users */}
|
|
|
|
|
<a
|
|
|
|
|
href="#main-content"
|
|
|
|
|
className="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[var(--sumi-z-max)] focus:bg-primary focus:text-primary-foreground focus:px-4 focus:py-2 focus:rounded-lg focus:shadow-lg"
|
|
|
|
|
>
|
|
|
|
|
{t('nav.skipToContent')}
|
|
|
|
|
</a>
|
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)}
|
|
|
|
|
/>
|
2026-02-14 20:45:15 +00:00
|
|
|
</AudioProvider>
|
2025-12-03 21:56:50 +00:00
|
|
|
</ErrorBoundary>
|
|
|
|
|
);
|
|
|
|
|
}
|