import { NodeViewProps, NodeViewWrapper } from "@tiptap/react"; import { Group, Text, Paper, ActionIcon, Loader } from "@mantine/core"; import { getFileUrl } from "@/lib/config.ts"; import { IconDownload, IconPaperclip } from "@tabler/icons-react"; import { useHover } from "@mantine/hooks"; import { formatBytes } from "@/lib"; import { useTranslation } from "react-i18next"; export default function AttachmentView(props: NodeViewProps) { const { t } = useTranslation(); const { node, selected } = props; const { url, name, size } = node.attrs; const { hovered, ref } = useHover(); return ( {url ? ( ) : ( )} {url ? name : t("Uploading {{name}}", { name })} {formatBytes(size)} {url && (selected || hovered) && ( )} ); }