MCPcopy
hub / github.com/shareAI-lab/learn-claude-code / Sidebar

Function Sidebar

web/src/components/layout/sidebar.tsx:17–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15};
16
17export function Sidebar() {
18 const pathname = usePathname();
19 const locale = pathname.split("/")[1] || "en";
20 const t = useTranslations("sessions");
21 const tLayer = useTranslations("layer_labels");
22
23 return (
24 <nav className="hidden w-56 shrink-0 md:block">
25 <div className="sticky top-[calc(3.5rem+2rem)] space-y-5">
26 {LAYERS.map((layer) => (
27 <div key={layer.id}>
28 <div className="flex items-center gap-1.5 pb-1.5">
29 <span className={cn("h-2 w-2 rounded-full", LAYER_DOT_BG[layer.id])} />
30 <span className="text-[11px] font-semibold uppercase tracking-wider text-zinc-400 dark:text-zinc-500">
31 {tLayer(layer.id)}
32 </span>
33 </div>
34 <ul className="space-y-0.5">
35 {layer.versions.map((vId) => {
36 const meta = VERSION_META[vId];
37 const href = `/${locale}/${vId}`;
38 const isActive =
39 pathname === href ||
40 pathname === `${href}/` ||
41 pathname.startsWith(`${href}/diff`);
42
43 return (
44 <li key={vId}>
45 <Link
46 href={href}
47 className={cn(
48 "block rounded-md px-2.5 py-1.5 text-sm transition-colors",
49 isActive
50 ? "bg-zinc-100 font-medium text-zinc-900 dark:bg-zinc-800 dark:text-white"
51 : "text-zinc-500 hover:bg-zinc-50 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"
52 )}
53 >
54 <span className="font-mono text-xs">{vId}</span>
55 <span className="ml-1.5">{t(vId) || meta?.title}</span>
56 </Link>
57 </li>
58 );
59 })}
60 </ul>
61 </div>
62 ))}
63 </div>
64 </nav>
65 );
66}

Callers

nothing calls this directly

Calls 2

useTranslationsFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected