Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Feat/header bar (#33353)

Jonathan Summers-Muirdc9376106e87
diff --git a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
index 7ae2be788e9..4ff8e49c2e2 100644
--- a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
+++ b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
@@ -29,7 +29,7 @@ const AppBannerWrapper = ({ children }: PropsWithChildren<{}>) => {
}, [resolvedTheme, monaco])
return (
- <div className="min-h-full flex flex-col">
+ <div className="h-screen flex flex-col">
<div className="flex-none">
{ongoingIncident && <IncidentBanner />}
{showNoticeBanner && <NoticeBanner />}
diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
index 5c09fc34e56..a59ab485bc7 100644
--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
@@ -149,7 +149,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
<title>{title ? `${title} | Supabase` : 'Supabase'}</title>
<meta name="description" content="Supabase Studio" />
</Head>
- <div className="h-screen min-h-[0px] basis-0 flex-1">
+ <div className="flex flex-col h-screen w-screen">
<WithSidebar title={title} breadcrumbs={breadcrumbs} sections={sectionsWithHeaders}>
{children}
</WithSidebar>
diff --git a/apps/studio/components/layouts/AppLayout/AppLayout.tsx b/apps/studio/components/layouts/AppLayout/AppLayout.tsx
index 24748c86ced..3ca69ee54ce 100644
--- a/apps/studio/components/layouts/AppLayout/AppLayout.tsx
+++ b/apps/studio/components/layouts/AppLayout/AppLayout.tsx
@@ -1,7 +1,7 @@
import { PropsWithChildren } from 'react'
const AppLayout = ({ children }: PropsWithChildren<{}>) => {
- return <div className="h-screen min-h-[0px] basis-0 flex-1">{children}</div>
+ return <div className="h-full min-h-[0px] basis-0 flex-1">{children}</div>
}
export default AppLayout
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
index 928066ecc70..023fc804ead 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
@@ -1,4 +1,5 @@
import Link from 'next/link'
+import { useRouter } from 'next/router'
import { ReactNode, useMemo } from 'react'
import { useParams } from 'common'
@@ -14,12 +15,12 @@ import { useOrgUsageQuery } from 'data/usage/org-usage-query'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { IS_PLATFORM } from 'lib/constants'
+import { useAppStateSnapshot } from 'state/app-state'
import { Badge, cn } from 'ui'
import BreadcrumbsView from './BreadcrumbsView'
import { FeedbackDropdown } from './FeedbackDropdown'
import HelpPopover from './HelpPopover'
import NotificationsPopoverV2 from './NotificationsPopoverV2/NotificationsPopover'
-import { useAppStateSnapshot } from 'state/app-state'
const LayoutHeaderDivider = () => (
<span className="text-border-stronger">
@@ -45,6 +46,7 @@ interface LayoutHeaderProps {
headerBorder?: boolean
showProductMenu?: boolean
customSidebarContent?: ReactNode
+ showHomeLink?: boolean
}
const LayoutHeader = ({
@@ -52,7 +54,9 @@ const LayoutHeader = ({
breadcrumbs = [],
headerBorder = true,
showProductMenu,
+ showHomeLink = false,
}: LayoutHeaderProps) => {
+ const router = useRouter()
const { ref: projectRef } = useParams()
const selectedProject = useSelectedProject()
const selectedOrganization = useSelectedOrganization()
@@ -101,6 +105,19 @@ const LayoutHeader = ({
<div className="relative flex flex-1 overflow-hidden">
<div className="flex w-full items-center justify-between py-2 pl-1 pr-3 md:px-3 flex-nowrap overflow-x-auto no-scrollbar">
<div className="flex items-center text-sm">
+ {showHomeLink && (
+ <Link
+ href={IS_PLATFORM ? '/projects' : `/project/${projectRef}`}
+ className="mx-1 hidden md:flex items-center w-[40px] h-[40px]"
+ >
+ <img
+ alt="Supabase"
+ src={`${router.basePath}/img/supabase-logo.svg`}
+ className="absolute h-[40px] w-6 cursor-pointer rounded"
+ />
+ </Link>
+ )}
+
{projectRef && (
<>
<div className="flex items-center">
@@ -125,8 +142,8 @@ const LayoutHeader = ({
</div>
<div className="ml-3 flex items-center gap-x-3">
- <Connect />
{!isBranchingEnabled && <EnableBranchingButton />}
+ <Connect />
</div>
</>
)}
diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
index 0f43d7a5820..1553d82a25e 100644
--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
@@ -231,17 +231,6 @@ export const NavContent = () => {
return (
<>
<ul className="flex flex-col gap-y-1 justify-start px-2 relative">
- <Link
- href={IS_PLATFORM ? '/projects' : `/project/${projectRef}`}
- className="mx-2 hidden md:flex items-center w-[40px] h-[40px]"
- onClick={onCloseNavigationIconLink}
- >
- <img
- alt="Supabase"
- src={`${router.basePath}/img/supabase-logo.svg`}
- className="absolute h-[40px] w-6 cursor-pointer rounded"
- />
- </Link>
<NavigationIconLink
isActive={isUndefined(activeRoute) && !isUndefined(router.query.ref)}
route={{
diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
index 9f3c3b13082..a1c19354464 100644
--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
@@ -1,22 +1,21 @@
-import Head from 'next/head'
-import { useRouter } from 'next/router'
-import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect, useState } from 'react'
-
import { useParams } from 'common'
import ProjectAPIDocs from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs'
import { AIAssistantPanel } from 'components/ui/AIAssistantPanel/AIAssistantPanel'
import AISettingsModal from 'components/ui/AISettingsModal'
import { Loading } from 'components/ui/Loading'
import { ResourceExhaustionWarningBanner } from 'components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner'
+import { AnimatePresence, motion } from 'framer-motion'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
+import Head from 'next/head'
+import { useRouter } from 'next/router'
+import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect, useState } from 'react'
import { useAppStateSnapshot } from 'state/app-state'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import { cn, ResizableHandle, ResizablePanel, ResizablePanelGroup } from 'ui'
import MobileSheetNav from 'ui-patterns/MobileSheetNav/MobileSheetNav'
-import AppLayout from '../AppLayout/AppLayout'
import EnableBranchingModal from '../AppLayout/EnableBranchingButton/EnableBranchingModal'
import BuildingState from './BuildingState'
import ConnectingState from './ConnectingState'
@@ -129,8 +128,10 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open])
+ const sideBarIsOpen = true // @mildtomato - var to use later to control collapsible sidebar
+
return (
- <AppLayout>
+ <>
<ProjectContextProvider projectRef={projectRef}>
<Head>
<title>
@@ -146,92 +147,109 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
</title>
<meta name="description" content="Supabase Studio" />
</Head>
- <div className="flex flex-col md:flex-row h-full">
- {/* Left-most navigation side bar to access products */}
- {!hideIconBar && <NavigationBar />}
+
+ <div className="flex flex-col h-screen w-screen">
{/* Top Nav to access products from mobile */}
{!hideIconBar && <MobileNavigationBar />}
- {showProductMenu && productMenu && !(!hideHeader && IS_PLATFORM) && (
- <MobileViewNav title={product} />
+ {!hideHeader && IS_PLATFORM && (
+ <LayoutHeader showHomeLink showProductMenu={!!(showProductMenu && productMenu)} />
)}
-
- {/* Product menu bar */}
- <ResizablePanelGroup
- className="flex h-full"
- direction="horizontal"
- autoSaveId="project-layout"
- >
- {/* Existing desktop menu */}
- <ResizablePanel
- id="panel-left"
- className={cn(
- 'hidden md:flex',
- resizableSidebar ? 'min-w-64 max-w-[32rem]' : 'min-w-64 max-w-64',
- {
- '!hidden': !showProductMenu || !productMenu,
- }
- )}
- defaultSize={0}
+ <div className="flex h-full flex-row grow overflow-y-auto">
+ {showProductMenu && productMenu && !(!hideHeader && IS_PLATFORM) && (
+ <MobileViewNav title={product} />
+ )}
+ {/* Left-most navigation side bar to access products */}
+ {!hideIconBar && <NavigationBar />}
+ {/* Product menu bar */}
+ <ResizablePanelGroup
+ className="flex h-full"
+ direction="horizontal"
+ autoSaveId="project-layout"
>
- <MenuBarWrapper
- isLoading={isLoading}
- isBlocking={isBlocking}
- productMenu={productMenu}
- >
- <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>
- </MenuBarWrapper>
- </ResizablePanel>
- <ResizableHandle
- className={cn('hidden md:flex', { '!hidden': !showProductMenu || !productMenu })}
- withHandle
- disabled={resizableSidebar ? false : true}
- />
- <ResizablePanel id="panel-right" className="h-full flex flex-col">
- {!hideHeader && IS_PLATFORM && (
- <LayoutHeader showProductMenu={!!(showProductMenu && productMenu)} />
+ {/* Existing desktop menu */}
+ {showProductMenu && productMenu && (
+ <ResizablePanel
+ order={1}
+ defaultSize={1}
+ id="panel-left"
+ className={cn(
+ 'hidden md:flex',
+ 'transition-all duration-[120ms]',
+ sideBarIsOpen
+ ? resizableSidebar
+ ? 'min-w-64 max-w-[32rem]'
+ : 'min-w-64 max-w-64'
+ : 'w-0 flex-shrink-0 max-w-0'
+ )}
+ >
+ {sideBarIsOpen && (
+ <AnimatePresence>
+ <motion.div
+ initial={{ width: 0, opacity: 0, height: '100%' }}
+ animate={{ width: 'auto', opacity: 1, height: '100%' }}
+ exit={{ width: 0, opacity: 0, height: '100%' }}
+ className="h-full flex-grow max-w-full"
+ transition={{ duration: 0.12 }}
+ >
+ <MenuBarWrapper
+ isLoading={isLoading}
+ isBlocking={isBlocking}
+ productMenu={productMenu}
+ >
+ <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>
+ </MenuBarWrapper>
+ </motion.div>
+ </AnimatePresence>
+ )}
+ </ResizablePanel>
)}
- <ResizablePanelGroup
- className="h-full w-full overflow-x-hidden flex-1"
- direction="horizontal"
- autoSaveId="project-layout-content"
- >
- <ResizablePanel id="panel-content" className="w-full lg:min-w-[600px]">
- <main
- className="h-full flex flex-col flex-1 w-full overflow-y-auto overflow-x-hidden"
- ref={ref}
- >
- {showPausedState ? (
- <div className="mx-auto my-8 md:my-16 w-full h-full max-w-7xl flex items-center">
- <div className="w-full">
- <ProjectPausedState product={product} />
+ {showProductMenu && productMenu && sideBarIsOpen && (
+ <ResizableHandle withHandle disabled={resizableSidebar ? false : true} />
+ )}
+ <ResizablePanel order={2} id="panel-right" className="h-full flex flex-col">
+ <ResizablePanelGroup
+ className="h-full w-full overflow-x-hidden flex-1"
+ direction="horizontal"
+ autoSaveId="project-layout-content"
+ >
+ <ResizablePanel id="panel-content" className="w-full md:min-w-[600px]">
+ <main
+ className="h-full flex flex-col flex-1 w-full overflow-y-auto overflow-x-hidden"
+ ref={ref}
+ >
+ {showPausedState ? (
+ <div className="mx-auto my-16 w-full h-full max-w-7xl flex items-center">
+ <div className="w-full">
+ <ProjectPausedState product={product} />
+ </div>
</div>
- </div>
- ) : (
- <ContentWrapper isLoading={isLoading} isBlocking={isBlocking}>
- <ResourceExhaustionWarningBanner />
- {children}
- </ContentWrapper>
- )}
- </main>
- </ResizablePanel>
- {isClient && aiAssistantPanel.open && (
- <>
- <ResizableHandle />
- <ResizablePanel
- id="panel-assistant"
- className={cn(
- 'bg fixed z-40 md:absolute right-0 top-0 md:top-[48px] bottom-0 xl:relative xl:top-0',
- 'w-screen h-[100dvh] md:h-auto md:w-auto md:min-w-[400px] max-w-[500px]',
- '2xl:min-w-[500px] 2xl:max-w-[600px]'
+ ) : (
+ <ContentWrapper isLoading={isLoading} isBlocking={isBlocking}>
+ <ResourceExhaustionWarningBanner />
+ {children}
+ </ContentWrapper>
)}
- >
- <AIAssistantPanel />
- </ResizablePanel>
- </>
- )}
- </ResizablePanelGroup>
- </ResizablePanel>
- </ResizablePanelGroup>
+ </main>
+ </ResizablePanel>
+ {isClient && aiAssistantPanel.open && (
+ <>
+ <ResizableHandle />
+ <ResizablePanel
+ id="panel-assistant"
+ className={cn(
+ 'bg fixed z-40 md:absolute right-0 top-0 md:top-[48px] bottom-0 xl:relative xl:top-0',
+ 'w-screen h-[100dvh] md:h-auto md:w-auto md:min-w-[400px] max-w-[500px]',
+ '2xl:min-w-[500px] 2xl:max-w-[600px]'
+ )}
+ >
+ <AIAssistantPanel />
+ </ResizablePanel>
+ </>
+ )}
+ </ResizablePanelGroup>
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ </div>
</div>
<EnableBranchingModal />
@@ -241,7 +259,7 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayout
<MobileSheetNav open={mobileMenuOpen} onOpenChange={setMobileMenuOpen}>
{productMenu}
</MobileSheetNav>
- </AppLayout>
+ </>
)
}
)
diff --git a/apps/studio/components/layouts/SignInLayout/SignInLayout.tsx b/apps/studio/components/layouts/SignInLayout/SignInLayout.tsx
index 1d208dc484d..8e05c1e64c7 100644
--- a/apps/studio/components/layouts/SignInLayout/SignInLayout.tsx
+++ b/apps/studio/components/layouts/SignInLayout/SignInLayout.tsx
@@ -1,17 +1,14 @@
import { useQueryClient } from '@tanstack/react-query'
-import { FileText } from 'lucide-react'
+import { DocsButton } from 'components/ui/DocsButton'
+import { useFlag } from 'hooks/ui/useFlag'
+import { BASE_PATH } from 'lib/constants'
+import { auth, buildPathWithParams, getAccessToken, getReturnToPath } from 'lib/gotrue'
import { useTheme } from 'next-themes'
import Image from 'next/legacy/image'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { PropsWithChildren, useEffect, useState } from 'react'
-
-import { useFlag } from 'hooks/ui/useFlag'
-import { BASE_PATH } from 'lib/constants'
-import { auth, buildPathWithParams, getAccessToken, getReturnToPath } from 'lib/gotrue'
import { tweets } from 'shared-data'
-import { Button } from 'ui'
-import { DocsButton } from 'components/ui/DocsButton'
type SignInLayoutProps = {
heading: string
@@ -85,7 +82,7 @@ const SignInLayout = ({
return (
<>
- <div className="flex flex-col flex-1 bg-alternative">
+ <div className="relative flex flex-col bg-alternative h-full">
<div
className={`absolute top-0 w-full px-8 mx-auto sm:px-6 lg:px-8 ${
ongoingIncident ? 'mt-14' : 'mt-6'
@@ -115,7 +112,7 @@ const SignInLayout = ({
</nav>
</div>
- <div className="flex flex-1">
+ <div className="flex flex-1 h-full">
<main className="flex flex-col items-center flex-1 flex-shrink-0 px-5 pt-16 pb-8 border-r shadow-lg bg-studio border-default">
<div className="flex-1 flex flex-col justify-center w-[330px] sm:w-[384px]">
<div className="mb-10">
diff --git a/apps/studio/styles/main.scss b/apps/studio/styles/main.scss
index 5430c117efd..1a97ce799d5 100644
--- a/apps/studio/styles/main.scss
+++ b/apps/studio/styles/main.scss
@@ -48,9 +48,7 @@ body,
.main {
@apply bg-studio relative;
@apply text-foreground;
- height: 100%;
- padding: 0;
- margin: 0;
+ @apply overflow-x-clip;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}
@@ -279,11 +277,11 @@ div[data-radix-portal]:not(.portal--toast) {
}
.react-grid-item > .react-resizable-handle::after {
- content: "";
+ content: '';
position: absolute;
right: 3px !important;
bottom: 3px !important;
width: 6px !important;
height: 6px !important;
@apply border-strong dark:border-r-2 dark:border-b-2 dark:border-overlay #{!important};
-}
\ No newline at end of file
+}