From e9d20a885b6c96e3f2313ba9b3e5451080750bf2 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 11 Jan 2023 10:13:19 +0000 Subject: [PATCH] Refactor main portal page into multiple components --- .../src/components/portal/page/Content.svelte | 5 + .../src/components/portal/page/SideNav.svelte | 8 - .../builder/portal/_components/Logo.svelte | 13 ++ .../portal/_components/MobileMenu.svelte | 79 +++++++ .../portal/_components/UpgradeButton.svelte | 20 ++ .../portal/_components/UserDropdown.svelte | 78 +++++++ .../src/pages/builder/portal/_layout.svelte | 202 ++++-------------- 7 files changed, 236 insertions(+), 169 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/_components/Logo.svelte create mode 100644 packages/builder/src/pages/builder/portal/_components/MobileMenu.svelte create mode 100644 packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte create mode 100644 packages/builder/src/pages/builder/portal/_components/UserDropdown.svelte diff --git a/packages/builder/src/components/portal/page/Content.svelte b/packages/builder/src/components/portal/page/Content.svelte index 083467b49b..d542dfcf56 100644 --- a/packages/builder/src/components/portal/page/Content.svelte +++ b/packages/builder/src/components/portal/page/Content.svelte @@ -37,5 +37,10 @@ .side-nav:not(.show-mobile) { display: none; } + .side-nav.show-mobile :global(.side-nav) { + border-bottom: var(--border-light); + margin: 0 -24px; + padding: 0 24px 32px 24px; + } } diff --git a/packages/builder/src/components/portal/page/SideNav.svelte b/packages/builder/src/components/portal/page/SideNav.svelte index e3e485fa30..fdd54b2182 100644 --- a/packages/builder/src/components/portal/page/SideNav.svelte +++ b/packages/builder/src/components/portal/page/SideNav.svelte @@ -23,12 +23,4 @@ color: var(--spectrum-global-color-gray-700); margin-bottom: var(--spacing-m); } - - @media (max-width: 640px) { - .side-nav { - border-bottom: var(--border-light); - margin: 0 -24px; - padding: 0 24px 32px 24px; - } - } diff --git a/packages/builder/src/pages/builder/portal/_components/Logo.svelte b/packages/builder/src/pages/builder/portal/_components/Logo.svelte new file mode 100644 index 0000000000..8276510201 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/_components/Logo.svelte @@ -0,0 +1,13 @@ + + +Budibase Logo $goto("./apps")} /> + + diff --git a/packages/builder/src/pages/builder/portal/_components/MobileMenu.svelte b/packages/builder/src/pages/builder/portal/_components/MobileMenu.svelte new file mode 100644 index 0000000000..bfb08f9b36 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/_components/MobileMenu.svelte @@ -0,0 +1,79 @@ + + +{#if visible} +
+{/if} +
+ +
+ +
+ + {#each menu as { title, href }} + + {/each} + +
+ +
+
+
+ + diff --git a/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte b/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte new file mode 100644 index 0000000000..29066b8117 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte @@ -0,0 +1,20 @@ + + +{#if $admin.cloud && $auth?.user?.accountPortalAccess} + +{:else if !$admin.cloud && $auth.isAdmin} + +{/if} diff --git a/packages/builder/src/pages/builder/portal/_components/UserDropdown.svelte b/packages/builder/src/pages/builder/portal/_components/UserDropdown.svelte new file mode 100644 index 0000000000..552e9247fc --- /dev/null +++ b/packages/builder/src/pages/builder/portal/_components/UserDropdown.svelte @@ -0,0 +1,78 @@ + + + +
+ + +
+ themeModal.show()} dataCy="theme"> + Theme + + profileModal.show()} + dataCy="user-info" + > + My profile + + updatePasswordModal.show()}> + Update password + + apiKeyModal.show()} dataCy="api-key"> + View API key + + $goto("../apps")}> + Close developer mode + + + Log out + +
+ + + + + + + + + + + + + + + diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index a43f294d0c..9048502550 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -1,30 +1,15 @@