1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Fix add component FAB not working when screen or navigation are selected

This commit is contained in:
Andrew Kingston 2023-08-23 15:04:18 +01:00
parent 899a1dd754
commit 08d2074515
2 changed files with 6 additions and 11 deletions

View file

@ -1,12 +1,7 @@
<script>
import { get } from "svelte/store"
import { onMount, onDestroy } from "svelte"
import {
store,
selectedComponent,
selectedScreen,
currentAsset,
} from "builderStore"
import { store, selectedScreen, currentAsset } from "builderStore"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import {
ProgressCircle,
@ -70,7 +65,7 @@
$: refreshContent(json)
// Determine if the add component menu is active
$: isAddingComponent = $isActive(`./${$selectedComponent?._id}/new`)
$: isAddingComponent = $isActive(`./${selectedComponentId}/new`)
// Register handler to send custom to the preview
$: sendPreviewEvent = (name, payload) => {
@ -212,10 +207,10 @@
}
const toggleAddComponent = () => {
if (isAddingComponent) {
$goto(`./${$selectedComponent?._id}`)
if ($isActive(`./${selectedComponentId}/new`)) {
$goto(`./${selectedComponentId}`)
} else {
$goto(`./${$selectedComponent?._id}/new`)
$goto(`./${selectedComponentId}/new`)
}
}

View file

@ -15,7 +15,7 @@
const toNewComponentRoute = () => {
if ($isActive(`./${$store.selectedComponentId}/new`)) {
return
$goto(`./${$store.selectedComponentId}`)
} else {
$goto(`./${$store.selectedComponentId}/new`)
}