fix(dsfr): graphique d'évolution en barres empilées + confirmation de déconnexion (web)
- évolution : courbes monotone (vagues sinusoïdales illisibles) remplacées par un histogramme empilé par émotion, bien plus lisible - ajoute une confirmation avant déconnexion dans l'en-tête web Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,6 @@ import {
|
|||||||
PieChart,
|
PieChart,
|
||||||
Pie,
|
Pie,
|
||||||
Cell,
|
Cell,
|
||||||
LineChart,
|
|
||||||
Line,
|
|
||||||
Legend,
|
Legend,
|
||||||
} from 'recharts';
|
} from 'recharts';
|
||||||
import type { ValueType, NameType } from 'recharts/types/component/DefaultTooltipContent';
|
import type { ValueType, NameType } from 'recharts/types/component/DefaultTooltipContent';
|
||||||
@@ -90,10 +88,10 @@ export default function EmotionChart({ data, type = 'repartition' }: EmotionChar
|
|||||||
return (
|
return (
|
||||||
<div style={{ width: '100%', height: '20rem' }}>
|
<div style={{ width: '100%', height: '20rem' }}>
|
||||||
<ResponsiveContainer width="100%" height={320}>
|
<ResponsiveContainer width="100%" height={320}>
|
||||||
<LineChart data={lineData}>
|
<BarChart data={lineData}>
|
||||||
<CartesianGrid strokeDasharray="3 3" style={{ opacity: 0.3 }} />
|
<CartesianGrid strokeDasharray="3 3" style={{ opacity: 0.3 }} />
|
||||||
<XAxis dataKey="date" tick={{ fontSize: 12 }} />
|
<XAxis dataKey="date" tick={{ fontSize: 12 }} />
|
||||||
<YAxis tick={{ fontSize: 12 }} />
|
<YAxis tick={{ fontSize: 12 }} allowDecimals={false} />
|
||||||
<Tooltip
|
<Tooltip
|
||||||
contentStyle={{
|
contentStyle={{
|
||||||
backgroundColor: 'rgba(255,255,255,0.95)',
|
backgroundColor: 'rgba(255,255,255,0.95)',
|
||||||
@@ -104,17 +102,14 @@ export default function EmotionChart({ data, type = 'repartition' }: EmotionChar
|
|||||||
/>
|
/>
|
||||||
<Legend />
|
<Legend />
|
||||||
{data.evolution.emotions.map((emotion) => (
|
{data.evolution.emotions.map((emotion) => (
|
||||||
<Line
|
<Bar
|
||||||
key={emotion.nom}
|
key={emotion.nom}
|
||||||
type="monotone"
|
|
||||||
dataKey={emotion.nom}
|
dataKey={emotion.nom}
|
||||||
stroke={emotion.couleur}
|
stackId="emotions"
|
||||||
strokeWidth={2}
|
fill={emotion.couleur}
|
||||||
dot={{ fill: emotion.couleur, r: 4 }}
|
|
||||||
activeDot={{ r: 6 }}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</LineChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname, useRouter } from "next/navigation";
|
||||||
import { useAuthStore } from "@/lib/auth-store";
|
import { useAuthStore } from "@/lib/auth-store";
|
||||||
|
import ConfirmDialog from "@/components/ui/ConfirmDialog";
|
||||||
|
|
||||||
interface NavLink {
|
interface NavLink {
|
||||||
href: string;
|
href: string;
|
||||||
@@ -11,9 +13,17 @@ interface NavLink {
|
|||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
const router = useRouter();
|
||||||
const { user, token, logout } = useAuthStore();
|
const { user, token, logout } = useAuthStore();
|
||||||
const isAuthenticated = !!token;
|
const isAuthenticated = !!token;
|
||||||
const isAdmin = user?.role?.nom === "administrateur";
|
const isAdmin = user?.role?.nom === "administrateur";
|
||||||
|
const [showLogoutConfirm, setShowLogoutConfirm] = useState(false);
|
||||||
|
|
||||||
|
const handleLogout = async () => {
|
||||||
|
setShowLogoutConfirm(false);
|
||||||
|
await logout();
|
||||||
|
router.push("/connexion");
|
||||||
|
};
|
||||||
|
|
||||||
const navLinks: NavLink[] = [
|
const navLinks: NavLink[] = [
|
||||||
{ href: "/", label: "Accueil" },
|
{ href: "/", label: "Accueil" },
|
||||||
@@ -83,7 +93,7 @@ export default function Header() {
|
|||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
className="fr-btn fr-icon-logout-box-r-line"
|
className="fr-btn fr-icon-logout-box-r-line"
|
||||||
onClick={() => logout()}
|
onClick={() => setShowLogoutConfirm(true)}
|
||||||
>
|
>
|
||||||
Déconnexion
|
Déconnexion
|
||||||
</button>
|
</button>
|
||||||
@@ -155,6 +165,15 @@ export default function Header() {
|
|||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ConfirmDialog
|
||||||
|
isOpen={showLogoutConfirm}
|
||||||
|
title="Déconnexion"
|
||||||
|
message="Voulez-vous vraiment vous déconnecter de votre compte CESIZen ?"
|
||||||
|
confirmLabel="Se déconnecter"
|
||||||
|
cancelLabel="Annuler"
|
||||||
|
onConfirm={handleLogout}
|
||||||
|
onClose={() => setShowLogoutConfirm(false)}
|
||||||
|
/>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user