Skip to content

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

Chore/banner for ipv4 deprecation notice (#20334)

Joshen Limb4023b6eb214
diff --git a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
index 186be70cd93..757d2ebcfab 100644
--- a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
+++ b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
@@ -4,11 +4,14 @@ import IncidentBanner from 'components/layouts/AppLayout/IncidentBanner'
import { getTheme } from 'components/ui/CodeEditor'
import { useFlag } from 'hooks'
import { PropsWithChildren, useEffect } from 'react'
+import { NoticeBanner } from 'components/layouts/AppLayout/NoticeBanner'
const AppBannerWrapper = ({ children }: PropsWithChildren<{}>) => {
const monaco = useMonaco()
const { resolvedTheme } = useTheme()
+
const ongoingIncident = useFlag('ongoingIncident')
+ const showNoticeBanner = useFlag('showNoticeBanner')
useEffect(() => {
if (monaco && resolvedTheme) {
@@ -20,7 +23,7 @@ const AppBannerWrapper = ({ children }: PropsWithChildren<{}>) => {
return (
<div className="min-h-full flex flex-col">
{ongoingIncident && <IncidentBanner />}
-
+ {showNoticeBanner && <NoticeBanner />}
{children}
</div>
)
diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
index 424141ac029..bd5d76de274 100644
--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
@@ -9,6 +9,7 @@ import { IS_PLATFORM } from 'lib/constants'
import SettingsLayout from '../SettingsLayout/SettingsLayout'
import { SidebarSection } from './AccountLayout.types'
import WithSidebar from './WithSidebar'
+import { LayoutWrapper } from '../LayoutWrapper'
export interface AccountLayoutProps {
title: string
@@ -23,9 +24,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
const { data: organizations } = useOrganizationsQuery()
const selectedOrganization = useSelectedOrganization()
- const ongoingIncident = useFlag('ongoingIncident')
const navLayoutV2 = useFlag('navigationLayoutV2')
- const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
const signOut = useSignOut()
const onClickLogout = async () => {
@@ -153,10 +152,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
<meta name="description" content="Supabase Studio" />
</Head>
<div className="flex h-full">
- <main
- style={{ height: maxHeight, maxHeight }}
- className="flex flex-col flex-1 w-full overflow-y-auto"
- >
+ <LayoutWrapper className="flex flex-col flex-1 w-full overflow-y-auto">
<WithSidebar
hideSidebar={navLayoutV2}
title={title}
@@ -165,7 +161,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
>
{children}
</WithSidebar>
- </main>
+ </LayoutWrapper>
</div>
</>
)
diff --git a/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx b/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx
index 8c000097e37..844aca124fe 100644
--- a/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx
+++ b/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx
@@ -1,8 +1,10 @@
-import { useFlag } from 'hooks'
import { isUndefined } from 'lodash'
import Link from 'next/link'
import { ReactNode } from 'react'
import { Badge, IconArrowUpRight, IconLogOut, Menu } from 'ui'
+
+import { useFlag } from 'hooks'
+import { LayoutWrapper } from '../LayoutWrapper'
import LayoutHeader from '../ProjectLayout/LayoutHeader'
import { SidebarLink, SidebarSection } from './AccountLayout.types'
@@ -18,15 +20,6 @@ interface WithSidebarProps {
children: ReactNode
}
-/*
-The information hierarchy for WithSidebar is:
- WithSidebar
- SectionsWithHeaders
- SidebarItem
- SidebarLink
- SidebarItem
- SidebarLink
-*/
const WithSidebar = ({
title,
header,
@@ -39,16 +32,13 @@ const WithSidebar = ({
customSidebarContent,
}: WithSidebarProps) => {
const noContent = !sections && !customSidebarContent
- const ongoingIncident = useFlag('ongoingIncident')
const navLayoutV2 = useFlag('navigationLayoutV2')
- const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
return (
<div className="flex max-h-full">
{!hideSidebar && !noContent && (
- <div
+ <LayoutWrapper
id="with-sidebar"
- style={{ height: maxHeight, maxHeight }}
className={[
'h-full bg-background',
'hide-scrollbar w-64 overflow-auto border-r border-default',
@@ -87,7 +77,7 @@ const WithSidebar = ({
})}
</Menu>
</div>
- </div>
+ </LayoutWrapper>
)}
<div className="flex flex-1 flex-col">
{!navLayoutV2 && <LayoutHeader breadcrumbs={breadcrumbs} />}
diff --git a/apps/studio/components/layouts/AppLayout/AppLayout.tsx b/apps/studio/components/layouts/AppLayout/AppLayout.tsx
index 5abf9b3a826..d8687edfc42 100644
--- a/apps/studio/components/layouts/AppLayout/AppLayout.tsx
+++ b/apps/studio/components/layouts/AppLayout/AppLayout.tsx
@@ -1,30 +1,21 @@
import { PropsWithChildren } from 'react'
-import AppHeader from './AppHeader'
import { useFlag } from 'hooks'
+import AppHeader from './AppHeader'
const AppLayout = ({ children }: PropsWithChildren<{}>) => {
const navLayoutV2 = useFlag('navigationLayoutV2')
const ongoingIncident = useFlag('ongoingIncident')
+ const showNoticeBanner = useFlag('showNoticeBanner')
const appHeaderHeight = navLayoutV2 ? 49 : 0
- const incidentBannerHeight = 44
+ const bannerHeight = [ongoingIncident, showNoticeBanner].filter(Boolean).length * 44
+ const maxHeight = `calc(100vh - ${bannerHeight}px - ${appHeaderHeight}px)`
return (
<div>
{navLayoutV2 && <AppHeader />}
- <div
- style={{
- height: ongoingIncident
- ? `calc(100vh - ${incidentBannerHeight}px - ${appHeaderHeight}px)`
- : `calc(100vh - ${appHeaderHeight}px)`,
- maxHeight: ongoingIncident
- ? `calc(100vh - ${incidentBannerHeight}px - ${appHeaderHeight}px)`
- : `calc(100vh - ${appHeaderHeight}px)`,
- }}
- >
- {children}
- </div>
+ <div style={{ maxHeight, height: maxHeight }}>{children}</div>
</div>
)
}
diff --git a/apps/studio/components/layouts/AppLayout/NoticeBanner.tsx b/apps/studio/components/layouts/AppLayout/NoticeBanner.tsx
new file mode 100644
index 00000000000..e438b4c22d1
--- /dev/null
+++ b/apps/studio/components/layouts/AppLayout/NoticeBanner.tsx
@@ -0,0 +1,44 @@
+import { Button, IconExternalLink } from 'ui'
+import { useRouter } from 'next/router'
+import { useProfile } from 'lib/profile'
+import { LOCAL_STORAGE_KEYS } from 'lib/constants'
+import { useLocalStorage } from 'hooks'
+
+// [Joshen] For this notice specifically, just FYI
+// 1 month after 26th Jan we'll need to add some contextual information about this deprecation
+// in the database settings pooling config section, for projects created before September 27th 2023
+
+export const NoticeBanner = () => {
+ const router = useRouter()
+ const { isLoading } = useProfile()
+
+ const [isDismissed, setIsDismissed] = useLocalStorage(
+ LOCAL_STORAGE_KEYS.PGBOUNCER_DEPRECATION_WARNING,
+ false
+ )
+
+ if (isLoading || router.pathname.includes('sign-in') || isDismissed) return null
+
+ return (
+ <div
+ className="flex items-center justify-center gap-x-4 bg-surface-100 py-3 transition text-foreground box-border border-b border-default"
+ style={{ height: '44px' }}
+ >
+ <p className="text-sm">PgBouncer and IPv4 will be deprecated after 26th January 2024</p>
+ <div className="flex items-center gap-x-1">
+ <Button asChild type="link" iconRight={<IconExternalLink />}>
+ <a
+ href="https://github.com/orgs/supabase/discussions/17817"
+ target="_blank"
+ rel="noreferrer"
+ >
+ Learn more
+ </a>
+ </Button>
+ <Button type="text" className="opacity-75" onClick={() => setIsDismissed(true)}>
+ Dismiss
+ </Button>
+ </div>
+ </div>
+ )
+}
diff --git a/apps/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx b/apps/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
index 82a640f50a5..8e92a748ae4 100644
--- a/apps/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
+++ b/apps/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
@@ -1,9 +1,11 @@
-import { useFlag, withAuth } from 'hooks'
-import { BASE_PATH } from 'lib/constants'
+import Link from 'next/link'
import { PropsWithChildren, ReactNode, forwardRef } from 'react'
-import { IconX, cn, LoadingLine, IconBook, IconLifeBuoy } from 'ui'
+import { IconBook, IconLifeBuoy, IconX, LoadingLine, cn } from 'ui'
+
+import { withAuth } from 'hooks'
+import { BASE_PATH } from 'lib/constants'
+import { LayoutWrapper } from '../LayoutWrapper'
import { ScaffoldContainer } from '../Scaffold'
-import Link from 'next/link'
export type IntegrationWindowLayoutProps = {
title: string
@@ -19,11 +21,8 @@ const IntegrationWindowLayout = ({
loading = false,
docsHref,
}: PropsWithChildren<IntegrationWindowLayoutProps>) => {
- const ongoingIncident = useFlag('ongoingIncident')
- const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
-
return (
- <div className="flex w-full flex-col" style={{ height: maxHeight, maxHeight }}>
+ <LayoutWrapper className="flex w-full flex-col">
<Header title={title} integrationIcon={integrationIcon} />
<LoadingLine loading={loading} />
<main className="overflow-auto flex flex-col h-full bg">{children}</main>
@@ -49,7 +48,7 @@ const IntegrationWindowLayout = ({
Support
</Link>
</ScaffoldContainer>
- </div>
+ </LayoutWrapper>
)
}
diff --git a/apps/studio/components/layouts/LayoutWrapper.tsx b/apps/studio/components/layouts/LayoutWrapper.tsx
new file mode 100644
index 00000000000..76e2100eeeb
--- /dev/null
+++ b/apps/studio/components/layouts/LayoutWrapper.tsx
@@ -0,0 +1,24 @@
+import { useFlag } from 'hooks'
+import { PropsWithChildren } from 'react'
+
+interface LayoutWrapperProps {
+ id?: string
+ className?: string
+}
+
+export const LayoutWrapper = ({
+ id,
+ className,
+ children,
+}: PropsWithChildren<LayoutWrapperProps>) => {
+ const ongoingIncident = useFlag('ongoingIncident')
+ const showNoticeBanner = useFlag('showNoticeBanner')
+ const numBanners = [ongoingIncident, showNoticeBanner].filter(Boolean).length
+ const maxHeight = `calc(100vh - ${numBanners * 44}px)`
+
+ return (
+ <div id={id} className={className} style={{ height: maxHeight, maxHeight }}>
+ {children}
+ </div>
+ )
+}
diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
index e5c7af6af0c..94e8ba72221 100644
--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx
@@ -1,8 +1,8 @@
+import { useParams } from 'common'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { Fragment, PropsWithChildren, ReactNode, useEffect } from 'react'
-import { useParams } from 'common/hooks'
import ProjectAPIDocs from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs'
import AISettingsModal from 'components/ui/AISettingsModal'
import Connecting from 'components/ui/Loading/Loading'
diff --git a/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx b/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx
index 81ec13f6e89..a0c483203da 100644
--- a/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx
+++ b/apps/studio/components/layouts/SettingsLayout/SettingsLayout.tsx
@@ -1,9 +1,10 @@
+import { useParams } from 'common'
+import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
+
import AppLayout from '../AppLayout/AppLayout'
-import { useParams } from 'common'
-import OrganizationSettingsMenu from './OrganizationSettingsMenu'
import AccountSettingsMenu from './AccountSettingsMenu'
-import { useRouter } from 'next/router'
+import OrganizationSettingsMenu from './OrganizationSettingsMenu'
const SettingsLayout = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter()
diff --git a/apps/studio/components/layouts/WizardLayout.tsx b/apps/studio/components/layouts/WizardLayout.tsx
index 91a01d81576..ca47d0176c8 100644
--- a/apps/studio/components/layouts/WizardLayout.tsx
+++ b/apps/studio/components/layouts/WizardLayout.tsx
@@ -3,9 +3,10 @@ import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { IconChevronRight } from 'ui'
-import { useFlag, withAuth } from 'hooks'
+import { withAuth } from 'hooks'
import { BASE_PATH } from 'lib/constants'
import { Organization, Project } from 'types'
+import { LayoutWrapper } from './LayoutWrapper'
import FeedbackDropdown from './ProjectLayout/LayoutHeader/FeedbackDropdown'
import HelpPopover from './ProjectLayout/LayoutHeader/HelpPopover'
@@ -19,18 +20,15 @@ const WizardLayout = ({
project,
children,
}: PropsWithChildren<WizardLayoutProps>) => {
- const ongoingIncident = useFlag('ongoingIncident')
- const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
-
return (
- <div className="flex w-full flex-col" style={{ height: maxHeight, maxHeight }}>
+ <LayoutWrapper className="flex w-full flex-col">
<Header organization={organization} project={project} />
<div className="overflow-auto">
<section className="has-slide-in slide-in relative mx-auto my-10 max-w-2xl">
{children}
</section>
</div>
- </div>
+ </LayoutWrapper>
)
}
diff --git a/apps/studio/lib/constants/index.ts b/apps/studio/lib/constants/index.ts
index 6143094166d..25151b3f80a 100644
--- a/apps/studio/lib/constants/index.ts
+++ b/apps/studio/lib/constants/index.ts
@@ -39,6 +39,7 @@ export const LOCAL_STORAGE_KEYS = {
GRAPHIQL_RLS_BYPASS_WARNING: 'graphiql-rls-bypass-warning-dismissed',
CLS_DIFF_WARNING: 'cls-diff-warning-dismissed',
CLS_SELECT_STAR_WARNING: 'cls-select-star-warning-dismissed',
+ PGBOUNCER_DEPRECATION_WARNING: 'pgbouncer-deprecation-warning-dismissed',
}
export const OPT_IN_TAGS = {
diff --git a/apps/studio/pages/support/new.tsx b/apps/studio/pages/support/new.tsx
index da5128e47ad..76ffea0a429 100644
--- a/apps/studio/pages/support/new.tsx
+++ b/apps/studio/pages/support/new.tsx
@@ -7,24 +7,18 @@ import { Button, IconLoader, IconTool } from 'ui'
import Success from 'components/interfaces/Support/Success'
import SupportForm from 'components/interfaces/Support/SupportForm'
+import { LayoutWrapper } from 'components/layouts/LayoutWrapper'
import { usePlatformStatusQuery } from 'data/platform/platform-status-query'
-import { useFlag, withAuth } from 'hooks'
+import { withAuth } from 'hooks'
import { BASE_PATH } from 'lib/constants'
const SupportPage = () => {
const [sentCategory, setSentCategory] = useState<string>()
-
- const ongoingIncident = useFlag('ongoingIncident')
- const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
-
const { data, isLoading } = usePlatformStatusQuery()
const isHealthy = data?.isHealthy
return (
- <div
- className="relative flex overflow-y-auto overflow-x-hidden"
- style={{ height: maxHeight, maxHeight }}
- >
+ <LayoutWrapper className="relative flex overflow-y-auto overflow-x-hidden">
<div className="mx-auto my-8 max-w-2xl px-4 lg:px-6">
<div className="space-y-12 py-8">
<div className="flex justify-between items-center">
@@ -97,7 +91,7 @@ const SupportPage = () => {
</div>
</div>
</div>
- </div>
+ </LayoutWrapper>
)
}