More sync operations

This commit is contained in:
Magnus Åhall 2024-12-18 19:12:10 +01:00
parent 9df85d9580
commit d0150145ed
10 changed files with 362 additions and 131 deletions

View file

@ -6,17 +6,21 @@ import { ROOT_NODE } from 'node_store'
const html = htm.bind(h)
export class Notes2 extends Component {
state = {
startNode: null,
}
constructor() {//{{{
super()
this.tree = createRef()
this.nodeUI = createRef()
this.state = {
startNode: null,
}
Sync.nodes().then(durationNodes =>
console.log(`Total time: ${Math.round(100 * durationNodes) / 100}s`)
)
this.getStartNode()
}//}}}
render({}, { startNode }) {//{{{
render(_props, { startNode }) {//{{{
if (startNode === null)
return
@ -81,7 +85,7 @@ class Tree extends Component {
})
return html`
<div id="tree">
<div id="logo"><a href="/notes2"><img src="/images/${_VERSION}/logo.svg" /></a></div>
<div id="logo" onclick=${() => _notes2.current.goToNode(ROOT_NODE)}><img src="/images/${_VERSION}/logo.svg" /></div>
${renderedTreeTrunk}
</div>`
}//}}}
@ -197,7 +201,7 @@ class TreeNode extends Component {
return html`
<div class="node">
<div class="expand-toggle" onclick=${() => { this.expanded.value ^= true }}>${expandImg}</div>
<div class="name ${selected}" onclick=${() => window._notes2.current.goToNode(node.UUID)}>${node.Name}</div>
<div class="name ${selected}" onclick=${() => window._notes2.current.goToNode(node.UUID)}>${node.get('Name')}</div>
<div class="children ${node.Children.length > 0 && this.expanded.value ? 'expanded' : 'collapsed'}">${children}</div>
</div>`
}//}}}