diff --git a/public/locales/en-US/application.json b/public/locales/en-US/application.json index c115337..3e5fc1f 100644 --- a/public/locales/en-US/application.json +++ b/public/locales/en-US/application.json @@ -111,6 +111,7 @@ "name": "Name", "size": "Size", "lastModified": "Last modified", + "currentFolder": "Current Folder", "backToParentFolder": "Back to the parent", "folders": "Folders", "files": "Files", diff --git a/public/locales/zh-CN/application.json b/public/locales/zh-CN/application.json index 532ddd1..16c1d53 100644 --- a/public/locales/zh-CN/application.json +++ b/public/locales/zh-CN/application.json @@ -111,6 +111,7 @@ "name": "名称", "size": "大小", "lastModified": "修改日期", + "currentFolder": "当前目录", "backToParentFolder": "上级目录", "folders": "文件夹", "files": "文件", diff --git a/src/component/FileManager/PathSelector.js b/src/component/FileManager/PathSelector.js index 317a82d..8946c37 100644 --- a/src/component/FileManager/PathSelector.js +++ b/src/component/FileManager/PathSelector.js @@ -98,17 +98,20 @@ class PathSelectorCompoment extends Component { } else { let path = toBeLoad; let name = toBeLoad; - const paths = path.split("/"); - name = paths.pop(); - name = name === "" ? "/" : name; - path = paths.join("/"); - dirList.unshift({ - name: name, - path: path, - displayName: this.props.t( - "fileManager.backToParentFolder" - ), - }); + const displayNames = ["fileManager.currentFolder", "fileManager.backToParentFolder"]; + for (let i = 0; i < 2; i++) { + const paths = path.split("/"); + name = paths.pop(); + name = name === "" ? "/" : name; + path = paths.join("/"); + dirList.unshift({ + name: name, + path: path, + displayName: this.props.t( + displayNames[i] + ), + }); + } } this.setState({ presentPath: toBeLoad, @@ -134,6 +137,24 @@ class PathSelectorCompoment extends Component { render() { const { classes, t } = this.props; + const showActionIcon = (index) => { + if (this.state.presentPath === "/") { + return index !== 0; + } + return index !== 1; + }; + + const actionIcon = (index) => { + if (this.state.presentPath === "/") { + return ; + } + + if (index === 0) { + return ; + } + return ; + }; + return (
@@ -156,7 +177,7 @@ class PathSelectorCompoment extends Component { style: { whiteSpace: "normal" }, }} /> - {(index !== 0 || value.name !== "/") && ( + {showActionIcon(index) && ( @@ -179,8 +200,7 @@ class PathSelectorCompoment extends Component { ) } > - {index === 0 && } - {index !== 0 && } + {actionIcon(index)} )}