budibase/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte

93 lines
2.2 KiB
Svelte
Raw Normal View History

<script>
import { onMount } from "svelte"
2020-12-02 14:41:00 +01:00
import { goto } from "@sveltech/routify"
import { store, currentAsset } from "builderStore"
import { FrontendTypes } from "constants"
import api from "builderStore/api"
2020-11-19 17:41:29 +01:00
import ComponentNavigationTree from "components/userInterface/ComponentNavigationTree/index.svelte"
import Layout from "components/userInterface/Layout.svelte"
import LayoutsList from "components/userInterface/LayoutsList.svelte"
2020-10-08 10:35:11 +02:00
import NewScreenModal from "components/userInterface/NewScreenModal.svelte"
import { Modal, Switcher } from "@budibase/bbui"
2020-05-29 19:32:52 +02:00
const tabs = [
{
title: "Screens",
2020-12-02 14:41:00 +01:00
key: "screens",
},
{
title: "Layouts",
2020-12-02 14:41:00 +01:00
key: "layouts",
},
]
let modal
let routes = {}
2020-12-02 14:41:00 +01:00
let tab = "screens"
function reroute({ detail }) {
if (!detail) return
$goto(`./${detail.heading.key}`)
}
onMount(() => {
2020-11-19 22:07:25 +01:00
store.actions.routing.fetch()
})
</script>
<div class="title">
2020-12-02 14:41:00 +01:00
<Switcher headings={tabs} bind:value={tab} on:change={reroute}>
{#if tab === 'screens'}
<i
on:click={modal.show}
data-cy="new-screen"
class="ri-add-circle-fill" />
<!-- <LayoutsList /> -->
{#if $currentAsset}
<div class="nav-items-container">
<!-- <Layout layout={$currentAsset} /> -->
<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}
{/if}
</Switcher>
</div>
<!-- {#if $store.currentFrontEndType === FrontendTypes.LAYOUT && $currentAsset} -->
<!-- <div class="nav-items-container"> -->
<!-- <Layout layout={$currentAsset} /> -->
<!-- <ComponentNavigationTree /> -->
<!-- </div> -->
<!-- <Modal bind:this={modal}> -->
<!-- <NewScreenModal /> -->
<!-- </Modal> -->
2020-12-02 14:27:20 +01:00
<!-- {/if} -->
<style>
.title {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.title h1 {
font-size: var(--font-size-m);
font-weight: 500;
margin: 0;
}
.title i {
font-size: 20px;
}
.title i:hover {
cursor: pointer;
color: var(--blue);
}
</style>