From 49c2bcf2edc97a46336d09330216a808b9c1daf1 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Mon, 11 Nov 2019 15:05:30 +0000 Subject: [PATCH] 'New Child Record' not woring on builder --- packages/builder/src/nav/BackendNav.svelte | 51 ++++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/packages/builder/src/nav/BackendNav.svelte b/packages/builder/src/nav/BackendNav.svelte index 65eff8e039..9545098fbd 100644 --- a/packages/builder/src/nav/BackendNav.svelte +++ b/packages/builder/src/nav/BackendNav.svelte @@ -8,14 +8,30 @@ import NavItem from "./NavItem.svelte"; import getIcon from "../common/icon"; +const newRootRecord = () => { + store.newRootRecord(); +} + +const newRootIndex = () => { + store.newRootIndex(); +} + +const newChildRecord = () => { + store.newChildRecord(); +} + +const newChildIndex = () => { + store.newChildIndex(); +} + const defaultNewChildActions = [ - { - label:"New Root Index", - onclick: store.newRootIndex - }, { label:"New Root Record", - onclick: store.newRootRecord + onclick: newRootRecord + }, + { + label:"New Root Index", + onclick: newRootIndex } ]; @@ -25,20 +41,27 @@ const setActiveNav = (name) => () => { store.setActiveNav(name); } - store.subscribe(db => { if(!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) { newChildActions = defaultNewChildActions; } else { newChildActions = [ - {label:"New Root Record", - onclick: store.newRootRecord}, - {label: `New Child Record of ${db.currentNode.name}`, - onclick: store.newChildRecord}, - {label:"New Root Index", - onclick: store.newRootIndex}, - {label: `New Index on ${db.currentNode.name}`, - onclick: store.newChildIndex} + { + label:"New Root Record", + onclick: newRootRecord + }, + { + label:"New Root Index", + onclick: newRootIndex + }, + { + label: `New Child Record of ${db.currentNode.name}`, + onclick: newChildRecord + }, + { + label: `New Index on ${db.currentNode.name}`, + onclick: newChildIndex + } ]; } });