From 2326fcdb435e1d51cb7d894028e067a62b5022ee Mon Sep 17 00:00:00 2001 From: llj Date: Fri, 29 Mar 2024 21:21:58 +0800 Subject: [PATCH] Upload link page redesign (#6000) * ['upload link' page] redesigned it(added the 'total status' bar, 'uploaded' icon & etc) * ['upload link' page] redesigned it(separated the statuses from the operations for file items, and etc.) --- frontend/src/css/file-uploader.css | 44 +++++++++++++++-- frontend/src/css/upload-link.css | 3 -- .../src/pages/upload-link/file-uploader.js | 4 ++ .../upload-link/forbid-upload-list-item.js | 15 ++++-- frontend/src/pages/upload-link/index.js | 5 +- .../src/pages/upload-link/upload-list-item.js | 40 +++++++++++----- .../upload-link/upload-progress-dialog.js | 48 +++++++++++++++++-- 7 files changed, 125 insertions(+), 34 deletions(-) diff --git a/frontend/src/css/file-uploader.css b/frontend/src/css/file-uploader.css index 657a5ba5c6..297d1fa6cb 100644 --- a/frontend/src/css/file-uploader.css +++ b/frontend/src/css/file-uploader.css @@ -73,11 +73,45 @@ color: #666666; } -.upload-operation .saving { - color: #ee8204; - word-wrap: break-word; -} - .disabled-link { color: #999999; } + +#upload-link-total-progress-container { + margin: 20px -32px 0; + border: 1px solid #eee; + border-width: 1px 0; + font-size: 14px; + height: 36px; +} + +.file-upload-item .upload-success-icon { + width: 16px; + height: 16px; + padding: 4px; + color: #fff; + background: #47b881; + border-radius: 100%; + font-size: 8px; + line-height: 1.1; + font-weight: bolder; +} + +.file-upload-item .upload-success-msg { + color: #47b881; +} + +.file-upload-item .upload-failure-icon { + width: 16px; + height: 16px; + padding: 4px; + color: #fff; + background: #ec4c47; + border-radius: 100%; + font-size: 8px; + text-align: center; +} + +.file-upload-item .upload-failure-msg { + color: #ec4c47; +} diff --git a/frontend/src/css/upload-link.css b/frontend/src/css/upload-link.css index 24376584d4..e5c47319a8 100644 --- a/frontend/src/css/upload-link.css +++ b/frontend/src/css/upload-link.css @@ -25,9 +25,6 @@ body { color: #f25041; font-size: 48px; } -#upload-link-panel .tip-list-item { - list-style: decimal inside none; -} #upload-link-drop-zone { background: rgba(255, 152, 0, 0.1); border: 2px dashed #ff9800; diff --git a/frontend/src/pages/upload-link/file-uploader.js b/frontend/src/pages/upload-link/file-uploader.js index 9302dad69f..97a2ce992f 100644 --- a/frontend/src/pages/upload-link/file-uploader.js +++ b/frontend/src/pages/upload-link/file-uploader.js @@ -302,8 +302,10 @@ class FileUploader extends React.Component { // start uploading onUploadStart = () => { + /* const message = gettext('File upload started'); toaster.notify(message); + */ }; onProgress = () => { @@ -421,10 +423,12 @@ class FileUploader extends React.Component { }; onComplete = () => { + /* if (!this.error) { const message = gettext('All files uploaded'); toaster.success(message); } + */ this.error = false; // reset it this.notifiedFolders = []; diff --git a/frontend/src/pages/upload-link/forbid-upload-list-item.js b/frontend/src/pages/upload-link/forbid-upload-list-item.js index bf39555e75..680e3d6e7e 100644 --- a/frontend/src/pages/upload-link/forbid-upload-list-item.js +++ b/frontend/src/pages/upload-link/forbid-upload-list-item.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Utils } from '../../utils/utils'; -import { gettext, maxUploadFileSize } from '../../utils/constants'; +import { gettext } from '../../utils/constants'; const propTypes = { file: PropTypes.object, @@ -10,15 +10,20 @@ const propTypes = { class ForbidUploadListItem extends React.Component { render() { - let { file } = this.props; - let msg = gettext('Please upload files less than {placeholder}').replace('{placeholder}', Utils.bytesToSize(maxUploadFileSize * 1000 * 1000)); + const { file } = this.props; return (
{file.name}
- - {msg} + {Utils.bytesToSize(file.size)} + +
+ + {gettext('File too large')} +
+ + ); } diff --git a/frontend/src/pages/upload-link/index.js b/frontend/src/pages/upload-link/index.js index d428247b02..46cee8107a 100644 --- a/frontend/src/pages/upload-link/index.js +++ b/frontend/src/pages/upload-link/index.js @@ -47,10 +47,7 @@ class SharedUploadLink extends React.Component { ) : ( -
    -
  1. {gettext('Folder upload is limited to Chrome, Firefox 50+, and Microsoft Edge.')}
  2. - {maxUploadFileSize &&
  3. {gettext('File size should be smaller than {max_size_placeholder}.').replace('{max_size_placeholder}', Utils.bytesToSize(maxUploadFileSize * 1000 * 1000))}
  4. } -
+ {maxUploadFileSize &&

{gettext('File size should be smaller than {max_size_placeholder}.').replace('{max_size_placeholder}', Utils.bytesToSize(maxUploadFileSize * 1000 * 1000))}

}