mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-20 21:48:33 +02:00
feat: Implement a new Sidebar component featuring dynamic navigation links, user session display, and logout functionality.
This commit is contained in:
1 parent
2fbe88be71
commit
90c38bca8b
1 file changed
+14
-5
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { LayoutGrid, Camera, FileDown, Settings, Package, BarChart3, LogOut, User as UserIcon } from "lucide-react";
|
import { LayoutGrid, Camera, FileDown, Settings, Package, BarChart3, LogOut, User as UserIcon, Loader2 } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
@@ -83,10 +83,19 @@ export function Sidebar() {
|
|||||||
<UserIcon className="w-4 h-4 text-[var(--accent)]" />
|
<UserIcon className="w-4 h-4 text-[var(--accent)]" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-[12px] font-bold text-[var(--text-primary)] truncate">{session?.user?.name || "Invité"}</p>
|
{session?.user ? (
|
||||||
<p className="text-[10px] uppercase font-black text-[var(--text-muted)] tracking-wider">
|
<>
|
||||||
{userRole === "admin" ? "Administrateur" : "Utilisateur"}
|
<p className="text-[12px] font-bold text-[var(--text-primary)] truncate">{session.user.name}</p>
|
||||||
</p>
|
<p className="text-[10px] uppercase font-black text-[var(--text-muted)] tracking-wider">
|
||||||
|
{userRole === "admin" ? "Administrateur" : "Utilisateur"}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Loader2 className="w-3 h-3 animate-spin text-[var(--accent)]" />
|
||||||
|
<p className="text-[10px] text-[var(--text-muted)] animate-pulse">Session...</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user