diff --git a/packages/builder/package.json b/packages/builder/package.json index 70a9602309..fa92be46a2 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -47,7 +47,6 @@ "safe-buffer": "^5.1.2", "shortid": "^2.2.8", "string_decoder": "^1.2.0", - "svelte-routing": "^1.4.2", "uikit": "^3.1.7" }, "devDependencies": { diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 2ec676b0e8..2ebde91183 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -105,7 +105,9 @@ const lodash_fp_exports = [ "toPairs", "remove", "findIndex", - "compose" + "compose", + "get", + "tap" ] const lodash_exports = [ diff --git a/packages/builder/src/PackageRoot.svelte b/packages/builder/src/PackageRoot.svelte index fcdc2d5c71..ab07f2bac1 100644 --- a/packages/builder/src/PackageRoot.svelte +++ b/packages/builder/src/PackageRoot.svelte @@ -4,7 +4,7 @@ import UserInterfaceRoot from "./userInterface/UserInterfaceRoot.svelte" import BackendRoot from "./BackendRoot.svelte" import { fade } from "svelte/transition" - import { SettingsIcon, PreviewIcon, HelpIcon } from "./common/Icons/" + import { SettingsIcon, PreviewIcon } from "./common/Icons/" const TABS = { BACKEND: "backend", diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 1fff326d46..0a3da2fb50 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -23,7 +23,6 @@ export const getBackendUiStore = () => { name: "" }, breadcrumbs: [], - selectedRecord: {}, selectedDatabase: {}, selectedModel: {}, } @@ -49,14 +48,15 @@ export const getBackendUiStore = () => { return state }), }, + views: { + select: view => store.update(state => { + state.selectedView = { ...state.selectedView, ...view } + return state + }) + }, modals: { show: modal => store.update(state => ({ ...state, visibleModal: modal })), hide: () => store.update(state => ({ ...state, visibleModal: null })) - }, - nodes: { - select: () => {}, - update: () => {}, - delete: () => {}, } } diff --git a/packages/builder/src/common/CodeArea.svelte b/packages/builder/src/common/CodeArea.svelte index 97de1002c2..a58fc12240 100644 --- a/packages/builder/src/common/CodeArea.svelte +++ b/packages/builder/src/common/CodeArea.svelte @@ -11,20 +11,11 @@ padding: 10px; margin-top: 5px; margin-bottom: 10px; - background: var(--primary100); + background: var(--secondary80); color: var(--white); font-family: "Courier New", Courier, monospace; width: 95%; height: 100px; border-radius: 5px; } - - span { - margin-left: 5px; - } - - .header { - display: flex; - align-items: center; - } diff --git a/packages/builder/src/database/IndexView.svelte b/packages/builder/src/database/IndexView.svelte index b60c4b4cb4..22a868ea15 100644 --- a/packages/builder/src/database/IndexView.svelte +++ b/packages/builder/src/database/IndexView.svelte @@ -4,11 +4,9 @@ import Button from "../common/Button.svelte" import Dropdown from "../common/Dropdown.svelte" import { store } from "../builderStore" - import { filter, some, map } from "lodash/fp" + import { filter, some, map, compose } from "lodash/fp" import { hierarchy as hierarchyFunctions, common } from "../../../core/src" - const pipe = common.$ - const SNIPPET_EDITORS = { MAP: "Map", FILTER: "Filter", @@ -19,25 +17,26 @@ let indexableRecords = [] let currentSnippetEditor = SNIPPET_EDITORS.MAP + const indexableRecordsFromIndex = compose( + map(node => ({ + node, + isallowed: index.allowedRecordNodeIds.some(id => node.nodeId === id), + })), + filter(hierarchyFunctions.isRecord), + filter(hierarchyFunctions.isDecendant(index.parent())), + hierarchyFunctions.getFlattenedHierarchy + ) + store.subscribe($store => { index = $store.currentNode - indexableRecords = pipe( - $store.hierarchy, - [ - hierarchyFunctions.getFlattenedHierarchy, - filter(hierarchyFunctions.isDecendant(index.parent())), - filter(hierarchyFunctions.isRecord), - map(node => ({ - node, - isallowed: index.allowedRecordNodeIds.some(id => node.nodeId === id), - })), - ] - ) + indexableRecords = indexableRecordsFromIndex($store.hierarchy) }) const toggleAllowedRecord = record => { if (record.isallowed) { - index.allowedRecordNodeIds = index.allowedRecordNodeIds.filter(id => id !== record.node.nodeId) + index.allowedRecordNodeIds = index.allowedRecordNodeIds.filter( + id => id !== record.node.nodeId + ) } else { index.allowedRecordNodeIds.push(record.node.nodeId) } diff --git a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte index 126b4f6cce..4a59d11298 100644 --- a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte @@ -1,7 +1,7 @@
-

- {last($backendUiStore.breadcrumbs)} -

+

{last($backendUiStore.breadcrumbs)}

+
+ + + + + + -
+