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

View File

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

View File

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

View File

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

View File

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