From d6dd76021226802adf5295b3243d6f2ae4fa5cc2 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sun, 10 Mar 2024 17:59:58 +0000
Subject: refactor: Move all components to the top level directory

---
 .../components/dashboard/bookmarks/Bookmarks.tsx   | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 packages/web/components/dashboard/bookmarks/Bookmarks.tsx

(limited to 'packages/web/components/dashboard/bookmarks/Bookmarks.tsx')

diff --git a/packages/web/components/dashboard/bookmarks/Bookmarks.tsx b/packages/web/components/dashboard/bookmarks/Bookmarks.tsx
new file mode 100644
index 00000000..1ad3670c
--- /dev/null
+++ b/packages/web/components/dashboard/bookmarks/Bookmarks.tsx
@@ -0,0 +1,32 @@
+import { redirect } from "next/navigation";
+import BookmarksGrid from "./BookmarksGrid";
+import { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks";
+import { api } from "@/server/api/client";
+import { getServerAuthSession } from "@/server/auth";
+
+export default async function Bookmarks({
+  favourited,
+  archived,
+  title,
+  showDivider,
+}: ZGetBookmarksRequest & { title: string; showDivider?: boolean }) {
+  const session = await getServerAuthSession();
+  if (!session) {
+    redirect("/");
+  }
+
+  const query = {
+    favourited,
+    archived,
+  };
+
+  const bookmarks = await api.bookmarks.getBookmarks(query);
+
+  return (
+    <div className="container flex flex-col gap-3">
+      <div className="text-2xl">{title}</div>
+      {showDivider && <hr />}
+      <BookmarksGrid query={query} bookmarks={bookmarks.bookmarks} />
+    </div>
+  );
+}
-- 
cgit v1.2.3-70-g09d2

