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 { apiClient } from '@/services/api/client';
|
|
|
|
|
import { User, PaginatedResponse } from '@/types/api';
|
|
|
|
|
import { userSchema } from '@/schemas/apiSchemas';
|
2026-01-07 09:33:52 +00:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
|
* Service pour la gestion des profils utilisateurs
|
|
|
|
|
* Aligné avec /api/v1/users backend
|
|
|
|
|
*/
|
2026-01-07 09:33:52 +00:00
|
|
|
export const userService = {
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Récupère le profil d'un utilisateur par son ID
|
|
|
|
|
*/
|
|
|
|
|
getProfile: async (id: string) => {
|
|
|
|
|
const response = await apiClient.get<User>(`/users/${id}`, {
|
|
|
|
|
validateSchema: userSchema,
|
|
|
|
|
} as any);
|
|
|
|
|
return { profile: response.data };
|
|
|
|
|
},
|
2026-01-07 10:15:48 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Récupère le profil d'un utilisateur par son nom d'utilisateur
|
|
|
|
|
*/
|
|
|
|
|
getProfileByUsername: async (username: string) => {
|
|
|
|
|
const response = await apiClient.get<User>(
|
|
|
|
|
`/users/by-username/${username}`,
|
|
|
|
|
{
|
|
|
|
|
validateSchema: userSchema,
|
|
|
|
|
} as any,
|
|
|
|
|
);
|
|
|
|
|
return { profile: response.data };
|
|
|
|
|
},
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Met à jour le profil de l'utilisateur
|
|
|
|
|
*/
|
|
|
|
|
updateProfile: async (id: string, data: any) => {
|
|
|
|
|
const response = await apiClient.put<User>(`/users/${id}`, data, {
|
|
|
|
|
validateSchema: userSchema,
|
|
|
|
|
} as any);
|
|
|
|
|
return { profile: response.data };
|
|
|
|
|
},
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Récupère le taux de complétion du profil
|
|
|
|
|
*/
|
|
|
|
|
getProfileCompletion: async (id: string) => {
|
|
|
|
|
const response = await apiClient.get<{
|
|
|
|
|
completion_percentage: number;
|
|
|
|
|
missing_fields: string[];
|
|
|
|
|
}>(`/users/${id}/completion`);
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Liste les utilisateurs avec pagination et recherche
|
|
|
|
|
*/
|
|
|
|
|
list: async (params?: {
|
|
|
|
|
page?: number;
|
|
|
|
|
limit?: number;
|
|
|
|
|
search?: string;
|
|
|
|
|
role?: string;
|
|
|
|
|
}) => {
|
|
|
|
|
const response = await apiClient.get<PaginatedResponse<User>>('/users', {
|
|
|
|
|
params: {
|
|
|
|
|
page: params?.page,
|
|
|
|
|
limit: params?.limit,
|
|
|
|
|
query: params?.search,
|
|
|
|
|
role: params?.role,
|
|
|
|
|
},
|
|
|
|
|
// Backend uses 'list' instead of 'items' for the root array
|
|
|
|
|
// We'll need a wrapper or handle it in the schema if we want strict validation
|
|
|
|
|
// For now, we manually map to satisfy the PaginatedResponse interface
|
|
|
|
|
});
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
// apiClient unwrap le format { success, data }
|
|
|
|
|
// Pour les listes, le backend retourne souvent { list: [], pagination: {} }
|
|
|
|
|
// Mais PaginatedResponse attend { items: [], ... }
|
|
|
|
|
const data = response.data as any;
|
|
|
|
|
const items = data.list || data.items || [];
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
return {
|
|
|
|
|
users: items,
|
|
|
|
|
pagination: data.pagination || {
|
|
|
|
|
total: data.total || items.length,
|
|
|
|
|
page: data.page || params?.page || 1,
|
|
|
|
|
limit: data.limit || params?.limit || 10,
|
|
|
|
|
total_pages: data.total_pages || 1,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Supprime un utilisateur (soft delete)
|
|
|
|
|
*/
|
|
|
|
|
deleteUser: async (id: string) => {
|
|
|
|
|
await apiClient.delete(`/users/${id}`);
|
|
|
|
|
},
|
2026-01-07 10:15:48 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Récupère les paramètres de l'utilisateur connecté
|
|
|
|
|
*/
|
|
|
|
|
getSettings: async () => {
|
|
|
|
|
const response = await apiClient.get<any>('/users/settings');
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
2026-01-07 10:15:48 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Met à jour les paramètres de l'utilisateur connecté
|
|
|
|
|
*/
|
|
|
|
|
updateSettings: async (data: any) => {
|
|
|
|
|
const response = await apiClient.put<any>('/users/settings', data);
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
2026-01-07 10:15:48 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
/**
|
|
|
|
|
* Exporte les données de l'utilisateur (GDPR)
|
|
|
|
|
*/
|
|
|
|
|
exportData: async () => {
|
|
|
|
|
// Cette route déclenche un téléchargement de fichier
|
|
|
|
|
window.open(
|
|
|
|
|
`${import.meta.env.VITE_API_URL || ''}/api/v1/users/me/export`,
|
|
|
|
|
'_blank',
|
|
|
|
|
);
|
|
|
|
|
},
|
2026-01-07 09:33:52 +00:00
|
|
|
};
|