Don't show selected components unless the components tab is active and automatically route to components whenever selecting on in the preview
This commit is contained in:
parent
ee0dd6853a
commit
c22ffb9f52
|
@ -5,6 +5,7 @@ import {
|
||||||
mainLayout,
|
mainLayout,
|
||||||
selectedComponent,
|
selectedComponent,
|
||||||
selectedAccessRole,
|
selectedAccessRole,
|
||||||
|
store,
|
||||||
} from "builderStore"
|
} from "builderStore"
|
||||||
import {
|
import {
|
||||||
datasources,
|
datasources,
|
||||||
|
|
|
@ -39,7 +39,11 @@
|
||||||
{#if $store.clientFeatures.devicePreview}
|
{#if $store.clientFeatures.devicePreview}
|
||||||
<DevicePreviewSelect />
|
<DevicePreviewSelect />
|
||||||
{/if}
|
{/if}
|
||||||
<Button cta icon="Add" on:click={() => $goto(newComponentUrl)}>
|
<Button
|
||||||
|
cta
|
||||||
|
icon="Add"
|
||||||
|
on:click={() => $goto(`./components/${$selectedScreen._id}/new`)}
|
||||||
|
>
|
||||||
Component
|
Component
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import ErrorSVG from "@budibase/frontend-core/assets/error.svg?raw"
|
import ErrorSVG from "@budibase/frontend-core/assets/error.svg?raw"
|
||||||
import { findComponent, findComponentPath } from "builderStore/componentUtils"
|
import { findComponent, findComponentPath } from "builderStore/componentUtils"
|
||||||
|
import { isActive, goto } from "@roxi/routify"
|
||||||
|
|
||||||
let iframe
|
let iframe
|
||||||
let layout
|
let layout
|
||||||
|
@ -41,7 +42,10 @@
|
||||||
screen = $selectedScreen
|
screen = $selectedScreen
|
||||||
layout = $store.layouts.find(layout => layout._id === screen?.layoutId)
|
layout = $store.layouts.find(layout => layout._id === screen?.layoutId)
|
||||||
}
|
}
|
||||||
$: selectedComponentId = $store.selectedComponentId ?? ""
|
// Don't show selected components unless on the components tab
|
||||||
|
$: selectedComponentId = $isActive("./components")
|
||||||
|
? $store.selectedComponentId
|
||||||
|
: ""
|
||||||
$: previewData = {
|
$: previewData = {
|
||||||
appId: $store.appId,
|
appId: $store.appId,
|
||||||
layout,
|
layout,
|
||||||
|
@ -140,10 +144,10 @@
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (type === "select-component" && data.id) {
|
if (type === "select-component" && data.id) {
|
||||||
store.update(state => {
|
$store.selectedComponentId = data.id
|
||||||
state.selectedComponentId = data.id
|
if (!$isActive("./components")) {
|
||||||
return state
|
$goto("./components")
|
||||||
})
|
}
|
||||||
} else if (type === "update-prop") {
|
} else if (type === "update-prop") {
|
||||||
await store.actions.components.updateProp(data.prop, data.value)
|
await store.actions.components.updateProp(data.prop, data.value)
|
||||||
} else if (type === "delete-component" && data.id) {
|
} else if (type === "delete-component" && data.id) {
|
||||||
|
|
Loading…
Reference in New Issue