diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 6e4557e106..99a140f16a 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -18,7 +18,7 @@ import ThemeModal from "components/settings/ThemeModal.svelte" import APIKeyModal from "components/settings/APIKeyModal.svelte" import Logo from "assets/bb-emblem.svg" - // import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags" + import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags" let loaded = false let themeModal @@ -43,6 +43,7 @@ } const buildMenu = admin => { + // Standard user and developer pages let menu = [ { title: "Apps", @@ -54,6 +55,7 @@ }, ] + // Admin only pages if (admin) { menu = [ { @@ -72,76 +74,20 @@ title: "Settings", href: "/builder/portal/settings", }, - { - title: "Account", - href: "/builder/portal/account", - }, ] - // if (!$adminStore.cloud) { - // menu = menu.concat([ - // { - // title: "Update", - // href: "/builder/portal/settings/update", - // }, - // ]) - // } } - // add link to account portal if the user has access - // let accountSectionAdded = false + // Check if allowed access to account section + if ( + isEnabled(TENANT_FEATURE_FLAGS.LICENSING) && + ($auth?.user?.accountPortalAccess || (!$adminStore.cloud && admin)) + ) { + menu.push({ + title: "Account", + href: "/builder/portal/account", + }) + } - // link out to account-portal if account holder in cloud or always in self-host - // if ($auth?.user?.accountPortalAccess || (!$adminStore.cloud && admin)) { - // accountSectionAdded = true - // menu = menu.concat([ - // { - // title: "Account", - // href: $adminStore.accountPortalUrl, - // heading: "Account", - // }, - // ]) - // } - // - // if (isEnabled(TENANT_FEATURE_FLAGS.LICENSING)) { - // // always show usage in self-host or cloud if licensing enabled - // menu = menu.concat([ - // { - // title: "Usage", - // href: "/builder/portal/settings/usage", - // heading: accountSectionAdded ? "" : "Account", - // }, - // ]) - // - // // show the relevant hosting upgrade page - // if ($adminStore.cloud && $auth?.user?.accountPortalAccess) { - // menu = menu.concat([ - // { - // title: "Upgrade", - // href: $adminStore.accountPortalUrl + "/portal/upgrade", - // }, - // ]) - // } else if (!$adminStore.cloud && admin) { - // menu = menu.concat({ - // title: "Upgrade", - // href: "/builder/portal/settings/upgrade", - // }) - // } - // - // // show the billing page to licensed account holders in cloud - // if ( - // $auth?.user?.accountPortalAccess && - // $auth.user.account.stripeCustomerId - // ) { - // menu = menu.concat([ - // { - // title: "Billing", - // href: $adminStore.accountPortalUrl + "/portal/billing", - // }, - // ]) - // } - // } - - menu = menu.filter(item => !!item) return menu } diff --git a/packages/builder/src/pages/builder/portal/account/_layout.svelte b/packages/builder/src/pages/builder/portal/account/_layout.svelte index cbe86daf7c..f933cf9c72 100644 --- a/packages/builder/src/pages/builder/portal/account/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/account/_layout.svelte @@ -2,22 +2,39 @@ import { url, isActive } from "@roxi/routify" import { Page } from "@budibase/bbui" import { Content, SideNav, SideNavItem } from "components/portal/page" + import { admin, auth } from "stores/portal"
+ - + + {#if $admin.cloud && $auth?.user?.accountPortalAccess} + + {:else if !$admin.cloud && admin} + + {/if} + + {#if $auth?.user?.accountPortalAccess && $auth.user.account.stripeCustomerId} + + {/if}
diff --git a/packages/builder/src/pages/builder/portal/settings/_layout.svelte b/packages/builder/src/pages/builder/portal/settings/_layout.svelte index b2f9c029ae..57410bcaeb 100644 --- a/packages/builder/src/pages/builder/portal/settings/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/settings/_layout.svelte @@ -2,6 +2,7 @@ import { url, isActive } from "@roxi/routify" import { Page } from "@budibase/bbui" import { Content, SideNav, SideNavItem } from "components/portal/page" + import { admin } from "stores/portal" $: wide = $isActive("./email/:template") @@ -25,11 +26,13 @@ url={$url("./organisation")} active={$isActive("./organisation")} /> - + {#if !$admin.cloud} + + {/if}