From 75d315dda4232ee3b89abf054f0b6ee10105ffe3 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Fri, 1 Mar 2024 18:00:58 +0000
Subject: feature: Add support for creating and updating lists

---
 packages/web/app/dashboard/components/AllLists.tsx | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 packages/web/app/dashboard/components/AllLists.tsx

(limited to 'packages/web/app/dashboard/components/AllLists.tsx')

diff --git a/packages/web/app/dashboard/components/AllLists.tsx b/packages/web/app/dashboard/components/AllLists.tsx
new file mode 100644
index 00000000..6b5ca3b5
--- /dev/null
+++ b/packages/web/app/dashboard/components/AllLists.tsx
@@ -0,0 +1,41 @@
+"use client";
+
+import { api } from "@/lib/trpc";
+import { ScrollArea } from "@/components/ui/scroll-area";
+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-2 overflow-scroll text-sm font-medium">
+      <NewListModal />
+      <li className="flex justify-between py-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>
+  );
+}
-- 
cgit v1.2.3-70-g09d2

