From 293869e1743c925519d938ebeeff033c773a1ec6 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 7 Feb 2024 16:57:47 +0000 Subject: [ui] Styling the bookmarks page --- web/app/bookmarks/components/AddLink.tsx | 15 +++--- web/app/bookmarks/components/LinkCard.tsx | 74 ++++++++++++++++++++++++------ web/app/bookmarks/components/LinksGrid.tsx | 2 +- 3 files changed, 71 insertions(+), 20 deletions(-) (limited to 'web/app') diff --git a/web/app/bookmarks/components/AddLink.tsx b/web/app/bookmarks/components/AddLink.tsx index 54cf9137..fab4db8b 100644 --- a/web/app/bookmarks/components/AddLink.tsx +++ b/web/app/bookmarks/components/AddLink.tsx @@ -1,6 +1,9 @@ "use client"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; import APIClient from "@/lib/api"; +import { Plus } from "lucide-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; @@ -11,6 +14,7 @@ export default function AddLink() { const bookmarkLink = async () => { const [_resp, error] = await APIClient.bookmarkLink(link); if (error) { + // TODO: Proper error handling alert(error.message); return; } @@ -18,8 +22,8 @@ export default function AddLink() { }; return ( -
- + - +
); } diff --git a/web/app/bookmarks/components/LinkCard.tsx b/web/app/bookmarks/components/LinkCard.tsx index 103f97ef..75973f7e 100644 --- a/web/app/bookmarks/components/LinkCard.tsx +++ b/web/app/bookmarks/components/LinkCard.tsx @@ -1,19 +1,67 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { + ImageCard, + ImageCardBody, + ImageCardFooter, + ImageCardTitle, +} from "@/components/ui/imageCard"; import { ZBookmarkedLink } from "@/lib/types/api/links"; +import { MoreHorizontal, Trash2 } from "lucide-react"; import Link from "next/link"; -export default async function LinkCard({ link }: { link: ZBookmarkedLink }) { +export function LinkOptions() { + // TODO: Implement deletion + return ( + + + + + + + + Delete + + + + ); +} + +export default function LinkCard({ link }: { link: ZBookmarkedLink }) { + const parsedUrl = new URL(link.url); + return ( - -
-

- {link.details?.favicon && ( - // eslint-disable-next-line @next/next/no-img-element - - )} - {link.details?.title ?? link.id} -

-

{link.details?.description ?? link.url}

-
- + + + + {link.details?.title ?? parsedUrl.host} + + + + +
+
+ + {parsedUrl.host} + +
+ +
+
+
); } diff --git a/web/app/bookmarks/components/LinksGrid.tsx b/web/app/bookmarks/components/LinksGrid.tsx index 83aaca80..4b82df98 100644 --- a/web/app/bookmarks/components/LinksGrid.tsx +++ b/web/app/bookmarks/components/LinksGrid.tsx @@ -12,7 +12,7 @@ export default async function LinksGrid() { const links = await getLinks(session.user.id); return ( -
+
{links.map((l) => ( ))} -- cgit v1.2.3-70-g09d2