This commit is contained in:
Martin McKeaveney 2020-11-19 16:41:29 +00:00
parent e5bba6b5e6
commit ab5312061b
4 changed files with 14 additions and 18 deletions

View File

@ -215,6 +215,7 @@ export const getFrontendStore = () => {
currentPage._screens = currentPage._screens.filter(
scr => scr._id !== screenToDelete._id
)
deletePromise = api.delete(
`/api/screens/${screenToDelete._id}/${screenToDelete._rev}`
)

View File

@ -27,22 +27,21 @@
icon="ri-route-line"
text={path}
opened={true}
withArrow={route.subpaths}
on:click={() => console.log(route)} />
withArrow={route.subpaths} />
{#each Object.keys(route.subpaths) as subpath}
{#each Object.keys(route.subpaths[subpath].screens) as screen}
{#each Object.entries(route.subpaths) as [url, subpath]}
{#each Object.values(subpath.screens) as screenId}
<NavItem
icon="ri-artboard-2-line"
indentLevel={indent || 1}
selected={$store.currentPreviewItem._id === route.subpaths[subpath].screens[screen]}
opened={$store.currentPreviewItem._id === route.subpaths[subpath].screens[screen]}
text={subpath}
selected={$store.currentPreviewItem._id === screenId}
opened={$store.currentPreviewItem._id === screenId}
text={url}
withArrow={route.subpaths}
on:click={() => changeScreen(route.subpaths[subpath].screens[screen])}>
<ScreenDropdownMenu screen={route.subpaths[subpath].screens[screen]} />
on:click={() => changeScreen(screenId)}>
<ScreenDropdownMenu screen={screenId} />
</NavItem>
{#if selectedScreen?._id === route.subpaths[subpath].screens[screen]}
{#if selectedScreen?._id === screenId}
<ComponentsTree
components={selectedScreen.props._children}
currentComponent={$store.currentComponentInfo}

View File

@ -2,7 +2,7 @@
import { onMount } from "svelte"
import { store, currentScreens } from "builderStore"
import api from "builderStore/api"
import ComponentsHierarchy from "components/userInterface/ComponentNavigationTree/index.svelte"
import ComponentNavigationTree from "components/userInterface/ComponentNavigationTree/index.svelte"
import PageLayout from "components/userInterface/PageLayout.svelte"
import PagesList from "components/userInterface/PagesList.svelte"
import NewScreenModal from "components/userInterface/NewScreenModal.svelte"
@ -13,12 +13,9 @@
let routes = {}
async function fetchRoutes() {
// fetch the routing stuff here
const response = await api.get("/api/routing")
const json = await response.json()
console.log(json)
routes = json.routes
}
@ -34,7 +31,7 @@
<PagesList />
<div class="nav-items-container">
<PageLayout layout={$store.pages[$store.currentPageName]} />
<ComponentsHierarchy {routes} />
<ComponentNavigationTree {routes} />
</div>
<Modal bind:this={modal}>
<NewScreenModal />

View File

@ -1,6 +1,6 @@
<script>
import { goto } from "@sveltech/routify"
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
import NavItem from "components/common/NavItem.svelte"
import { last } from "lodash/fp"
import { store } from "builderStore"
@ -37,8 +37,7 @@
on:click={setCurrentScreenToLayout} />
{#if $store.currentPreviewItem?.name === _layout.title && _layout.component.props._children}
<ComponentsHierarchyChildren
thisComponent={_layout.component.props}
<ComponentTree
components={_layout.component.props._children}
currentComponent={$store.currentComponentInfo}
{dragDropStore} />