Skip to content

Commit

Permalink
Add indentation for deeper notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackymancs4 committed Mar 26, 2020
1 parent 063a164 commit 979e8ec
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ElectronClient/gui/MainScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,18 @@ class MainScreenComponent extends React.Component {
},
});
} else if (command.name === 'moveToFolder') {
const folderItems = this.props.folders;
const startFolders = folderItems
.map(a => {
return { key: a.id, value: a.id, label: a.title, indentDepth: a.parent_id == '' ? 0 : 1 };
});

const startFolders = [];
const maxDepth = 20;

const addOptions = (folders, depth) => {
for (let i = 0; i < folders.length; i++) {
const folder = folders[i];
startFolders.push({ key: folder.id, value: folder.id, label: folder.title, indentDepth: depth });
if (folder.children) addOptions(folder.children, (depth + 1) < maxDepth ? depth + 1 : maxDepth);
}
};
addOptions(await Folder.allAsTree(), 0);

this.setState({
promptOptions: {
Expand Down

0 comments on commit 979e8ec

Please sign in to comment.