wip: add back root routify index page

This commit is contained in:
kevmodrome 2020-04-02 15:16:46 +02:00
parent 7a5d80a947
commit f827e8d9aa
15 changed files with 72 additions and 90 deletions

View File

@ -1,11 +1,8 @@
<script> <script>
import NoPackage from "./NoPackage.svelte"
import PackageRoot from "./PackageRoot.svelte"
import Settings from "./Settings.svelte"
import { store, initialise } from "builderStore"
import { onMount } from "svelte" import { onMount } from "svelte"
import IconButton from "components/common/IconButton.svelte" import { Router } from "@sveltech/routify"
import Spinner from "components/common/Spinner.svelte" import { routes } from "@sveltech/routify/tmp/routes"
import { store, initialise } from "builderStore"
import AppNotification, { import AppNotification, {
showAppNotification, showAppNotification,
} from "components/common/AppNotification.svelte" } from "components/common/AppNotification.svelte"
@ -26,55 +23,6 @@
}) })
</script> </script>
<main>
<AppNotification /> <AppNotification />
{#await init}
<div class="spinner-container">
<Spinner />
</div>
{:then result}
{#if $store.hasAppPackage} <Router {routes} />
<PackageRoot />
{:else}
<NoPackage />
{/if}
{:catch err}
<h1 style="color:red">{err}</h1>
{/await}
<!--
<div class="settings">
<IconButton icon="settings"
on:click={store.showSettings}/>
</div>
{#if $store.useAnalytics}
<iframe src="https://marblekirby.github.io/bb-analytics.html" width="0" height="0" style="visibility:hidden;display:none"/>
{/if}
-->
</main>
<style>
main {
height: 100%;
width: 100%;
font-family: "Roboto", Helvetica, Arial, sans-serif;
}
.settings {
position: absolute;
bottom: 25px;
right: 25px;
}
.spinner-container {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -10,20 +10,8 @@ export const initialise = async () => {
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
LogRocket.init("knlald/budibase") LogRocket.init("knlald/budibase")
} }
setupRouter(store)
await store.initialise() await store.initialise()
} catch (err) { } catch (err) {
console.log(err) console.log(err)
} }
} }
const setupRouter = writable => {
const pushState = history.pushState
history.pushState = () => {
pushState.apply(history, [writable])
writable.initialise()
}
window.addEventListener("hashchange", () => {
writable.initialise()
})
}

View File

@ -1,3 +1,4 @@
//
import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp" import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp"
import { pipe, getNode, constructHierarchy } from "components/common/core" import { pipe, getNode, constructHierarchy } from "components/common/core"
import * as backendStoreActions from "./backend" import * as backendStoreActions from "./backend"
@ -101,10 +102,6 @@ export const getStore = () => {
export default getStore export default getStore
const initialise = (store, initial) => async () => { const initialise = (store, initial) => async () => {
appname = window.location.hash
? last(window.location.hash.substr(1).split("/"))
: ""
if (!appname) { if (!appname) {
initial.apps = await api.get(`/_builder/api/apps`).then(r => r.json()) initial.apps = await api.get(`/_builder/api/apps`).then(r => r.json())
initial.hasAppPackage = false initial.hasAppPackage = false

View File

@ -0,0 +1,52 @@
<script>
import Button from "components/common/Button.svelte"
export let apps
</script>
<div class="root">
<div class="inner">
<img
src="/_builder/assets/budibase-logo.png"
class="logo"
alt="budibase logo" />
<div>
<div>
<h4 style="margin-bottom: 20px">Choose an Application</h4>
{#each apps as app}
<a href={`/${app}`} class="app-link">{app}</a>
{/each}
</div>
</div>
</div>
</div>
<style>
.root {
position: fixed;
margin: 0 auto;
text-align: center;
top: 20%;
/*color: #333333;
background-color: #fdfdfd;*/
width: 100%;
}
.inner {
display: inline-block;
margin: auto;
}
.logo {
width: 300px;
margin-bottom: 40px;
}
.root :global(.option) {
width: 250px;
}
.app-link {
margin-top: 10px;
display: block;
}
</style>

View File

@ -2,8 +2,8 @@
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { isActive, goto, url, context } from "@sveltech/routify" import { isActive, goto, url, context } from "@sveltech/routify"
import { SettingsIcon, PreviewIcon } from "../../common/Icons/" import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
import IconButton from "../../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
$: ({ component } = $context) $: ({ component } = $context)
$: list = component.parent.children.filter(child => child.isIndexable) $: list = component.parent.children.filter(child => child.isIndexable)

View File

@ -1,11 +1,11 @@
<script> <script>
import BackendNav from "../../../nav/BackendNav.svelte" import BackendNav from "components/nav/BackendNav.svelte"
import SchemaManagementDrawer from "../../../nav/SchemaManagementDrawer.svelte" import SchemaManagementDrawer from "components/nav/SchemaManagementDrawer.svelte"
import Database from "../../../database/DatabaseRoot.svelte" import Database from "components/database/DatabaseRoot.svelte"
import UserInterface from "../../../userInterface/UserInterfaceRoot.svelte" import UserInterface from "components/userInterface/UserInterfaceRoot.svelte"
import ActionsAndTriggers from "../../../actionsAndTriggers/ActionsAndTriggersRoot.svelte" import ActionsAndTriggers from "components/actionsAndTriggers/ActionsAndTriggersRoot.svelte"
import AccessLevels from "../../../accessLevels/AccessLevelsRoot.svelte" import AccessLevels from "components/accessLevels/AccessLevelsRoot.svelte"
import ComingSoon from "../../../common/ComingSoon.svelte" import ComingSoon from "components/common/ComingSoon.svelte"
</script> </script>
<div class="root"> <div class="root">

View File

@ -1,6 +1,6 @@
<script> <script>
import { goto } from "@sveltech/routify" import { goto } from "@sveltech/routify"
$goto("../backend") // $goto("../backend")
</script> </script>
<!-- routify:options $index=false --> <!-- routify:options $index=false -->

View File

@ -1,10 +1,8 @@
<script> <script>
import AppList from "../AppList.svelte" import AppList from "components/start/AppList.svelte"
import PackageRoot from "../PackageRoot.svelte"
import Settings from "../Settings.svelte"
import { onMount } from "svelte" import { onMount } from "svelte"
import IconButton from "../common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
import Spinner from "../common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
let promise = getApps() let promise = getApps()
@ -21,7 +19,6 @@
</script> </script>
<main> <main>
{#await promise} {#await promise}
<div class="spinner-container"> <div class="spinner-container">
<Spinner /> <Spinner />