"use client"; import { ZBookmark } from "@/lib/types/api/bookmarks"; import BookmarkOptions from "./BookmarkOptions"; import { api } from "@/lib/trpc"; import { Maximize2, Star } from "lucide-react"; import { cn } from "@/lib/utils"; import TagList from "./TagList"; import Markdown from "react-markdown"; import { useState } from "react"; import { BookmarkedTextViewer } from "./BookmarkedTextViewer"; import { Button } from "@/components/ui/button"; export default function TextCard({ bookmark: initialData, className, }: { bookmark: ZBookmark; className: string; }) { const { data: bookmark } = api.bookmarks.getBookmark.useQuery( { bookmarkId: initialData.id, }, { initialData, }, ); const [previewModalOpen, setPreviewModalOpen] = useState(false); 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 && ( )}
); }