mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-26 13:16:24 +00:00
fix(frontend): show media icons for APNG, AVIF and WebM (#6089)
This commit is contained in:
parent
c714629faf
commit
d0e4d3525c
@ -234,6 +234,8 @@ export function getFileIcon(filepath: string, className?: string) {
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "png":
|
||||
case "apng":
|
||||
case "avif":
|
||||
case "gif":
|
||||
case "bmp":
|
||||
case "tiff":
|
||||
@ -254,6 +256,7 @@ export function getFileIcon(filepath: string, className?: string) {
|
||||
case "mp4":
|
||||
case "mov":
|
||||
case "m4v":
|
||||
case "webm":
|
||||
return <FilePlayIcon className={className} />;
|
||||
default:
|
||||
if (isCodeFile) {
|
||||
|
||||
17
frontend/tests/unit/core/utils/files.test.ts
Normal file
17
frontend/tests/unit/core/utils/files.test.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { expect, test } from "@rstest/core";
|
||||
import { FilePlayIcon, FileTextIcon, ImageIcon } from "lucide-react";
|
||||
|
||||
import { canBrowserPreviewFile, getFileIcon } from "@/core/utils/files";
|
||||
|
||||
test.each([
|
||||
["animation.apng", ImageIcon],
|
||||
["photo.avif", ImageIcon],
|
||||
["clip.webm", FilePlayIcon],
|
||||
])("uses a media icon for previewable %s", (filepath, icon) => {
|
||||
expect(canBrowserPreviewFile(filepath)).toBe(true);
|
||||
expect(getFileIcon(filepath).type).toBe(icon);
|
||||
});
|
||||
|
||||
test("keeps the document icon for an unknown extension", () => {
|
||||
expect(getFileIcon("data.unknown").type).toBe(FileTextIcon);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user