Skip to content

Commit f647316

Browse files
authored
Hide mobile nav menu on organizations page (supabase#39908)
* Hide mobile nav menu on organizations page * Fix
1 parent 738c568 commit f647316

File tree

8 files changed

+27
-23
lines changed

8 files changed

+27
-23
lines changed

apps/studio/components/layouts/AccountLayout/WithSidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ArrowLeft } from 'lucide-react'
22
import Link from 'next/link'
33
import { PropsWithChildren, ReactNode } from 'react'
4+
import { useAppStateSnapshot } from 'state/app-state'
45
import { cn, Menu } from 'ui'
56
import MobileSheetNav from 'ui-patterns/MobileSheetNav/MobileSheetNav'
67
import type { SidebarSection } from './AccountLayout.types'
7-
import { useAppStateSnapshot } from 'state/app-state'
88

99
interface WithSidebarProps {
1010
title: string
@@ -49,7 +49,7 @@ export const WithSidebar = ({
4949
)}
5050
<div className="flex flex-1 flex-col">
5151
<div className="flex-1 flex-grow overflow-y-auto">
52-
<div className="mx-auto max-w-7xl w-full px-6 lg:px-14 xl:px-28 2xl:px-32 py-16">
52+
<div className="mx-auto max-w-7xl w-full md:px-6 lg:px-14 xl:px-28 2xl:px-32 py-16">
5353
{children}
5454
</div>
5555
</div>

apps/studio/components/layouts/DefaultLayout.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { ProjectContextProvider } from './ProjectLayout/ProjectContext'
1515

1616
export interface DefaultLayoutProps {
1717
headerTitle?: string
18+
hideMobileMenu?: boolean
1819
}
1920

2021
/**
@@ -27,7 +28,11 @@ export interface DefaultLayoutProps {
2728
* - Mobile navigation bar
2829
* - First level side navigation bar (e.g For navigating to Table Editor, SQL Editor, Database page, etc)
2930
*/
30-
const DefaultLayout = ({ children, headerTitle }: PropsWithChildren<DefaultLayoutProps>) => {
31+
const DefaultLayout = ({
32+
children,
33+
headerTitle,
34+
hideMobileMenu,
35+
}: PropsWithChildren<DefaultLayoutProps>) => {
3136
const { ref } = useParams()
3237
const router = useRouter()
3338
const appSnap = useAppStateSnapshot()
@@ -55,7 +60,7 @@ const DefaultLayout = ({ children, headerTitle }: PropsWithChildren<DefaultLayou
5560
{/* Top Banner */}
5661
<AppBannerWrapper />
5762
<div className="flex-shrink-0">
58-
<MobileNavigationBar />
63+
<MobileNavigationBar hideMobileMenu={hideMobileMenu} />
5964
<LayoutHeader
6065
showProductMenu={showProductMenu}
6166
headerTitle={headerTitle}

apps/studio/components/layouts/ProjectLayout/NavigationBar/MobileNavigationBar.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { useState } from 'react'
66
import { useParams } from 'common'
77
import { SidebarContent } from 'components/interfaces/Sidebar'
88
import { IS_PLATFORM } from 'lib/constants'
9-
import { buttonVariants, cn } from 'ui'
9+
import { Button, cn } from 'ui'
1010
import { CommandMenuTrigger } from 'ui-patterns'
1111
import MobileSheetNav from 'ui-patterns/MobileSheetNav/MobileSheetNav'
1212

1313
export const ICON_SIZE = 20
1414
export const ICON_STROKE_WIDTH = 1.5
1515

16-
const MobileNavigationBar = () => {
16+
const MobileNavigationBar = ({ hideMobileMenu }: { hideMobileMenu?: boolean }) => {
1717
const router = useRouter()
1818
const [isSheetOpen, setIsSheetOpen] = useState(false)
1919
const { ref: projectRef } = useParams()
@@ -57,16 +57,15 @@ const MobileNavigationBar = () => {
5757
</div>
5858
</button>
5959
</CommandMenuTrigger>
60-
<button
61-
title="Menu dropdown button"
62-
className={cn(
63-
buttonVariants({ type: 'default' }),
64-
'flex lg:hidden border-default bg-surface-100/75 text-foreground-light rounded-md min-w-[30px] w-[30px] h-[30px] data-[state=open]:bg-overlay-hover/30'
65-
)}
66-
onClick={() => setIsSheetOpen(true)}
67-
>
68-
<Menu size={18} strokeWidth={1} />
69-
</button>
60+
{!hideMobileMenu && (
61+
<Button
62+
title="Menu dropdown button"
63+
type="default"
64+
className="flex lg:hidden border-default bg-surface-100/75 text-foreground-light rounded-md min-w-[30px] w-[30px] h-[30px] data-[state=open]:bg-overlay-hover/30"
65+
icon={<Menu />}
66+
onClick={() => setIsSheetOpen(true)}
67+
/>
68+
)}
7069
</div>
7170
</nav>
7271
<MobileSheetNav open={isSheetOpen} onOpenChange={setIsSheetOpen} data-state="expanded">

apps/studio/pages/account/audit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Audit: NextPageWithLayout = () => {
2727

2828
Audit.getLayout = (page) => (
2929
<AppLayout>
30-
<DefaultLayout headerTitle="Account">
30+
<DefaultLayout hideMobileMenu headerTitle="Account">
3131
<OrganizationLayout>
3232
<AccountLayout title="Audit Logs">{page}</AccountLayout>
3333
</OrganizationLayout>

apps/studio/pages/account/me.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { AccountConnections } from 'components/interfaces/Account/Preferences/Ac
22
import { AccountDeletion } from 'components/interfaces/Account/Preferences/AccountDeletion'
33
import { AccountIdentities } from 'components/interfaces/Account/Preferences/AccountIdentities'
44
import { AnalyticsSettings } from 'components/interfaces/Account/Preferences/AnalyticsSettings'
5+
import { HotkeySettings } from 'components/interfaces/Account/Preferences/HotkeySettings'
56
import { ProfileInformation } from 'components/interfaces/Account/Preferences/ProfileInformation'
67
import { ThemeSettings } from 'components/interfaces/Account/Preferences/ThemeSettings'
7-
import { HotkeySettings } from 'components/interfaces/Account/Preferences/HotkeySettings'
88
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
99
import AppLayout from 'components/layouts/AppLayout/AppLayout'
1010
import DefaultLayout from 'components/layouts/DefaultLayout'
@@ -27,7 +27,7 @@ const User: NextPageWithLayout = () => {
2727

2828
User.getLayout = (page) => (
2929
<AppLayout>
30-
<DefaultLayout headerTitle="Account">
30+
<DefaultLayout hideMobileMenu headerTitle="Account">
3131
<OrganizationLayout>
3232
<AccountLayout title="Account Settings">{page}</AccountLayout>
3333
</OrganizationLayout>

apps/studio/pages/account/security.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const Security: NextPageWithLayout = () => {
8181

8282
Security.getLayout = (page) => (
8383
<AppLayout>
84-
<DefaultLayout headerTitle="Account">
84+
<DefaultLayout hideMobileMenu headerTitle="Account">
8585
<OrganizationLayout>
8686
<AccountLayout title="Security">{page}</AccountLayout>
8787
</OrganizationLayout>

apps/studio/pages/account/tokens.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const UserAccessTokens: NextPageWithLayout = () => {
7272

7373
UserAccessTokens.getLayout = (page) => (
7474
<AppLayout>
75-
<DefaultLayout headerTitle="Account">
75+
<DefaultLayout hideMobileMenu headerTitle="Account">
7676
<OrganizationLayout>
7777
<AccountLayout title="Access Tokens">{page}</AccountLayout>
7878
</OrganizationLayout>

apps/studio/pages/organizations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ const OrganizationsPage: NextPageWithLayout = () => {
114114

115115
OrganizationsPage.getLayout = (page) => (
116116
<AppLayout>
117-
<DefaultLayout headerTitle="Organizations">
118-
<PageLayout title="Your Organizations" className="max-w-[1200px] px-6 mx-auto">
117+
<DefaultLayout hideMobileMenu headerTitle="Organizations">
118+
<PageLayout title="Your Organizations" className="max-w-[1200px] lg:px-6 mx-auto">
119119
{page}
120120
</PageLayout>
121121
</DefaultLayout>

0 commit comments

Comments
 (0)