From 3208dda3848ad739f54cebf44c423e2b68e85b2d Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 28 Feb 2024 20:45:28 +0000 Subject: feature: Add support for storing and previewing raw notes --- .../dashboard/bookmarks/components/TextCard.tsx | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 packages/web/app/dashboard/bookmarks/components/TextCard.tsx (limited to 'packages/web/app/dashboard/bookmarks/components/TextCard.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/TextCard.tsx b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx new file mode 100644 index 00000000..7ee1a90b --- /dev/null +++ b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx @@ -0,0 +1,62 @@ +"use client"; + +import { ZBookmark } from "@/lib/types/api/bookmarks"; +import BookmarkOptions from "./BookmarkOptions"; +import { api } from "@/lib/trpc"; +import { Star } from "lucide-react"; +import { cn } from "@/lib/utils"; +import TagList from "./TagList"; + +export default function TextCard({ + bookmark: initialData, + className, +}: { + bookmark: ZBookmark; + className: string; +}) { + const { data: bookmark } = api.bookmarks.getBookmark.useQuery( + { + bookmarkId: initialData.id, + }, + { + initialData, + }, + ); + const bookmarkedText = bookmark.content; + if (bookmarkedText.type != "text") { + throw new Error("Unexpected bookmark type"); + } + + const numWords = bookmarkedText.text.split(" ").length; + + return ( +
12 ? "row-span-2 h-96" : "row-span-1 h-40", + ), + )} + > +

+ {bookmarkedText.text} +

+
+ +
+
+
+ {bookmark.favourited && ( + + )} +
+ +
+
+ ); +} -- cgit v1.2.3-70-g09d2