chore: update devbook.md to mark completion of layout, UI components, and homepage; update dev.db

This commit is contained in:
Julien Froidefond
2025-11-27 13:11:11 +01:00
parent 6a9bf88a65
commit 27e409fb76
12 changed files with 701 additions and 10 deletions

105
src/app/sessions/page.tsx Normal file
View File

@@ -0,0 +1,105 @@
import Link from 'next/link';
import { auth } from '@/lib/auth';
import { prisma } from '@/services/database';
import { Card, CardContent, Badge, Button } from '@/components/ui';
async function getSessions(userId: string) {
return prisma.session.findMany({
where: { userId },
include: {
_count: {
select: {
items: true,
actions: true,
},
},
},
orderBy: { updatedAt: 'desc' },
});
}
export default async function SessionsPage() {
const session = await auth();
if (!session?.user?.id) {
return null;
}
const sessions = await getSessions(session.user.id);
return (
<main className="mx-auto max-w-7xl px-4 py-8">
{/* Header */}
<div className="mb-8 flex items-center justify-between">
<div>
<h1 className="text-3xl font-bold text-foreground">Mes Sessions SWOT</h1>
<p className="mt-1 text-muted">
Gérez vos ateliers SWOT avec vos collaborateurs
</p>
</div>
<Link href="/sessions/new">
<Button>
<span></span>
Nouvelle Session
</Button>
</Link>
</div>
{/* Sessions Grid */}
{sessions.length === 0 ? (
<Card className="p-12 text-center">
<div className="text-5xl mb-4">📋</div>
<h2 className="text-xl font-semibold text-foreground mb-2">
Aucune session pour le moment
</h2>
<p className="text-muted mb-6">
Créez votre première session SWOT pour commencer à analyser les forces,
faiblesses, opportunités et menaces de vos collaborateurs.
</p>
<Link href="/sessions/new">
<Button>Créer ma première session</Button>
</Link>
</Card>
) : (
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{sessions.map((s) => (
<Link key={s.id} href={`/sessions/${s.id}`}>
<Card hover className="h-full p-6">
<div className="mb-4 flex items-start justify-between">
<div>
<h3 className="font-semibold text-foreground line-clamp-1">
{s.title}
</h3>
<p className="text-sm text-muted">{s.collaborator}</p>
</div>
<span className="text-2xl">📊</span>
</div>
<CardContent className="p-0">
<div className="flex flex-wrap gap-2 mb-4">
<Badge variant="primary">
{s._count.items} items
</Badge>
<Badge variant="success">
{s._count.actions} actions
</Badge>
</div>
<p className="text-xs text-muted">
Mis à jour le{' '}
{new Date(s.updatedAt).toLocaleDateString('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
</p>
</CardContent>
</Card>
</Link>
))}
</div>
)}
</main>
);
}