{#if depth === 0}
Workspace
openCreate('', 'space')} title="New Space" type="button">+
{#if loading}
Loading...
{:else if localError}
{localError}
{:else} {#each roots() as node (node.id)}
{/each} {/if} {#if showCreate}
New {newNodeType}
x
{creating ? '...' : 'Create'}
Cancel
{/if}
{:else}
{#if hasKids(node.id)}
toggle(node.id)} type="button" aria-label={expandedNodes[node.id] ? 'Collapse' : 'Expand'}>
{:else}
{/if}
selectNode(node.id)} type="button">{node.title}
{#if node.type !== 'case'}
openCreate(node.id, 'case')} title="Add child" type="button">+
{/if}
{#if expandedNodes[node.id]} {#each childrenOf(node.id) as child (child.id)}
{/each} {/if}
{/if}