import { Suspense } from 'react'; import Link from 'next/link'; import { auth } from '@/lib/auth'; import { getSessionsByUserId } from '@/services/sessions'; import { getMotivatorSessionsByUserId } from '@/services/moving-motivators'; import { Card, Button } from '@/components/ui'; import { WorkshopTabs } from './WorkshopTabs'; function WorkshopTabsSkeleton() { return (
{/* Tabs skeleton */}
{[...Array(4)].map((_, i) => (
))}
{/* Cards skeleton */}
{[...Array(6)].map((_, i) => (
))}
); } export default async function SessionsPage() { const session = await auth(); if (!session?.user?.id) { return null; } // Fetch both SWOT and Moving Motivators sessions const [swotSessions, motivatorSessions] = await Promise.all([ getSessionsByUserId(session.user.id), getMotivatorSessionsByUserId(session.user.id), ]); // Add type to each session for unified display const allSwotSessions = swotSessions.map((s) => ({ ...s, workshopType: 'swot' as const, })); const allMotivatorSessions = motivatorSessions.map((s) => ({ ...s, workshopType: 'motivators' as const, })); // Combine and sort by updatedAt const allSessions = [...allSwotSessions, ...allMotivatorSessions].sort( (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime() ); const hasNoSessions = allSessions.length === 0; return (
{/* Header */}

Mes Ateliers

Tous vos ateliers en un seul endroit

{/* Content */} {hasNoSessions ? (
🚀

Commencez votre premier atelier

Créez un atelier SWOT pour analyser les forces et faiblesses, ou un Moving Motivators pour découvrir les motivations de vos collaborateurs.

) : ( }> )}
); }