1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-04 16:49:40 +00:00

change file icon size to 256 (#6490)

This commit is contained in:
Michael An 2024-08-05 21:04:31 +08:00 committed by GitHub
parent 5fbc14e089
commit 20cf8b7f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 19 additions and 31 deletions

View File

@ -103,7 +103,7 @@ class FileDetails extends React.Component {
let { dirent, repoID, path } = this.props; let { dirent, repoID, path } = this.props;
const smallIconUrl = Utils.getFileIconUrl(dirent.name); const smallIconUrl = Utils.getFileIconUrl(dirent.name);
let bigIconUrl = Utils.getFileIconUrl(dirent.name, 192); let bigIconUrl = Utils.getFileIconUrl(dirent.name);
const isImg = Utils.imageCheck(dirent.name); const isImg = Utils.imageCheck(dirent.name);
const isVideo = Utils.videoCheck(dirent.name); const isVideo = Utils.videoCheck(dirent.name);
if (isImg || (enableVideoThumbnail && isVideo)) { if (isImg || (enableVideoThumbnail && isVideo)) {

View File

@ -40,7 +40,7 @@ class SearchedListItem extends React.Component {
render() { render() {
let { item, currentItem } = this.props; let { item, currentItem } = this.props;
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(false); let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(false);
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name, 192); let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name);
let trClass = this.state.highlight ? 'tr-highlight' : ''; let trClass = this.state.highlight ? 'tr-highlight' : '';
if (currentItem) { if (currentItem) {
if (item.repo_id === currentItem.repo_id && item.path === currentItem.path) { if (item.repo_id === currentItem.repo_id && item.path === currentItem.path) {

View File

@ -39,7 +39,7 @@ class FileView extends React.Component {
} }
componentDidMount() { componentDidMount() {
const fileIcon = Utils.getFileIconUrl(fileName, 192); const fileIcon = Utils.getFileIconUrl(fileName);
document.getElementById('favicon').href = fileIcon; document.getElementById('favicon').href = fileIcon;
} }

View File

@ -23,7 +23,7 @@ class SearchResultItem extends React.Component {
render() { render() {
let item = this.props.item; let item = this.props.item;
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true); let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true);
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name, 192); let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name);
let showName = item.repo_name + '/' + item.link_content; let showName = item.repo_name + '/' + item.link_content;
showName = showName.endsWith('/') ? showName.slice(0, showName.length - 1) : showName; showName = showName.endsWith('/') ? showName.slice(0, showName.length - 1) : showName;

View File

@ -56,8 +56,7 @@ class SharedFileView extends React.Component {
}; };
componentDidMount() { componentDidMount() {
const fileIcon = Utils.getFileIconUrl(fileName);
const fileIcon = Utils.getFileIconUrl(fileName, 192);
document.getElementById('favicon').href = fileIcon; document.getElementById('favicon').href = fileIcon;
if (trafficOverLimit) { if (trafficOverLimit) {

View File

@ -204,8 +204,7 @@ class MarkdownEditor extends React.Component {
}; };
async componentDidMount() { async componentDidMount() {
const fileIcon = Utils.getFileIconUrl(fileName);
const fileIcon = Utils.getFileIconUrl(fileName, 192);
document.getElementById('favicon').href = fileIcon; document.getElementById('favicon').href = fileIcon;
// get file info // get file info

View File

@ -1,11 +1,6 @@
import { seafileAPI } from '../../utils/seafile-api'; import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils'; import { Utils } from '../../utils/utils';
const initFavicon = (fileName) => {
const fileIcon = Utils.getFileIconUrl(fileName, 192);
document.getElementById('favicon').href = fileIcon;
};
const getFileInfo = async (repoID, filePath) => { const getFileInfo = async (repoID, filePath) => {
const fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath); const fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath);
const { mtime, size, starred, permission, last_modifier_name: lastModifier, id } = fileInfoRes.data; const { mtime, size, starred, permission, last_modifier_name: lastModifier, id } = fileInfoRes.data;
@ -38,7 +33,8 @@ const setFileContent = async (downloadUrl) => {
}; };
export const getPlainOptions = async ({ fileName, filePath, repoID }) => { export const getPlainOptions = async ({ fileName, filePath, repoID }) => {
initFavicon(fileName); const fileIcon = Utils.getFileIconUrl(fileName);
document.getElementById('favicon').href = fileIcon;
const fileInfo = await getFileInfo(repoID, filePath); const fileInfo = await getFileInfo(repoID, filePath);
const downloadUrl = await getFileDownloadUrl(repoID, filePath); const downloadUrl = await getFileDownloadUrl(repoID, filePath);
const markdownContent = await setFileContent(downloadUrl); const markdownContent = await setFileContent(downloadUrl);

View File

@ -31,7 +31,7 @@ export default class SdocEditor extends React.Component {
if (suffix) { if (suffix) {
docName = docName + suffix; docName = docName + suffix;
} }
const fileIcon = Utils.getFileIconUrl(docName, 192); const fileIcon = Utils.getFileIconUrl(docName);
document.getElementById('favicon').href = fileIcon; document.getElementById('favicon').href = fileIcon;
}; };

View File

@ -28,7 +28,7 @@ class ResultsItem extends React.Component {
let item = this.props.item; let item = this.props.item;
let linkContent = decodeURI(item.fullpath).substring(1); let linkContent = decodeURI(item.fullpath).substring(1);
let folderIconUrl = linkContent ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true); let folderIconUrl = linkContent ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true);
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name, 192); let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name);
if (item.thumbnail_url !== '') { if (item.thumbnail_url !== '') {
fileIconUrl = item.thumbnail_url; fileIconUrl = item.thumbnail_url;

View File

@ -959,7 +959,7 @@ class GridItem extends React.Component {
<a href={fileURL} className="grid-file-img-link d-block" onClick={this.handleFileClick}> <a href={fileURL} className="grid-file-img-link d-block" onClick={this.handleFileClick}>
{thumbnailURL ? {thumbnailURL ?
<img className="thumbnail" src={thumbnailURL} alt="" /> : <img className="thumbnail" src={thumbnailURL} alt="" /> :
<img src={Utils.getFileIconUrl(item.file_name, 192)} alt="" width="96" height="96" /> <img src={Utils.getFileIconUrl(item.file_name)} alt="" width="96" height="96" />
} }
</a> </a>
<a href={fileURL} className="grid-file-name grid-file-name-link" onClick={this.handleFileClick}>{item.file_name}</a> <a href={fileURL} className="grid-file-name grid-file-name-link" onClick={this.handleFileClick}>{item.file_name}</a>

View File

@ -40,7 +40,7 @@ window.seafile = {
}; };
(function () { (function () {
const fileIcon = Utils.getFileIconUrl(docName, 192); const fileIcon = Utils.getFileIconUrl(docName);
document.getElementById('favicon').href = fileIcon; document.getElementById('favicon').href = fileIcon;
})(); })();

View File

@ -392,15 +392,13 @@ export const Utils = {
} }
return this.getFolderIconUrl(readonly, size, dirent.has_been_shared_out); return this.getFolderIconUrl(readonly, size, dirent.has_been_shared_out);
} else { } else {
return this.getFileIconUrl(dirent.name, size); return this.getFileIconUrl(dirent.name);
} }
}, },
getAdminTemplateDirentIcon: function (dirent, isBig) { getAdminTemplateDirentIcon: function (dirent) {
let size = this.isHiDPI() ? 48 : 24;
size = isBig ? 192 : size;
if (dirent.is_file) { if (dirent.is_file) {
return this.getFileIconUrl(dirent.obj_name, size); return this.getFileIconUrl(dirent.obj_name);
} else { } else {
return this.getFolderIconUrl(); return this.getFolderIconUrl();
} }
@ -414,22 +412,18 @@ export const Utils = {
return `${mediaUrl}img/folder${readonly ? '-read-only' : ''}${sharedOut ? '-shared-out' : ''}-${size}.png`; return `${mediaUrl}img/folder${readonly ? '-read-only' : ''}${sharedOut ? '-shared-out' : ''}-${size}.png`;
}, },
getFileIconUrl: function (filename, size) { getFileIconUrl: function (filename) {
if (!size) {
size = Utils.isHiDPI() ? 48 : 24;
}
size = size > 24 ? 192 : 24;
let file_ext = ''; let file_ext = '';
if (filename.lastIndexOf('.') == -1) { if (filename.lastIndexOf('.') == -1) {
return mediaUrl + 'img/file/' + size + '/' + this.FILEEXT_ICON_MAP['default']; return mediaUrl + 'img/file/256/' + this.FILEEXT_ICON_MAP['default'];
} else { } else {
file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase(); file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
} }
if (this.FILEEXT_ICON_MAP[file_ext]) { if (this.FILEEXT_ICON_MAP[file_ext]) {
return mediaUrl + 'img/file/' + size + '/' + this.FILEEXT_ICON_MAP[file_ext]; return mediaUrl + 'img/file/256/' + this.FILEEXT_ICON_MAP[file_ext];
} else { } else {
return mediaUrl + 'img/file/' + size + '/' + this.FILEEXT_ICON_MAP['default']; return mediaUrl + 'img/file/256/' + this.FILEEXT_ICON_MAP['default'];
} }
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

BIN
media/img/file/256/css.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
media/img/file/256/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
media/img/file/256/md.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
media/img/file/256/pdf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
media/img/file/256/pic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
media/img/file/256/ppt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
media/img/file/256/psd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
media/img/file/256/sdoc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
media/img/file/256/txt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
media/img/file/256/word.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB