From 4fae8f04f546d2b3f6053870d93385fa36af4742 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 9 Feb 2024 15:32:04 +0000 Subject: [ui] Adding the favourites and archive pages --- .../dashboard/bookmarks/components/Bookmarks.tsx | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 packages/web/app/dashboard/bookmarks/components/Bookmarks.tsx (limited to 'packages/web/app/dashboard/bookmarks/components/Bookmarks.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/Bookmarks.tsx b/packages/web/app/dashboard/bookmarks/components/Bookmarks.tsx new file mode 100644 index 00000000..6a9ffe1b --- /dev/null +++ b/packages/web/app/dashboard/bookmarks/components/Bookmarks.tsx @@ -0,0 +1,38 @@ +import { redirect } from "next/navigation"; +import BookmarksGrid from "./BookmarksGrid"; +import { authOptions } from "@/lib/auth"; +import { getServerSession } from "next-auth"; +import { getBookmarks } from "@/lib/services/bookmarks"; +import { ZGetBookmarksRequest } from "@/lib/types/api/bookmarks"; + +export default async function Bookmarks({ + favourited, + archived, + title, +}: ZGetBookmarksRequest & { title: string }) { + const session = await getServerSession(authOptions); + if (!session) { + redirect("/"); + } + const bookmarks = await getBookmarks(session.user.id, { + favourited, + archived, + }); + + if (bookmarks.length == 0) { + // TODO: This needs to be polished + return ( + <> +
{title}
+
No bookmarks
+ + ); + } + + return ( + <> +
{title}
+ + + ); +} -- cgit v1.2.3-70-g09d2