Skip to content

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

Make feature preview available + Fix up Connect UI for local self-host (#35060)

Joshen Limfd10704cc1f2
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
index 5f2b4f548e6..5a8a0221444 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
@@ -1,6 +1,6 @@
import { noop } from 'lodash'
-import { LOCAL_STORAGE_KEYS } from 'lib/constants'
+import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
import { EMPTY_OBJ } from 'lib/void'
import { PropsWithChildren, createContext, useContext, useEffect, useState } from 'react'
import { APISidePanelPreview } from './APISidePanelPreview'
@@ -17,6 +17,7 @@ export const FEATURE_PREVIEWS = [
content: <LayoutUpdatePreview />,
discussionsUrl: 'https://github.com/orgs/supabase/discussions/18038',
isNew: false,
+ isPlatformOnly: true,
},
{
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_INLINE_EDITOR,
@@ -24,18 +25,21 @@ export const FEATURE_PREVIEWS = [
content: <InlineEditorPreview />,
discussionsUrl: 'https://github.com/orgs/supabase/discussions/33690',
isNew: true,
+ isPlatformOnly: false,
},
{
key: LOCAL_STORAGE_KEYS.UI_TABLE_EDITOR_TABS,
name: 'Table Editor Tabs',
content: <TableEditorTabsPreview />,
isNew: true,
+ isPlatformOnly: false,
},
{
key: LOCAL_STORAGE_KEYS.UI_SQL_EDITOR_TABS,
name: 'SQL Editor Tabs',
content: <SqlEditorTabsPreview />,
isNew: true,
+ isPlatformOnly: true,
},
{
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL,
@@ -43,6 +47,7 @@ export const FEATURE_PREVIEWS = [
content: <APISidePanelPreview />,
discussionsUrl: 'https://github.com/orgs/supabase/discussions/18038',
isNew: false,
+ isPlatformOnly: false,
},
{
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS,
@@ -50,6 +55,7 @@ export const FEATURE_PREVIEWS = [
content: <CLSPreview />,
discussionsUrl: 'https://github.com/orgs/supabase/discussions/20295',
isNew: false,
+ isPlatformOnly: false,
},
]
@@ -120,10 +126,12 @@ export const useIsTableEditorTabsEnabled = () => {
export const useIsSQLEditorTabsEnabled = () => {
const { flags } = useFeaturePreviewContext()
+ if (!IS_PLATFORM) return false
return flags[LOCAL_STORAGE_KEYS.UI_SQL_EDITOR_TABS]
}
-export const useNewLayout = (): boolean => {
+export const useIsNewLayoutEnabled = (): boolean => {
const { flags } = useFeaturePreviewContext()
+ if (!IS_PLATFORM) return false
return flags[LOCAL_STORAGE_KEYS.UI_NEW_LAYOUT_PREVIEW]
}
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
index e6134800ea3..71862a31f93 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx
@@ -6,7 +6,7 @@ import { useParams } from 'common'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useFlag } from 'hooks/ui/useFlag'
-import { LOCAL_STORAGE_KEYS } from 'lib/constants'
+import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
import { useAppStateSnapshot } from 'state/app-state'
import { removeTabsByEditor } from 'state/tabs'
import { Badge, Button, Modal, ScrollArea, cn } from 'ui'
@@ -20,15 +20,9 @@ const FeaturePreviewModal = () => {
const { mutate: sendEvent } = useSendEventMutation()
const enableNewLayoutPreview = useFlag('newLayoutPreview')
- const isFeaturePreviewTabsTableEditorFlag = useFlag('featurePreviewTabsTableEditor')
- const isFeaturePreviewTabsSqlEditorFlag = useFlag('featurePreviewSqlEditorTabs')
function isReleasedToPublic(feature: (typeof FEATURE_PREVIEWS)[number]) {
switch (feature.key) {
- case LOCAL_STORAGE_KEYS.UI_TABLE_EDITOR_TABS:
- return isFeaturePreviewTabsTableEditorFlag
- case LOCAL_STORAGE_KEYS.UI_SQL_EDITOR_TABS:
- return isFeaturePreviewTabsSqlEditorFlag
case LOCAL_STORAGE_KEYS.UI_NEW_LAYOUT_PREVIEW:
return enableNewLayoutPreview
default:
@@ -45,6 +39,10 @@ const FeaturePreviewModal = () => {
const selectedFeature = FEATURE_PREVIEWS.find((preview) => preview.key === selectedFeatureKey)
const isSelectedFeatureEnabled = flags[selectedFeatureKey]
+ const allFeaturePreviews = IS_PLATFORM
+ ? FEATURE_PREVIEWS
+ : FEATURE_PREVIEWS.filter((x) => !x.isPlatformOnly)
+
const toggleFeature = () => {
onUpdateFlag(selectedFeatureKey, !isSelectedFeatureEnabled)
sendEvent({
@@ -88,32 +86,31 @@ const FeaturePreviewModal = () => {
<div className="flex">
<div>
<ScrollArea className="h-[550px] w-[280px] border-r">
- {FEATURE_PREVIEWS.filter((feature) => {
- // filter out preview features that are not released to the public
- return isReleasedToPublic(feature)
- }).map((feature) => {
- const isEnabled = flags[feature.key] ?? false
+ {allFeaturePreviews
+ .filter((feature) => isReleasedToPublic(feature))
+ .map((feature) => {
+ const isEnabled = flags[feature.key] ?? false
- return (
- <div
- key={feature.key}
- onClick={() => snap.setSelectedFeaturePreview(feature.key)}
- className={cn(
- 'flex items-center space-x-3 p-4 border-b cursor-pointer bg transition',
- selectedFeatureKey === feature.key ? 'bg-surface-300' : 'bg-surface-100'
- )}
- >
- {isEnabled ? (
- <Eye size={14} strokeWidth={2} className="text-brand" />
- ) : (
- <EyeOff size={14} strokeWidth={1.5} className="text-foreground-light" />
- )}
- <p className="text-sm truncate" title={feature.name}>
- {feature.name}
- </p>
- </div>
- )
- })}
+ return (
+ <div
+ key={feature.key}
+ onClick={() => snap.setSelectedFeaturePreview(feature.key)}
+ className={cn(
+ 'flex items-center space-x-3 p-4 border-b cursor-pointer bg transition',
+ selectedFeatureKey === feature.key ? 'bg-surface-300' : 'bg-surface-100'
+ )}
+ >
+ {isEnabled ? (
+ <Eye size={14} strokeWidth={2} className="text-brand" />
+ ) : (
+ <EyeOff size={14} strokeWidth={1.5} className="text-foreground-light" />
+ )}
+ <p className="text-sm truncate" title={feature.name}>
+ {feature.name}
+ </p>
+ </div>
+ )
+ })}
</ScrollArea>
</div>
<div className="flex-grow max-h-[550px] p-4 space-y-3 overflow-y-auto">
diff --git a/apps/studio/components/interfaces/Connect/Connect.types.ts b/apps/studio/components/interfaces/Connect/Connect.types.ts
index 588df17d642..5b6c5f6e6d5 100644
--- a/apps/studio/components/interfaces/Connect/Connect.types.ts
+++ b/apps/studio/components/interfaces/Connect/Connect.types.ts
@@ -14,5 +14,6 @@ export interface ContentFileProps {
transactionDedicated?: string
sessionDedicated?: string
ipv4SupportedForDedicatedPooler: boolean
+ direct?: string
}
}
diff --git a/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx b/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx
index 1f5098a4275..de37317c0db 100644
--- a/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx
+++ b/apps/studio/components/interfaces/Connect/ConnectTabContent.tsx
@@ -6,13 +6,13 @@ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { usePgbouncerConfigQuery } from 'data/database/pgbouncer-config-query'
import { useSupavisorConfigurationQuery } from 'data/database/supavisor-configuration-query'
+import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { pluckObjectFields } from 'lib/helpers'
import { cn } from 'ui'
-import type { projectKeys } from './Connect.types'
-import { getConnectionStrings as getConnectionStringsV2 } from './DatabaseSettings.utils'
-import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
-import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { getAddons } from '../Billing/Subscription/Subscription.utils'
+import type { projectKeys } from './Connect.types'
+import { getConnectionStrings } from './DatabaseSettings.utils'
interface ConnectContentTabProps extends HTMLAttributes<HTMLDivElement> {
projectKeys: projectKeys
@@ -23,6 +23,7 @@ interface ConnectContentTabProps extends HTMLAttributes<HTMLDivElement> {
transactionDedicated?: string
sessionDedicated?: string
ipv4SupportedForDedicatedPooler: boolean
+ direct?: string
}
}
@@ -44,24 +45,21 @@ const ConnectTabContent = forwardRef<HTMLDivElement, ConnectContentTabProps>(
const poolingConfigurationShared = supavisorConfig?.find((x) => x.database_type === 'PRIMARY')
const poolingConfigurationDedicated = allowPgBouncerSelection ? pgbouncerConfig : undefined
- const connectionStringsShared =
- poolingConfigurationShared !== undefined
- ? getConnectionStringsV2({
- connectionInfo,
- poolingInfo: {
- connectionString: poolingConfigurationShared.connection_string,
- db_host: poolingConfigurationShared.db_host,
- db_name: poolingConfigurationShared.db_name,
- db_port: poolingConfigurationShared.db_port,
- db_user: poolingConfigurationShared.db_user,
- },
- metadata: { projectRef },
- })
- : { direct: { uri: '' }, pooler: { uri: '' } }
+ const connectionStringsShared = getConnectionStrings({
+ connectionInfo,
+ poolingInfo: {
+ connectionString: poolingConfigurationShared?.connection_string ?? '',
+ db_host: poolingConfigurationShared?.db_host ?? '',
+ db_name: poolingConfigurationShared?.db_name ?? '',
+ db_port: poolingConfigurationShared?.db_port ?? 0,
+ db_user: poolingConfigurationShared?.db_user ?? '',
+ },
+ metadata: { projectRef },
+ })
const connectionStringsDedicated =
poolingConfigurationDedicated !== undefined
- ? getConnectionStringsV2({
+ ? getConnectionStrings({
connectionInfo,
poolingInfo: {
connectionString: poolingConfigurationDedicated.connection_string,
@@ -95,6 +93,7 @@ const ConnectTabContent = forwardRef<HTMLDivElement, ConnectContentTabProps>(
transactionDedicated: connectionStringsDedicated?.pooler.uri,
sessionDedicated: connectionStringsDedicated?.pooler.uri.replace('6543', '5432'),
ipv4SupportedForDedicatedPooler: !!ipv4Addon,
+ direct: connectionStringsShared.direct.uri,
}}
/>
</div>
diff --git a/apps/studio/components/interfaces/Connect/ConnectionPanel.tsx b/apps/studio/components/interfaces/Connect/ConnectionPanel.tsx
index 2ac1a54dddc..c232c4f070a 100644
--- a/apps/studio/components/interfaces/Connect/ConnectionPanel.tsx
+++ b/apps/studio/components/interfaces/Connect/ConnectionPanel.tsx
@@ -4,6 +4,7 @@ import { PropsWithChildren, ReactNode } from 'react'
import { useParams } from 'common'
import { useSupavisorConfigurationQuery } from 'data/database/supavisor-configuration-query'
+import { IS_PLATFORM } from 'lib/constants'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import {
Badge,
@@ -206,31 +207,35 @@ export const ConnectionPanel = ({
</>
)}
- <div className="border border-muted px-5 flex gap-7 items-center py-3 first:rounded-t last:rounded-b">
- <div className="flex items-center gap-2">
- <IPv4StatusIcon active={ipv4Status.type === 'success'} />
- </div>
- <div className="flex flex-col">
- <span className="text-xs text-foreground">{ipv4Status.title}</span>
- {ipv4Status.description &&
- (typeof ipv4Status.description === 'string' ? (
- <span className="text-xs text-foreground-lighter">{ipv4Status.description}</span>
- ) : (
- ipv4Status.description
- ))}
- {links.length > 0 && (
- <div className="flex items-center gap-x-2 mt-2">
- {links.map((link) => (
- <Button key={link.text} asChild type="default" size="tiny">
- <Link href={link.url} className="text-xs text-light hover:text-foreground">
- {link.text}
- </Link>
- </Button>
+ {IS_PLATFORM && (
+ <div className="border border-muted px-5 flex gap-7 items-center py-3 first:rounded-t last:rounded-b">
+ <div className="flex items-center gap-2">
+ <IPv4StatusIcon active={ipv4Status.type === 'success'} />
+ </div>
+ <div className="flex flex-col">
+ <span className="text-xs text-foreground">{ipv4Status.title}</span>
+ {ipv4Status.description &&
+ (typeof ipv4Status.description === 'string' ? (
+ <span className="text-xs text-foreground-lighter">
+ {ipv4Status.description}
+ </span>
+ ) : (
+ ipv4Status.description
))}
- </div>
- )}
+ {links.length > 0 && (
+ <div className="flex items-center gap-x-2 mt-2">
+ {links.map((link) => (
+ <Button key={link.text} asChild type="default" size="tiny">
+ <Link href={link.url} className="text-xs text-light hover:text-foreground">
+ {link.text}
+ </Link>
+ </Button>
+ ))}
+ </div>
+ )}
+ </div>
</div>
- </div>
+ )}
{type === 'session' && (
<div className="border border-muted px-5 flex gap-7 items-center py-3 first:rounded-t last:rounded-b bg-alternative/50">
@@ -246,7 +251,7 @@ export const ConnectionPanel = ({
</div>
)}
- {ipv4Status.type === 'error' && (
+ {IS_PLATFORM && ipv4Status.type === 'error' && (
<Collapsible_Shadcn_ className="group -space-y-px">
<CollapsibleTrigger_Shadcn_
asChild
diff --git a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
index c555f92c8d6..02478f2de23 100644
--- a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
+++ b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
@@ -12,6 +12,7 @@ import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
+import { IS_PLATFORM } from 'lib/constants'
import { pluckObjectFields } from 'lib/helpers'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import {
@@ -94,15 +95,21 @@ export const DatabaseConnectionString = () => {
} = useReadReplicasQuery({ projectRef })
const poolerError = sharedPoolerPreferred ? pgbouncerError : supavisorConfigError
- const isLoadingPoolerConfig = sharedPoolerPreferred
- ? isLoadingPgbouncerConfig
- : isLoadingSupavisorConfig
- const isErrorPoolerConfig = sharedPoolerPreferred
- ? isErrorPgbouncerConfig
- : isErrorSupavisorConfig
- const isSuccessPoolerConfig = sharedPoolerPreferred
- ? isSuccessPgBouncerConfig
- : isSuccessSupavisorConfig
+ const isLoadingPoolerConfig = !IS_PLATFORM
+ ? false
+ : sharedPoolerPreferred
+ ? isLoadingPgbouncerConfig
+ : isLoadingSupavisorConfig
+ const isErrorPoolerConfig = !IS_PLATFORM
+ ? undefined
+ : sharedPoolerPreferred
+ ? isErrorPgbouncerConfig
+ : isErrorSupavisorConfig
+ const isSuccessPoolerConfig = !IS_PLATFORM
+ ? true
+ : sharedPoolerPreferred
+ ? isSuccessPgBouncerConfig
+ : isSuccessSupavisorConfig
const error = poolerError || readReplicasError
const isLoading = isLoadingPoolerConfig || isLoadingReadReplicas
@@ -152,48 +159,22 @@ export const DatabaseConnectionString = () => {
metadata: { projectRef },
})
- const connectionStrings =
- isSuccessSupavisorConfig && poolingConfiguration !== undefined
- ? getConnectionStrings({
- connectionInfo,
- poolingInfo: {
- connectionString: isReplicaSelected
- ? poolingConfiguration.connection_string.replace(
- poolingConfiguration.db_host,
- connectionInfo.db_host
- )
- : poolingConfiguration.connection_string,
- db_host: isReplicaSelected ? connectionInfo.db_host : poolingConfiguration.db_host,
- db_name: poolingConfiguration.db_name,
- db_port: poolingConfiguration.db_port,
- db_user: poolingConfiguration.db_user,
- },
- metadata: { projectRef },
- })
- : {
- direct: {
- uri: '',
- psql: '',
- golang: '',
- jdbc: '',
- dotnet: '',
- nodejs: '',
- php: '',
- python: '',
- sqlalchemy: '',
- },
- pooler: {
- uri: '',
- psql: '',
- golang: '',
- jdbc: '',
- dotnet: '',
- nodejs: '',
- php: '',
- python: '',
- sqlalchemy: '',
- },
- }
+ const connectionStrings = getConnectionStrings({
+ connectionInfo,
+ poolingInfo: {
+ connectionString: isReplicaSelected
+ ? poolingConfiguration?.connection_string.replace(
+ poolingConfiguration?.db_host,
+ connectionInfo.db_host
+ ) ?? ''
+ : poolingConfiguration?.connection_string ?? '',
+ db_host: isReplicaSelected ? connectionInfo.db_host : poolingConfiguration?.db_host,
+ db_name: poolingConfiguration?.db_name ?? '',
+ db_port: poolingConfiguration?.db_port ?? 0,
+ db_user: poolingConfiguration?.db_user ?? '',
+ },
+ metadata: { projectRef },
+ })
const lang = DATABASE_CONNECTION_TYPES.find((type) => type.id === selectedTab)?.lang ?? 'bash'
const contentType =
@@ -350,130 +331,135 @@ export const DatabaseConnectionString = () => {
onCopyCallback={() => handleCopy(selectedTab, 'direct')}
/>
- <ConnectionPanel
- type="transaction"
- title="Transaction pooler"
- contentType={contentType}
- lang={lang}
- badge={poolerBadge}
- fileTitle={fileTitle}
- description="Ideal for stateless applications like serverless functions where each interaction with Postgres is brief and isolated."
- connectionString={connectionStrings['pooler'][selectedTab]}
- ipv4Status={{
- type: !sharedPoolerPreferred && !ipv4Addon ? 'error' : 'success',
- title:
- !sharedPoolerPreferred && !ipv4Addon
- ? 'Not IPv4 compatible'
- : 'IPv4 compatible',
- description:
- !sharedPoolerPreferred && !ipv4Addon
- ? PGBOUNCER_ENABLED_BUT_NO_IPV4_ADDON_TEXT
- : sharedPoolerPreferred
- ? 'Transaction pooler connections are IPv4 proxied for free.'
- : IPV4_ADDON_TEXT,
- links: !sharedPoolerPreferred ? buttonLinks : undefined,
- }}
- notice={['Does not support PREPARE statements']}
- parameters={[
- { ...CONNECTION_PARAMETERS.host, value: poolingConfiguration?.db_host ?? '' },
- {
- ...CONNECTION_PARAMETERS.port,
- value: poolingConfiguration?.db_port.toString() ?? '6543',
- },
- {
- ...CONNECTION_PARAMETERS.database,
- value: poolingConfiguration?.db_name ?? '',
- },
- { ...CONNECTION_PARAMETERS.user, value: poolingConfiguration?.db_user ?? '' },
- { ...CONNECTION_PARAMETERS.pool_mode, value: 'transaction' },
- ]}
- onCopyCallback={() => handleCopy(selectedTab, 'transaction_pooler')}
- >
- {!sharedPoolerPreferred && !ipv4Addon && (
- <Collapsible_Shadcn_ className="group">
- <CollapsibleTrigger_Shadcn_
- asChild
- className="w-full justify-start !last:rounded-b group-data-[state=open]:rounded-b-none border-light mt-4 px-3"
+ {IS_PLATFORM && (
+ <>
+ <ConnectionPanel
+ type="transaction"
+ title="Transaction pooler"
+ contentType={contentType}
+ lang={lang}
+ badge={poolerBadge}
+ fileTitle={fileTitle}
+ description="Ideal for stateless applications like serverless functions where each interaction with Postgres is brief and isolated."
+ connectionString={connectionStrings['pooler'][selectedTab]}
+ ipv4Status={{
+ type: !sharedPoolerPreferred && !ipv4Addon ? 'error' : 'success',
+ title:
+ !sharedPoolerPreferred && !ipv4Addon
+ ? 'Not IPv4 compatible'
+ : 'IPv4 compatible',
+ description:
+ !sharedPoolerPreferred && !ipv4Addon
+ ? PGBOUNCER_ENABLED_BUT_NO_IPV4_ADDON_TEXT
+ : sharedPoolerPreferred
+ ? 'Transaction pooler connections are IPv4 proxied for free.'
+ : IPV4_ADDON_TEXT,
+ links: !sharedPoolerPreferred ? buttonLinks : undefined,
+ }}
+ notice={['Does not support PREPARE statements']}
+ parameters={[
+ { ...CONNECTION_PARAMETERS.host, value: poolingConfiguration?.db_host ?? '' },
+ {
+ ...CONNECTION_PARAMETERS.port,
+ value: poolingConfiguration?.db_port.toString() ?? '6543',
+ },
+ {
+ ...CONNECTION_PARAMETERS.database,
+ value: poolingConfiguration?.db_name ?? '',
+ },
+ { ...CONNECTION_PARAMETERS.user, value: poolingConfiguration?.db_user ?? '' },
+ { ...CONNECTION_PARAMETERS.pool_mode, value: 'transaction' },
+ ]}
+ onCopyCallback={() => handleCopy(selectedTab, 'transaction_pooler')}
+ >
+ {!sharedPoolerPreferred && !ipv4Addon && (
+ <Collapsible_Shadcn_ className="group">
+ <CollapsibleTrigger_Shadcn_
+ asChild
+ className="w-full justify-start !last:rounded-b group-data-[state=open]:rounded-b-none border-light mt-4 px-3"
+ >
+ <Button
+ type="default"
+ size="large"
+ iconRight={
+ <ChevronDown className="transition group-data-[state=open]:rotate-180" />
+ }
+ className="text-foreground !bg-dash-sidebar justify-between"
+ >
+ <div className="text-xs flex items-center p-2">
+ <span>Using the Shared Pooler</span>
+ <Badge variant={'brand'} size={'small'} className="ml-2">
+ IPv4 compatible
+ </Badge>
+ </div>
+ </Button>
+ </CollapsibleTrigger_Shadcn_>
+ <CollapsibleContent_Shadcn_ className="bg-dash-sidebar rounded-b border text-xs">
+ <p className="px-3 py-2">
+ Only recommended when your network does not support IPv6. Added latency
+ compared to dedicated pooler.
+ </p>
+ <CodeBlock
+ wrapperClassName={cn(
+ '[&_pre]:border-x-0 [&_pre]:border-b-0 [&_pre]:px-4 [&_pre]:py-3',
+ '[&_pre]:rounded-t-none'
+ )}
+ language={lang}
+ value={supavisorConnectionStrings['pooler'][selectedTab]}
+ className="[&_code]:text-[12px] [&_code]:text-foreground"
+ hideLineNumbers
+ onCopyCallback={() => handleCopy(selectedTab, 'transaction_pooler')}
+ />
+ </CollapsibleContent_Shadcn_>
+ </Collapsible_Shadcn_>
+ )}
+ </ConnectionPanel>
+
+ {sharedPoolerPreferred && ipv4Addon && (
+ <Admonition
+ type="warning"
+ title="Highly recommended to not use Session Pooler"
+ className="[&>div]:gap-0 px-8 [&>svg]:left-7 border-0 border-b rounded-none border-border-muted !py-4 mb-0"
>
- <Button
- type="default"
- size="large"
- iconRight={
- <ChevronDown className="transition group-data-[state=open]:rotate-180" />
- }
- className="text-foreground !bg-dash-sidebar justify-between"
- >
- <div className="text-xs flex items-center p-2">
- <span>Using the Shared Pooler</span>
- <Badge variant={'brand'} size={'small'} className="ml-2">
- IPv4 compatible
- </Badge>
- </div>
- </Button>
- </CollapsibleTrigger_Shadcn_>
- <CollapsibleContent_Shadcn_ className="bg-dash-sidebar rounded-b border text-xs">
- <p className="px-3 py-2">
- Only recommended when your network does not support IPv6. Added latency
- compared to dedicated pooler.
+ <p className="text-sm text-foreground-lighter !mb-0">
+ If you are using Session Pooler, we recommend switching to Direct
+ Connection.
</p>
- <CodeBlock
- wrapperClassName={cn(
- '[&_pre]:border-x-0 [&_pre]:border-b-0 [&_pre]:px-4 [&_pre]:py-3',
- '[&_pre]:rounded-t-none'
- )}
- language={lang}
- value={supavisorConnectionStrings['pooler'][selectedTab]}
- className="[&_code]:text-[12px] [&_code]:text-foreground"
- hideLineNumbers
- onCopyCallback={() => handleCopy(selectedTab, 'transaction_pooler')}
- />
- </CollapsibleContent_Shadcn_>
- </Collapsible_Shadcn_>
- )}
- </ConnectionPanel>
-
- {sharedPoolerPreferred && ipv4Addon && (
- <Admonition
- type="warning"
- title="Highly recommended to not use Session Pooler"
- className="[&>div]:gap-0 px-8 [&>svg]:left-7 border-0 border-b rounded-none border-border-muted !py-4 mb-0"
- >
- <p className="text-sm text-foreground-lighter !mb-0">
- If you are using Session Pooler, we recommend switching to Direct Connection.
- </p>
- </Admonition>
+ </Admonition>
+ )}
+
+ <ConnectionPanel
+ type="session"
+ title="Session pooler"
+ contentType={contentType}
+ lang={lang}
+ badge="Shared Pooler"
+ fileTitle={fileTitle}
+ description="Only recommended as an alternative to Direct Connection, when connecting via an IPv4 network."
+ connectionString={supavisorConnectionStrings['pooler'][selectedTab].replace(
+ '6543',
+ '5432'
+ )}
+ ipv4Status={{
+ type: 'success',
+ title: 'IPv4 compatible',
+ description: 'Session pooler connections are IPv4 proxied for free',
+ links: undefined,
+ }}
+ parameters={[
+ { ...CONNECTION_PARAMETERS.host, value: sharedPoolerConfig?.db_host ?? '' },
+ { ...CONNECTION_PARAMETERS.port, value: '5432' },
+ {
+ ...CONNECTION_PARAMETERS.database,
+ value: sharedPoolerConfig?.db_name ?? '',
+ },
+ { ...CONNECTION_PARAMETERS.user, value: sharedPoolerConfig?.db_user ?? '' },
+ { ...CONNECTION_PARAMETERS.pool_mode, value: 'session' },
+ ]}
+ onCopyCallback={() => handleCopy(selectedTab, 'session_pooler')}
+ />
+ </>
)}
-
- <ConnectionPanel
- type="session"
- title="Session pooler"
- contentType={contentType}
- lang={lang}
- badge="Shared Pooler"
- fileTitle={fileTitle}
- description="Only recommended as an alternative to Direct Connection, when connecting via an IPv4 network."
- connectionString={supavisorConnectionStrings['pooler'][selectedTab].replace(
- '6543',
- '5432'
- )}
- ipv4Status={{
- type: 'success',
- title: 'IPv4 compatible',
- description: 'Session pooler connections are IPv4 proxied for free',
- links: undefined,
- }}
- parameters={[
- { ...CONNECTION_PARAMETERS.host, value: sharedPoolerConfig?.db_host ?? '' },
- { ...CONNECTION_PARAMETERS.port, value: '5432' },
- {
- ...CONNECTION_PARAMETERS.database,
- value: sharedPoolerConfig?.db_name ?? '',
- },
- { ...CONNECTION_PARAMETERS.user, value: sharedPoolerConfig?.db_user ?? '' },
- { ...CONNECTION_PARAMETERS.pool_mode, value: 'session' },
- ]}
- onCopyCallback={() => handleCopy(selectedTab, 'session_pooler')}
- />
</div>
</div>
diff --git a/apps/studio/components/interfaces/Connect/DatabaseSettings.utils.ts b/apps/studio/components/interfaces/Connect/DatabaseSettings.utils.ts
index 7e2beb9de3c..0f331df2b8b 100644
--- a/apps/studio/components/interfaces/Connect/DatabaseSettings.utils.ts
+++ b/apps/studio/components/interfaces/Connect/DatabaseSettings.utils.ts
@@ -21,7 +21,7 @@ export const getConnectionStrings = ({
db_host: string
db_name: string
}
- poolingInfo: {
+ poolingInfo?: {
connectionString: string
db_user: string
db_port: number
@@ -36,7 +36,7 @@ export const getConnectionStrings = ({
direct: ConnectionStrings
pooler: ConnectionStrings
} => {
- const isMd5 = poolingInfo.connectionString.includes('options=reference')
+ const isMd5 = poolingInfo?.connectionString.includes('options=reference')
const { projectRef } = metadata
const password = '[YOUR-PASSWORD]'
@@ -47,10 +47,10 @@ export const getConnectionStrings = ({
const directName = connectionInfo.db_name
// Pooler connection variables
- const poolerUser = poolingInfo.db_user
- const poolerPort = poolingInfo.db_port
- const poolerHost = poolingInfo.db_host
- const poolerName = poolingInfo.db_name
+ const poolerUser = poolingInfo?.db_user
+ const poolerPort = poolingInfo?.db_port
+ const poolerHost = poolingInfo?.db_host
+ const poolerName = poolingInfo?.db_name
// Direct connection strings
const directPsqlString = isMd5
@@ -84,9 +84,9 @@ export const getConnectionStrings = ({
? `psql "postgresql://${poolerUser}:${password}@${poolerHost}:${poolerPort}/${poolerName}?options=reference%3D${projectRef}"`
: `psql -h ${poolerHost} -p ${poolerPort} -d ${poolerName} -U ${poolerUser}`
- const poolerUriString = poolingInfo.connectionString
+ const poolerUriString = poolingInfo?.connectionString ?? ''
- const nodejsPoolerUriString = `DATABASE_URL=${poolingInfo.connectionString}`
+ const nodejsPoolerUriString = `DATABASE_URL=${poolingInfo?.connectionString}`
const poolerGolangString = `user=${poolerUser}
password=${password}
diff --git a/apps/studio/components/interfaces/Connect/content/prisma/content.tsx b/apps/studio/components/interfaces/Connect/content/prisma/content.tsx
index 632a42c5d45..f437e9ef83f 100644
--- a/apps/studio/components/interfaces/Connect/content/prisma/content.tsx
+++ b/apps/studio/components/interfaces/Connect/content/prisma/content.tsx
@@ -7,6 +7,7 @@ import {
ConnectTabTrigger,
ConnectTabTriggers,
} from 'components/interfaces/Connect/ConnectTabs'
+import { IS_PLATFORM } from 'lib/constants'
const ContentFile = ({ connectionStringPooler }: ContentFileProps) => {
return (
@@ -41,11 +42,11 @@ DIRECT_URL="${connectionStringPooler.sessionShared}"
# DIRECT_URL="${connectionStringPooler.sessionDedicated}"
`
: `
-# Connect to Supabase via connection pooling.
-DATABASE_URL="${connectionStringPooler.transactionShared}?pgbouncer=true"
+# Connect to Supabase ${IS_PLATFORM ? 'via connection pooling' : ''}
+DATABASE_URL="${IS_PLATFORM ? `${connectionStringPooler.transactionShared}?pgbouncer=true` : connectionStringPooler.direct}"
-# Direct connection to the database. Used for migrations.
-DIRECT_URL="${connectionStringPooler.sessionShared}"
+# Direct connection to the database. Used for migrations
+DIRECT_URL="${IS_PLATFORM ? connectionStringPooler.sessionShared : connectionStringPooler.direct}"
`}
</SimpleCodeBlock>
</ConnectTabContent>
diff --git a/apps/studio/components/interfaces/HomePageActions.tsx b/apps/studio/components/interfaces/HomePageActions.tsx
index cc9de3d469a..fe4a1e9f0a7 100644
--- a/apps/studio/components/interfaces/HomePageActions.tsx
+++ b/apps/studio/components/interfaces/HomePageActions.tsx
@@ -3,10 +3,9 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { IS_PLATFORM, useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
-import { useFlag } from 'hooks/ui/useFlag'
import { PROJECT_STATUS } from 'lib/constants'
import { EMPTY_ARR } from 'lib/void'
import {
@@ -40,7 +39,7 @@ const HomePageActions = ({
setSearch,
setFilterStatus,
}: HomePageActionsProps) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const router = useRouter()
const { slug } = useParams()
diff --git a/apps/studio/components/interfaces/LocalDropdown.tsx b/apps/studio/components/interfaces/LocalDropdown.tsx
new file mode 100644
index 00000000000..ae3e07bce65
--- /dev/null
+++ b/apps/studio/components/interfaces/LocalDropdown.tsx
@@ -0,0 +1,69 @@
+import { ProfileImage } from 'components/ui/ProfileImage'
+import { Command, FlaskConical } from 'lucide-react'
+import { useTheme } from 'next-themes'
+
+import { useAppStateSnapshot } from 'state/app-state'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ singleThemes,
+ Theme,
+} from 'ui'
+import { useSetCommandMenuOpen } from 'ui-patterns'
+
+export const LocalDropdown = () => {
+ const { theme, setTheme } = useTheme()
+ const snap = useAppStateSnapshot()
+ const setCommandMenuOpen = useSetCommandMenuOpen()
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger className="border flex-shrink-0 px-3" asChild>
+ <Button
+ type="default"
+ className="[&>span]:flex px-0 py-0 rounded-full overflow-hidden h-8 w-8"
+ >
+ <ProfileImage className="w-8 h-8 rounded-md" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent side="bottom" align="end" className="w-44">
+ <DropdownMenuItem
+ className="flex gap-2"
+ onClick={() => snap.setShowFeaturePreviewModal(true)}
+ onSelect={() => snap.setShowFeaturePreviewModal(true)}
+ >
+ <FlaskConical size={14} strokeWidth={1.5} className="text-foreground-lighter" />
+ Feature previews
+ </DropdownMenuItem>
+ <DropdownMenuItem className="flex gap-2" onClick={() => setCommandMenuOpen(true)}>
+ <Command size={14} strokeWidth={1.5} className="text-foreground-lighter" />
+ Command menu
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Theme</DropdownMenuLabel>
+ <DropdownMenuRadioGroup
+ value={theme}
+ onValueChange={(value) => {
+ setTheme(value)
+ }}
+ >
+ {singleThemes.map((theme: Theme) => (
+ <DropdownMenuRadioItem key={theme.value} value={theme.value}>
+ {theme.name}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
diff --git a/apps/studio/components/interfaces/Organization/GeneralSettings/DeleteOrganizationButton.tsx b/apps/studio/components/interfaces/Organization/GeneralSettings/DeleteOrganizationButton.tsx
index edf1650a174..da2876a39dc 100644
--- a/apps/studio/components/interfaces/Organization/GeneralSettings/DeleteOrganizationButton.tsx
+++ b/apps/studio/components/interfaces/Organization/GeneralSettings/DeleteOrganizationButton.tsx
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
import { useState } from 'react'
import { toast } from 'sonner'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useOrganizationDeleteMutation } from 'data/organizations/organization-delete-mutation'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
@@ -11,7 +11,7 @@ import { Button, Form, Input, Modal } from 'ui'
const DeleteOrganizationButton = () => {
const router = useRouter()
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const selectedOrganization = useSelectedOrganization()
const { slug: orgSlug, name: orgName } = selectedOrganization ?? {}
diff --git a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 951978507eb..a4c95fb621b 100644
--- a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -2,7 +2,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useCallback } from 'react'
import { toast } from 'sonner'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { EmptyIntegrationConnection } from 'components/interfaces/Integrations/VercelGithub/IntegrationPanels'
import { Markdown } from 'components/interfaces/Markdown'
import VercelSection from 'components/interfaces/Settings/Integrations/VercelIntegration/VercelSection'
@@ -43,7 +43,7 @@ const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
}
const IntegrationSettings = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const org = useSelectedOrganization()
diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx
index 181a93cca60..27ad91f1448 100644
--- a/apps/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx
+++ b/apps/studio/components/interfaces/Organization/TeamSettings/TeamSettings.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react'
import { toast } from 'sonner'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import {
ScaffoldActionsContainer,
ScaffoldActionsGroup,
@@ -28,7 +28,7 @@ import MembersView from './MembersView'
import { hasMultipleOwners, useGetRolesManagementPermissions } from './TeamSettings.utils'
const TeamSettings = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const {
organizationMembersCreate: organizationMembersCreationEnabled,
diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
index 64066b64959..02354d7dd10 100644
--- a/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/Usage.tsx
@@ -1,14 +1,15 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import dayjs from 'dayjs'
+import Link from 'next/link'
import { useEffect, useMemo, useState } from 'react'
import { useParams } from 'common'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import {
ScaffoldContainer,
ScaffoldContainerLegacy,
ScaffoldTitle,
} from 'components/layouts/Scaffold'
-
import AlertError from 'components/ui/AlertError'
import DateRangePicker from 'components/ui/DateRangePicker'
import NoPermission from 'components/ui/NoPermission'
@@ -17,7 +18,6 @@ import { useProjectsQuery } from 'data/projects/projects-query'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { TIME_PERIODS_BILLING, TIME_PERIODS_REPORTS } from 'lib/constants/metrics'
import { cn, Listbox } from 'ui'
import { Admonition } from 'ui-patterns'
@@ -27,10 +27,9 @@ import Bandwidth from './Bandwidth'
import Compute from './Compute'
import SizeAndCounts from './SizeAndCounts'
import TotalUsage from './TotalUsage'
-import Link from 'next/link'
const Usage = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { slug, projectRef } = useParams()
const [dateRange, setDateRange] = useState<any>()
diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsx
index 03a3a0d2c24..66394b2249b 100644
--- a/apps/studio/components/interfaces/Sidebar.tsx
+++ b/apps/studio/components/interfaces/Sidebar.tsx
@@ -56,8 +56,8 @@ import {
} from 'ui'
import {
useIsAPIDocsSidePanelEnabled,
+ useIsNewLayoutEnabled,
useIsSQLEditorTabsEnabled,
- useNewLayout,
} from './App/FeaturePreview/FeaturePreviewContext'
export const ICON_SIZE = 32
@@ -74,7 +74,7 @@ const SidebarMotion = motion(SidebarPrimitive) as FC<
export interface SidebarProps extends ComponentPropsWithoutRef<typeof SidebarPrimitive> {}
export const Sidebar = ({ className, ...props }: SidebarProps) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { ref } = useParams()
@@ -151,7 +151,7 @@ export const Sidebar = ({ className, ...props }: SidebarProps) => {
}
export const SidebarContent = ({ footer }: { footer?: ReactNode }) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { ref: projectRef } = useParams()
// temporary logic to show settings route in sidebar footer
diff --git a/apps/studio/components/interfaces/ThemeDropdown.tsx b/apps/studio/components/interfaces/ThemeDropdown.tsx
deleted file mode 100644
index b93d1555ef8..00000000000
--- a/apps/studio/components/interfaces/ThemeDropdown.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { Palette } from 'lucide-react'
-import { useTheme } from 'next-themes'
-
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuLabel,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuTrigger,
- singleThemes,
- Theme,
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from 'ui'
-
-export const ThemeDropdown = () => {
- const { theme, setTheme } = useTheme()
-
- return (
- <DropdownMenu>
- <Tooltip>
- <TooltipTrigger asChild>
- <DropdownMenuTrigger asChild>
- <Button
- type="text"
- className="w-7"
- icon={<Palette className="text-foreground-light" />}
- />
- </DropdownMenuTrigger>
- </TooltipTrigger>
- <TooltipContent side="bottom" align="center">
- <span>Theme</span>
- </TooltipContent>
- </Tooltip>
- <DropdownMenuContent side="top" align="end" className="w-32">
- <DropdownMenuGroup>
- <DropdownMenuLabel>Theme</DropdownMenuLabel>
- <DropdownMenuRadioGroup
- value={theme}
- onValueChange={(value) => {
- setTheme(value)
- }}
- >
- {singleThemes.map((theme: Theme) => (
- <DropdownMenuRadioItem key={theme.value} value={theme.value}>
- {theme.name}
- </DropdownMenuRadioItem>
- ))}
- </DropdownMenuRadioGroup>
- </DropdownMenuGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- )
-}
diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
index 89c3ed3d924..29c32fd75b5 100644
--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx
@@ -4,7 +4,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { PropsWithChildren, useEffect } from 'react'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { withAuth } from 'hooks/misc/withAuth'
import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
@@ -24,7 +24,7 @@ export interface AccountLayoutProps {
const AccountLayout = ({ children, title }: PropsWithChildren<AccountLayoutProps>) => {
const router = useRouter()
const appSnap = useAppStateSnapshot()
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const [lastVisitedOrganization] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.LAST_VISITED_ORGANIZATION,
diff --git a/apps/studio/components/layouts/AccountLayout/AccountSettingsLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountSettingsLayout.tsx
index a54e32b9597..e4f0d1747cb 100644
--- a/apps/studio/components/layouts/AccountLayout/AccountSettingsLayout.tsx
+++ b/apps/studio/components/layouts/AccountLayout/AccountSettingsLayout.tsx
@@ -2,12 +2,12 @@ import Link from 'next/link'
import { usePathname } from 'next/navigation'
import { PropsWithChildren } from 'react'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { Button, cn } from 'ui'
import { ScaffoldContainerLegacy } from '../Scaffold'
const AccountSettingsLayout = ({ children }: PropsWithChildren) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const pathname = usePathname()
const links = [
diff --git a/apps/studio/components/layouts/AppLayout/BranchDropdown.tsx b/apps/studio/components/layouts/AppLayout/BranchDropdown.tsx
index 9851c136350..03015d98d9e 100644
--- a/apps/studio/components/layouts/AppLayout/BranchDropdown.tsx
+++ b/apps/studio/components/layouts/AppLayout/BranchDropdown.tsx
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
import { useState } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { Branch, useBranchesQuery } from 'data/branches/branches-query'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
@@ -64,7 +64,7 @@ const BranchLink = ({
}
const BranchDropdown = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const router = useRouter()
const { ref } = useParams()
diff --git a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx
index 47ca3fb8151..13c659f29ec 100644
--- a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx
+++ b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
import { useState } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import PartnerIcon from 'components/ui/PartnerIcon'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
@@ -28,7 +28,7 @@ import {
} from 'ui'
const OrganizationDropdown = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const router = useRouter()
const { slug: routeSlug } = useParams()
diff --git a/apps/studio/components/layouts/AppLayout/ProjectDropdown.tsx b/apps/studio/components/layouts/AppLayout/ProjectDropdown.tsx
index c93ae75429f..36e6d45b1c6 100644
--- a/apps/studio/components/layouts/AppLayout/ProjectDropdown.tsx
+++ b/apps/studio/components/layouts/AppLayout/ProjectDropdown.tsx
@@ -5,7 +5,7 @@ import { ParsedUrlQuery } from 'querystring'
import { useState } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { ProjectInfo, useProjectsQuery } from 'data/projects/projects-query'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
@@ -93,7 +93,7 @@ interface ProjectDropdownProps {
}
const ProjectDropdown = ({ isNewNav = true }: ProjectDropdownProps) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const router = useRouter()
const { ref } = useParams()
diff --git a/apps/studio/components/layouts/DefaultLayout.tsx b/apps/studio/components/layouts/DefaultLayout.tsx
index 225d35a7100..1d44ce50950 100644
--- a/apps/studio/components/layouts/DefaultLayout.tsx
+++ b/apps/studio/components/layouts/DefaultLayout.tsx
@@ -3,7 +3,7 @@ import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { AppBannerWrapper } from 'components/interfaces/App'
import { AppBannerContextProvider } from 'components/interfaces/App/AppBannerWrapperContext'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { Sidebar } from 'components/interfaces/Sidebar'
import { useShowLayoutHeader } from 'hooks/misc/useShowLayoutHeader'
import { SidebarProvider } from 'ui'
@@ -13,7 +13,6 @@ import { ProjectContextProvider } from './ProjectLayout/ProjectContext'
export interface DefaultLayoutProps {
headerTitle?: string
- showProductMenu?: boolean
}
/**
@@ -27,12 +26,8 @@ export interface DefaultLayoutProps {
* - First level side navigation bar (e.g For navigating to Table Editor, SQL Editor, Database page, etc)
* @param showProductMenu - (Mobile only) Show button to toggle visiblity of product menu (Default: true)
*/
-const DefaultLayout = ({
- children,
- headerTitle,
- showProductMenu = true,
-}: PropsWithChildren<DefaultLayoutProps>) => {
- const newLayoutPreview = useNewLayout()
+const DefaultLayout = ({ children, headerTitle }: PropsWithChildren<DefaultLayoutProps>) => {
+ const newLayoutPreview = useIsNewLayoutEnabled()
const showLayoutHeader = useShowLayoutHeader()
const { ref } = useParams()
@@ -47,7 +42,7 @@ const DefaultLayout = ({
<div className="flex-shrink-0">
<MobileNavigationBar />
{newLayoutPreview || showLayoutHeader ? (
- <LayoutHeader showProductMenu={showProductMenu} headerTitle={headerTitle} />
+ <LayoutHeader headerTitle={headerTitle} />
) : null}
</div>
{/* Main Content Area */}
diff --git a/apps/studio/components/layouts/OrganizationLayout.tsx b/apps/studio/components/layouts/OrganizationLayout.tsx
index af5290ef6f9..1327d8a641a 100644
--- a/apps/studio/components/layouts/OrganizationLayout.tsx
+++ b/apps/studio/components/layouts/OrganizationLayout.tsx
@@ -2,7 +2,7 @@ import { ExternalLink } from 'lucide-react'
import { useRouter } from 'next/router'
import { Fragment, type PropsWithChildren } from 'react'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import PartnerIcon from 'components/ui/PartnerIcon'
import { PARTNER_TO_NAME } from 'components/ui/PartnerManagedResource'
import { useVercelRedirectQuery } from 'data/integrations/vercel-redirect-query'
@@ -45,7 +45,7 @@ const OrganizationLayoutContent = ({ children }: PropsWithChildren<{}>) => {
const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter()
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const selectedOrganization = useSelectedOrganization()
const { data: organizations } = useOrganizationsQuery()
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HomeIcon.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HomeIcon.tsx
index 56ef45a8fa7..23938d63705 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HomeIcon.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HomeIcon.tsx
@@ -2,7 +2,7 @@ import Image from 'next/image'
import Link from 'next/link'
import { useRouter } from 'next/router'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
@@ -11,7 +11,7 @@ import { useShowLayoutHeader } from 'hooks/misc/useShowLayoutHeader'
import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
export const HomeIcon = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const showLayoutHeader = useShowLayoutHeader()
const selectedOrganization = useSelectedOrganization()
const { data: organizations } = useOrganizationsQuery()
@@ -32,11 +32,11 @@ export const HomeIcon = () => {
return '/projects'
}
- const href = newLayoutPreview
- ? IS_PLATFORM
+ const href = IS_PLATFORM
+ ? newLayoutPreview
? getDefaultOrgRedirect()
- : `/project/${project?.ref}`
- : '/projects'
+ : `/projects`
+ : '/project/default'
return (
<Link href={href} className="items-center justify-center flex-shrink-0 hidden md:flex">
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
index e467a692474..4ebf9b274b6 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
@@ -3,9 +3,9 @@ import Link from 'next/link'
import { ReactNode, useMemo } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import Connect from 'components/interfaces/Connect/Connect'
-import { ThemeDropdown } from 'components/interfaces/ThemeDropdown'
+import { LocalDropdown } from 'components/interfaces/LocalDropdown'
import { UserDropdown } from 'components/interfaces/UserDropdown'
import AssistantButton from 'components/layouts/AppLayout/AssistantButton'
import BranchDropdown from 'components/layouts/AppLayout/BranchDropdown'
@@ -19,7 +19,6 @@ import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { useShowLayoutHeader } from 'hooks/misc/useShowLayoutHeader'
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'
@@ -49,24 +48,21 @@ const LayoutHeaderDivider = ({ className, ...props }: React.HTMLProps<HTMLSpanEl
interface LayoutHeaderProps {
customHeaderComponents?: ReactNode
breadcrumbs?: any[]
- showProductMenu?: boolean
headerTitle?: string
}
const LayoutHeader = ({
customHeaderComponents,
breadcrumbs = [],
- showProductMenu,
headerTitle,
}: LayoutHeaderProps) => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const showLayoutHeader = useShowLayoutHeader()
const { ref: projectRef, slug } = useParams()
const selectedProject = useSelectedProject()
const selectedOrganization = useSelectedOrganization()
const isBranchingEnabled = selectedProject?.is_branch_enabled === true
- const { setMobileMenuOpen } = useAppStateSnapshot()
// We only want to query the org usage and check for possible over-ages for plans without usage billing enabled (free or pro with spend cap)
const { data: orgUsage } = useOrgUsageQuery(
@@ -169,7 +165,7 @@ const LayoutHeader = ({
ease: 'easeOut',
}}
>
- <Connect />
+ {<Connect />}
{!isBranchingEnabled && IS_PLATFORM && <EnableBranchingButton />}
</motion.div>
)}
@@ -189,7 +185,7 @@ const LayoutHeader = ({
) : (
<>
<LocalVersionPopover />
- <ThemeDropdown />
+ <LocalDropdown />
</>
)}
</div>
diff --git a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx
index 56db448226c..3f2f0ba4006 100644
--- a/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.tsx
@@ -2,13 +2,13 @@ import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useCurrentPath } from 'hooks/misc/useCurrentPath'
import { NavMenu, NavMenuItem } from 'ui'
import { ScaffoldContainerLegacy, ScaffoldTitle } from '../Scaffold'
function OrganizationSettingsLayout({ children }: PropsWithChildren) {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { slug } = useParams()
const fullCurrentPath = useCurrentPath()
diff --git a/apps/studio/components/ui/DatabaseSelector.tsx b/apps/studio/components/ui/DatabaseSelector.tsx
index 8f24ed5243b..391f36c5951 100644
--- a/apps/studio/components/ui/DatabaseSelector.tsx
+++ b/apps/studio/components/ui/DatabaseSelector.tsx
@@ -10,6 +10,7 @@ import { Markdown } from 'components/interfaces/Markdown'
import { REPLICA_STATUS } from 'components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants'
import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
import { formatDatabaseID, formatDatabaseRegion } from 'data/read-replicas/replicas.utils'
+import { IS_PLATFORM } from 'lib/constants'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import {
Button,
@@ -198,29 +199,31 @@ const DatabaseSelector = ({
})}
</ScrollArea>
</CommandGroup_Shadcn_>
- <CommandGroup_Shadcn_ className="border-t">
- <CommandItem_Shadcn_
- className="cursor-pointer w-full"
- onSelect={() => {
- setOpen(false)
- router.push(`/project/${projectRef}/settings/infrastructure`)
- }}
- onClick={() => setOpen(false)}
- >
- <Link
- href={`/project/${projectRef}/settings/infrastructure`}
- onClick={() => {
+ {IS_PLATFORM && (
+ <CommandGroup_Shadcn_ className="border-t">
+ <CommandItem_Shadcn_
+ className="cursor-pointer w-full"
+ onSelect={() => {
setOpen(false)
- // [Joshen] This is used in the Connect UI which is available across all pages
- setShowConnect(null)
+ router.push(`/project/${projectRef}/settings/infrastructure`)
}}
- className="w-full flex items-center gap-2"
+ onClick={() => setOpen(false)}
>
- <Plus size={14} strokeWidth={1.5} />
- <p>Create a new read replica</p>
- </Link>
- </CommandItem_Shadcn_>
- </CommandGroup_Shadcn_>
+ <Link
+ href={`/project/${projectRef}/settings/infrastructure`}
+ onClick={() => {
+ setOpen(false)
+ // [Joshen] This is used in the Connect UI which is available across all pages
+ setShowConnect(null)
+ }}
+ className="w-full flex items-center gap-2"
+ >
+ <Plus size={14} strokeWidth={1.5} />
+ <p>Create a new read replica</p>
+ </Link>
+ </CommandItem_Shadcn_>
+ </CommandGroup_Shadcn_>
+ )}
</CommandList_Shadcn_>
</Command_Shadcn_>
</PopoverContent_Shadcn_>
diff --git a/apps/studio/data/database/pgbouncer-config-query.ts b/apps/studio/data/database/pgbouncer-config-query.ts
index 93809e5ba4c..71df7be13d0 100644
--- a/apps/studio/data/database/pgbouncer-config-query.ts
+++ b/apps/studio/data/database/pgbouncer-config-query.ts
@@ -1,6 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import { ResponseError } from 'types'
import { databaseKeys } from './keys'
@@ -36,7 +37,7 @@ export const usePgbouncerConfigQuery = <TData = PgbouncerConfigData>(
databaseKeys.pgbouncerConfig(projectRef),
({ signal }) => getPgbouncerConfig({ projectRef }, signal),
{
- enabled: enabled && typeof projectRef !== 'undefined',
+ enabled: enabled && typeof projectRef !== 'undefined' && IS_PLATFORM,
...options,
}
)
diff --git a/apps/studio/data/database/supavisor-configuration-query.ts b/apps/studio/data/database/supavisor-configuration-query.ts
index 7ce49f11905..59e4237fd81 100644
--- a/apps/studio/data/database/supavisor-configuration-query.ts
+++ b/apps/studio/data/database/supavisor-configuration-query.ts
@@ -1,6 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import type { ResponseError } from 'types'
import { databaseKeys } from './keys'
@@ -36,7 +37,7 @@ export const useSupavisorConfigurationQuery = <TData = SupavisorConfigurationDat
databaseKeys.poolingConfiguration(projectRef),
({ signal }) => getSupavisorConfiguration({ projectRef }, signal),
{
- enabled: enabled && typeof projectRef !== 'undefined',
+ enabled: enabled && typeof projectRef !== 'undefined' && IS_PLATFORM,
...options,
}
)
diff --git a/apps/studio/data/read-replicas/replicas-query.ts b/apps/studio/data/read-replicas/replicas-query.ts
index 8e773d67752..30b885d9d38 100644
--- a/apps/studio/data/read-replicas/replicas-query.ts
+++ b/apps/studio/data/read-replicas/replicas-query.ts
@@ -1,6 +1,5 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
-import { IS_PLATFORM } from 'common'
import type { components } from 'data/api'
import { get, handleError } from 'data/fetchers'
import type { ResponseError } from 'types'
@@ -38,7 +37,7 @@ export const useReadReplicasQuery = <TData = ReadReplicasData>(
replicaKeys.list(projectRef),
({ signal }) => getReadReplicas({ projectRef }, signal),
{
- enabled: enabled && IS_PLATFORM && typeof projectRef !== 'undefined',
+ enabled: enabled && typeof projectRef !== 'undefined',
...options,
}
)
diff --git a/apps/studio/hooks/misc/useHideSidebar.ts b/apps/studio/hooks/misc/useHideSidebar.ts
index 71c7be370b7..086a7f1670f 100644
--- a/apps/studio/hooks/misc/useHideSidebar.ts
+++ b/apps/studio/hooks/misc/useHideSidebar.ts
@@ -1,9 +1,9 @@
import { usePathname } from 'next/navigation'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
export function useHideSidebar() {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const pathname = usePathname() ?? ''
const shouldHide =
pathname.startsWith('/account') ||
diff --git a/apps/studio/hooks/misc/useOrganizationRestrictions.ts b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
index f2958a336a7..012e1136610 100644
--- a/apps/studio/hooks/misc/useOrganizationRestrictions.ts
+++ b/apps/studio/hooks/misc/useOrganizationRestrictions.ts
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { RESTRICTION_MESSAGES } from 'components/interfaces/Organization/restriction.constants'
import { useOverdueInvoicesQuery } from 'data/invoices/invoices-overdue-query'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
@@ -15,7 +15,7 @@ export type WarningBannerProps = {
export function useOrganizationRestrictions() {
const org = useSelectedOrganization()
- const isNewLayout = useNewLayout()
+ const isNewLayout = useIsNewLayoutEnabled()
const { data: overdueInvoices } = useOverdueInvoicesQuery()
const { data: organizations } = useOrganizationsQuery()
diff --git a/apps/studio/hooks/misc/useShowLayoutHeader.ts b/apps/studio/hooks/misc/useShowLayoutHeader.ts
index 6f531d86a88..fd785a8736f 100644
--- a/apps/studio/hooks/misc/useShowLayoutHeader.ts
+++ b/apps/studio/hooks/misc/useShowLayoutHeader.ts
@@ -1,9 +1,9 @@
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { useRouter } from 'next/router'
export function useShowLayoutHeader() {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { ref } = useParams()
const router = useRouter()
const pathname = router.pathname ?? ''
diff --git a/apps/studio/pages/account/audit.tsx b/apps/studio/pages/account/audit.tsx
index 0a95edfefa0..c4575b0e71f 100644
--- a/apps/studio/pages/account/audit.tsx
+++ b/apps/studio/pages/account/audit.tsx
@@ -1,5 +1,5 @@
import { AuditLogs } from 'components/interfaces/Account'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
import AppLayout from 'components/layouts/AppLayout/AppLayout'
import DefaultLayout from 'components/layouts/DefaultLayout'
@@ -14,7 +14,7 @@ import type { NextPageWithLayout } from 'types'
import { cn } from 'ui'
const Audit: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
return (
<ScaffoldContainer className={cn(newLayoutPreview ? '[&>div]:mt-8' : '')}>
diff --git a/apps/studio/pages/account/me.tsx b/apps/studio/pages/account/me.tsx
index 539dd4e13ea..2140bcefa6c 100644
--- a/apps/studio/pages/account/me.tsx
+++ b/apps/studio/pages/account/me.tsx
@@ -3,7 +3,7 @@ import { AccountIdentities } from 'components/interfaces/Account/Preferences/Acc
import { AnalyticsSettings } from 'components/interfaces/Account/Preferences/AnalyticsSettings'
import { ProfileInformation } from 'components/interfaces/Account/Preferences/ProfileInformation'
import { ThemeSettings } from 'components/interfaces/Account/Preferences/ThemeSettings'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
import AccountSettingsLayout from 'components/layouts/AccountLayout/AccountSettingsLayout'
import AppLayout from 'components/layouts/AppLayout/AppLayout'
@@ -23,7 +23,7 @@ import { useProfile } from 'lib/profile'
import type { NextPageWithLayout } from 'types'
const User: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
if (newLayoutPreview) {
return <ProfileCard />
diff --git a/apps/studio/pages/account/security.tsx b/apps/studio/pages/account/security.tsx
index a7c3d554c0f..ace7b7d6349 100644
--- a/apps/studio/pages/account/security.tsx
+++ b/apps/studio/pages/account/security.tsx
@@ -1,7 +1,7 @@
import { Smartphone } from 'lucide-react'
import { TOTPFactors } from 'components/interfaces/Account'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
import AccountSettingsLayout from 'components/layouts/AccountLayout/AccountSettingsLayout'
import AppLayout from 'components/layouts/AppLayout/AppLayout'
@@ -37,7 +37,7 @@ const collapsibleClasses = [
]
const Security: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const { data } = useMfaListFactorsQuery()
const PageContent = () => (
diff --git a/apps/studio/pages/account/tokens.tsx b/apps/studio/pages/account/tokens.tsx
index 23999adbb76..bbcd8dcfccd 100644
--- a/apps/studio/pages/account/tokens.tsx
+++ b/apps/studio/pages/account/tokens.tsx
@@ -7,7 +7,7 @@ import {
NewAccessTokenButton,
NewTokenBanner,
} from 'components/interfaces/Account'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
import AccountSettingsLayout from 'components/layouts/AccountLayout/AccountSettingsLayout'
import AppLayout from 'components/layouts/AppLayout/AppLayout'
@@ -25,7 +25,7 @@ import { Button } from 'ui'
import { Admonition } from 'ui-patterns'
const UserAccessTokens: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const [newToken, setNewToken] = useState<NewAccessToken | undefined>()
const PageContent = () => (
diff --git a/apps/studio/pages/api/platform/projects/[ref]/databases.ts b/apps/studio/pages/api/platform/projects/[ref]/databases.ts
index 42272484420..02c03361d8c 100644
--- a/apps/studio/pages/api/platform/projects/[ref]/databases.ts
+++ b/apps/studio/pages/api/platform/projects/[ref]/databases.ts
@@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { paths } from 'api-types'
import apiWrapper from 'lib/api/apiWrapper'
+import { PROJECT_REST_URL } from 'pages/api/constants'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
@@ -21,5 +22,21 @@ type ResponseData =
paths['/platform/projects/{ref}/databases']['get']['responses']['200']['content']['application/json']
const handleGet = async (req: NextApiRequest, res: NextApiResponse<ResponseData>) => {
- return res.status(200).json([])
+ return res.status(200).json([
+ {
+ cloud_provider: 'localhost' as any,
+ connectionString: '',
+ connection_string_read_only: '',
+ db_host: '127.0.0.1',
+ db_name: 'postgres',
+ db_port: 5432,
+ db_user: 'postgres',
+ identifier: 'default',
+ inserted_at: '',
+ region: 'local',
+ restUrl: PROJECT_REST_URL,
+ size: '',
+ status: 'ACTIVE_HEALTHY',
+ },
+ ])
}
diff --git a/apps/studio/pages/org/[slug]/index.tsx b/apps/studio/pages/org/[slug]/index.tsx
index 8e6dbeaeee5..044935bcd8e 100644
--- a/apps/studio/pages/org/[slug]/index.tsx
+++ b/apps/studio/pages/org/[slug]/index.tsx
@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import { useParams } from 'common'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import { ProjectList } from 'components/interfaces/Home/ProjectList'
import HomePageActions from 'components/interfaces/HomePageActions'
import DefaultLayout from 'components/layouts/DefaultLayout'
@@ -13,7 +13,7 @@ import { PROJECT_STATUS } from 'lib/constants'
import type { NextPageWithLayout } from 'types'
const ProjectsPage: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const hasWindowLoaded = typeof window !== 'undefined'
const router = useRouter()
diff --git a/apps/studio/pages/project/[ref]/index.tsx b/apps/studio/pages/project/[ref]/index.tsx
index 7166d4afbf2..f6502e8aaad 100644
--- a/apps/studio/pages/project/[ref]/index.tsx
+++ b/apps/studio/pages/project/[ref]/index.tsx
@@ -142,7 +142,7 @@ const Home: NextPageWithLayout = () => {
}
Home.getLayout = (page) => (
- <DefaultLayout showProductMenu={false}>
+ <DefaultLayout>
<ProjectLayoutWithAuth>{page}</ProjectLayoutWithAuth>
</DefaultLayout>
)
diff --git a/apps/studio/pages/projects.tsx b/apps/studio/pages/projects.tsx
index 25435ca3a2d..1723e6bbaa4 100644
--- a/apps/studio/pages/projects.tsx
+++ b/apps/studio/pages/projects.tsx
@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'
import { ProjectList } from 'components/interfaces/Home/ProjectList'
import HomePageActions from 'components/interfaces/HomePageActions'
-import { useNewLayout } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
+import { useIsNewLayoutEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import DefaultLayout from 'components/layouts/DefaultLayout'
import OrganizationLayout from 'components/layouts/OrganizationLayout'
import { MAX_WIDTH_CLASSES, PADDING_CLASSES } from 'components/layouts/Scaffold'
@@ -18,7 +18,7 @@ import type { NextPageWithLayout } from 'types'
import { cn } from 'ui'
const ProjectsPage: NextPageWithLayout = () => {
- const newLayoutPreview = useNewLayout()
+ const newLayoutPreview = useIsNewLayoutEnabled()
const [lastVisitedOrganization] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.LAST_VISITED_ORGANIZATION,
''