The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add feature preview banner toast for explorerd (#49606)
Joshen Lim961fc749d482
diff --git a/apps/studio/components/layouts/ObservabilityLayout/ObservabilityLayout.tsx b/apps/studio/components/layouts/ObservabilityLayout/ObservabilityLayout.tsxindex acdd6ac0b98..8283641f5df 100644--- a/apps/studio/components/layouts/ObservabilityLayout/ObservabilityLayout.tsx+++ b/apps/studio/components/layouts/ObservabilityLayout/ObservabilityLayout.tsx@@ -56,7 +56,6 @@ const ObservabilityLayoutContent = ({})}, [addBanner,- dismissBanner,isInitialized,isDatabaseConnectionsBannerDismissed,previouslyToggled,diff --git a/apps/studio/components/layouts/ProjectLayout/index.test.tsx b/apps/studio/components/layouts/ProjectLayout/index.test.tsxindex 6c7b2601677..13090a00efd 100644--- a/apps/studio/components/layouts/ProjectLayout/index.test.tsx+++ b/apps/studio/components/layouts/ProjectLayout/index.test.tsx@@ -81,6 +81,7 @@ vi.mock('common', () => ({`project-integration-banner-dismissed-${ref}-${integrationSource}`,},isFeatureEnabled: () => false,+ useFlag: () => false,}))vi.mock('framer-motion', () => ({diff --git a/apps/studio/components/layouts/ProjectLayout/index.tsx b/apps/studio/components/layouts/ProjectLayout/index.tsxindex 3e63092a140..d03fe84dd62 100644--- a/apps/studio/components/layouts/ProjectLayout/index.tsx+++ b/apps/studio/components/layouts/ProjectLayout/index.tsx@@ -1,4 +1,4 @@-import { LOCAL_STORAGE_KEYS, mergeRefs, useParams } from 'common'+import { LOCAL_STORAGE_KEYS, mergeRefs, useFlag, useParams } from 'common'import { AnimatePresence, motion } from 'framer-motion'import { XIcon } from 'lucide-react'import Head from 'next/head'@@ -42,6 +42,7 @@ import { UnhealthyState } from './UnhealthyState'import { UpgradingState } from './UpgradingState'import { CreateBranchModal } from '@/components/interfaces/BranchManagement/CreateBranchModal'import { ProjectAPIDocs } from '@/components/interfaces/ProjectAPIDocs/ProjectAPIDocs'+import { BannerExplorer } from '@/components/ui/BannerStack/Banners/BannerExplorer'import { BannerFreeMicroUpgrade } from '@/components/ui/BannerStack/Banners/BannerFreeMicroUpgrade'import { BANNER_ID, useBannerStack } from '@/components/ui/BannerStack/BannerStackProvider'import { ButtonTooltip } from '@/components/ui/ButtonTooltip'@@ -152,6 +153,9 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec!!projectResourceWarnings?.disk_io_exhaustionconst isNanoCompute = selectedProject?.infra_compute_size === 'nano'const showUpgradeBanner = isNanoCompute && isComputeNearExhaustion++ const isExplorerEnabled = useFlag('explorer')+const [isFreeMicroUpgradeBannerDismissed] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.FREE_MICRO_UPGRADE_BANNER_DISMISSED(selectedProject?.ref ?? ''),false@@ -164,6 +168,11 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec}),false)+ const [isExplorerBannerDismissed, , { isSuccess: isLocalStorageReady }] = useLocalStorageQuery(+ LOCAL_STORAGE_KEYS.EXPLORER_BANNER_DISMISSED,+ false+ )+const { showSidebar } = useAppStateSnapshot()const { setContent: setMobileSheetContent, registerOpenMenu } = useMobileSheet()@@ -233,6 +242,17 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjecdismissBanner,])+ useEffect(() => {+ if (!isExplorerEnabled || !isLocalStorageReady || isExplorerBannerDismissed) return++ addBanner({+ id: 'explorer-banner',+ priority: 2,+ isDismissed: false,+ content: <BannerExplorer />,+ })+ }, [addBanner, isExplorerEnabled, isExplorerBannerDismissed, isLocalStorageReady])+useLayoutEffect(() => {const unregister = registerOpenMenu(() => {setMobileSheetContent(diff --git a/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx b/apps/studio/components/ui/BannerStack/BannerStackProvider.tsxindex 4c95ece2585..90413237e61 100644--- a/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx+++ b/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx@@ -9,6 +9,7 @@ export const BANNER_ID = {TOS_UPDATE: 'tos-update-banner',LOGS_ALL_DEPRECATION: 'logs-all-deprecation-banner',SELECT_26: 'select-2026-banner',+ EXPLORER: 'explorer-banner',} as constexport type BannerId = (typeof BANNER_ID)[keyof typeof BANNER_ID]diff --git a/apps/studio/components/ui/BannerStack/Banners/BannerExplorer.tsx b/apps/studio/components/ui/BannerStack/Banners/BannerExplorer.tsxnew file mode 100644index 00000000000..78120cc7b39--- /dev/null+++ b/apps/studio/components/ui/BannerStack/Banners/BannerExplorer.tsx@@ -0,0 +1,84 @@+import { LOCAL_STORAGE_KEYS } from 'common'+import { AnimatePresence, motion } from 'framer-motion'+import { Badge, Button } from 'ui'++import { BannerCard } from '../BannerCard'+import { useBannerStack } from '../BannerStackProvider'+import { useFeaturePreviewModal } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'+import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'+import { useTrack } from '@/lib/telemetry/track'++export const BannerExplorer = () => {+ const track = useTrack()+ const { dismissBanner } = useBannerStack()+ const { selectFeaturePreview } = useFeaturePreviewModal()++ const [, setIsDismissed] = useLocalStorageQuery(+ LOCAL_STORAGE_KEYS.EXPLORER_BANNER_DISMISSED,+ false+ )++ return (+ <BannerCard+ onDismiss={() => {+ setIsDismissed(true)+ dismissBanner('explorer-banner')+ track('explorer_banner_dismiss_button_clicked')+ }}+ >+ <div className="flex flex-col gap-y-4">+ <div className="flex flex-col gap-y-2 items-start w-full">+ <Badge variant="success" className="-ml-0.5 uppercase inline-flex items-center">+ Preview+ </Badge>+ <AnimatePresence>+ <div className="border h-27 w-full rounded-t-md mt-2 bg-surface-100 py-4 px-2 pb-0">+ <motion.div+ initial={{ opacity: 0, top: 10 }}+ animate={{ opacity: 1, top: 0 }}+ transition={{ delay: 0.5, duration: 0.2, ease: 'easeOut' }}+ className="w-[90%] mx-auto"+ >+ <p className="text-[10px]">User growth</p>+ <p className="text-[9px] text-foreground-lighter">+ Track how your user base is trending.+ </p>+ </motion.div>+ <motion.div+ initial={{ opacity: 0, top: 10 }}+ animate={{ opacity: 1, top: 0 }}+ transition={{ delay: 1, duration: 0.2, ease: 'easeOut' }}+ className="w-full h-13.5 border border-b-0 mt-2 rounded-t bg-surface-200 overflow-hidden"+ >+ <div className="h-3 w-full border-b" />+ <p className="px-2 py-1 text-[8px] font-mono tracking-tighter flex flex-col">+ <span className="text-code_block-1">select</span>+ <span className="pl-2">date_trunc('week', last_sign_in_at) as week,</span>+ <span className="pl-2">count(distinct id) as active_users</span>+ </p>+ </motion.div>+ </div>+ </AnimatePresence>+ </div>+ <div className="flex flex-col gap-y-1 mb-2">+ <p className="text-sm font-medium">Explorer & Notebooks</p>+ <p className="text-xs text-foreground-lighter text-balance">+ New unified workspace for querying data and chatting with Assistant.+ </p>+ </div>+ <div className="flex gap-2">+ <Button+ variant="default"+ size="tiny"+ onClick={() => {+ selectFeaturePreview(LOCAL_STORAGE_KEYS.UI_PREVIEW_EXPLORER)+ track('explorer_banner_cta_button_clicked')+ }}+ >+ Enable Explorer+ </Button>+ </div>+ </div>+ </BannerCard>+ )+}diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.tsindex cf3e8259db9..374cdc1d794 100644--- a/packages/common/constants/local-storage.ts+++ b/packages/common/constants/local-storage.ts@@ -116,6 +116,7 @@ export const LOCAL_STORAGE_KEYS = {`organization-marketplace-banner-dismissed-${orgSlug}-${managedBy}`,PROJECT_INTEGRATION_BANNER_DISMISSED: (ref: string, integrationSource: string) =>`project-integration-banner-dismissed-${ref}-${integrationSource}`,+ EXPLORER_BANNER_DISMISSED: `explorer-banner-dismissed`,TABLE_EDITOR_QUEUE_OPERATIONS_BANNER_DISMISSED: (ref: string) =>`table-editor-queue-operations-banner-dismissed-${ref}`,diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex 335d13f4df5..a25642186f1 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -1530,6 +1530,28 @@ export interface DatabaseConnectionsBannerCtaButtonClickedEvent {groups: TelemetryGroups}+/**+ * User clicked the dismiss button on the Explorer feature preview banner in studio project pages.+ *+ * @group Events+ * @source studio+ */+export interface ExplorerBannerDismissButtonClickedEvent {+ action: 'explorer_banner_dismiss_button_clicked'+ groups: TelemetryGroups+}++/**+ * User clicked the CTA button on the Explorer feature preview banner in studio project pages.+ *+ * @group Events+ * @source studio+ */+export interface ExplorerBannerCtaButtonClickedEvent {+ action: 'explorer_banner_cta_button_clicked'+ groups: TelemetryGroups+}+/*** User clicked a metric card PID in the Overview panel of the Database Connections observability page, selecting it in the activity table below.*@@ -3810,6 +3832,8 @@ export type TelemetryEvent =| DatabaseConnectionsBlockerViewClickedEvent| DatabaseConnectionsBannerDismissButtonClickedEvent| DatabaseConnectionsBannerCtaButtonClickedEvent+ | ExplorerBannerDismissButtonClickedEvent+ | ExplorerBannerCtaButtonClickedEvent| SessionTerminateButtonClickedEvent| SessionTerminateSubmittedEvent| QueryCancelButtonClickedEvent