2020-02-20 18:11:41 +01:00
|
|
|
<script>
|
2020-04-28 15:28:31 +02:00
|
|
|
import { goto } from "@sveltech/routify"
|
2020-12-01 17:22:06 +01:00
|
|
|
import { FrontendTypes } from "constants"
|
2020-11-19 17:41:29 +01:00
|
|
|
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
|
2020-12-05 00:42:22 +01:00
|
|
|
import LayoutDropdownMenu from "./ComponentNavigationTree/LayoutDropdownMenu.svelte"
|
2020-12-02 18:07:30 +01:00
|
|
|
import initDragDropStore from "./ComponentNavigationTree/dragDropStore"
|
2020-10-22 18:42:03 +02:00
|
|
|
import NavItem from "components/common/NavItem.svelte"
|
|
|
|
import { last } from "lodash/fp"
|
2020-12-01 17:22:06 +01:00
|
|
|
import { store, currentAsset } from "builderStore"
|
2020-08-13 11:15:37 +02:00
|
|
|
import { writable } from "svelte/store"
|
2020-02-20 18:11:41 +01:00
|
|
|
|
2020-12-02 15:49:43 +01:00
|
|
|
export let layout
|
2020-02-20 18:11:41 +01:00
|
|
|
|
|
|
|
let confirmDeleteDialog
|
|
|
|
let componentToDelete = ""
|
|
|
|
|
2020-12-03 13:08:33 +01:00
|
|
|
const dragDropStore = initDragDropStore()
|
2020-02-20 18:11:41 +01:00
|
|
|
|
2020-12-03 18:31:38 +01:00
|
|
|
const selectLayout = () => {
|
|
|
|
store.actions.layouts.select(layout._id)
|
|
|
|
$goto(`./layouts/${layout._id}`)
|
2020-04-28 15:28:31 +02:00
|
|
|
}
|
2020-02-20 18:11:41 +01:00
|
|
|
</script>
|
|
|
|
|
2020-10-22 18:42:03 +02:00
|
|
|
<NavItem
|
|
|
|
border={false}
|
|
|
|
icon="ri-layout-3-line"
|
2020-12-02 15:15:07 +01:00
|
|
|
text={layout.name}
|
2020-10-22 18:42:03 +02:00
|
|
|
withArrow
|
2020-12-02 15:49:43 +01:00
|
|
|
selected={$store.currentComponentInfo?._id === layout.props._id}
|
2020-12-03 16:15:14 +01:00
|
|
|
opened={$store.currentAssetId === layout._id}
|
2020-12-05 00:42:22 +01:00
|
|
|
on:click={selectLayout}>
|
|
|
|
<LayoutDropdownMenu layoutId={layout._id} />
|
|
|
|
</NavItem>
|
2020-06-01 23:16:55 +02:00
|
|
|
|
2020-12-03 16:15:14 +01:00
|
|
|
{#if $store.currentAssetId === layout._id && layout.props._children}
|
2020-11-19 17:41:29 +01:00
|
|
|
<ComponentTree
|
2020-12-02 15:49:43 +01:00
|
|
|
components={layout.props._children}
|
2020-08-13 11:15:37 +02:00
|
|
|
currentComponent={$store.currentComponentInfo}
|
|
|
|
{dragDropStore} />
|
2020-06-01 23:16:55 +02:00
|
|
|
{/if}
|