diff options
Diffstat (limited to 'apps/web/components/dashboard/preview/AttachmentBox.tsx')
| -rw-r--r-- | apps/web/components/dashboard/preview/AttachmentBox.tsx | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/apps/web/components/dashboard/preview/AttachmentBox.tsx b/apps/web/components/dashboard/preview/AttachmentBox.tsx index 32939cb0..19622f8d 100644 --- a/apps/web/components/dashboard/preview/AttachmentBox.tsx +++ b/apps/web/components/dashboard/preview/AttachmentBox.tsx @@ -9,32 +9,18 @@ import { } from "@/components/ui/collapsible"; import FilePickerButton from "@/components/ui/file-picker-button"; import { toast } from "@/components/ui/use-toast"; +import { ASSET_TYPE_TO_ICON } from "@/lib/attachments"; import useUpload from "@/lib/hooks/upload-file"; import { useTranslation } from "@/lib/i18n/client"; -import { - Archive, - Camera, - ChevronsDownUp, - Download, - Image, - Paperclip, - Pencil, - Plus, - Trash2, - Video, -} from "lucide-react"; +import { ChevronsDownUp, Download, Pencil, Plus, Trash2 } from "lucide-react"; import { useAttachBookmarkAsset, useDetachBookmarkAsset, useReplaceBookmarkAsset, -} from "@hoarder/shared-react/hooks/bookmarks"; +} from "@hoarder/shared-react/hooks/assets"; import { getAssetUrl } from "@hoarder/shared-react/utils/assetUtils"; -import { - BookmarkTypes, - ZAssetType, - ZBookmark, -} from "@hoarder/shared/types/bookmarks"; +import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks"; import { humanFriendlyNameForAssertType, isAllowedToAttachAsset, @@ -43,17 +29,6 @@ import { export default function AttachmentBox({ bookmark }: { bookmark: ZBookmark }) { const { t } = useTranslation(); - const typeToIcon: Record<ZAssetType, React.ReactNode> = { - screenshot: <Camera className="size-4" />, - assetScreenshot: <Camera className="size-4" />, - fullPageArchive: <Archive className="size-4" />, - precrawledArchive: <Archive className="size-4" />, - bannerImage: <Image className="size-4" />, - video: <Video className="size-4" />, - bookmarkAsset: <Paperclip className="size-4" />, - unknown: <Paperclip className="size-4" />, - }; - const { mutate: attachAsset, isPending: isAttaching } = useAttachBookmarkAsset({ onSuccess: () => { @@ -124,7 +99,7 @@ export default function AttachmentBox({ bookmark }: { bookmark: ZBookmark }) { href={getAssetUrl(asset.id)} className="flex items-center gap-1" > - {typeToIcon[asset.assetType]} + {ASSET_TYPE_TO_ICON[asset.assetType]} <p>{humanFriendlyNameForAssertType(asset.assetType)}</p> </Link> <div className="flex gap-2"> |
