Fix datasource navigator padding, add other user selection state to design section

This commit is contained in:
Andrew Kingston 2023-07-04 11:28:02 +01:00
parent f3ecbca6b4
commit dae2c0cfba
8 changed files with 16 additions and 10 deletions

View File

@ -216,7 +216,7 @@
<style> <style>
.hierarchy-items-container { .hierarchy-items-container {
margin: 0 calc(-1 * var(--spacing-xl)); margin: 0 calc(-1 * var(--spacing-l));
} }
.datasource-icon { .datasource-icon {
display: grid; display: grid;

View File

@ -133,6 +133,7 @@
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: stretch; align-items: stretch;
position: relative;
} }
.nav-item.scrollable { .nav-item.scrollable {
flex-direction: column; flex-direction: column;
@ -172,10 +173,12 @@
height: 28px; height: 28px;
border: 2px solid var(--selected-by-color); border: 2px solid var(--selected-by-color);
left: 0; left: 0;
top: 0;
border-radius: 2px; border-radius: 2px;
} }
.selected-by-label { .selected-by-label {
position: absolute; position: absolute;
top: 0;
right: 0; right: 0;
background: var(--selected-by-color); background: var(--selected-by-color);
padding: 2px 4px; padding: 2px 4px;

View File

@ -5,8 +5,6 @@
import { isActive, goto, redirect } from "@roxi/routify" import { isActive, goto, redirect } from "@roxi/routify"
import BetaButton from "./_components/BetaButton.svelte" import BetaButton from "./_components/BetaButton.svelte"
import { datasources } from "stores/backend" import { datasources } from "stores/backend"
import { onDestroy } from "svelte"
import { store } from "builderStore"
$: { $: {
// If we ever don't have any data other than the users table, prompt the // If we ever don't have any data other than the users table, prompt the
@ -15,10 +13,6 @@
$redirect("./new") $redirect("./new")
} }
} }
onDestroy(() => {
store.actions.websocket.selectResource(null)
})
</script> </script>
<!-- routify:options index=1 --> <!-- routify:options index=1 -->

View File

@ -7,6 +7,9 @@
import { onDestroy } from "svelte" import { onDestroy } from "svelte"
const { isActive, goto } = routify const { isActive, goto } = routify
$: screenId = $store.selectedScreenId
$: store.actions.websocket.selectResource(screenId)
// Keep URL and state in sync for selected screen ID // Keep URL and state in sync for selected screen ID
const stopSyncing = syncURLToState({ const stopSyncing = syncURLToState({
urlParam: "screenId", urlParam: "screenId",

View File

@ -3,7 +3,7 @@
import ComponentTree from "./ComponentTree.svelte" import ComponentTree from "./ComponentTree.svelte"
import { dndStore } from "./dndStore.js" import { dndStore } from "./dndStore.js"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { store, selectedScreen } from "builderStore" import { store, selectedScreen, userSelectedResourceMap } from "builderStore"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import ScreenslotDropdownMenu from "./ScreenslotDropdownMenu.svelte" import ScreenslotDropdownMenu from "./ScreenslotDropdownMenu.svelte"
import DNDPositionIndicator from "./DNDPositionIndicator.svelte" import DNDPositionIndicator from "./DNDPositionIndicator.svelte"
@ -41,6 +41,7 @@
$store.selectedComponentId = $selectedScreen?.props._id $store.selectedComponentId = $selectedScreen?.props._id
}} }}
id={`component-${$selectedScreen?.props._id}`} id={`component-${$selectedScreen?.props._id}`}
selectedBy={$userSelectedResourceMap[$selectedScreen?.props._id]}
> >
<ScreenslotDropdownMenu component={$selectedScreen?.props} /> <ScreenslotDropdownMenu component={$selectedScreen?.props} />
</NavItem> </NavItem>

View File

@ -1,5 +1,5 @@
<script> <script>
import { store } from "builderStore" import { store, userSelectedResourceMap } from "builderStore"
import ComponentDropdownMenu from "./ComponentDropdownMenu.svelte" import ComponentDropdownMenu from "./ComponentDropdownMenu.svelte"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import { capitalise } from "helpers" import { capitalise } from "helpers"
@ -123,6 +123,7 @@
selected={$store.selectedComponentId === component._id} selected={$store.selectedComponentId === component._id}
{opened} {opened}
highlighted={isChildOfSelectedComponent(component)} highlighted={isChildOfSelectedComponent(component)}
selectedBy={$userSelectedResourceMap[component._id]}
> >
<ComponentDropdownMenu {component} /> <ComponentDropdownMenu {component} />
</NavItem> </NavItem>

View File

@ -7,6 +7,9 @@
import ComponentListPanel from "./_components/navigation/ComponentListPanel.svelte" import ComponentListPanel from "./_components/navigation/ComponentListPanel.svelte"
import ComponentSettingsPanel from "./_components/settings/ComponentSettingsPanel.svelte" import ComponentSettingsPanel from "./_components/settings/ComponentSettingsPanel.svelte"
$: componentId = $store.selectedComponentId
$: store.actions.websocket.selectResource(componentId)
const cleanUrl = url => { const cleanUrl = url => {
// Strip trailing slashes // Strip trailing slashes
if (url?.endsWith("/index")) { if (url?.endsWith("/index")) {

View File

@ -2,7 +2,7 @@
import { Search, Layout, Select, Body, Button } from "@budibase/bbui" import { Search, Layout, Select, Body, Button } from "@budibase/bbui"
import Panel from "components/design/Panel.svelte" import Panel from "components/design/Panel.svelte"
import { roles } from "stores/backend" import { roles } from "stores/backend"
import { store, sortedScreens } from "builderStore" import { store, sortedScreens, userSelectedResourceMap } from "builderStore"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte" import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
import ScreenWizard from "./ScreenWizard.svelte" import ScreenWizard from "./ScreenWizard.svelte"
@ -60,6 +60,7 @@
on:click={() => store.actions.screens.select(screen._id)} on:click={() => store.actions.screens.select(screen._id)}
rightAlignIcon rightAlignIcon
showTooltip showTooltip
selectedBy={$userSelectedResourceMap[screen._id]}
> >
<ScreenDropdownMenu screenId={screen._id} /> <ScreenDropdownMenu screenId={screen._id} />
<RoleIndicator slot="right" roleId={screen.routing.roleId} /> <RoleIndicator slot="right" roleId={screen.routing.roleId} />