the-tip-top-frontend/utils/constants.ts
soufiane 5708e8f514 fix: remove lowercase role values from NAV_ITEMS constant
Remove all lowercase role values ('client', 'employee', 'admin') from NAV_ITEMS array in utils/constants.ts to match the User type definition which only uses uppercase roles ('CLIENT', 'EMPLOYEE', 'ADMIN'). This fixes TypeScript compilation error in Navbar.tsx where item.roles.includes(user.role) was failing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 01:34:21 +01:00

192 lines
4.4 KiB
TypeScript

export const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000/api';
// API Endpoints
export const API_ENDPOINTS = {
AUTH: {
LOGIN: '/auth/login',
REGISTER: '/auth/register',
LOGOUT: '/auth/logout',
ME: '/auth/me',
GOOGLE: '/auth/google',
FACEBOOK: '/auth/facebook',
VERIFY_EMAIL: '/auth/verify-email',
FORGOT_PASSWORD: '/auth/forgot-password',
RESET_PASSWORD: '/auth/reset-password',
},
GAME: {
PLAY: '/game/play',
MY_TICKETS: '/game/my-tickets',
TICKET_DETAILS: (id: string) => `/game/tickets/${id}`,
},
EMPLOYEE: {
VALIDATE_TICKET: '/employee/validate-ticket',
PENDING_TICKETS: '/employee/pending-tickets',
CLAIM_TICKET: (id: string) => `/employee/tickets/${id}/claim`,
},
ADMIN: {
STATISTICS: '/admin/statistics',
ALL_TICKETS: '/admin/tickets',
ALL_USERS: '/admin/users',
PRIZES: '/admin/prizes',
CREATE_PRIZE: '/admin/prizes',
UPDATE_PRIZE: (id: string) => `/admin/prizes/${id}`,
DELETE_PRIZE: (id: string) => `/admin/prizes/${id}`,
},
USER: {
PROFILE: '/user/profile',
UPDATE_PROFILE: '/user/profile',
CHANGE_PASSWORD: '/user/change-password',
},
} as const;
// Local Storage Keys
export const STORAGE_KEYS = {
TOKEN: 'auth_token',
USER: 'user_data',
THEME: 'theme_preference',
} as const;
// Prize Names and Colors
export const PRIZE_CONFIG = {
INFUSEUR: {
name: 'Infuseur à thé',
description: 'Un infuseur à thé de qualité',
color: 'bg-blue-100 text-blue-800',
icon: '🫖',
},
THE_SIGNATURE: {
name: 'Thé signature 100g',
description: 'Notre thé signature premium 100g',
color: 'bg-green-100 text-green-800',
icon: '🍵',
},
COFFRET_DECOUVERTE: {
name: 'Coffret découverte 39€',
description: 'Un coffret découverte de nos meilleurs thés',
color: 'bg-purple-100 text-purple-800',
icon: '🎁',
},
COFFRET_PRESTIGE: {
name: 'Coffret prestige 69€',
description: 'Un coffret prestige d\'exception',
color: 'bg-amber-100 text-amber-800',
icon: '🏆',
},
THE_GRATUIT: {
name: 'Thé gratuit en magasin',
description: 'Un thé gratuit de votre choix en magasin',
color: 'bg-pink-100 text-pink-800',
icon: '☕',
},
} as const;
// Navigation Routes
export const ROUTES = {
HOME: '/',
LOGIN: '/login',
REGISTER: '/register',
LOTS: '/lots',
GAME: '/jeux',
PROFILE: '/profil',
MY_LOTS: '/mes-lots',
HISTORY: '/historique',
CLIENT_DASHBOARD: '/client',
EMPLOYEE_DASHBOARD: '/employe/dashboard',
EMPLOYEE_VERIFICATION: '/employe/verification',
EMPLOYEE_HISTORY: '/employe/historique',
ADMIN_DASHBOARD: '/admin/dashboard',
ADMIN_USERS: '/admin/utilisateurs',
ADMIN_STATISTICS: '/admin/statistiques',
ADMIN_DRAWS: '/admin/tirages',
} as const;
// Role-based Navigation
export const NAV_ITEMS = [
{
label: 'Accueil',
href: ROUTES.HOME,
roles: ['CLIENT', 'EMPLOYEE', 'ADMIN'],
},
{
label: 'Lots',
href: ROUTES.LOTS,
roles: ['CLIENT', 'EMPLOYEE', 'ADMIN'],
},
{
label: 'Jouer',
href: ROUTES.GAME,
roles: ['CLIENT'],
},
{
label: 'Mes lots',
href: ROUTES.MY_LOTS,
roles: ['CLIENT'],
},
{
label: 'Mes gains',
href: ROUTES.HISTORY,
roles: ['CLIENT'],
},
{
label: 'Mon profil',
href: ROUTES.PROFILE,
roles: ['CLIENT', 'EMPLOYEE', 'ADMIN'],
},
{
label: 'Dashboard',
href: ROUTES.EMPLOYEE_DASHBOARD,
roles: ['EMPLOYEE'],
},
{
label: 'Validation',
href: ROUTES.EMPLOYEE_VERIFICATION,
roles: ['EMPLOYEE'],
},
{
label: 'Historique',
href: ROUTES.EMPLOYEE_HISTORY,
roles: ['EMPLOYEE'],
},
{
label: 'Dashboard',
href: ROUTES.ADMIN_DASHBOARD,
roles: ['ADMIN'],
},
{
label: 'Utilisateurs',
href: ROUTES.ADMIN_USERS,
roles: ['ADMIN'],
},
{
label: 'Statistiques',
href: ROUTES.ADMIN_STATISTICS,
roles: ['ADMIN'],
},
{
label: 'Tirages',
href: ROUTES.ADMIN_DRAWS,
roles: ['ADMIN'],
},
] as const;
// Ticket Status
export const TICKET_STATUS = {
PENDING: 'PENDING',
CLAIMED: 'CLAIMED',
REJECTED: 'REJECTED',
} as const;
// Ticket Status Labels
export const TICKET_STATUS_LABELS = {
PENDING: 'En attente',
CLAIMED: 'Réclamé',
REJECTED: 'Rejeté',
} as const;
// Ticket Status Colors
export const TICKET_STATUS_COLORS = {
PENDING: 'bg-yellow-100 text-yellow-800',
CLAIMED: 'bg-green-100 text-green-800',
REJECTED: 'bg-red-100 text-red-800',
} as const;