diff --git a/public/static/css/default.css b/public/static/css/default.css index e2f0bb2..702807a 100644 --- a/public/static/css/default.css +++ b/public/static/css/default.css @@ -461,7 +461,6 @@ .title-m { font-size: 1.4rem; - /* font-weight: bold; */ line-height: 2rem; overflow: hidden; white-space: nowrap; @@ -470,6 +469,14 @@ display: block; } +.title-m-wrap { + font-size: 1.4rem; + line-height: 2rem; + overflow: hidden; + overflow-wrap: break-word; + display: block; +} + .desc-m { font-size: 1.2rem; line-height: 2rem; @@ -491,6 +498,13 @@ justify-content: flex-start; } +.v-mid-r { + display: flex; + flex: 0 0 auto; + align-items: center; + justify-content: flex-end; +} + .full-width { width: 100%; } @@ -568,3 +582,15 @@ transform: rotate(360deg); } } + +.float-l { + float: left; +} + +.txt-align-l { + text-align: left; +} + +.txt-align-r { + text-align: right; +} \ No newline at end of file diff --git a/public/static/css/white.css b/public/static/css/white.css index ec5750f..18265a3 100644 --- a/public/static/css/white.css +++ b/public/static/css/white.css @@ -14,9 +14,12 @@ color: #f1c40f; } -.light-bg { +.lightest-bg { background-color: white; } +.light-bg { + background-color: #f6f6f6; +} .normal-bg { background-color: #ecf0f6; } @@ -276,7 +279,7 @@ input:focus { font-size: 1.8rem; line-height: 2rem; display: block; - margin: 2rem 0; + /* margin: 2rem 0; */ word-break: break-all; } @@ -286,6 +289,9 @@ input:focus { line-height: 2rem; display: block; word-break: break-all; + padding: 2rem; + margin-top: 1rem; + border-radius: 0.8rem; } .theme-default #item-rows .hr { @@ -503,10 +509,10 @@ input:focus { margin: auto 1rem auto auto; } -.theme-default .float-l { +/* .theme-default .float-l { display: inline-block; margin: auto 1rem auto auto; -} +} */ .theme-default .float-r { display: inline-block; @@ -569,7 +575,6 @@ input:focus { .theme-default .card { padding: 1rem; - /* background-color: #e8e8e8; */ text-align: center; border-radius: 0.8rem; } diff --git a/src/client/web/src/components/control/tabs.tsx b/src/client/web/src/components/control/tabs.tsx index de22b6c..907b644 100644 --- a/src/client/web/src/components/control/tabs.tsx +++ b/src/client/web/src/components/control/tabs.tsx @@ -81,7 +81,10 @@ export class Tabs extends React.Component { }); return ( -
{tabs}
+
+ {tabs} +
+
); } } diff --git a/src/client/web/src/components/panel_files.tsx b/src/client/web/src/components/panel_files.tsx index a05a537..2966a35 100644 --- a/src/client/web/src/components/panel_files.tsx +++ b/src/client/web/src/components/panel_files.tsx @@ -26,6 +26,7 @@ import { Table, Cell, Head } from "./layout/table"; import { BtnList } from "./control/btn_list"; import { Segments } from "./layout/segments"; import { Rows } from "./layout/rows"; +import { Columns } from "./layout/columns"; import { Up } from "../worker/upload_mgr"; import { UploadEntry, UploadState } from "../worker/interface"; import { getIcon } from "./visual/icons"; @@ -104,7 +105,6 @@ export class FilesPanel extends React.Component { if (!this.props.enabled) { return; } - const uploadInput = this.uploadInput as HTMLButtonElement; uploadInput.click(); }; @@ -132,14 +132,16 @@ export class FilesPanel extends React.Component { document.removeEventListener("keyup", this.hotkeyHandler.handle); } + onNewFolderNameChange = (ev: React.ChangeEvent) => { + this.setState({ newFolderName: ev.target.value }); + }; + setLoading = (state: boolean) => { updater().setControlOption(loadingCtrl, state ? ctrlOn : ctrlOff); this.props.update(updater().updateUI); }; - updateProgress = async ( - infos: Map - ) => { + updateProgress = async (infos: Map) => { updater().setUploads(infos); let errCount = 0; infos.valueSeq().forEach((entry: UploadEntry) => { @@ -159,7 +161,7 @@ export class FilesPanel extends React.Component { }; addUploads = (event: React.ChangeEvent) => { - if (event.target.files.length > 1000) { + if (event.target.files.length > 200) { alertMsg(this.props.msg.pkg.get("err.tooManyUploads")); return; } @@ -176,11 +178,7 @@ export class FilesPanel extends React.Component { this.props.update(updater().updateUploadingsInfo); }; - onNewFolderNameChange = (ev: React.ChangeEvent) => { - this.setState({ newFolderName: ev.target.value }); - }; - - onMkDir = async () => { + mkDir = async () => { if (this.state.newFolderName === "") { alertMsg(this.props.msg.pkg.get("browser.folder.add.fail")); return; @@ -237,7 +235,8 @@ export class FilesPanel extends React.Component { const filesToDel = this.state.selectedItems.keySeq().join(", "); if ( !confirmMsg( - `${this.props.msg.pkg.get("op.confirm")} [${this.state.selectedItems.size + `${this.props.msg.pkg.get("op.confirm")} [${ + this.state.selectedItems.size }]: ${filesToDel}` ) ) { @@ -474,134 +473,7 @@ export class FilesPanel extends React.Component { this.props.update(updater().updateFilesInfo); }; - prepareTable = ( - sortedItems: List, - showOp: string - ): React.ReactNode => { - const items = sortedItems.map((item: MetadataResp) => { - const isSelected = this.state.selectedItems.has(item.name); - const dirPath = this.props.filesInfo.dirPath.join("/"); - const itemPath = dirPath.endsWith("/") - ? `${dirPath}${item.name}` - : `${dirPath}/${item.name}`; - - const icon = item.isDir ? ( -
- -
- ) : ( -
- -
- ); - - const modTimeTitle = this.props.msg.pkg.get("item.modTime"); - const sizeTitle = this.props.msg.pkg.get("item.size"); - const itemSize = FileSize(item.size, { round: 0 }); - - const content = item.isDir ? ( -
-
-
this.gotoChild(item.name)} - > - {item.name} -
-
- - {`${modTimeTitle}: `} - {`${item.modTime}`} - -
-
-
- ) : ( -
-
-
- - {item.name} - -
- {`${sizeTitle}: `} - {`${itemSize} | `} - {`SHA1: `} - {item.sha1} -
-
-
-
- ); - - const op = item.isDir ? ( -
- this.select(item.name)} className="float-l"> - {isSelected - ? getIcon("RiCheckboxFill", "1.8rem", "cyan1") - : getIcon("RiCheckboxBlankLine", "1.8rem", "black1")} - -
- ) : ( -
- this.select(item.name)} className="float-l"> - {isSelected - ? getIcon("RiCheckboxFill", "1.8rem", "cyan1") - : getIcon("RiCheckboxBlankLine", "1.8rem", "black1")} - -
- ); - - return { - val: item, - cells: List([ - { elem: icon, val: item.isDir ? "d" : "f" }, - { elem: content, val: itemPath }, - { elem: op, val: "" }, - ]), - }; - }); - - const tableTitles = List([ - { - elem: ( -
- -
- ), - sortable: true, - }, - { - elem:
Name
, - sortable: true, - }, - { - elem:
Action
, - sortable: false, - }, - ]); - - return ( - - ); - }; - - prepareRows = ( + prepareColumns = ( sortedItems: List, showOp: string ): React.ReactNode => { @@ -617,55 +489,60 @@ export class FilesPanel extends React.Component { ? `${dirPath}${item.name}` : `${dirPath}/${item.name}`; - const selectedIconColor = isSelected ? "cyan1-font" : "black1-font"; - + const selectedIconColor = isSelected ? "highlight-font" : "dark-font"; const descIconColor = this.state.showDetail.has(item.name) - ? "cyan1-font" - : "grey0-font"; + ? "highlight-font" + : "light-font"; const icon = item.isDir ? ( - + ) : ( - + ); - const fileType = item.isDir - ? this.props.msg.pkg.get("item.type.folder") - : this.props.msg.pkg.get("item.type.file"); + const modTimeDate = new Date(item.modTime); + const modTimeFormatted = `${modTimeDate.getFullYear()}-${ + modTimeDate.getMonth() + 1 + }-${modTimeDate.getDate()}`; const downloadPath = `/v1/fs/files?fp=${itemPath}`; const name = item.isDir ? ( - this.gotoChild(item.name)}> - {item.name} + + this.gotoChild(item.name)}> + {item.name} + + {` - ${modTimeFormatted}`} ) : ( - - {item.name} - + + + {item.name} + + {` - ${modTimeFormatted}`} + ); const checkIcon = isSelected ? ( this.select(item.name)} /> ) : ( this.select(item.name)} /> ); const op = item.isDir ? ( -
{checkIcon}
+
{checkIcon}
) : ( -
+
this.toggleDetail(item.name)} /> - {checkIcon}
); @@ -674,42 +551,23 @@ export class FilesPanel extends React.Component { const pathTitle = this.props.msg.pkg.get("item.downloadURL"); const modTimeTitle = this.props.msg.pkg.get("item.modTime"); const sizeTitle = this.props.msg.pkg.get("item.size"); - const fileTypeTitle = this.props.msg.pkg.get("item.type"); const itemSize = FileSize(item.size, { round: 0 }); - - const compact = item.isDir ? ( - - {`${modTimeTitle}: `} - {item.modTime} - - ) : ( - - {`${pathTitle}: `} - {`${absDownloadURL} | `} - {`${modTimeTitle}: `} - {`${item.modTime} | `} - {`${sizeTitle}: `} - {`${itemSize} | `} - {`SHA1: `} - {item.sha1} - - ); const details = ( -
+
- {pathTitle} + {pathTitle} {absDownloadURL}
- {modTimeTitle} - {item.modTime} + {modTimeTitle} + {modTimeFormatted}
- {sizeTitle} + {sizeTitle} {itemSize}
@@ -718,11 +576,11 @@ export class FilesPanel extends React.Component {
SHA1, + SHA1, this.generateHash(itemPath)} size={"2rem"} - className={`grey3-font ${shareModeClass}`} + className={`dark-font ${shareModeClass}`} />, ])} childrenStyles={List([{}, { justifyContent: "flex-end" }])} @@ -732,34 +590,33 @@ export class FilesPanel extends React.Component {
); - const desc = this.state.showDetail.has(item.name) ? details : compact; + const desc = this.state.showDetail.has(item.name) ? details : null; - const elem = ( + const cells = List([ + icon, +
{name}
, +
{itemSize}
, +
{op}
, + ]); + + const tableCols = ( + + ); + + return (
- -
- {icon} - {`${fileTypeTitle}`} -   - {`- ${fileType}`} -
-
, -
{op}
, - ])} - childrenStyles={List([{}, { justifyContent: "flex-end" }])} - /> -
{name}
-
{desc}
+ {tableCols} + {desc}
); - - return elem; }); - return ; + return
{rows}
; }; setView = (opt: string) => { @@ -835,7 +692,7 @@ export class FilesPanel extends React.Component { - { /> ); const viewType = this.props.ui.control.controls.get(filesViewCtrl); - const view = - viewType === "rows" ? ( -
- {this.prepareRows(this.props.filesInfo.items, showOp)} -
- ) : ( - this.prepareTable(this.props.filesInfo.items, showOp) - ); + const view = ( +
+ {this.prepareColumns(this.props.filesInfo.items, showOp)} +
+ ); // TODO: support better views in the future const usedSpace = FileSize( // TODO: this a work around before transaction is introduced Math.trunc( parseInt(this.props.login.extInfo.usedSpace, 10) / (1024 * 1024) ) * - (1024 * 1024), + (1024 * 1024), { round: 0, } @@ -916,7 +770,7 @@ export class FilesPanel extends React.Component { Math.trunc( parseInt(this.props.login.quota.spaceLimit, 10) / (1024 * 1024) ) * - (1024 * 1024), + (1024 * 1024), { round: 0, } @@ -987,20 +841,20 @@ export class FilesPanel extends React.Component { { - this.setView("rows"); - }} - />, - { - this.setView("table"); - }} - />, + // { + // this.setView("rows"); + // }} + // />, + // { + // this.setView("table"); + // }} + // />,