2019-08-27 08:32:56 +02:00
|
|
|
<script>
|
|
|
|
|
2020-01-28 22:17:04 +01:00
|
|
|
import Textbox from "../common/Textbox.svelte";
|
|
|
|
import Dropdown from "../common/Dropdown.svelte";
|
|
|
|
import Button from "../common/Button.svelte";
|
|
|
|
import { store } from "../builderStore";
|
|
|
|
import { isRootComponent } from "./pagesParsing/searchComponents";
|
|
|
|
import { pipe } from "../common/core";
|
|
|
|
import {
|
|
|
|
filter, find, concat
|
|
|
|
} from "lodash/fp";
|
|
|
|
|
|
|
|
const notSeletedComponent = {name:"(none selected)"};
|
|
|
|
|
|
|
|
$: page = $store.pages[$store.currentPageName];
|
|
|
|
$: title = page.index.title;
|
|
|
|
$: components = pipe($store.components, [
|
|
|
|
filter(store => !isRootComponent($store)),
|
2019-09-12 07:10:50 +02:00
|
|
|
concat([notSeletedComponent])
|
|
|
|
]);
|
2020-01-28 22:17:04 +01:00
|
|
|
$: entryComponent = find(c => c.name === page.appBody)(components) || notSeletedComponent;
|
|
|
|
|
|
|
|
|
|
|
|
const save = () => {
|
|
|
|
if(!title || !entryComponent || entryComponent === notSeletedComponent) return;
|
|
|
|
const page = {
|
|
|
|
index: {
|
|
|
|
title
|
|
|
|
},
|
|
|
|
appBody: entryComponent.name,
|
|
|
|
}
|
|
|
|
store.savePage(page);
|
2019-08-27 08:32:56 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-09-03 13:12:24 +02:00
|
|
|
<div class="root">
|
2019-08-27 08:32:56 +02:00
|
|
|
|
2019-09-03 13:12:24 +02:00
|
|
|
<h3>{$store.currentPageName}</h3>
|
2019-08-27 08:32:56 +02:00
|
|
|
|
2019-09-03 13:12:24 +02:00
|
|
|
<form class="uk-form-horizontal">
|
2019-09-12 07:10:50 +02:00
|
|
|
<Textbox bind:text={title} label="Title" hasError={!title}/>
|
2019-09-03 13:12:24 +02:00
|
|
|
<div class="help-text">The title of your page, displayed in the bowser tab</div>
|
|
|
|
<Dropdown label="App Entry Component"
|
|
|
|
options={components}
|
|
|
|
bind:selected={entryComponent}
|
|
|
|
textMember={(v) => v.name} />
|
2019-08-27 08:32:56 +02:00
|
|
|
|
2019-09-03 13:12:24 +02:00
|
|
|
<div class="help-text">The component that will be loaded into the body of the page</div>
|
|
|
|
<div style="margin-top: 20px"></div>
|
|
|
|
<Button on:click={save}>Save</Button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
2019-08-27 08:32:56 +02:00
|
|
|
|
2019-09-03 13:12:24 +02:00
|
|
|
<style>
|
2020-01-28 22:17:04 +01:00
|
|
|
.root {
|
|
|
|
padding: 15px;
|
|
|
|
}
|
|
|
|
.help-text {
|
|
|
|
color: var(--slate);
|
|
|
|
font-size: 10pt;
|
|
|
|
}
|
|
|
|
</style>
|