diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 61f816196e..1bd86480a4 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -26,7 +26,9 @@ export const currentScreens = derived(store, $store => { if (currentScreens == null) { return [] } - return Array.isArray(currentScreens) ? currentScreens : Object.values(currentScreens) + return Array.isArray(currentScreens) + ? currentScreens + : Object.values(currentScreens) }) export const initialise = async () => { diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index d06ff3744c..ee0c98ed8d 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -1,15 +1,24 @@ import { get, writable } from "svelte/store" -import {cloneDeep} from "lodash/fp" -import { createProps, getBuiltin, makePropsSafe } from "components/userInterface/pagesParsing/createProps" +import { cloneDeep } from "lodash/fp" +import { + createProps, + getBuiltin, + makePropsSafe, +} from "components/userInterface/pagesParsing/createProps" import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents" -import {allScreens, backendUiStore } from "builderStore" +import { allScreens, backendUiStore } from "builderStore" import { generate_screen_css } from "../generate_css" import { fetchComponentLibDefinitions } from "../loadComponentLibraries" import api from "../api" import { DEFAULT_PAGES_OBJECT } from "../../constants" import getNewComponentName from "../getNewComponentName" import analytics from "analytics" -import { findChildComponentType, generateNewIdsForComponent, getComponentDefinition, getParent } from "../storeUtils" +import { + findChildComponentType, + generateNewIdsForComponent, + getComponentDefinition, + getParent, +} from "../storeUtils" const INITIAL_FRONTEND_STATE = { apps: [], @@ -165,7 +174,9 @@ export const getFrontendStore = () => { const json = await response.json() screen._rev = json.rev screen._id = json.id - const foundScreen = currentPageScreens.findIndex(el => el._id === screen._id) + const foundScreen = currentPageScreens.findIndex( + el => el._id === screen._id + ) if (currentPageScreens !== -1) { currentPageScreens.splice(foundScreen, 1) } @@ -318,14 +329,11 @@ export const getFrontendStore = () => { const instanceId = get(backendUiStore).selectedDatabase._id const instanceName = getNewComponentName(component, state) - const newComponent = createProps( - component, - { - ...presetProps, - _instanceId: instanceId, - _instanceName: instanceName, - } - ) + const newComponent = createProps(component, { + ...presetProps, + _instanceId: instanceId, + _instanceName: instanceName, + }) const currentComponent = state.components[state.currentComponentInfo._component] diff --git a/packages/builder/src/builderStore/storeUtils.js b/packages/builder/src/builderStore/storeUtils.js index 69050e1b87..97b780de69 100644 --- a/packages/builder/src/builderStore/storeUtils.js +++ b/packages/builder/src/builderStore/storeUtils.js @@ -36,7 +36,11 @@ export const walkProps = (props, action, cancelToken = null) => { } } -export const generateNewIdsForComponent = (component, state, changeName = true) => +export const generateNewIdsForComponent = ( + component, + state, + changeName = true +) => walkProps(component, prop => { prop._id = uuid() if (changeName) prop._instanceName = getNewComponentName(prop, state) diff --git a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte index 8d119e8ec3..999014f0cd 100644 --- a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte @@ -99,9 +99,7 @@
-
- -
+
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/ComponentsHierarchy.svelte b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte index c69d5f7b9b..a9140e2978 100644 --- a/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte +++ b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte @@ -24,15 +24,12 @@ let componentToDelete = "" const normalizedName = name => - pipe( - name, - [ - trimCharsStart("./"), - trimCharsStart("~/"), - trimCharsStart("../"), - trimChars(" "), - ] - ) + pipe(name, [ + trimCharsStart("./"), + trimCharsStart("~/"), + trimCharsStart("../"), + trimChars(" "), + ]) const changeScreen = screen => { store.actions.screens.select(screen.props._instanceName) diff --git a/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte b/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte index a9f390900a..7bedf5e6a8 100644 --- a/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte +++ b/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte @@ -35,11 +35,7 @@ const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1) const get_name = s => (!s ? "" : last(s.split("/"))) - const get_capitalised_name = name => - pipe( - name, - [get_name, capitalise] - ) + const get_capitalised_name = name => pipe(name, [get_name, capitalise]) const isScreenslot = name => name === "##builtin/screenslot" const selectComponent = component => {