From f80f4a6c436065a7020cd1f875312628e1e04c21 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Thu, 2 Apr 2020 15:16:46 +0200 Subject: [PATCH] wip: add back root routify index page --- packages/builder/src/App.svelte | 62 ++----------------- packages/builder/src/builderStore/index.js | 14 +---- .../builder/src/builderStore/store/index.js | 5 +- .../src/components/start/AppList.svelte | 52 ++++++++++++++++ .../_layout.svelte | 4 +- .../backend/_layout.svelte | 14 ++--- .../backend/actions/index.svelte | 0 .../backend/database/index.svelte | 0 .../backend/index.svelte | 0 .../frontend/_layout.svelte | 0 .../frontend/index.svelte | 0 .../index.svelte | 2 +- .../settings/_layout.svelte | 0 .../settings/index.svelte | 0 packages/builder/src/pages/index.svelte | 9 +-- 15 files changed, 72 insertions(+), 90 deletions(-) create mode 100644 packages/builder/src/components/start/AppList.svelte rename packages/builder/src/pages/{_[application] => [application]}/_layout.svelte (95%) rename packages/builder/src/pages/{_[application] => [application]}/backend/_layout.svelte (57%) rename packages/builder/src/pages/{_[application] => [application]}/backend/actions/index.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/backend/database/index.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/backend/index.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/frontend/_layout.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/frontend/index.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/index.svelte (80%) rename packages/builder/src/pages/{_[application] => [application]}/settings/_layout.svelte (100%) rename packages/builder/src/pages/{_[application] => [application]}/settings/index.svelte (100%) diff --git a/packages/builder/src/App.svelte b/packages/builder/src/App.svelte index 424c7b9a1e..7f2279fbd8 100644 --- a/packages/builder/src/App.svelte +++ b/packages/builder/src/App.svelte @@ -1,11 +1,8 @@ -
- - {#await init} -
- -
- {:then result} + - {#if $store.hasAppPackage} - - {:else} - - {/if} - - {:catch err} -

{err}

- {/await} - - -
- - + diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 801ecb6464..b3556cff93 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -10,20 +10,8 @@ export const initialise = async () => { if (process.env.NODE_ENV === "production") { LogRocket.init("knlald/budibase") } - setupRouter(store) await store.initialise() } catch (err) { console.log(err) } -} - -const setupRouter = writable => { - const pushState = history.pushState - history.pushState = () => { - pushState.apply(history, [writable]) - writable.initialise() - } - window.addEventListener("hashchange", () => { - writable.initialise() - }) -} +} \ No newline at end of file diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index 76cdc5a7c3..dcd13aab3b 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -1,3 +1,4 @@ +// import { filter, cloneDeep, last, concat, isEmpty, values } from "lodash/fp" import { pipe, getNode, constructHierarchy } from "components/common/core" import * as backendStoreActions from "./backend" @@ -101,10 +102,6 @@ export const getStore = () => { export default getStore const initialise = (store, initial) => async () => { - appname = window.location.hash - ? last(window.location.hash.substr(1).split("/")) - : "" - if (!appname) { initial.apps = await api.get(`/_builder/api/apps`).then(r => r.json()) initial.hasAppPackage = false diff --git a/packages/builder/src/components/start/AppList.svelte b/packages/builder/src/components/start/AppList.svelte new file mode 100644 index 0000000000..0a499b80eb --- /dev/null +++ b/packages/builder/src/components/start/AppList.svelte @@ -0,0 +1,52 @@ + + +
+
+ +
+
+

Choose an Application

+ {#each apps as app} + {app} + {/each} +
+
+
+
+ + diff --git a/packages/builder/src/pages/_[application]/_layout.svelte b/packages/builder/src/pages/[application]/_layout.svelte similarity index 95% rename from packages/builder/src/pages/_[application]/_layout.svelte rename to packages/builder/src/pages/[application]/_layout.svelte index a6df5958ed..11f65a8c85 100644 --- a/packages/builder/src/pages/_[application]/_layout.svelte +++ b/packages/builder/src/pages/[application]/_layout.svelte @@ -2,8 +2,8 @@ import { fade } from "svelte/transition" import { isActive, goto, url, context } from "@sveltech/routify" - import { SettingsIcon, PreviewIcon } from "../../common/Icons/" - import IconButton from "../../common/IconButton.svelte" + import { SettingsIcon, PreviewIcon } from "components/common/Icons/" + import IconButton from "components/common/IconButton.svelte" $: ({ component } = $context) $: list = component.parent.children.filter(child => child.isIndexable) diff --git a/packages/builder/src/pages/_[application]/backend/_layout.svelte b/packages/builder/src/pages/[application]/backend/_layout.svelte similarity index 57% rename from packages/builder/src/pages/_[application]/backend/_layout.svelte rename to packages/builder/src/pages/[application]/backend/_layout.svelte index 58452ee636..2e44ab88f1 100644 --- a/packages/builder/src/pages/_[application]/backend/_layout.svelte +++ b/packages/builder/src/pages/[application]/backend/_layout.svelte @@ -1,11 +1,11 @@
diff --git a/packages/builder/src/pages/_[application]/backend/actions/index.svelte b/packages/builder/src/pages/[application]/backend/actions/index.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/backend/actions/index.svelte rename to packages/builder/src/pages/[application]/backend/actions/index.svelte diff --git a/packages/builder/src/pages/_[application]/backend/database/index.svelte b/packages/builder/src/pages/[application]/backend/database/index.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/backend/database/index.svelte rename to packages/builder/src/pages/[application]/backend/database/index.svelte diff --git a/packages/builder/src/pages/_[application]/backend/index.svelte b/packages/builder/src/pages/[application]/backend/index.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/backend/index.svelte rename to packages/builder/src/pages/[application]/backend/index.svelte diff --git a/packages/builder/src/pages/_[application]/frontend/_layout.svelte b/packages/builder/src/pages/[application]/frontend/_layout.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/frontend/_layout.svelte rename to packages/builder/src/pages/[application]/frontend/_layout.svelte diff --git a/packages/builder/src/pages/_[application]/frontend/index.svelte b/packages/builder/src/pages/[application]/frontend/index.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/frontend/index.svelte rename to packages/builder/src/pages/[application]/frontend/index.svelte diff --git a/packages/builder/src/pages/_[application]/index.svelte b/packages/builder/src/pages/[application]/index.svelte similarity index 80% rename from packages/builder/src/pages/_[application]/index.svelte rename to packages/builder/src/pages/[application]/index.svelte index 25636f83f1..db9f091c2d 100644 --- a/packages/builder/src/pages/_[application]/index.svelte +++ b/packages/builder/src/pages/[application]/index.svelte @@ -1,6 +1,6 @@ diff --git a/packages/builder/src/pages/_[application]/settings/_layout.svelte b/packages/builder/src/pages/[application]/settings/_layout.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/settings/_layout.svelte rename to packages/builder/src/pages/[application]/settings/_layout.svelte diff --git a/packages/builder/src/pages/_[application]/settings/index.svelte b/packages/builder/src/pages/[application]/settings/index.svelte similarity index 100% rename from packages/builder/src/pages/_[application]/settings/index.svelte rename to packages/builder/src/pages/[application]/settings/index.svelte diff --git a/packages/builder/src/pages/index.svelte b/packages/builder/src/pages/index.svelte index 004280071b..2b401321a2 100644 --- a/packages/builder/src/pages/index.svelte +++ b/packages/builder/src/pages/index.svelte @@ -1,10 +1,8 @@
- {#await promise}