Added root folder for share functionality (#1005)

main
Boris Sekachev 6 years ago committed by Nikita Manovich
parent 337f7a0018
commit d24dd740e6

@ -216,11 +216,13 @@ export default class FileManager extends React.PureComponent<Props, State> {
public render(): JSX.Element {
const { withRemote } = this.props;
const { active } = this.state;
return (
<>
<Tabs
type='card'
activeKey={active}
tabBarGutter={5}
onChange={
(activeKey: string): void => this.setState({

@ -26,10 +26,10 @@ interface DispatchToProps {
function mapStateToProps(state: CombinedState): StateToProps {
function convert(items: ShareItem[], path?: string): TreeNodeNormal[] {
return items.map((item): TreeNodeNormal => {
const key = `${path}/${item.name}`.replace(/\/+/g, '/'); // // => /
const key = `${path}${item.name}/`;
return {
key,
title: item.name,
title: item.name || 'root',
isLeaf: item.type !== 'DIR',
children: convert(item.children, key),
};
@ -38,7 +38,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
const { root } = state.share;
return {
treeData: convert(root.children, root.name),
treeData: convert([root], ''),
};
}

@ -10,7 +10,7 @@ import {
const defaultState: ShareState = {
root: {
name: '/',
name: '',
type: 'DIR',
children: [],
},

Loading…
Cancel
Save