"use client"; import { useState } from "react"; import Link from "next/link"; import { ChevronRight, ChevronDown, Search, X } from "lucide-react"; import { useSkills } from "@/lib/hooks"; import type { SkillSummary } from "@/lib/types"; export default function SkillsPage() { const { data, isLoading } = useSkills(); const [search, setSearch] = useState(""); const [collapsed, setCollapsed] = useState>(new Set()); const skills = data?.skills || []; const categories = [...new Set(skills.map((s) => s.category || "uncategorized"))].sort(); const filtered = search ? skills.filter((s) => s.name.toLowerCase().includes(search.toLowerCase()) || s.description.toLowerCase().includes(search.toLowerCase())) : skills; const grouped = categories .map((cat) => ({ category: cat, skills: filtered.filter((s) => (s.category || "uncategorized") === cat) })) .filter((g) => g.skills.length > 0); const toggle = (cat: string) => { setCollapsed((prev) => { const next = new Set(prev); next.has(cat) ? next.delete(cat) : next.add(cat); return next; }); }; return (

Skills

{skills.length}
setSearch(e.target.value)} placeholder="Filter..." className="w-full pl-9 pr-9 py-2.5 rounded-xl text-sm outline-none transition-colors" style={{ background: "var(--bg-raised)", border: "1px solid var(--border)", color: "var(--text-1)" }} /> {search && ( )}
{isLoading ? (
{[...Array(5)].map((_, i) =>
)}
) : (
{grouped.map(({ category, skills }) => { const isCollapsed = collapsed.has(category) && !search; return (
{!isCollapsed && skills.map((s) => (
{s.name}
{s.description}
))}
); })} {grouped.length === 0 && (

No skills match “{search}”

)}
)}
); }