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)
templateApi(s.hierarchy).constructNode(parentNode, cloned)
const newIndexOfchild = child => {
const newIndexOfChild = child => {
if (child === cloned) return index
const currentIndex = parentNode.children.indexOf(child)
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") {
const defaultIndex = templateApi(s.hierarchy).getNewIndexTemplate(

View File

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

View File

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

View File

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