From 2a41f57382e7809aad58369a82d7ebccb913768a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 3 Dec 2020 12:08:33 +0000 Subject: [PATCH] Linting and update to try and fix issues when screens are created, screen saving now generates CSS. --- .../src/builderStore/store/frontend.js | 21 +- .../ComponentTree.svelte | 2 +- .../ComponentNavigationTree/PathTree.svelte | 5 +- .../ComponentSelectionList.svelte | 8 +- .../userInterface/FrontendNavigatePane.svelte | 1 - .../components/userInterface/Layout.svelte | 2 +- .../userInterface/NewScreenModal.svelte | 4 +- .../[application]/design/layouts/index.svelte | 2 +- packages/server/src/api/controllers/screen.js | 12 +- .../src/api/controllers/static/index.js | 1 - .../static/templates/BudibaseApp.svelte | 1 - packages/server/src/api/routes/static.js | 23 +- packages/server/yarn.lock | 209 +++++++++++++++++- 13 files changed, 253 insertions(+), 38 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 7c6d15da9a..cde89707d4 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -107,7 +107,7 @@ export const getFrontendStore = () => { state.currentAssetId = screenId state.currentView = "detail" - promise = store.actions.screens.regenerateCssForCurrentScreen() + promise = store.actions.screens.regenerateCss(screen) const safeProps = makePropsSafe( state.components[screen.props._component], screen.props @@ -119,30 +119,19 @@ export const getFrontendStore = () => { await promise }, create: async screen => { - let promises = [] + screen = await store.actions.screens.save(screen) store.update(state => { state.currentPreviewItem = screen state.currentComponentInfo = screen.props state.currentFrontEndType = FrontendTypes.SCREEN - - if (state.currentPreviewItem) { - promises.push( - store.actions.screens.regenerateCss(state.currentPreviewItem) - ) - } - - promises.push(store.actions.screens.save(screen)) return state }) - - await Promise.all(promises) + return screen }, save: async screen => { const creatingNewScreen = screen._id === undefined const response = await api.post(`/api/screens`, screen) - const json = await response.json() - screen._rev = json.rev - screen._id = json.id + screen = await response.json() store.update(state => { const foundScreen = state.screens.findIndex( @@ -164,6 +153,8 @@ export const getFrontendStore = () => { } return state }) + console.log(screen) + return screen }, regenerateCss: async asset => { const response = await api.post("/api/css/generate", asset) diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte index d858394d80..e11008b291 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/ComponentTree.svelte @@ -11,7 +11,7 @@ export let currentComponent export let onSelect = () => {} export let level = 0 - export let dragDropStore + export let dragDropStore const isScreenslot = name => name === "##builtin/screenslot" diff --git a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte index 8f5872b317..cac25c303e 100644 --- a/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte +++ b/packages/builder/src/components/userInterface/ComponentNavigationTree/PathTree.svelte @@ -8,7 +8,7 @@ import NavItem from "components/common/NavItem.svelte" import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte" - const dragDropStore = instantiateStore(); + const dragDropStore = instantiateStore() export let route export let path @@ -45,8 +45,7 @@ + {dragDropStore} /> {/if} {/each} {/each} diff --git a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte index b7d0fd1f11..b3d1238323 100644 --- a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte +++ b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte @@ -40,13 +40,9 @@ class="category" on:click={() => onCategoryChosen(category, idx)} class:active={idx === selectedIndex}> - {#if category.icon} - - {/if} + {#if category.icon}{/if} {category.name} - {#if category.isCategory} - - {/if} + {#if category.isCategory}{/if} {/each} diff --git a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte index c53694c1bc..ee61d82c68 100644 --- a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte @@ -70,7 +70,6 @@ -