aboutsummaryrefslogtreecommitdiffstats
path: root/web/app/bookmarks/components/LinksGrid.tsx
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-02-07 02:48:38 +0000
committerMohamedBassem <me@mbassem.com>2024-02-07 02:48:38 +0000
commitdaebbf0154a290fb690ed94fca23377e0f739f53 (patch)
treed02b91093a976704a558971490cf2e6406c48b94 /web/app/bookmarks/components/LinksGrid.tsx
parentc3ecb08ec0addfb02e2da7e79e168ca17d38cd3b (diff)
downloadkarakeep-daebbf0154a290fb690ed94fca23377e0f739f53.tar.zst
[ui] Very first draft of the link grid
Diffstat (limited to 'web/app/bookmarks/components/LinksGrid.tsx')
-rw-r--r--web/app/bookmarks/components/LinksGrid.tsx21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/app/bookmarks/components/LinksGrid.tsx b/web/app/bookmarks/components/LinksGrid.tsx
new file mode 100644
index 00000000..83aaca80
--- /dev/null
+++ b/web/app/bookmarks/components/LinksGrid.tsx
@@ -0,0 +1,21 @@
+import { getServerSession } from "next-auth";
+import { redirect } from "next/navigation";
+import { authOptions } from "@/lib/auth";
+import { getLinks } from "@/lib/services/links";
+import LinkCard from "./LinkCard";
+
+export default async function LinksGrid() {
+ const session = await getServerSession(authOptions);
+ if (!session) {
+ redirect("/");
+ }
+ const links = await getLinks(session.user.id);
+
+ return (
+ <div className="container mx-auto mt-8 grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
+ {links.map((l) => (
+ <LinkCard key={l.id} link={l} />
+ ))}
+ </div>
+ );
+}