Add log out and old settings to action menu from top bar avatar

This commit is contained in:
Andrew Kingston 2021-05-06 15:00:35 +01:00
parent 2e335019cd
commit 4d69e8c5c2
4 changed files with 22 additions and 30 deletions

View File

@ -4,6 +4,7 @@
import Menu from "../Menu/Menu.svelte" import Menu from "../Menu/Menu.svelte"
export let disabled = false export let disabled = false
export let align = "left"
let anchor let anchor
let dropdown let dropdown
@ -31,7 +32,7 @@
<div use:getAnchor on:click={openMenu}> <div use:getAnchor on:click={openMenu}>
<slot name="control" /> <slot name="control" />
</div> </div>
<Popover bind:this={dropdown} {anchor} align="left"> <Popover bind:this={dropdown} {anchor} {align}>
<Menu> <Menu>
<slot /> <slot />
</Menu> </Menu>

View File

@ -1,15 +0,0 @@
<script>
import { Button, Modal } from "@budibase/bbui"
import BuilderSettingsModal from "./BuilderSettingsModal.svelte"
let modal
</script>
<div>
<Button primary quiet icon="Settings" text on:click={modal.show}>
Settings
</Button>
</div>
<Modal bind:this={modal} width="30%">
<BuilderSettingsModal />
</Modal>

View File

@ -1,6 +0,0 @@
<script>
import { Button } from "@budibase/bbui"
import { auth } from "stores/backend"
</script>
<Button primary quiet text icon="LogOut" on:click={auth.logout}>Log Out</Button>

View File

@ -8,11 +8,14 @@
Layout, Layout,
SideNavigation as Navigation, SideNavigation as Navigation,
SideNavigationItem as Item, SideNavigationItem as Item,
ActionMenu,
MenuItem,
Modal,
} from "@budibase/bbui" } from "@budibase/bbui"
import ConfigChecklist from "components/common/ConfigChecklist.svelte" import ConfigChecklist from "components/common/ConfigChecklist.svelte"
import { organisation, apps } from "stores/portal" import { organisation, apps } from "stores/portal"
import BuilderSettingsButton from "components/start/BuilderSettingsButton.svelte" import { auth } from "stores/backend"
import LogoutButton from "components/start/LogoutButton.svelte" import BuilderSettingsModal from "components/start/BuilderSettingsModal.svelte"
organisation.init() organisation.init()
apps.load() apps.load()
@ -20,6 +23,7 @@
let orgName let orgName
let orgLogo let orgLogo
let user let user
let oldSettingsModal
async function getInfo() { async function getInfo() {
// fetch orgInfo // fetch orgInfo
@ -64,24 +68,31 @@
<Item selected={$isActive(href)} {href} {heading}>{title}</Item> <Item selected={$isActive(href)} {href} {heading}>{title}</Item>
{/each} {/each}
</Navigation> </Navigation>
<BuilderSettingsButton />
<LogoutButton />
</div> </div>
</Layout> </Layout>
</div> </div>
<div class="main"> <div class="main">
<div class="toolbar"> <div class="toolbar">
<Search placeholder="Global search" /> <Search placeholder="Global search" />
<div class="avatar"> <ActionMenu align="right">
<Avatar size="M" name="John Doe" /> <div slot="control" class="avatar">
<Icon size="XL" name="ChevronDown" /> <Avatar size="M" name="John Doe" />
</div> <Icon size="XL" name="ChevronDown" />
</div>
<MenuItem icon="Settings" on:click={oldSettingsModal.show}>
Settings
</MenuItem>
<MenuItem icon="LogOut" on:click={auth.logout}>Log out</MenuItem>
</ActionMenu>
</div> </div>
<div> <div>
<slot /> <slot />
</div> </div>
</div> </div>
</div> </div>
<Modal bind:this={oldSettingsModal} width="30%">
<BuilderSettingsModal />
</Modal>
<style> <style>
.container { .container {
@ -130,6 +141,7 @@
grid-template-columns: 250px auto; grid-template-columns: 250px auto;
justify-content: space-between; justify-content: space-between;
padding: var(--spacing-m) calc(var(--spacing-xl) * 2); padding: var(--spacing-m) calc(var(--spacing-xl) * 2);
align-items: center;
} }
img { img {
width: 28px; width: 28px;