fix(webui): unify file reference icons across preview surfaces

This commit is contained in:
Xubin Ren committed 2026-09-24 15:17:05 +08:00
1 parent f8bfcf4250
commit ebb29759c0
4 files changed
+111 -127

No files matched your search

+5 -7
View File
@@ -1,5 +1,4 @@
import { useState, type ReactNode } from "react";
import { FileIcon, ImageIcon, PlaySquare } from "lucide-react";
import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
@@ -7,6 +6,7 @@ import type { UIMediaAttachment } from "@/lib/types";
import { ImageThumbnail } from "@/components/ImageGallery";
import { ImageLightbox } from "@/components/ImageLightbox";
import { useRegisterInlineImage } from "@/components/InlineImageContext";
import { FileReferenceIcon, fileKindForPath } from "@/components/FileReferenceChip";
interface AttachmentTileProps {
attachment: UIMediaAttachment;
@@ -58,14 +58,12 @@ export function AttachmentTile({ attachment, className, inline = false, variant
);
}
const Icon = attachment.kind === "video"
? PlaySquare
: attachment.kind === "image"
? ImageIcon
: FileIcon;
const fileKind = attachment.kind === "file"
? fileKindForPath(attachment.name || attachment.url || "")
: attachment.kind;
const body = (
<>
<Icon className="h-4 w-4 flex-none" aria-hidden />
<FileReferenceIcon kind={fileKind} className="size-4" />
<span className="min-w-0 truncate">{attachment.name ?? label}</span>
</>
);