From 08a5694e451218f1bcb2ad9eb42fd93250afbb96 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 9 Feb 2024 01:50:35 +0000 Subject: [refactor] Extract the bookmark model to be a high level model to support other type of bookmarks --- .../bookmarks/components/BookmarksGrid.tsx | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/web/app/dashboard/bookmarks/components/BookmarksGrid.tsx (limited to 'packages/web/app/dashboard/bookmarks/components/BookmarksGrid.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/BookmarksGrid.tsx b/packages/web/app/dashboard/bookmarks/components/BookmarksGrid.tsx new file mode 100644 index 00000000..2b6b19b6 --- /dev/null +++ b/packages/web/app/dashboard/bookmarks/components/BookmarksGrid.tsx @@ -0,0 +1,27 @@ +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; +import { authOptions } from "@/lib/auth"; +import { getBookmarks } from "@/lib/services/bookmarks"; +import LinkCard from "./LinkCard"; +import { ZBookmark } from "@/lib/types/api/bookmarks"; + +function renderBookmark(bookmark: ZBookmark) { + switch (bookmark.content.type) { + case "link": + return ; + } +} + +export default async function BookmarksGrid() { + const session = await getServerSession(authOptions); + if (!session) { + redirect("/"); + } + const bookmarks = await getBookmarks(session.user.id); + + return ( +
+ {bookmarks.map((b) => renderBookmark(b))} +
+ ); +} -- cgit v1.2.3-70-g09d2