diff options
Diffstat (limited to 'apps/web/components/dashboard')
3 files changed, 10 insertions, 26 deletions
diff --git a/apps/web/components/dashboard/bookmarks/TextCard.tsx b/apps/web/components/dashboard/bookmarks/TextCard.tsx index 74b3e8e5..b18efc3d 100644 --- a/apps/web/components/dashboard/bookmarks/TextCard.tsx +++ b/apps/web/components/dashboard/bookmarks/TextCard.tsx @@ -1,10 +1,10 @@ "use client"; import { useState } from "react"; +import { MarkdownComponent } from "@/components/ui/markdown-component"; import { api } from "@/lib/trpc"; import { bookmarkLayoutSwitch } from "@/lib/userLocalSettings/bookmarksLayout"; import { cn } from "@/lib/utils"; -import Markdown from "react-markdown"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; import { isBookmarkStillTagging } from "@hoarder/shared-react/utils/bookmarkUtils"; @@ -52,11 +52,7 @@ export default function TextCard({ /> <BookmarkLayoutAdaptingCard title={bookmark.title} - content={ - <Markdown className="prose dark:prose-invert"> - {bookmarkedText.text} - </Markdown> - } + content={<MarkdownComponent>{bookmarkedText.text}</MarkdownComponent>} footer={null} wrapTags={true} bookmark={bookmark} diff --git a/apps/web/components/dashboard/preview/TextContentSection.tsx b/apps/web/components/dashboard/preview/TextContentSection.tsx index eba7d28b..2df1e964 100644 --- a/apps/web/components/dashboard/preview/TextContentSection.tsx +++ b/apps/web/components/dashboard/preview/TextContentSection.tsx @@ -1,5 +1,5 @@ +import { MarkdownComponent } from "@/components/ui/markdown-component"; import { ScrollArea } from "@radix-ui/react-scroll-area"; -import Markdown from "react-markdown"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; @@ -9,9 +9,7 @@ export function TextContentSection({ bookmark }: { bookmark: ZBookmark }) { } return ( <ScrollArea className="h-full"> - <Markdown className="prose mx-auto dark:prose-invert"> - {bookmark.content.text} - </Markdown> + <MarkdownComponent>{bookmark.content.text}</MarkdownComponent> </ScrollArea> ); } diff --git a/apps/web/components/dashboard/settings/AddApiKey.tsx b/apps/web/components/dashboard/settings/AddApiKey.tsx index 15a78d56..34fd2df7 100644 --- a/apps/web/components/dashboard/settings/AddApiKey.tsx +++ b/apps/web/components/dashboard/settings/AddApiKey.tsx @@ -5,6 +5,7 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; +import CopyBtn from "@/components/ui/copy-button"; import { Dialog, DialogClose, @@ -28,19 +29,10 @@ import { Input } from "@/components/ui/input"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; import { zodResolver } from "@hookform/resolvers/zod"; -import { Check, Copy } from "lucide-react"; import { useForm } from "react-hook-form"; import { z } from "zod"; function ApiKeySuccess({ apiKey }: { apiKey: string }) { - const [isCopied, setCopied] = useState(false); - - const onCopy = () => { - navigator.clipboard.writeText(apiKey); - setCopied(true); - setTimeout(() => setCopied(false), 2000); - }; - return ( <div> <div className="py-4"> @@ -49,13 +41,11 @@ function ApiKeySuccess({ apiKey }: { apiKey: string }) { </div> <div className="flex space-x-2 pt-2"> <Input value={apiKey} readOnly /> - <Button onClick={onCopy}> - {!isCopied ? ( - <Copy className="size-4" /> - ) : ( - <Check className="size-4" /> - )} - </Button> + <CopyBtn + getStringToCopy={() => { + return apiKey; + }} + /> </div> </div> ); |
