diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index a8dc989313..663128160f 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -86,7 +86,7 @@ } .is-selected:not(.spectrum-ActionButton--emphasized):not(.spectrum-ActionButton--quiet) { background: var(--spectrum-global-color-gray-300); - border-color: var(--spectrum-global-color-gray-700); + border-color: var(--spectrum-global-color-gray-500); } .noPadding { padding: 0; diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index d99601afeb..abc7188985 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -1,11 +1,21 @@ -export default function positionDropdown( - element, - { anchor, align, maxWidth, useAnchorWidth, offset = 5 } -) { - const update = () => { +export default function positionDropdown(element, opts) { + let resizeObserver + let latestOpts = opts + + // We need a static reference to this function so that we can properly + // clean up the scroll listener. + const scrollUpdate = () => { + updatePosition(latestOpts) + } + + // Updates the position of the dropdown + const updatePosition = opts => { + const { anchor, align, maxWidth, useAnchorWidth, offset = 5 } = opts if (!anchor) { return } + + // Compute bounds const anchorBounds = anchor.getBoundingClientRect() const elementBounds = element.getBoundingClientRect() let styles = { @@ -51,26 +61,47 @@ export default function positionDropdown( }) } + // The actual svelte action callback which creates observers on the relevant + // DOM elements + const update = newOpts => { + latestOpts = newOpts + + // Cleanup old state + if (resizeObserver) { + resizeObserver.disconnect() + } + + // Do nothing if no anchor + const { anchor } = newOpts + if (!anchor) { + return + } + + // Observe both anchor and element and resize the popover as appropriate + resizeObserver = new ResizeObserver(() => updatePosition(newOpts)) + resizeObserver.observe(anchor) + resizeObserver.observe(element) + resizeObserver.observe(document.body) + } + // Apply initial styles which don't need to change element.style.position = "absolute" element.style.zIndex = "9999" - // Observe both anchor and element and resize the popover as appropriate - const resizeObserver = new ResizeObserver(entries => { - entries.forEach(update) - }) - if (anchor) { - resizeObserver.observe(anchor) - } - resizeObserver.observe(element) - resizeObserver.observe(document.body) + // Set up a scroll listener + document.addEventListener("scroll", scrollUpdate, true) - document.addEventListener("scroll", update, true) + // Perform initial update + update(opts) return { + update, destroy() { - resizeObserver.disconnect() - document.removeEventListener("scroll", update, true) + // Cleanup + if (resizeObserver) { + resizeObserver.disconnect() + } + document.removeEventListener("scroll", scrollUpdate, true) }, } } diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte index b873fabb80..8f6ef06591 100644 --- a/packages/bbui/src/Popover/Popover.svelte +++ b/packages/bbui/src/Popover/Popover.svelte @@ -57,30 +57,28 @@ {#if open} - {#key anchor} - - {}, - anchor, - }} - on:keydown={handleEscape} - class="spectrum-Popover is-open" - role="presentation" - transition:fly|local={{ y: -20, duration: 200 }} - > - - - - {/key} + + {}, + anchor, + }} + on:keydown={handleEscape} + class="spectrum-Popover is-open" + role="presentation" + transition:fly|local={{ y: -20, duration: 200 }} + > + + + {/if} diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index 032cf850fa..80122c23a5 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -66,7 +66,7 @@ - + {#if loaded} @@ -124,14 +124,19 @@ - 0} on:click={login}> + 0} + on:click={login} + > Log in to {company} - $goto("./forgot")}> - Forgot password + $goto("./forgot")}> + Forgot password? diff --git a/packages/builder/src/pages/builder/invite/index.svelte b/packages/builder/src/pages/builder/invite/index.svelte index 4b786db497..35231117c4 100644 --- a/packages/builder/src/pages/builder/invite/index.svelte +++ b/packages/builder/src/pages/builder/invite/index.svelte @@ -68,7 +68,7 @@ - + Join {company} @@ -175,6 +175,7 @@ 0 || onboarding} cta on:click={acceptInvite} diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 1f95c2f694..e1f6d8ca3f 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -14,7 +14,7 @@ let activeTab = "Apps" $: $url(), updateActiveTab($menu) - $: fullScreen = !$apps?.length + $: fullscreen = !$apps.length const updateActiveTab = menu => { for (let entry of menu) { @@ -37,7 +37,8 @@ $redirect("../") } else { try { - await organisation.init() + // We need to load apps to know if we need to show onboarding fullscreen + await Promise.all([apps.load(), organisation.init()]) } catch (error) { notifications.error("Error getting org config") } @@ -47,37 +48,39 @@ }) -{#if fullScreen} - -{:else if $auth.user && loaded} - - - - - +{#if $auth.user && loaded} + {#if fullscreen} + + {:else} + + + + + + + + + {#each $menu as { title, href }} + $goto(href)} /> + {/each} + + + + + + + + + + + - - - {#each $menu as { title, href }} - $goto(href)} /> - {/each} - - - - - - - - - - + + + - - - - - + {/if} {/if}