mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 19:00:12 +00:00
remove icon in card view header (#8298)
This commit is contained in:
@@ -24,9 +24,11 @@ const FileNameFormatter = ({
|
|||||||
className={classnames('sf-metadata-ui cell-formatter-container file-name-formatter', className)}
|
className={classnames('sf-metadata-ui cell-formatter-container file-name-formatter', className)}
|
||||||
title={value}
|
title={value}
|
||||||
>
|
>
|
||||||
<div className="sf-metadata-file-icon-container">
|
{icon &&
|
||||||
<img className="sf-metadata-file-icon" src={icon} onError={onLoadError} alt='' />
|
<div className="sf-metadata-file-icon-container">
|
||||||
</div>
|
<img className="sf-metadata-file-icon" src={icon} onError={onLoadError} alt='' />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<span className="sf-metadata-file-name" onClick={onClickName}>{value}</span>
|
<span className="sf-metadata-file-name" onClick={onClickName}>{value}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -7,7 +7,7 @@ import { siteRoot, thumbnailDefaultSize } from '../../../utils/constants';
|
|||||||
import { getParentDirFromRecord, getFileMTimeFromRecord } from '../../utils/cell';
|
import { getParentDirFromRecord, getFileMTimeFromRecord } from '../../utils/cell';
|
||||||
import { checkIsDir } from '../../utils/row';
|
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 parentDir = useMemo(() => getParentDirFromRecord(record), [record]);
|
||||||
const isDir = useMemo(() => checkIsDir(record), [record]);
|
const isDir = useMemo(() => checkIsDir(record), [record]);
|
||||||
const className = useMemo(() => {
|
const className = useMemo(() => {
|
||||||
@@ -16,19 +16,20 @@ const FileName = ({ record, className: propsClassName, value, showThumbnail = tr
|
|||||||
}, [propsClassName, value]);
|
}, [propsClassName, value]);
|
||||||
|
|
||||||
const iconUrl = useMemo(() => {
|
const iconUrl = useMemo(() => {
|
||||||
|
if (hideIcon) return {};
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
const icon = Utils.getFolderIconUrl();
|
const icon = Utils.getFolderIconUrl();
|
||||||
return { iconUrl: icon, defaultIconUrl: icon };
|
return { iconUrl: icon, defaultIconUrl: icon };
|
||||||
}
|
}
|
||||||
const defaultIconUrl = Utils.getFileIconUrl(value);
|
const defaultIconUrl = Utils.getFileIconUrl(value);
|
||||||
if (Utils.imageCheck(value) && showThumbnail) {
|
if (Utils.imageCheck(value)) {
|
||||||
const path = Utils.encodePath(Utils.joinPath(parentDir, value));
|
const path = Utils.encodePath(Utils.joinPath(parentDir, value));
|
||||||
const repoID = window.sfMetadataStore.repoId;
|
const repoID = window.sfMetadataStore.repoId;
|
||||||
const thumbnail = `${siteRoot}thumbnail/${repoID}/${thumbnailDefaultSize}${path}?mtime=${getFileMTimeFromRecord(record)}`;
|
const thumbnail = `${siteRoot}thumbnail/${repoID}/${thumbnailDefaultSize}${path}?mtime=${getFileMTimeFromRecord(record)}`;
|
||||||
return { iconUrl: thumbnail, defaultIconUrl };
|
return { iconUrl: thumbnail, defaultIconUrl };
|
||||||
}
|
}
|
||||||
return { iconUrl: defaultIconUrl, defaultIconUrl };
|
return { iconUrl: defaultIconUrl, defaultIconUrl };
|
||||||
}, [isDir, value, parentDir, record, showThumbnail]);
|
}, [isDir, hideIcon, value, parentDir, record]);
|
||||||
|
|
||||||
return (<FileNameFormatter { ...params } className={className} value={value} onClickName={onFileNameClick} { ...iconUrl } />);
|
return (<FileNameFormatter { ...params } className={className} value={value} onClickName={onFileNameClick} { ...iconUrl } />);
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ const FileName = ({ record, className: propsClassName, value, showThumbnail = tr
|
|||||||
|
|
||||||
FileName.propTypes = {
|
FileName.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
|
hideIcon: PropTypes.bool,
|
||||||
record: PropTypes.object.isRequired,
|
record: PropTypes.object.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
onFileNameClick: PropTypes.func,
|
onFileNameClick: PropTypes.func,
|
||||||
|
@@ -84,7 +84,14 @@ const CardItem = ({
|
|||||||
<img loading="lazy" className="sf-metadata-card-item-image" ref={imgRef} src={imageURLs.URL} onError={onLoadError} alt="" />
|
<img loading="lazy" className="sf-metadata-card-item-image" ref={imgRef} src={imageURLs.URL} onError={onLoadError} alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div className="sf-metadata-card-item-text-container">
|
<div className="sf-metadata-card-item-text-container">
|
||||||
<Formatter value={fileNameValue} column={fileNameColumn} record={record} showThumbnail={false} onFileNameClick={handleFilenameClick} tagsData={tagsData} />
|
<Formatter
|
||||||
|
value={fileNameValue}
|
||||||
|
column={fileNameColumn}
|
||||||
|
record={record}
|
||||||
|
hideIcon={true}
|
||||||
|
onFileNameClick={handleFilenameClick}
|
||||||
|
tagsData={tagsData}
|
||||||
|
/>
|
||||||
<div className="sf-metadata-card-last-modified-info">
|
<div className="sf-metadata-card-last-modified-info">
|
||||||
<Formatter value={modifierValue} column={modifierColumn} record={record} tagsData={tagsData} />
|
<Formatter value={modifierValue} column={modifierColumn} record={record} tagsData={tagsData} />
|
||||||
<Formatter value={mtimeValue} format="relativeTime" column={mtimeColumn} record={record} tagsData={tagsData} />
|
<Formatter value={mtimeValue} format="relativeTime" column={mtimeColumn} record={record} tagsData={tagsData} />
|
||||||
|
Reference in New Issue
Block a user