Sidebar.tsx 2.29 KB
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import { BookOpen, Database, FileText } from "lucide-react";
import { cn } from "@/lib/utils";

export default function Sidebar() {
  const pathname = usePathname();

  return (
    <aside className="w-16 flex flex-col items-center py-6 bg-slate-900 text-slate-400 shrink-0">
      <div className="w-10 h-10 bg-blue-600 rounded-xl flex items-center justify-center text-white mb-8 shadow-lg shadow-blue-500/20">
        <BookOpen className="w-6 h-6 fill-current" />
      </div>
      <nav className="flex-1 flex flex-col gap-6">
        <Link
          href="/"
          className={cn(
            "p-2 rounded-lg transition relative group",
            pathname === "/" ? "bg-slate-800 text-white" : "hover:bg-slate-800 hover:text-slate-200"
          )}
          title="Wiki 原始文件"
        >
          <FileText className="w-5 h-5" />
          <span className="absolute left-full ml-2 px-2 py-1 bg-slate-800 text-white text-xs rounded opacity-0 group-hover:opacity-100 pointer-events-none whitespace-nowrap z-50">
            Wiki 原始文件
          </span>
        </Link>
        <Link
          href="/wiki-repo"
          className={cn(
            "p-2 rounded-lg transition relative group",
            pathname === "/wiki-repo" ? "bg-slate-800 text-white" : "hover:bg-slate-800 hover:text-slate-200"
          )}
          title="Wiki 知识库"
        >
          <BookOpen className="w-5 h-5" />
          <span className="absolute left-full ml-2 px-2 py-1 bg-slate-800 text-white text-xs rounded opacity-0 group-hover:opacity-100 pointer-events-none whitespace-nowrap z-50">
            Wiki 知识库
          </span>
        </Link>
        <Link
          href="/rag"
          className={cn(
            "p-2 rounded-lg transition relative group",
            pathname === "/rag" ? "bg-slate-800 text-white" : "hover:bg-slate-800 hover:text-slate-200"
          )}
          title="RAG 工作台"
        >
          <Database className="w-5 h-5" />
          <span className="absolute left-full ml-2 px-2 py-1 bg-slate-800 text-white text-xs rounded opacity-0 group-hover:opacity-100 pointer-events-none whitespace-nowrap z-50">
            RAG 工作台
          </span>
        </Link>
      </nav>
    </aside>
  );
}