"use client"; import { useState } from "react"; import { Folder, Search, X } from "lucide-react"; import type { Project } from "./types"; interface Props { projects: Project[]; loading: boolean; selectedId: string | null; onSelect: (id: string | null) => void; } export function ProjectPicker({ projects, loading, selectedId, onSelect }: Props) { const [search, setSearch] = useState(""); const q = search.toLowerCase().trim(); const filtered = q ? projects.filter((p) => p.name.toLowerCase().includes(q)) : projects; return ( <>
setSearch(e.target.value)} className="flex-1 bg-transparent text-sm text-gray-700 placeholder:text-gray-400 outline-none" autoFocus /> {search && ( )}
{loading ? (
{[65, 45, 80, 55, 70].map((w, i) => (
))}
) : filtered.length === 0 ? (

{q ? "No matches found" : "No projects yet"}

) : (

Projects

{filtered.map((project) => { const isSelected = selectedId === project.id; return ( ); })}
)}
); }