ui: scratchpad: hide sidebar if no extra page loaded

This commit is contained in:
undefined committed 2022-08-01 23:07:05 +08:00
1 parent e3a5543d9f
commit 6689604e48
1 file changed
+5 -6
@@ -34,10 +34,7 @@ function buildNestedPane([a, ...panes], mode = 'horizontal') {
const pages = { const pages = {
problem: { problem: {
icon: () => <ProblemIcon />, icon: () => <ProblemIcon />,
component: () => { component: () => <Dom childDom={$('.problem-content').get(0)} id="problem-content" />,
console.log($('.problem-content'));
return <Dom childDom={$('.problem-content').get(0)} id="problem-content" />;
},
}, },
}; };
@@ -78,14 +75,16 @@ export default function ScratchpadContainer() {
}); });
}; };
const showSidebar = Object.keys(pages).length > 1;
return ( return (
<SplitPane <SplitPane
split="vertical" split="vertical"
primary="first" primary="first"
defaultSize={50} size={showSidebar ? 50 : 0}
allowResize={false} allowResize={false}
> >
<div className="scratchpad__tablist"> <div className="scratchpad__tablist" style={{ display: showSidebar ? 'block' : 'none' }}>
{Object.keys(pages).map((key) => { {Object.keys(pages).map((key) => {
const Component = pages[key].icon; const Component = pages[key].icon;
return ( return (