diff options
| author | MohamedBassem <me@mbassem.com> | 2024-02-08 02:16:51 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-02-08 02:23:29 +0000 |
| commit | 2659da517aeec0fe955422dee76f7de292f1a591 (patch) | |
| tree | 5150d69d2e5b70aea2cad6adefc6e2511d0d29da /web/app/dashboard/bookmarks/components/LinksGrid.tsx | |
| parent | 7344f167edae95b2edd984ec1ae0ef5359d1e028 (diff) | |
| download | karakeep-2659da517aeec0fe955422dee76f7de292f1a591.tar.zst | |
[feature] Introduce a sidebar
Diffstat (limited to 'web/app/dashboard/bookmarks/components/LinksGrid.tsx')
| -rw-r--r-- | web/app/dashboard/bookmarks/components/LinksGrid.tsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/web/app/dashboard/bookmarks/components/LinksGrid.tsx b/web/app/dashboard/bookmarks/components/LinksGrid.tsx new file mode 100644 index 00000000..66f0d766 --- /dev/null +++ b/web/app/dashboard/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 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> + ); +} |
