chore: remove Motivators page and update links to Sessions across the application

This commit is contained in:
Julien Froidefond
2025-11-28 15:09:01 +01:00
parent eaeb1335fa
commit cee3cd7b47
9 changed files with 8 additions and 139 deletions

View File

@@ -56,3 +56,4 @@ export async function updatePasswordAction(data: {
return result;
}

View File

@@ -29,7 +29,7 @@ export default async function MotivatorSessionPage({ params }: MotivatorSessionP
{/* Header */}
<div className="mb-8">
<div className="flex items-center gap-2 text-sm text-muted mb-2">
<Link href="/motivators" className="hover:text-foreground">
<Link href="/sessions" className="hover:text-foreground">
Moving Motivators
</Link>
<span>/</span>

View File

@@ -1,137 +0,0 @@
import Link from 'next/link';
import { auth } from '@/lib/auth';
import { getMotivatorSessionsByUserId } from '@/services/moving-motivators';
import { Card, CardContent, Badge, Button, CollaboratorDisplay } from '@/components/ui';
export default async function MotivatorsPage() {
const session = await auth();
if (!session?.user?.id) {
return null;
}
const sessions = await getMotivatorSessionsByUserId(session.user.id);
// Separate owned vs shared sessions
const ownedSessions = sessions.filter((s) => s.isOwner);
const sharedSessions = sessions.filter((s) => !s.isOwner);
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">Moving Motivators</h1>
<p className="mt-1 text-muted">
Découvrez ce qui motive vraiment vos collaborateurs
</p>
</div>
<Link href="/motivators/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 Moving Motivators pour explorer les motivations
intrinsèques de vos collaborateurs.
</p>
<Link href="/motivators/new">
<Button>Créer ma première session</Button>
</Link>
</Card>
) : (
<div className="space-y-8">
{/* My Sessions */}
{ownedSessions.length > 0 && (
<section>
<h2 className="text-lg font-semibold text-foreground mb-4">
📁 Mes sessions ({ownedSessions.length})
</h2>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{ownedSessions.map((s) => (
<SessionCard key={s.id} session={s} />
))}
</div>
</section>
)}
{/* Shared Sessions */}
{sharedSessions.length > 0 && (
<section>
<h2 className="text-lg font-semibold text-foreground mb-4">
🤝 Sessions partagées avec moi ({sharedSessions.length})
</h2>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{sharedSessions.map((s) => (
<SessionCard key={s.id} session={s} />
))}
</div>
</section>
)}
</div>
)}
</main>
);
}
type SessionWithMeta = Awaited<ReturnType<typeof getMotivatorSessionsByUserId>>[number];
function SessionCard({ session: s }: { session: SessionWithMeta }) {
return (
<Link href={`/motivators/${s.id}`}>
<Card hover className="h-full p-6">
<div className="mb-4 flex items-start justify-between">
<div className="flex-1 min-w-0">
<h3 className="font-semibold text-foreground line-clamp-1">
{s.title}
</h3>
<div className="mt-1">
<CollaboratorDisplay collaborator={s.resolvedParticipant} size="sm" />
</div>
{!s.isOwner && (
<p className="text-xs text-muted mt-1">
Par {s.user.name || s.user.email}
</p>
)}
</div>
<div className="flex items-center gap-2">
{!s.isOwner && (
<Badge variant={s.role === 'EDITOR' ? 'primary' : 'warning'}>
{s.role === 'EDITOR' ? '✏️' : '👁️'}
</Badge>
)}
<span className="text-2xl">🎯</span>
</div>
</div>
<CardContent className="p-0">
<div className="flex flex-wrap gap-2 mb-4">
<Badge variant="primary">
{s._count.cards} motivations
</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>
);
}

View File

@@ -39,7 +39,7 @@ export default function Home() {
{/* Moving Motivators Workshop Card */}
<WorkshopCard
href="/motivators"
href="/sessions"
icon="🎯"
title="Moving Motivators"
tagline="Révélez ce qui motive vraiment"

View File

@@ -113,3 +113,4 @@ export function PasswordForm() {
);
}

View File

@@ -82,3 +82,4 @@ export function ProfileForm({ initialData }: ProfileFormProps) {
);
}

View File

@@ -29,3 +29,4 @@ export function Avatar({
);
}

View File

@@ -80,3 +80,4 @@ export function CollaboratorDisplay({
);
}

View File

@@ -21,3 +21,4 @@ export function getGravatarUrl(
return `https://www.gravatar.com/avatar/${hash}?d=${fallback}&s=${size}`;
}