Skip to content

Commit

Permalink
change file icon size to 256 (#6490)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 authored Aug 5, 2024
1 parent 5fbc14e commit 20cf8b7
Show file tree
Hide file tree
Showing 47 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/dirent-detail/file-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class FileDetails extends React.Component {
let { dirent, repoID, path } = this.props;

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 isVideo = Utils.videoCheck(dirent.name);
if (isImg || (enableVideoThumbnail && isVideo)) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/file-chooser/searched-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SearchedListItem extends React.Component {
render() {
let { item, currentItem } = this.props;
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' : '';
if (currentItem) {
if (item.repo_id === currentItem.repo_id && item.path === currentItem.path) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/file-view/file-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FileView extends React.Component {
}

componentDidMount() {
const fileIcon = Utils.getFileIconUrl(fileName, 192);
const fileIcon = Utils.getFileIconUrl(fileName);
document.getElementById('favicon').href = fileIcon;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/search/search-result-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SearchResultItem extends React.Component {
render() {
let item = this.props.item;
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;
showName = showName.endsWith('/') ? showName.slice(0, showName.length - 1) : showName;

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/shared-file-view/shared-file-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class SharedFileView extends React.Component {
};

componentDidMount() {

const fileIcon = Utils.getFileIconUrl(fileName, 192);
const fileIcon = Utils.getFileIconUrl(fileName);
document.getElementById('favicon').href = fileIcon;

if (trafficOverLimit) {
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/markdown-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ class MarkdownEditor extends React.Component {
};

async componentDidMount() {

const fileIcon = Utils.getFileIconUrl(fileName, 192);
const fileIcon = Utils.getFileIconUrl(fileName);
document.getElementById('favicon').href = fileIcon;

// get file info
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/pages/plain-markdown-editor/helper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { seafileAPI } from '../../utils/seafile-api';
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 fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath);
const { mtime, size, starred, permission, last_modifier_name: lastModifier, id } = fileInfoRes.data;
Expand Down Expand Up @@ -38,7 +33,8 @@ const setFileContent = async (downloadUrl) => {
};

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 downloadUrl = await getFileDownloadUrl(repoID, filePath);
const markdownContent = await setFileContent(downloadUrl);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/sdoc/sdoc-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class SdocEditor extends React.Component {
if (suffix) {
docName = docName + suffix;
}
const fileIcon = Utils.getFileIconUrl(docName, 192);
const fileIcon = Utils.getFileIconUrl(docName);
document.getElementById('favicon').href = fileIcon;
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/search/search-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ResultsItem extends React.Component {
let item = this.props.item;
let linkContent = decodeURI(item.fullpath).substring(1);
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 !== '') {
fileIconUrl = item.thumbnail_url;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/shared-dir-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ class GridItem extends React.Component {
<a href={fileURL} className="grid-file-img-link d-block" onClick={this.handleFileClick}>
{thumbnailURL ?
<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 href={fileURL} className="grid-file-name grid-file-name-link" onClick={this.handleFileClick}>{item.file_name}</a>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/shared-file-view-sdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ window.seafile = {
};

(function () {
const fileIcon = Utils.getFileIconUrl(docName, 192);
const fileIcon = Utils.getFileIconUrl(docName);
document.getElementById('favicon').href = fileIcon;
})();

Expand Down
20 changes: 7 additions & 13 deletions frontend/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,13 @@ export const Utils = {
}
return this.getFolderIconUrl(readonly, size, dirent.has_been_shared_out);
} else {
return this.getFileIconUrl(dirent.name, size);
return this.getFileIconUrl(dirent.name);
}
},

getAdminTemplateDirentIcon: function (dirent, isBig) {
let size = this.isHiDPI() ? 48 : 24;
size = isBig ? 192 : size;
getAdminTemplateDirentIcon: function (dirent) {
if (dirent.is_file) {
return this.getFileIconUrl(dirent.obj_name, size);
return this.getFileIconUrl(dirent.obj_name);
} else {
return this.getFolderIconUrl();
}
Expand All @@ -414,22 +412,18 @@ export const Utils = {
return `${mediaUrl}img/folder${readonly ? '-read-only' : ''}${sharedOut ? '-shared-out' : ''}-${size}.png`;
},

getFileIconUrl: function (filename, size) {
if (!size) {
size = Utils.isHiDPI() ? 48 : 24;
}
size = size > 24 ? 192 : 24;
getFileIconUrl: function (filename) {
let file_ext = '';
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 {
file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
}

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 {
return mediaUrl + 'img/file/' + size + '/' + this.FILEEXT_ICON_MAP['default'];
return mediaUrl + 'img/file/256/' + this.FILEEXT_ICON_MAP['default'];
}
},

Expand Down
Binary file removed media/img/file/192/excel.png
Binary file not shown.
Binary file removed media/img/file/192/file.png
Binary file not shown.
Binary file removed media/img/file/192/music.png
Binary file not shown.
Binary file removed media/img/file/192/pdf.png
Binary file not shown.
Binary file removed media/img/file/192/pic.png
Binary file not shown.
Binary file removed media/img/file/192/ppt.png
Binary file not shown.
Binary file removed media/img/file/192/sdoc.png
Binary file not shown.
Binary file removed media/img/file/192/sdoc_notification.ico
Binary file not shown.
Binary file removed media/img/file/192/txt.png
Binary file not shown.
Binary file removed media/img/file/192/video.png
Binary file not shown.
Binary file removed media/img/file/192/word.png
Binary file not shown.
Binary file removed media/img/file/24/excel.png
Binary file not shown.
Binary file removed media/img/file/24/file.png
Binary file not shown.
Binary file removed media/img/file/24/music.png
Binary file not shown.
Binary file removed media/img/file/24/pdf.png
Binary file not shown.
Binary file removed media/img/file/24/pic.png
Binary file not shown.
Binary file removed media/img/file/24/ppt.png
Binary file not shown.
Binary file removed media/img/file/24/sdoc.png
Binary file not shown.
Binary file removed media/img/file/24/txt.png
Binary file not shown.
Binary file removed media/img/file/24/video.png
Binary file not shown.
Binary file removed media/img/file/24/word.png
Binary file not shown.
Binary file added media/img/file/256/css.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/file/256/excel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/file/256/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/file/256/md.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/file/256/music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/img/file/256/pdf.png
Binary file added media/img/file/256/pic.png
Binary file added media/img/file/256/ppt.png
Binary file added media/img/file/256/psd.png
Binary file added media/img/file/256/sdoc.png
Binary file added media/img/file/256/sdoc_notification.ico
Binary file not shown.
Binary file added media/img/file/256/txt.png
Binary file added media/img/file/256/video.png
Binary file added media/img/file/256/word.png

0 comments on commit 20cf8b7

Please sign in to comment.