2020-05-29 14:28:12 +02:00
|
|
|
<script>
|
2020-11-18 23:04:18 +01:00
|
|
|
import { onMount } from "svelte"
|
2020-12-04 15:07:56 +01:00
|
|
|
import { goto } from "@sveltech/routify"
|
2020-11-25 18:56:09 +01:00
|
|
|
import { store, currentAsset } from "builderStore"
|
2020-11-19 17:41:29 +01:00
|
|
|
import ComponentNavigationTree from "components/userInterface/ComponentNavigationTree/index.svelte"
|
2020-11-25 18:56:09 +01:00
|
|
|
import Layout from "components/userInterface/Layout.svelte"
|
2020-10-08 10:35:11 +02:00
|
|
|
import NewScreenModal from "components/userInterface/NewScreenModal.svelte"
|
2020-12-04 15:07:56 +01:00
|
|
|
import { Modal, Switcher } from "@budibase/bbui"
|
2020-05-29 19:32:52 +02:00
|
|
|
|
2020-12-01 17:22:06 +01:00
|
|
|
const tabs = [
|
|
|
|
{
|
|
|
|
title: "Screens",
|
2020-12-02 14:41:00 +01:00
|
|
|
key: "screens",
|
2020-12-01 17:22:06 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "Layouts",
|
2020-12-02 14:41:00 +01:00
|
|
|
key: "layouts",
|
2020-12-01 17:22:06 +01:00
|
|
|
},
|
|
|
|
]
|
2020-11-18 23:04:18 +01:00
|
|
|
|
2020-12-01 17:22:06 +01:00
|
|
|
let modal
|
2020-11-18 23:04:18 +01:00
|
|
|
let routes = {}
|
2020-12-02 14:41:00 +01:00
|
|
|
let tab = "screens"
|
|
|
|
|
2020-12-03 16:15:14 +01:00
|
|
|
function navigate({ detail }) {
|
2020-12-02 14:41:00 +01:00
|
|
|
if (!detail) return
|
|
|
|
$goto(`./${detail.heading.key}`)
|
|
|
|
}
|
2020-11-18 23:04:18 +01:00
|
|
|
|
|
|
|
onMount(() => {
|
2020-11-19 22:07:25 +01:00
|
|
|
store.actions.routing.fetch()
|
2020-11-18 23:04:18 +01:00
|
|
|
})
|
2020-05-29 14:28:12 +02:00
|
|
|
</script>
|
|
|
|
|
2020-10-22 19:12:40 +02:00
|
|
|
<div class="title">
|
2020-12-03 16:15:14 +01:00
|
|
|
<Switcher headings={tabs} bind:value={tab} on:change={navigate}>
|
2020-12-02 14:41:00 +01:00
|
|
|
{#if tab === 'screens'}
|
2020-12-01 17:22:06 +01:00
|
|
|
<i
|
|
|
|
on:click={modal.show}
|
|
|
|
data-cy="new-screen"
|
|
|
|
class="ri-add-circle-fill" />
|
|
|
|
{#if $currentAsset}
|
|
|
|
<div class="nav-items-container">
|
|
|
|
<ComponentNavigationTree />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
<Modal bind:this={modal}>
|
|
|
|
<NewScreenModal />
|
|
|
|
</Modal>
|
2020-12-02 14:41:00 +01:00
|
|
|
{:else if tab === 'layouts'}
|
2020-12-02 15:49:43 +01:00
|
|
|
{#each $store.layouts as layout}
|
|
|
|
<Layout {layout} />
|
|
|
|
{/each}
|
2020-12-01 17:22:06 +01:00
|
|
|
{/if}
|
|
|
|
</Switcher>
|
2020-05-29 14:28:12 +02:00
|
|
|
</div>
|
2020-12-01 17:22:06 +01:00
|
|
|
|
2020-10-22 19:12:40 +02:00
|
|
|
<style>
|
|
|
|
.title {
|
|
|
|
display: flex;
|
2020-12-04 15:07:56 +01:00
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: stretch;
|
2020-10-22 19:12:40 +02:00
|
|
|
}
|
|
|
|
.title i {
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
.title i:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
color: var(--blue);
|
|
|
|
}
|
|
|
|
</style>
|