diff --git a/src/client/web/src/components/browser.tsx b/src/client/web/src/components/browser.tsx index 7ea7db4..c0500d1 100644 --- a/src/client/web/src/components/browser.tsx +++ b/src/client/web/src/components/browser.tsx @@ -37,6 +37,7 @@ export interface BrowserProps { uploadValue: string; isVertical: boolean; + tab: string; } export interface Props { @@ -297,6 +298,11 @@ export class Browser extends React.Component { }); }; + setTab = (tabName: string) => { + updater().setTab(tabName); + this.props.update(updater().updateBrowser); + }; + render() { let breadcrumb = this.props.browser.dirPath.map( (pathPart: string, key: number) => { @@ -337,7 +343,7 @@ export class Browser extends React.Component { /> @@ -345,7 +351,6 @@ export class Browser extends React.Component { @@ -373,7 +378,7 @@ export class Browser extends React.Component { @@ -503,6 +508,57 @@ export class Browser extends React.Component { ); }); + const itemListPane = + this.props.browser.tab === "" || this.props.browser.tab === "item" ? ( +
+
+
{ops}
+
+ +
+ + , + + // + // + // {this.props.msg.pkg.get("browser.item.title")} + // + // + // Files and folders in current path + // + // , + + , + ])} + // style={{ flex: "column nowrap" }} + /> + , + + + + , + ])} + childrenStyles={List([{}, { justifyContent: "flex-end" }])} + /> + + {itemList} +
+
+ ) : null; + const uploadingList = this.props.browser.uploadings.map( (uploading: UploadInfo) => { const pathParts = uploading.realFilePath.split("/"); @@ -551,6 +607,43 @@ export class Browser extends React.Component { } ); + const uploadingListPane = + this.props.browser.tab === "uploading" ? ( + this.props.browser.uploadings.size === 0 ? ( +
No uploading found
+ ) : ( +
+ + , + + + + {this.props.msg.pkg.get("browser.upload.title")} + + + All files in uploading + + , + ])} + /> + , + + , + ])} + /> + + {uploadingList} +
+ ) + ) : null; + const sharingList = this.props.browser.sharings.map((dirPath: string) => { return (
@@ -592,118 +685,108 @@ export class Browser extends React.Component { ); }); - return ( -
-
- {this.props.browser.uploadings.size === 0 ? null : ( -
- - , - - - - {this.props.msg.pkg.get("browser.upload.title")} - - - All files in uploading - - , - ])} - /> - , - - , - ])} - /> - - {uploadingList} -
- )} - - {this.props.browser.sharings.size === 0 ? null : ( -
- - , - - - - {this.props.msg.pkg.get("browser.share.title")} - - - Sharing Folders - - , - ])} - /> - , - - , - ])} - /> - - {sharingList} -
- )} - -
-
{ops}
-
- + const sharingingListPane = + this.props.browser.tab === "sharing" ? ( + this.props.browser.sharings.size === 0 ? ( +
No sharing found
+ ) : (
, - // - // - // {this.props.msg.pkg.get("browser.item.title")} - // - // - // Files and folders in current path - // - // , - - , + + + {this.props.msg.pkg.get("browser.share.title")} + + + Sharing Folders + + , ])} - // style={{ flex: "column nowrap" }} /> , - - - , + , ])} - childrenStyles={List([{}, { justifyContent: "flex-end" }])} /> - {itemList} + {sharingList}
+ ) + ) : null; + + return ( +
+
+
+
+ + + +
+
+ {sharingingListPane} + {uploadingListPane} + {itemListPane}
); diff --git a/src/client/web/src/components/core_state.ts b/src/client/web/src/components/core_state.ts index 133475f..3c90943 100644 --- a/src/client/web/src/components/core_state.ts +++ b/src/client/web/src/components/core_state.ts @@ -50,6 +50,7 @@ export function initState(): ICoreState { uploadings: List([]), uploadValue: "", uploadFiles: List([]), + tab: "", }, panes: { displaying: "browser", diff --git a/src/client/web/src/components/state_updater.ts b/src/client/web/src/components/state_updater.ts index e01efb9..11a687c 100644 --- a/src/client/web/src/components/state_updater.ts +++ b/src/client/web/src/components/state_updater.ts @@ -214,9 +214,11 @@ export class Updater { batch = batch.push(itemsToMove.get(i)); if (batch.size >= batchSize || i == itemsToMove.size - 1) { - let promises = batch.map(async (fromTo: any): Promise> => { - return this.filesClient.move(fromTo.from, fromTo.to); - }); + let promises = batch.map( + async (fromTo: any): Promise> => { + return this.filesClient.move(fromTo.from, fromTo.to); + } + ); const resps = await Promise.all(promises.toSeq()); resps.forEach((resp: Response, i: number) => { @@ -230,9 +232,7 @@ export class Updater { } if (fails.size > 0) { - alertMsg( - `${this.props.msg.pkg.get("move.fail")}: ${fails.join(",\n")}` - ); + alertMsg(`${this.props.msg.pkg.get("move.fail")}: ${fails.join(",\n")}`); } return this.setItems(List(dstDir.split("/"))); @@ -412,6 +412,23 @@ export class Updater { } }; + setTab = (tabName: string) => { + switch (tabName) { + case "item": + this.props.browser.tab = tabName; + break; + case "uploading": + this.props.browser.tab = tabName; + break; + case "sharing": + this.props.browser.tab = tabName; + break; + default: + this.props.browser.tab = "item"; + break; + } + }; + updateBrowser = (prevState: ICoreState): ICoreState => { return { ...prevState,