From 0e0157fe84b166d3851726703fabd1878f7294e4 Mon Sep 17 00:00:00 2001
From: Michael An <2331806369@qq.com>
Date: Sun, 12 Oct 2025 11:04:43 +0800
Subject: [PATCH] remove icon in card view header (#8298)
---
.../cell-formatter/file-name-formatter/index.js | 8 +++++---
.../src/metadata/components/cell-formatter/file-name.js | 8 +++++---
.../metadata/views/card/card-items/card-item/index.js | 9 ++++++++-
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/frontend/src/metadata/components/cell-formatter/file-name-formatter/index.js b/frontend/src/metadata/components/cell-formatter/file-name-formatter/index.js
index 121c6115e3..b9b8e643f4 100644
--- a/frontend/src/metadata/components/cell-formatter/file-name-formatter/index.js
+++ b/frontend/src/metadata/components/cell-formatter/file-name-formatter/index.js
@@ -24,9 +24,11 @@ const FileNameFormatter = ({
className={classnames('sf-metadata-ui cell-formatter-container file-name-formatter', className)}
title={value}
>
-
-

-
+ {icon &&
+
+

+
+ }
{value}
);
diff --git a/frontend/src/metadata/components/cell-formatter/file-name.js b/frontend/src/metadata/components/cell-formatter/file-name.js
index 968661e403..effc0f5982 100644
--- a/frontend/src/metadata/components/cell-formatter/file-name.js
+++ b/frontend/src/metadata/components/cell-formatter/file-name.js
@@ -7,7 +7,7 @@ import { siteRoot, thumbnailDefaultSize } from '../../../utils/constants';
import { getParentDirFromRecord, getFileMTimeFromRecord } from '../../utils/cell';
import { checkIsDir } from '../../utils/row';
-const FileName = ({ record, className: propsClassName, value, showThumbnail = true, onFileNameClick, ...params }) => {
+const FileName = ({ record, className: propsClassName, value, hideIcon = false, onFileNameClick, ...params }) => {
const parentDir = useMemo(() => getParentDirFromRecord(record), [record]);
const isDir = useMemo(() => checkIsDir(record), [record]);
const className = useMemo(() => {
@@ -16,19 +16,20 @@ const FileName = ({ record, className: propsClassName, value, showThumbnail = tr
}, [propsClassName, value]);
const iconUrl = useMemo(() => {
+ if (hideIcon) return {};
if (isDir) {
const icon = Utils.getFolderIconUrl();
return { iconUrl: icon, defaultIconUrl: icon };
}
const defaultIconUrl = Utils.getFileIconUrl(value);
- if (Utils.imageCheck(value) && showThumbnail) {
+ if (Utils.imageCheck(value)) {
const path = Utils.encodePath(Utils.joinPath(parentDir, value));
const repoID = window.sfMetadataStore.repoId;
const thumbnail = `${siteRoot}thumbnail/${repoID}/${thumbnailDefaultSize}${path}?mtime=${getFileMTimeFromRecord(record)}`;
return { iconUrl: thumbnail, defaultIconUrl };
}
return { iconUrl: defaultIconUrl, defaultIconUrl };
- }, [isDir, value, parentDir, record, showThumbnail]);
+ }, [isDir, hideIcon, value, parentDir, record]);
return ();
@@ -36,6 +37,7 @@ const FileName = ({ record, className: propsClassName, value, showThumbnail = tr
FileName.propTypes = {
value: PropTypes.string,
+ hideIcon: PropTypes.bool,
record: PropTypes.object.isRequired,
className: PropTypes.string,
onFileNameClick: PropTypes.func,
diff --git a/frontend/src/metadata/views/card/card-items/card-item/index.js b/frontend/src/metadata/views/card/card-items/card-item/index.js
index 18c6507ad0..4138373e6e 100644
--- a/frontend/src/metadata/views/card/card-items/card-item/index.js
+++ b/frontend/src/metadata/views/card/card-items/card-item/index.js
@@ -84,7 +84,14 @@ const CardItem = ({