2020-03-31 11:50:13 +02:00
|
|
|
<script>
|
2020-05-27 12:54:53 +02:00
|
|
|
import Modal from "svelte-simple-modal"
|
2020-04-02 16:27:19 +02:00
|
|
|
import { store } from "builderStore"
|
2020-06-03 18:05:36 +02:00
|
|
|
import { get } from "builderStore/api"
|
2020-04-02 16:27:19 +02:00
|
|
|
|
2020-03-31 11:50:13 +02:00
|
|
|
import { fade } from "svelte/transition"
|
2020-05-19 15:19:32 +02:00
|
|
|
import { isActive, goto, layout } from "@sveltech/routify"
|
2020-03-31 11:50:13 +02:00
|
|
|
|
2020-04-02 15:16:46 +02:00
|
|
|
import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
|
|
|
|
import IconButton from "components/common/IconButton.svelte"
|
2020-03-31 11:50:13 +02:00
|
|
|
|
2020-04-02 16:27:19 +02:00
|
|
|
// Get Package and set store
|
2020-04-02 17:01:19 +02:00
|
|
|
export let application
|
2020-04-02 16:27:19 +02:00
|
|
|
|
|
|
|
let promise = getPackage()
|
|
|
|
|
|
|
|
async function getPackage() {
|
2020-06-03 18:05:36 +02:00
|
|
|
const res = await get(`/api/${application}/appPackage`)
|
2020-04-02 16:27:19 +02:00
|
|
|
const pkg = await res.json()
|
|
|
|
|
|
|
|
if (res.ok) {
|
|
|
|
await store.setPackage(pkg)
|
|
|
|
return pkg
|
|
|
|
} else {
|
|
|
|
throw new Error(pkg)
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 11:50:13 +02:00
|
|
|
</script>
|
|
|
|
|
2020-05-27 12:54:53 +02:00
|
|
|
<Modal>
|
|
|
|
<div class="root">
|
|
|
|
|
|
|
|
<div class="top-nav">
|
|
|
|
<div class="topleftnav">
|
|
|
|
<button class="home-logo">
|
|
|
|
<img
|
|
|
|
src="/_builder/assets/bb-logo.svg"
|
|
|
|
alt="budibase icon"
|
|
|
|
on:click={() => $goto(`/`)} />
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<!-- This gets all indexable subroutes and sticks them in the top nav. -->
|
|
|
|
{#each $layout.children as { path, title }}
|
|
|
|
<span
|
|
|
|
class:active={$isActive(path)}
|
|
|
|
class="topnavitem"
|
|
|
|
on:click={() => $goto(path)}>
|
|
|
|
{title}
|
|
|
|
</span>
|
|
|
|
{/each}
|
|
|
|
<!-- <IconButton icon="home"
|
2020-03-31 11:50:13 +02:00
|
|
|
color="var(--slate)"
|
|
|
|
hoverColor="var(--secondary75)"/> -->
|
2020-05-27 12:54:53 +02:00
|
|
|
</div>
|
|
|
|
<div class="toprightnav">
|
|
|
|
<span
|
|
|
|
class:active={$isActive(`/settings`)}
|
|
|
|
class="topnavitemright"
|
|
|
|
on:click={() => $goto(`/settings`)}>
|
|
|
|
<SettingsIcon />
|
|
|
|
</span>
|
2020-06-09 14:34:19 +02:00
|
|
|
<span
|
|
|
|
class:active={false}
|
|
|
|
class="topnavitemright"
|
|
|
|
on:click={() => window.open(`/${application}`)}>
|
|
|
|
<PreviewIcon />
|
|
|
|
</span>
|
2020-05-27 12:54:53 +02:00
|
|
|
</div>
|
2020-03-31 11:50:13 +02:00
|
|
|
</div>
|
|
|
|
|
2020-05-27 12:54:53 +02:00
|
|
|
{#await promise}
|
|
|
|
<!-- This should probably be some kind of loading state? -->
|
|
|
|
<div />
|
|
|
|
{:then}
|
|
|
|
<slot />
|
|
|
|
{:catch error}
|
|
|
|
<p>Something went wrong: {error.message}</p>
|
|
|
|
{/await}
|
2020-03-31 11:50:13 +02:00
|
|
|
|
2020-05-27 12:54:53 +02:00
|
|
|
</div>
|
|
|
|
</Modal>
|
2020-03-31 11:50:13 +02:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.root {
|
2020-06-01 23:04:32 +02:00
|
|
|
min-height: 100%;
|
2020-06-02 11:37:31 +02:00
|
|
|
height: 100%;
|
2020-03-31 11:50:13 +02:00
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
2020-05-29 00:31:55 +02:00
|
|
|
a {
|
|
|
|
text-transform: none;
|
|
|
|
color: var(--ink-lighter);
|
|
|
|
}
|
|
|
|
|
2020-03-31 11:50:13 +02:00
|
|
|
.top-nav {
|
|
|
|
flex: 0 0 auto;
|
2020-05-23 10:49:25 +02:00
|
|
|
height: 60px;
|
|
|
|
background: #fff;
|
2020-03-31 11:50:13 +02:00
|
|
|
padding: 0px 20px 0 20px;
|
|
|
|
display: flex;
|
|
|
|
box-sizing: border-box;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2020-05-23 10:49:25 +02:00
|
|
|
border-bottom: 1px solid var(--grey);
|
2020-03-31 11:50:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.content > div {
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toprightnav {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.topleftnav {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.topnavitem {
|
|
|
|
cursor: pointer;
|
2020-05-23 10:49:25 +02:00
|
|
|
color: var(--ink-lighter);
|
|
|
|
margin: 0px 00px 0px 20px;
|
2020-03-31 11:50:13 +02:00
|
|
|
padding-top: 4px;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 1rem;
|
|
|
|
height: 100%;
|
|
|
|
align-items: center;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
|
|
|
|
.topnavitem:hover {
|
2020-05-23 10:49:25 +02:00
|
|
|
color: var(--ink-light);
|
2020-03-31 11:50:13 +02:00
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.active {
|
2020-05-23 10:49:25 +02:00
|
|
|
color: var(--ink);
|
|
|
|
font-weight: 500;
|
2020-03-31 11:50:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.topnavitemright {
|
|
|
|
cursor: pointer;
|
2020-05-23 10:49:25 +02:00
|
|
|
color: var(--ink-light);
|
|
|
|
margin: 0px 20px 0px 0px;
|
2020-03-31 11:50:13 +02:00
|
|
|
padding-top: 4px;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 1rem;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex: 1;
|
|
|
|
align-items: center;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
|
|
|
|
.topnavitemright:hover {
|
2020-05-27 12:11:32 +02:00
|
|
|
color: var(--ink);
|
2020-03-31 11:50:13 +02:00
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.home-logo {
|
|
|
|
border-style: none;
|
|
|
|
background-color: rgba(0, 0, 0, 0);
|
|
|
|
cursor: pointer;
|
|
|
|
outline: none;
|
|
|
|
height: 40px;
|
2020-05-23 10:49:25 +02:00
|
|
|
padding: 0px 10px 8px 0;
|
|
|
|
align-items: center;
|
2020-03-31 11:50:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.home-logo:hover {
|
|
|
|
color: var(--hovercolor);
|
|
|
|
}
|
|
|
|
|
|
|
|
.home-logo:active {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.home-logo img {
|
2020-05-23 10:49:25 +02:00
|
|
|
height: 40px;
|
2020-03-31 11:50:13 +02:00
|
|
|
}
|
|
|
|
span:first-letter {
|
|
|
|
text-transform: capitalize;
|
|
|
|
}
|
|
|
|
</style>
|