more UI tidy up

This commit is contained in:
Martin McKeaveney 2020-02-26 18:16:10 +00:00
parent 48240c5941
commit 97a72ed966
4 changed files with 17 additions and 12 deletions

View File

@ -274,13 +274,13 @@ const saveCurrentNode = store => () => {
const cloned = cloneDeep(s.currentNode) const cloned = cloneDeep(s.currentNode)
templateApi(s.hierarchy).constructNode(parentNode, cloned) templateApi(s.hierarchy).constructNode(parentNode, cloned)
const newIndexOfchild = child => { const newIndexOfChild = child => {
if (child === cloned) return index if (child === cloned) return index
const currentIndex = parentNode.children.indexOf(child) const currentIndex = parentNode.children.indexOf(child)
return currentIndex >= index ? currentIndex + 1 : currentIndex return currentIndex >= index ? currentIndex + 1 : currentIndex
} }
parentNode.children = pipe(parentNode.children, [sortBy(newIndexOfchild)]) parentNode.children = pipe(parentNode.children, [sortBy(newIndexOfChild)])
if (!existingNode && s.currentNode.type === "record") { if (!existingNode && s.currentNode.type === "record") {
const defaultIndex = templateApi(s.hierarchy).getNewIndexTemplate( const defaultIndex = templateApi(s.hierarchy).getNewIndexTemplate(

View File

@ -19,9 +19,11 @@
</script> </script>
<div class="root" style="left: {left}"> <div class="root" style="left: {left}">
<ButtonGroup> <ButtonGroup>
<ActionButton color="secondary" grouped on:click={store.saveCurrentNode}> <ActionButton
color="secondary"
grouped
on:click={store.saveCurrentNode}>
{#if $store.currentNodeIsNew}Create{:else}Update{/if} {#if $store.currentNodeIsNew}Create{:else}Update{/if}
</ActionButton> </ActionButton>

View File

@ -9,10 +9,11 @@
let navActive = "" let navActive = ""
$: icon = type === "index" ? "list" : "file" $: icon = type === "index" ? "list" : "file"
store.subscribe(s => { store.subscribe(state => {
if (s.currentNode) if (state.currentNode) {
navActive = navActive =
s.activeNav === "database" && node.nodeId === s.currentNode.nodeId state.activeNav === "database" && node.nodeId === state.currentNode.nodeId
}
}) })
</script> </script>

View File

@ -1,7 +1,7 @@
<script> <script>
import { store } from "../builderStore/store" import { store } from "../builderStore/store"
import UIkit from "uikit" import UIkit from "uikit"
import Button from "../common/Button.svelte" import ActionButton from "../common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import CodeMirror from "codemirror" import CodeMirror from "codemirror"
import "codemirror/mode/javascript/javascript.js" import "codemirror/mode/javascript/javascript.js"
@ -74,10 +74,12 @@
</div> </div>
</div> </div>
<ButtonGroup style="float: right;"> <div class="uk-modal-footer">
<Button color="primary" grouped on:click={save}>Save</Button> <ButtonGroup>
<Button color="tertiary" grouped on:click={cancel}>Close</Button> <ActionButton primary on:click={save}>Save</ActionButton>
</ButtonGroup> <ActionButton alert on:click={cancel}>Close</ActionButton>
</ButtonGroup>
</div>
</div> </div>
</div> </div>