The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): add auth overview feature flag (#39113)
kemal.earth685505a568ca
diff --git a/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx b/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsxnew file mode 100644index 00000000000..aefc6fad95a--- /dev/null+++ b/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx@@ -0,0 +1,15 @@+import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'+import { Card } from 'ui'++export const OverviewLearnMore = () => {+ return (+ <ScaffoldSection isFullWidth>+ <ScaffoldSectionTitle className="mb-4">Learn more</ScaffoldSectionTitle>+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6 opacity-30 pointer-events-none">+ <Card className="aspect-square" />+ <Card className="aspect-square" />+ <Card className="aspect-square" />+ </div>+ </ScaffoldSection>+ )+}diff --git a/apps/studio/components/interfaces/Auth/Overview/OverviewMonitoring.tsx b/apps/studio/components/interfaces/Auth/Overview/OverviewMonitoring.tsxnew file mode 100644index 00000000000..098ff90beec--- /dev/null+++ b/apps/studio/components/interfaces/Auth/Overview/OverviewMonitoring.tsx@@ -0,0 +1,16 @@+import { ScaffoldSectionTitle, ScaffoldSection } from 'components/layouts/Scaffold'+import { Card } from 'ui'++export const OverviewMonitoring = () => {+ return (+ <ScaffoldSection isFullWidth>+ <ScaffoldSectionTitle className="mb-4">Monitoring</ScaffoldSectionTitle>+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6 opacity-30 pointer-events-none">+ <Card className="h-36" />+ <Card className="h-36" />+ <Card className="aspect-video" />+ <Card className="aspect-video" />+ </div>+ </ScaffoldSection>+ )+}diff --git a/apps/studio/components/interfaces/Auth/Overview/OverviewUsage.tsx b/apps/studio/components/interfaces/Auth/Overview/OverviewUsage.tsxnew file mode 100644index 00000000000..f0223bd5091--- /dev/null+++ b/apps/studio/components/interfaces/Auth/Overview/OverviewUsage.tsx@@ -0,0 +1,14 @@+import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'+import { Card } from 'ui'++export const OverviewUsage = () => {+ return (+ <ScaffoldSection isFullWidth>+ <ScaffoldSectionTitle className="mb-4">Usage</ScaffoldSectionTitle>+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6 opacity-30 pointer-events-none">+ <Card className="aspect-video" />+ <Card className="aspect-video" />+ </div>+ </ScaffoldSection>+ )+}diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsxindex 63c0ee2600e..72eea15c4c9 100644--- a/apps/studio/components/interfaces/Sidebar.tsx+++ b/apps/studio/components/interfaces/Sidebar.tsx@@ -46,6 +46,7 @@ import {useIsNewStorageUIEnabled,useUnifiedLogsPreview,} from './App/FeaturePreview/FeaturePreviewContext'+import { useFlag } from 'common'export const ICON_SIZE = 32export const ICON_STROKE_WIDTH = 1.5@@ -244,12 +245,15 @@ const ProjectLinks = () => {'realtime:all',])+ const authOverviewPageEnabled = useFlag('authOverviewPage')+const toolRoutes = generateToolRoutes(ref, project)const productRoutes = generateProductRoutes(ref, project, {auth: authEnabled,edgeFunctions: edgeFunctionsEnabled,storage: storageEnabled,realtime: realtimeEnabled,+ authOverviewPage: authOverviewPageEnabled,isStorageV2,})const otherRoutes = generateOtherRoutes(ref, project, {diff --git a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsxindex a57815f65d4..8fa1483de02 100644--- a/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx+++ b/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx@@ -8,11 +8,14 @@ import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { withAuth } from 'hooks/misc/withAuth'import ProjectLayout from '../ProjectLayout/ProjectLayout'import { generateAuthMenu } from './AuthLayout.utils'+import { useFlag } from 'common'const AuthProductMenu = () => {const router = useRouter()const { ref: projectRef = 'default' } = useParams()+ const authenticationShowOverview = useFlag('authOverviewPage')+const {authenticationSignInProviders,authenticationRateLimits,@@ -42,6 +45,7 @@ const AuthProductMenu = () => {authenticationMultiFactor,authenticationAttackProtection,authenticationAdvanced,+ authenticationShowOverview,})}/>)diff --git a/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts b/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.tsindex e40c51f9af4..67bad8717a3 100644--- a/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts+++ b/apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts@@ -10,6 +10,7 @@ export const generateAuthMenu = (authenticationMultiFactor: booleanauthenticationAttackProtection: booleanauthenticationAdvanced: boolean+ authenticationShowOverview: boolean}): ProductMenuGroup[] => {const {@@ -19,12 +20,18 @@ export const generateAuthMenu = (authenticationMultiFactor,authenticationAttackProtection,authenticationAdvanced,+ authenticationShowOverview,} = flags ?? {}return [{title: 'Manage',- items: [{ name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] }],+ items: [+ ...(authenticationShowOverview+ ? [{ name: 'Overview', key: 'overview', url: `/project/${ref}/auth/overview`, items: [] }]+ : []),+ { name: 'Users', key: 'users', url: `/project/${ref}/auth/users`, items: [] },+ ],},{title: 'Configuration',diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsxindex 2f0b698771c..c3f6fc7885f 100644--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx@@ -50,6 +50,7 @@ export const generateProductRoutes = (edgeFunctions?: booleanstorage?: booleanrealtime?: boolean+ authOverviewPage?: booleanisStorageV2?: boolean}): Route[] => {@@ -61,6 +62,7 @@ export const generateProductRoutes = (const edgeFunctionsEnabled = features?.edgeFunctions ?? trueconst storageEnabled = features?.storage ?? trueconst realtimeEnabled = features?.realtime ?? true+ const authOverviewPageEnabled = features?.authOverviewPage ?? falseconst isStorageV2 = features?.isStorageV2 ?? falseconst databaseMenu = generateDatabaseMenu(project)@@ -86,7 +88,13 @@ export const generateProductRoutes = (key: 'auth',label: 'Authentication',icon: <Auth size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/auth/users`),+ link:+ ref &&+ (isProjectBuilding+ ? buildingUrl+ : authOverviewPageEnabled+ ? `/project/${ref}/auth/overview`+ : `/project/${ref}/auth/users`),items: authMenu,},]diff --git a/apps/studio/pages/project/[ref]/auth/overview.tsx b/apps/studio/pages/project/[ref]/auth/overview.tsxnew file mode 100644index 00000000000..6f55feeb6c7--- /dev/null+++ b/apps/studio/pages/project/[ref]/auth/overview.tsx@@ -0,0 +1,57 @@+import { NextPageWithLayout } from 'types'+import DefaultLayout from 'components/layouts/DefaultLayout'+import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'+import { PageLayout } from 'components/layouts/PageLayout/PageLayout'+import { DocsButton } from 'components/ui/DocsButton'+import { DOCS_URL } from 'lib/constants'+import { OverviewMonitoring } from 'components/interfaces/Auth/Overview/OverviewMonitoring'+import { OverviewUsage } from 'components/interfaces/Auth/Overview/OverviewUsage'+import { OverviewLearnMore } from 'components/interfaces/Auth/Overview/OverviewLearnMore'+import { useRouter } from 'next/router'+import { FeatureFlagContext, useFlag, useParams } from 'common'+import { useContext, useEffect } from 'react'++const AuthOverview: NextPageWithLayout = () => {+ const router = useRouter()+ const { ref } = useParams()+ const { hasLoaded } = useContext(FeatureFlagContext)+ const authOverviewPageEnabled = useFlag('authOverviewPage')++ useEffect(() => {+ if (hasLoaded && !authOverviewPageEnabled) {+ router.replace(`/project/${ref}/auth/users`)+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [authOverviewPageEnabled, router, ref])++ if (!authOverviewPageEnabled) {+ return null+ }++ return (+ <ScaffoldContainer size="large">+ <div className="mb-4 flex flex-col gap-2">+ <OverviewMonitoring />+ <OverviewUsage />+ <OverviewLearnMore />+ </div>+ </ScaffoldContainer>+ )+}++AuthOverview.getLayout = (page) => (+ <DefaultLayout>+ <AuthLayout>+ <PageLayout+ title="Overview"+ secondaryActions={<DocsButton href={`${DOCS_URL}/guides/auth`} />}+ size="large"+ >+ {page}+ </PageLayout>+ </AuthLayout>+ </DefaultLayout>+)++export default AuthOverview