2024-11-04 23:55:08 +01:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { Category } from "@/lib/types";
|
|
|
|
|
import ScriptAccordion from "./ScriptAccordion";
|
|
|
|
|
|
|
|
|
|
const Sidebar = ({
|
|
|
|
|
items,
|
|
|
|
|
selectedScript,
|
|
|
|
|
setSelectedScript,
|
|
|
|
|
}: {
|
|
|
|
|
items: Category[];
|
|
|
|
|
selectedScript: string | null;
|
|
|
|
|
setSelectedScript: (script: string | null) => void;
|
|
|
|
|
}) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex min-w-72 flex-col sm:max-w-72">
|
|
|
|
|
<div className="flex items-end justify-between pb-4">
|
|
|
|
|
<h1 className="text-xl font-bold">Categories</h1>
|
|
|
|
|
<p className="text-xs italic text-muted-foreground">
|
2024-11-09 20:06:54 +01:00
|
|
|
{items.reduce((acc, category) => acc + category.scripts.length, 0)}{" "}
|
2024-11-04 23:55:08 +01:00
|
|
|
Total scripts
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="rounded-lg">
|
2024-11-09 20:06:54 +01:00
|
|
|
<ScriptAccordion
|
|
|
|
|
items={items}
|
|
|
|
|
selectedScript={selectedScript}
|
|
|
|
|
setSelectedScript={setSelectedScript}
|
|
|
|
|
/>
|
2024-11-04 23:55:08 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Sidebar;
|