blob: 5b706cbea4fe9318877d8543b57dc0f6be772ba0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
"use client";
import { api } from "@/lib/trpc";
import SidebarItem from "./SidebarItem";
import LoadingSpinner from "@/components/ui/spinner";
import NewListModal, { useNewListModal } from "./NewListModal";
import { Plus } from "lucide-react";
import Link from "next/link";
export default function AllLists() {
const { data: lists } = api.lists.list.useQuery();
const { setOpen } = useNewListModal();
return (
<ul className="max-h-full gap-y-2 overflow-auto text-sm font-medium">
<NewListModal />
<li className="flex justify-between pb-2 font-bold">
<p>Lists</p>
<Link href="#" onClick={() => setOpen(true)}>
<Plus />
</Link>
</li>
{lists && lists.lists.length == 0 && <li>No lists</li>}
{lists ? (
lists.lists.map((l) => (
<SidebarItem
key={l.id}
logo={<span className="text-lg"> {l.icon}</span>}
name={l.name}
path={`/dashboard/lists/${l.id}`}
className="py-0.5"
/>
))
) : (
<LoadingSpinner />
)}
</ul>
);
}
|