import { ActionButton } from "@/components/ui/action-button"; import { toast } from "@/components/ui/use-toast"; import { cn } from "@/lib/utils"; import { Trash2 } from "lucide-react"; import { useDeleteHighlight } from "@karakeep/shared-react/hooks/highlights"; import { ZHighlight } from "@karakeep/shared/types/highlights"; import { HIGHLIGHT_COLOR_MAP } from "../preview/highlights"; export default function HighlightCard({ highlight, clickable, className, readOnly, }: { highlight: ZHighlight; clickable: boolean; className?: string; readOnly: boolean; }) { const { mutate: deleteHighlight, isPending: isDeleting } = useDeleteHighlight( { onSuccess: () => { toast({ description: "Highlight has been deleted!", }); }, onError: () => { toast({ description: "Something went wrong", variant: "destructive", }); }, }, ); const onBookmarkClick = () => { document .querySelector(`[data-highlight-id="${highlight.id}"]`) ?.scrollIntoView({ behavior: "smooth", block: "center", }); }; const Wrapper = ({ className, children, }: { className?: string; children: React.ReactNode; }) => clickable ? ( ) : (
{highlight.note && ( {highlight.note} )}{highlight.text}