Update top nav bar and core layout

This commit is contained in:
Andrew Kingston 2022-10-27 09:06:14 +01:00
parent c9df4e5cb9
commit d016ee9775
1 changed files with 67 additions and 79 deletions

View File

@ -3,16 +3,14 @@
import { import {
Icon, Icon,
Avatar, Avatar,
Layout,
SideNavigation as Navigation,
SideNavigationItem as Item,
ActionMenu, ActionMenu,
MenuItem, MenuItem,
Modal, Modal,
clickOutside,
notifications, notifications,
Tabs,
Tab,
Button,
} from "@budibase/bbui" } from "@budibase/bbui"
import ConfigChecklist from "components/common/ConfigChecklist.svelte"
import { organisation, auth, admin as adminStore } from "stores/portal" import { organisation, auth, admin as adminStore } from "stores/portal"
import { onMount } from "svelte" import { onMount } from "svelte"
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
@ -26,6 +24,7 @@
let changePasswordModal let changePasswordModal
let apiKeyModal let apiKeyModal
let mobileMenuVisible = false let mobileMenuVisible = false
let activeTab = "Apps"
$: menu = buildMenu($auth.isAdmin) $: menu = buildMenu($auth.isAdmin)
@ -122,12 +121,6 @@
badge: "New", badge: "New",
}, },
]) ])
} else if (!$adminStore.cloud && admin) {
menu = menu.concat({
title: "Upgrade",
href: "/builder/portal/settings/upgrade",
badge: "New",
})
} }
// show the billing page to licensed account holders in cloud // show the billing page to licensed account holders in cloud
@ -173,42 +166,28 @@
loaded = true loaded = true
} }
} }
// Find selected tab
for (let entry of menu) {
if ($isActive(entry.href)) {
activeTab = entry.title
break
}
}
}) })
</script> </script>
{#if $auth.user && loaded} {#if $auth.user && loaded}
<div class="container"> <div class="container">
<div <div class="nav">
class="nav" <div class="branding" on:click={() => $goto("./apps")}>
class:visible={mobileMenuVisible} <img src={Logo} alt="Logotype" />
use:clickOutside={hideMobileMenu} </div>
> <Tabs selected={activeTab}>
<Layout paddingX="L" paddingY="L"> {#each menu as { title, href }}
<div class="branding"> <Tab {title} on:click={() => $goto(href)} />
<div class="name" on:click={() => $goto("./apps")}> {/each}
<img src={$organisation?.logoUrl || Logo} alt="Logotype" /> </Tabs>
<span>{$organisation?.company || "Budibase"}</span>
</div>
<div class="onboarding">
<ConfigChecklist />
</div>
</div>
<div class="menu">
<Navigation>
{#each menu as { title, href, heading, badge }}
<Item
on:click={hideMobileMenu}
selected={$isActive(href)}
{href}
{badge}
{heading}>{title}</Item
>
{/each}
</Navigation>
</div>
</Layout>
</div>
<div class="main">
<div class="toolbar"> <div class="toolbar">
<div class="mobile-toggle"> <div class="mobile-toggle">
<Icon hoverable name="ShowMenu" on:click={showMobileMenu} /> <Icon hoverable name="ShowMenu" on:click={showMobileMenu} />
@ -219,11 +198,20 @@
alt={$organisation?.company || "Budibase"} alt={$organisation?.company || "Budibase"}
/> />
</div> </div>
{#if !$adminStore.cloud && $auth.isAdmin}
<Button
size="S"
cta
on:click={() => $goto("/builder/portal/settings/upgrade")}
>
Upgrade
</Button>
{/if}
<div class="user-dropdown"> <div class="user-dropdown">
<ActionMenu align="right" dataCy="user-menu"> <ActionMenu align="right" dataCy="user-menu">
<div slot="control" class="avatar"> <div slot="control" class="avatar">
<Avatar <Avatar
size="M" size="L"
initials={$auth.initials} initials={$auth.initials}
url={$auth.user.pictureUrl} url={$auth.user.pictureUrl}
/> />
@ -256,6 +244,8 @@
</ActionMenu> </ActionMenu>
</div> </div>
</div> </div>
</div>
<div class="main">
<div class="content"> <div class="content">
<slot /> <slot />
</div> </div>
@ -276,79 +266,77 @@
.container { .container {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: row; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
align-items: stretch; align-items: stretch;
} }
.nav { .nav {
background: var(--background); background: var(--background);
border-right: var(--border-light); display: flex;
overflow: auto; flex-direction: row;
flex: 0 0 auto; justify-content: flex-start;
width: 250px; align-items: stretch;
border-bottom: var(--border-light);
padding: 0 20px;
gap: 24px;
} }
.main { .nav :global(.spectrum-Tabs) {
flex: 1 1 auto; margin-bottom: -2px;
display: grid; padding: 7px 0;
grid-template-rows: auto 1fr; }
overflow: hidden; .nav :global(.spectrum-Tabs-itemLabel) {
color: #d0d0d0;
}
.nav :global(.spectrum-Tabs-item.is-selected .spectrum-Tabs-itemLabel) {
color: #ffffff;
} }
.branding { .branding {
display: grid; display: grid;
grid-gap: var(--spacing-s); place-items: center;
grid-template-columns: auto auto;
justify-content: space-between;
align-items: center;
}
.name {
display: grid;
grid-template-columns: auto auto;
grid-gap: var(--spacing-m);
align-items: center;
}
.name:hover {
cursor: pointer;
} }
.avatar { .avatar {
display: grid; display: grid;
grid-template-columns: auto auto; grid-template-columns: auto auto;
place-items: center; place-items: center;
grid-gap: var(--spacing-xs); grid-gap: var(--spacing-s);
} }
.avatar:hover { .avatar:hover {
cursor: pointer; cursor: pointer;
filter: brightness(110%); filter: brightness(110%);
} }
.toolbar { .toolbar {
background: var(--background); flex: 1 1 auto;
border-bottom: var(--border-light);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: flex-end;
align-items: center; align-items: center;
padding: var(--spacing-m) calc(var(--spacing-xl) * 2); gap: 24px;
} }
.mobile-toggle, .mobile-toggle,
.mobile-logo { .mobile-logo {
display: none; display: none;
} }
.user-dropdown { .user-dropdown {
flex: 1 1 auto;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
} }
img { img {
width: 28px; width: 30px;
height: 28px; height: 30px;
} }
span {
overflow: hidden; .main {
text-overflow: ellipsis; flex: 1 1 auto;
font-weight: 600; display: flex;
flex-direction: row;
justify-content: center;
align-items: stretch;
overflow: auto;
padding: 50px;
} }
.content { .content {
overflow: auto; max-width: 1080px;
} }
@media (max-width: 640px) { @media (max-width: 640px) {