The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Home New: Top (#38336)
Saxon Fletcher0f712bc9e28b
diff --git a/apps/studio/components/interfaces/Home/Home.tsx b/apps/studio/components/interfaces/Home/Home.tsxnew file mode 100644index 00000000000..014d8749a84--- /dev/null+++ b/apps/studio/components/interfaces/Home/Home.tsx@@ -0,0 +1,297 @@+import dayjs from 'dayjs'+import Link from 'next/link'+import { useEffect, useMemo, useRef } from 'react'++import { useParams } from 'common'+import { ClientLibrary } from 'components/interfaces/Home'+import { AdvisorWidget } from 'components/interfaces/Home/AdvisorWidget'+import { ExampleProject } from 'components/interfaces/Home/ExampleProject'+import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants'+import { NewProjectPanel } from 'components/interfaces/Home/NewProjectPanel/NewProjectPanel'+import { ProjectUsageSection } from 'components/interfaces/Home/ProjectUsageSection'+import { ServiceStatus } from 'components/interfaces/Home/ServiceStatus'+import { ProjectPausedState } from 'components/layouts/ProjectLayout/PausedState/ProjectPausedState'+import { ComputeBadgeWrapper } from 'components/ui/ComputeBadgeWrapper'+import { InlineLink } from 'components/ui/InlineLink'+import { ProjectUpgradeFailedBanner } from 'components/ui/ProjectUpgradeFailedBanner'+import { useBranchesQuery } from 'data/branches/branches-query'+import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'+import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'+import { useTablesQuery } from 'data/tables/tables-query'+import { useCustomContent } from 'hooks/custom-content/useCustomContent'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'+import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'+import {+ useIsOrioleDb,+ useProjectByRefQuery,+ useSelectedProjectQuery,+} from 'hooks/misc/useSelectedProject'+import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'+import { useAppStateSnapshot } from 'state/app-state'+import {+ Badge,+ cn,+ Tabs_Shadcn_,+ TabsContent_Shadcn_,+ TabsList_Shadcn_,+ TabsTrigger_Shadcn_,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from 'ui'+import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'++export const Home = () => {+ const { data: project } = useSelectedProjectQuery()+ const { data: organization } = useSelectedOrganizationQuery()+ const { data: parentProject } = useProjectByRefQuery(project?.parent_project_ref)+ const isOrioleDb = useIsOrioleDb()+ const snap = useAppStateSnapshot()+ const { ref, enableBranching } = useParams()++ const { projectHomepageExampleProjects } = useCustomContent(['project_homepage:example_projects'])++ const {+ projectHomepageShowAllClientLibraries: showAllClientLibraries,+ projectHomepageShowInstanceSize: showInstanceSize,+ projectHomepageShowExamples: showExamples,+ } = useIsFeatureEnabled([+ 'project_homepage:show_all_client_libraries',+ 'project_homepage:show_instance_size',+ 'project_homepage:show_examples',+ ])++ const clientLibraries = useMemo(() => {+ if (showAllClientLibraries) {+ return CLIENT_LIBRARIES+ }+ return CLIENT_LIBRARIES.filter((library) => library.language === 'JavaScript')+ }, [showAllClientLibraries])++ const hasShownEnableBranchingModalRef = useRef(false)+ const isPaused = project?.status === PROJECT_STATUS.INACTIVE+ const isNewProject = dayjs(project?.inserted_at).isAfter(dayjs().subtract(2, 'day'))++ useEffect(() => {+ if (enableBranching && !hasShownEnableBranchingModalRef.current) {+ hasShownEnableBranchingModalRef.current = true+ snap.setShowCreateBranchModal(true)+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [enableBranching])++ const { data: tablesData, isLoading: isLoadingTables } = useTablesQuery({+ projectRef: project?.ref,+ connectionString: project?.connectionString,+ schema: 'public',+ })+ const { data: functionsData, isLoading: isLoadingFunctions } = useEdgeFunctionsQuery({+ projectRef: project?.ref,+ })+ const { data: replicasData, isLoading: isLoadingReplicas } = useReadReplicasQuery({+ projectRef: project?.ref,+ })++ const { data: branches } = useBranchesQuery({+ projectRef: project?.parent_project_ref ?? project?.ref,+ })++ const mainBranch = branches?.find((branch) => branch.is_default)+ const currentBranch = branches?.find((branch) => branch.project_ref === project?.ref)+ const isMainBranch = currentBranch?.name === mainBranch?.name+ let projectName = 'Welcome to your project'++ if (currentBranch && !isMainBranch) {+ projectName = currentBranch?.name+ } else if (project?.name) {+ projectName = project?.name+ }++ const tablesCount = Math.max(0, tablesData?.length ?? 0)+ const functionsCount = Math.max(0, functionsData?.length ?? 0)+ // [Joshen] JFYI minus 1 as the replicas endpoint returns the primary DB minimally+ const replicasCount = Math.max(0, (replicasData?.length ?? 1) - 1)++ return (+ <div className="w-full px-4">+ <div className={cn('py-16 ', !isPaused && 'border-b border-muted ')}>+ <div className="mx-auto max-w-7xl flex flex-col gap-y-4">+ <div className="flex flex-col md:flex-row md:items-center gap-6 justify-between w-full">+ <div className="flex flex-col md:flex-row md:items-end gap-3 w-full">+ <div>+ {!isMainBranch && (+ <Link+ href={`/project/${parentProject?.ref}`}+ className="text-sm text-foreground-light"+ >+ {parentProject?.name}+ </Link>+ )}+ <h1 className="text-3xl">{projectName}</h1>+ </div>+ <div className="flex items-center gap-x-2 mb-1">+ {isOrioleDb && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="warning">OrioleDB</Badge>+ </TooltipTrigger>+ <TooltipContent side="bottom" align="start" className="max-w-80 text-center">+ This project is using Postgres with OrioleDB which is currently in preview and+ not suitable for production workloads. View our{' '}+ <InlineLink href="https://supabase.com/docs/guides/database/orioledb">+ documentation+ </InlineLink>{' '}+ for all limitations.+ </TooltipContent>+ </Tooltip>+ )}+ {showInstanceSize && (+ <ComputeBadgeWrapper+ project={{+ ref: project?.ref,+ organization_slug: organization?.slug,+ cloud_provider: project?.cloud_provider,+ infra_compute_size: project?.infra_compute_size,+ }}+ />+ )}+ </div>+ </div>+ <div className="flex items-center">+ {project?.status === PROJECT_STATUS.ACTIVE_HEALTHY && (+ <div className="flex items-center gap-x-6">+ <div className="flex flex-col gap-y-1">+ <Link+ href={`/project/${ref}/editor`}+ className="transition text-foreground-light hover:text-foreground text-sm"+ >+ Tables+ </Link>++ {isLoadingTables ? (+ <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />+ ) : (+ <p className="text-2xl tabular-nums">{tablesCount}</p>+ )}+ </div>++ {IS_PLATFORM && (+ <div className="flex flex-col gap-y-1">+ <Link+ href={`/project/${ref}/functions`}+ className="transition text-foreground-light hover:text-foreground text-sm"+ >+ Functions+ </Link>+ {isLoadingFunctions ? (+ <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />+ ) : (+ <p className="text-2xl tabular-nums">{functionsCount}</p>+ )}+ </div>+ )}++ {IS_PLATFORM && (+ <div className="flex flex-col gap-y-1">+ <Link+ href={`/project/${ref}/settings/infrastructure`}+ className="transition text-foreground-light hover:text-foreground text-sm"+ >+ Replicas+ </Link>+ {isLoadingReplicas ? (+ <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />+ ) : (+ <p className="text-2xl tabular-nums">{replicasCount}</p>+ )}+ </div>+ )}+ </div>+ )}+ {IS_PLATFORM && project?.status === PROJECT_STATUS.ACTIVE_HEALTHY && (+ <div className="ml-6 border-l flex items-center w-[145px] justify-end">+ <ServiceStatus />+ </div>+ )}+ </div>+ </div>+ <ProjectUpgradeFailedBanner />+ {isPaused && <ProjectPausedState />}+ </div>+ </div>++ {!isPaused && (+ <>+ <div className="py-16 border-b border-muted">+ <div className="mx-auto max-w-7xl space-y-16">+ {IS_PLATFORM && project?.status !== PROJECT_STATUS.INACTIVE && (+ <>{isNewProject ? <NewProjectPanel /> : <ProjectUsageSection />}</>+ )}+ {!isNewProject && project?.status !== PROJECT_STATUS.INACTIVE && <AdvisorWidget />}+ </div>+ </div>++ <div className="bg-surface-100/5 py-16">+ <div className="mx-auto max-w-7xl space-y-16">+ {project?.status !== PROJECT_STATUS.INACTIVE && (+ <>+ <div className="space-y-8">+ <h2 className="text-lg">Client libraries</h2>+ <div className="grid grid-cols-2 gap-x-8 gap-y-8 md:gap-12 mb-12 md:grid-cols-3">+ {clientLibraries.map((library) => (+ <ClientLibrary key={library.language} {...library} />+ ))}+ </div>+ </div>+ {showExamples && (+ <div className="flex flex-col gap-y-8">+ <h4 className="text-lg">Example projects</h4>+ {!!projectHomepageExampleProjects ? (+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">+ {projectHomepageExampleProjects+ .sort((a, b) => a.title.localeCompare(b.title))+ .map((project) => (+ <ExampleProject key={project.url} {...project} />+ ))}+ </div>+ ) : (+ <div className="flex justify-center">+ <Tabs_Shadcn_ defaultValue="app" className="w-full">+ <TabsList_Shadcn_ className="flex gap-4 mb-8">+ <TabsTrigger_Shadcn_ value="app">App Frameworks</TabsTrigger_Shadcn_>+ <TabsTrigger_Shadcn_ value="mobile">+ Mobile Frameworks+ </TabsTrigger_Shadcn_>+ </TabsList_Shadcn_>+ <TabsContent_Shadcn_ value="app">+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">+ {EXAMPLE_PROJECTS.filter((project) => project.type === 'app')+ .sort((a, b) => a.title.localeCompare(b.title))+ .map((project) => (+ <ExampleProject key={project.url} {...project} />+ ))}+ </div>+ </TabsContent_Shadcn_>+ <TabsContent_Shadcn_ value="mobile">+ <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">+ {EXAMPLE_PROJECTS.filter((project) => project.type === 'mobile')+ .sort((a, b) => a.title.localeCompare(b.title))+ .map((project) => (+ <ExampleProject key={project.url} {...project} />+ ))}+ </div>+ </TabsContent_Shadcn_>+ </Tabs_Shadcn_>+ </div>+ )}+ </div>+ )}+ </>+ )}+ </div>+ </div>+ </>+ )}+ </div>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx b/apps/studio/components/interfaces/HomeNew/ActivityStats.tsxnew file mode 100644index 00000000000..22464a7a5fb--- /dev/null+++ b/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx@@ -0,0 +1,131 @@+import dayjs from 'dayjs'+import { GitBranch } from 'lucide-react'+import Link from 'next/link'+import { useMemo } from 'react'++import { useParams } from 'common'+import { useBranchesQuery } from 'data/branches/branches-query'+import { useBackupsQuery } from 'data/database/backups-query'+import { useMigrationsQuery } from 'data/database/migrations-query'+import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'+import { cn, Skeleton } from 'ui'+import { TimestampInfo } from 'ui-patterns'+import { ServiceStatus } from './ServiceStatus'++export const ActivityStats = () => {+ const { ref } = useParams()+ const { data: project } = useSelectedProjectQuery()++ const { data: branchesData, isLoading: isLoadingBranches } = useBranchesQuery({+ projectRef: project?.parent_project_ref ?? project?.ref,+ })+ const isDefaultProject = project?.parent_project_ref === undefined+ const currentBranch = useMemo(+ () => (branchesData ?? []).find((b) => b.project_ref === ref),+ [branchesData, ref]+ )+ const latestNonDefaultBranch = useMemo(() => {+ const list = (branchesData ?? []).filter((b) => !b.is_default)+ if (list.length === 0) return undefined+ return list+ .slice()+ .sort(+ (a, b) =>+ new Date(b.created_at ?? b.updated_at).valueOf() -+ new Date(a.created_at ?? a.updated_at).valueOf()+ )[0]+ }, [branchesData])++ const { data: migrationsData, isLoading: isLoadingMigrations } = useMigrationsQuery({+ projectRef: project?.ref,+ connectionString: project?.connectionString,+ })+ const latestMigration = useMemo(() => (migrationsData ?? [])[0], [migrationsData])++ const { data: backupsData, isLoading: isLoadingBackups } = useBackupsQuery({+ projectRef: project?.ref,+ })+ const latestBackup = useMemo(() => {+ const list = backupsData?.backups ?? []+ if (list.length === 0) return undefined+ return list+ .slice()+ .sort((a, b) => new Date(b.inserted_at).valueOf() - new Date(a.inserted_at).valueOf())[0]+ }, [backupsData])++ return (+ <div className="@container">+ <div className="grid grid-cols-2 xl:flex xl:gap-10 gap-4 flex-wrap">+ <div className="block">+ <p className="heading-meta text-foreground-light mb-1">Status</p>+ <ServiceStatus />+ </div>++ <Link className="block" href={`/project/${ref}/database/migrations`}>+ <h4 className="heading-meta text-foreground-light mb-1">Last migration</h4>++ <div className={cn('h-[34px] flex items-center capitalize-sentence')}>+ {isLoadingMigrations ? (+ <Skeleton className="h-6 w-24" />+ ) : latestMigration ? (+ <TimestampInfo+ className="text-base"+ label={dayjs(latestMigration.version, 'YYYYMMDDHHmmss').fromNow()}+ utcTimestamp={dayjs(latestMigration.version, 'YYYYMMDDHHmmss').toISOString()}+ />+ ) : (+ <p className="text-foreground-lighter">No migrations</p>+ )}+ </div>+ </Link>++ <Link className="block" href={`/project/${ref}/database/backups/scheduled`}>+ <h4 className="heading-meta text-foreground-light mb-1">Last backup</h4>++ <div className={cn('h-[34px] flex items-center capitalize-sentence')}>+ {isLoadingBackups ? (+ <Skeleton className="h-6 w-24" />+ ) : backupsData?.pitr_enabled ? (+ <p>PITR enabled</p>+ ) : latestBackup ? (+ <TimestampInfo+ className="text-base"+ label={dayjs(latestBackup.inserted_at).fromNow()}+ utcTimestamp={latestBackup.inserted_at}+ />+ ) : (+ <p className="text-foreground-lighter">No backups</p>+ )}+ </div>+ </Link>++ <Link className="block" href={`/project/${ref}/branches`}>+ <h4 className="heading-meta text-foreground-light mb-1">+ {isDefaultProject ? 'Recent branch' : 'Branch Created'}+ </h4>++ <div className="text-foreground truncate h-[34px] flex items-center capitalize-sentence">+ {isLoadingBranches ? (+ <Skeleton className="h-6 w-24" />+ ) : isDefaultProject ? (+ <div className="flex items-center gap-2">+ <GitBranch size={16} strokeWidth={1.5} className="text-foreground-lighter" />+ <p className={cn('truncate', !latestNonDefaultBranch && 'text-foreground-lighter')}>+ {latestNonDefaultBranch?.name ?? 'No branches'}+ </p>+ </div>+ ) : currentBranch?.created_at ? (+ <TimestampInfo+ className="text-base"+ label={dayjs(currentBranch.created_at).fromNow()}+ utcTimestamp={currentBranch.created_at}+ />+ ) : (+ <p className="text-foreground-lighter">Unknown</p>+ )}+ </div>+ </Link>+ </div>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/Home.tsx b/apps/studio/components/interfaces/HomeNew/Home.tsxnew file mode 100644index 00000000000..5c2390d1c47--- /dev/null+++ b/apps/studio/components/interfaces/HomeNew/Home.tsx@@ -0,0 +1,115 @@+import { DndContext, DragEndEvent, PointerSensor, useSensor, useSensors } from '@dnd-kit/core'+import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'+import { useEffect, useRef } from 'react'++import { useParams } from 'common'+import { SortableSection } from 'components/interfaces/HomeNew/SortableSection'+import { TopSection } from 'components/interfaces/HomeNew/TopSection'+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'+import { useBranchesQuery } from 'data/branches/branches-query'+import { useLocalStorage } from 'hooks/misc/useLocalStorage'+import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'+import {+ useIsOrioleDb,+ useProjectByRefQuery,+ useSelectedProjectQuery,+} from 'hooks/misc/useSelectedProject'+import { PROJECT_STATUS } from 'lib/constants'+import { useAppStateSnapshot } from 'state/app-state'++export const HomeV2 = () => {+ const { ref, enableBranching } = useParams()+ const isOrioleDb = useIsOrioleDb()+ const snap = useAppStateSnapshot()+ const { data: project } = useSelectedProjectQuery()+ const { data: organization } = useSelectedOrganizationQuery()+ const { data: parentProject } = useProjectByRefQuery(project?.parent_project_ref)++ const hasShownEnableBranchingModalRef = useRef(false)+ const isPaused = project?.status === PROJECT_STATUS.INACTIVE++ const { data: branches } = useBranchesQuery({+ projectRef: project?.parent_project_ref ?? project?.ref,+ })++ const mainBranch = branches?.find((branch) => branch.is_default)+ const currentBranch = branches?.find((branch) => branch.project_ref === project?.ref)+ const isMainBranch = currentBranch?.name === mainBranch?.name++ const projectName =+ currentBranch && !isMainBranch+ ? currentBranch.name+ : project?.name+ ? project.name+ : 'Welcome to your project'++ const [sectionOrder, setSectionOrder] = useLocalStorage<string[]>(+ `home-section-order-${project?.ref || 'default'}`,+ ['getting-started', 'usage', 'advisor', 'custom-report']+ )++ const [gettingStartedState] = useLocalStorage<'empty' | 'code' | 'no-code' | 'hidden'>(+ `home-getting-started-${project?.ref || 'default'}`,+ 'empty'+ )++ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 8 } }))++ const handleDragEnd = (event: DragEndEvent) => {+ const { active, over } = event+ if (!over || active.id === over.id) return+ setSectionOrder((items) => {+ const oldIndex = items.indexOf(String(active.id))+ const newIndex = items.indexOf(String(over.id))+ if (oldIndex === -1 || newIndex === -1) return items+ return arrayMove(items, oldIndex, newIndex)+ })+ }++ useEffect(() => {+ if (enableBranching && !hasShownEnableBranchingModalRef.current) {+ hasShownEnableBranchingModalRef.current = true+ snap.setShowCreateBranchModal(true)+ }+ }, [enableBranching, snap])++ return (+ <div className="w-full">+ <ScaffoldContainer size="large">+ <ScaffoldSection isFullWidth className="pt-16 pb-0">+ <TopSection+ projectName={projectName}+ isMainBranch={isMainBranch}+ parentProject={parentProject}+ isOrioleDb={!!isOrioleDb}+ project={project}+ organization={organization}+ projectRef={ref}+ isPaused={isPaused}+ />+ </ScaffoldSection>+ </ScaffoldContainer>++ {!isPaused && (+ <ScaffoldContainer size="large">+ <ScaffoldSection isFullWidth className="gap-16 pb-32">+ <DndContext sensors={sensors} onDragEnd={handleDragEnd}>+ <SortableContext+ items={sectionOrder.filter(+ (id) => id !== 'getting-started' || gettingStartedState !== 'hidden'+ )}+ strategy={verticalListSortingStrategy}+ >+ {sectionOrder.map((id) => (+ <SortableSection key={id} id={id}>+ {id}+ </SortableSection>+ ))}+ </SortableContext>+ </DndContext>+ </ScaffoldSection>+ </ScaffoldContainer>+ )}+ </div>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsxnew file mode 100644index 00000000000..768c0de480a--- /dev/null+++ b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx@@ -0,0 +1,331 @@+import { AlertTriangle, CheckCircle2, ChevronDown, ChevronRight, Loader2 } from 'lucide-react'+import Link from 'next/link'+import { useState } from 'react'++import { PopoverSeparator } from '@ui/components/shadcn/ui/popover'+import { useParams } from 'common'+import { useBranchesQuery } from 'data/branches/branches-query'+import { useEdgeFunctionServiceStatusQuery } from 'data/service-status/edge-functions-status-query'+import {+ ProjectServiceStatus,+ useProjectServiceStatusQuery,+} from 'data/service-status/service-status-query'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'+import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'+import {+ Button,+ InfoIcon,+ PopoverContent_Shadcn_,+ PopoverTrigger_Shadcn_,+ Popover_Shadcn_,+ cn,+} from 'ui'++/**+ * [Joshen] JFYI before we go live with this, we need to revisit the migrations section+ * as I don't think it should live in the ServiceStatus component since its not indicative+ * of a project's "service". ServiceStatus's intention is to be an ongoing health/status check.+ *+ * For context, migrations are meant to be indicative for only when creating branches or projects+ * with an initial SQL, so "healthy" migrations just means that migrations have all been successfully+ * ran. So it might be a matter of decoupling "ready" state vs "health checks"+ * [Edit] Now that migrations are only showing up if the project is a branch, i think its okay for now+ *+ * [Joshen] Another issue that requires investigation before we go live with the changes:+ * We've removed the isProjectNew check in this component which we had that logic cause new+ * projects would show unhealthy as the services are still starting up - but it causes a+ * perceived negative impression as new projects were showing unhealthy, hence the 5 minute+ * threshold check (we’d show “Coming up” instead of “unhealthy” if the project is within 5+ * minutes of when it was created). Might be related to decoupling "ready" state vs "health checks"+ */++const StatusMessage = ({+ status,+ isLoading,+ isHealthy,+}: {+ isLoading: boolean+ isHealthy: boolean+ status?: ProjectServiceStatus+}) => {+ if (isHealthy) return 'Healthy'+ if (isLoading) return 'Checking status'+ if (status === 'UNHEALTHY') return 'Unhealthy'+ if (status === 'COMING_UP') return 'Coming up...'+ if (status === 'ACTIVE_HEALTHY') return 'Healthy'+ if (status) return status+ return 'Unable to connect'+}++const iconProps = {+ size: 18,+ strokeWidth: 1.5,+}+const LoaderIcon = () => <Loader2 {...iconProps} className="animate-spin" />+const AlertIcon = () => <AlertTriangle {...iconProps} />+const CheckIcon = () => <CheckCircle2 {...iconProps} className="text-brand" />++const StatusIcon = ({+ isLoading,+ isHealthy,+ projectStatus,+}: {+ isLoading: boolean+ isHealthy: boolean+ projectStatus?: ProjectServiceStatus+}) => {+ if (isHealthy) return <CheckIcon />+ if (isLoading) return <LoaderIcon />+ if (projectStatus === 'UNHEALTHY') return <AlertIcon />+ if (projectStatus === 'COMING_UP') return <LoaderIcon />+ if (projectStatus === 'ACTIVE_HEALTHY') return <CheckIcon />+ return <AlertIcon />+}++export const ServiceStatus = () => {+ const { ref } = useParams()+ const { data: project } = useSelectedProjectQuery()+ const [open, setOpen] = useState(false)++ const {+ projectAuthAll: authEnabled,+ projectEdgeFunctionAll: edgeFunctionsEnabled,+ realtimeAll: realtimeEnabled,+ projectStorageAll: storageEnabled,+ } = useIsFeatureEnabled([+ 'project_auth:all',+ 'project_edge_function:all',+ 'realtime:all',+ 'project_storage:all',+ ])++ const isBranch = project?.parentRef !== project?.ref++ // Get branches data when on a branch+ const { data: branches, isLoading: isBranchesLoading } = useBranchesQuery(+ { projectRef: isBranch ? project?.parentRef : undefined },+ {+ enabled: isBranch,+ }+ )++ const currentBranch = isBranch+ ? branches?.find((branch) => branch.project_ref === ref)+ : undefined++ // [Joshen] Need pooler service check eventually+ const { data: status, isLoading } = useProjectServiceStatusQuery(+ { projectRef: ref },+ { refetchInterval: (data) => (data?.some((service) => !service.healthy) ? 5000 : false) }+ )+ const { data: edgeFunctionsStatus } = useEdgeFunctionServiceStatusQuery(+ { projectRef: ref },+ { refetchInterval: (data) => (!data?.healthy ? 5000 : false) }+ )++ const authStatus = status?.find((service) => service.name === 'auth')+ const restStatus = status?.find((service) => service.name === 'rest')+ const realtimeStatus = status?.find((service) => service.name === 'realtime')+ const storageStatus = status?.find((service) => service.name === 'storage')+ const dbStatus = status?.find((service) => service.name === 'db')++ const isMigrationLoading =+ project?.status === 'COMING_UP' ||+ (isBranch &&+ (isBranchesLoading ||+ currentBranch?.status === 'CREATING_PROJECT' ||+ currentBranch?.status === 'RUNNING_MIGRATIONS'))++ // [Joshen] Need individual troubleshooting docs for each service eventually for users to self serve+ const services: {+ name: string+ error?: string+ docsUrl?: string+ isLoading: boolean+ isHealthy: boolean+ status: ProjectServiceStatus+ logsUrl: string+ }[] = [+ {+ name: 'Database',+ error: undefined,+ docsUrl: undefined,+ isLoading: isLoading,+ isHealthy: !!dbStatus?.healthy,+ status: dbStatus?.status ?? 'UNHEALTHY',+ logsUrl: '/logs/postgres-logs',+ },+ {+ name: 'PostgREST',+ error: restStatus?.error,+ docsUrl: undefined,+ isLoading,+ isHealthy: !!restStatus?.healthy,+ status: restStatus?.status ?? 'UNHEALTHY',+ logsUrl: '/logs/postgrest-logs',+ },+ ...(authEnabled+ ? [+ {+ name: 'Auth',+ error: authStatus?.error,+ docsUrl: undefined,+ isLoading,+ isHealthy: !!authStatus?.healthy,+ status: authStatus?.status ?? 'UNHEALTHY',+ logsUrl: '/logs/auth-logs',+ },+ ]+ : []),+ ...(realtimeEnabled+ ? [+ {+ name: 'Realtime',+ error: realtimeStatus?.error,+ docsUrl: undefined,+ isLoading,+ isHealthy: !!realtimeStatus?.healthy,+ status: realtimeStatus?.status ?? 'UNHEALTHY',+ logsUrl: '/logs/realtime-logs',+ },+ ]+ : []),+ ...(storageEnabled+ ? [+ {+ name: 'Storage',+ error: storageStatus?.error,+ docsUrl: undefined,+ isLoading,+ isHealthy: !!storageStatus?.healthy,+ status: storageStatus?.status ?? 'UNHEALTHY',+ logsUrl: '/logs/storage-logs',+ },+ ]+ : []),+ ...(edgeFunctionsEnabled+ ? [+ {+ name: 'Edge Functions',+ error: undefined,+ docsUrl: 'https://supabase.com/docs/guides/functions/troubleshooting',+ isLoading,+ isHealthy: !!edgeFunctionsStatus?.healthy,+ status: edgeFunctionsStatus?.healthy+ ? 'ACTIVE_HEALTHY'+ : isLoading+ ? 'COMING_UP'+ : ('UNHEALTHY' as ProjectServiceStatus),+ logsUrl: '/logs/edge-functions-logs',+ },+ ]+ : []),+ ...(isBranch+ ? [+ {+ name: 'Migrations',+ error: undefined,+ docsUrl: undefined,+ isLoading: isBranchesLoading,+ isHealthy: isBranch+ ? currentBranch?.status === 'FUNCTIONS_DEPLOYED'+ : !isMigrationLoading,+ status: (isBranch+ ? currentBranch?.status === 'FUNCTIONS_DEPLOYED'+ ? 'ACTIVE_HEALTHY'+ : currentBranch?.status === 'FUNCTIONS_FAILED' ||+ currentBranch?.status === 'MIGRATIONS_FAILED'+ ? 'UNHEALTHY'+ : 'COMING_UP'+ : isMigrationLoading+ ? 'COMING_UP'+ : 'ACTIVE_HEALTHY') as ProjectServiceStatus,+ logsUrl: isBranch ? '/branches' : '/logs/database-logs',+ },+ ]+ : []),+ ]++ const isLoadingChecks = services.some((service) => service.isLoading)+ const allServicesOperational = services.every((service) => service.isHealthy)++ const anyUnhealthy = services.some(+ (service) => !service.isHealthy && service.status !== 'COMING_UP'+ )+ const anyComingUp = services.some((service) => service.status === 'COMING_UP')+ const overallStatusLabel = isLoadingChecks+ ? 'Checking...'+ : anyUnhealthy+ ? 'Unhealthy'+ : anyComingUp || isMigrationLoading+ ? 'Coming up...'+ : 'Healthy'++ return (+ <Popover_Shadcn_ modal={false} open={open} onOpenChange={setOpen}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button+ type="outline"+ className="text-base h-auto px-2"+ iconRight={<ChevronDown size={14} strokeWidth={1.5} />}+ icon={+ isLoadingChecks || anyComingUp || isMigrationLoading ? (+ <Loader2 className="animate-spin ml-1" size={12} strokeWidth={1.5} />+ ) : (+ <div+ className={cn(+ 'w-2 h-2 rounded-full ml-1.5',+ allServicesOperational ? 'bg-brand' : 'bg-warning'+ )}+ />+ )+ }+ >+ {overallStatusLabel}+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ portal className="p-0 w-56" side="bottom" align="start">+ {services.map((service) => (+ <Link+ href={`/project/${ref}${service.logsUrl}`}+ key={service.name}+ className="transition px-3 py-2 text-xs flex items-center justify-between border-b last:border-none group relative hover:bg-surface-300"+ >+ <div className="flex gap-x-2">+ <StatusIcon+ isLoading={service.isLoading}+ isHealthy={!!service.isHealthy}+ projectStatus={service.status}+ />+ <div className="flex-1">+ <p>{service.name}</p>+ <p className="text-foreground-light flex items-center gap-1">+ <StatusMessage+ isLoading={service.isLoading}+ isHealthy={!!service.isHealthy}+ status={service.status}+ />+ </p>+ </div>+ </div>+ <div className="flex items-center gap-x-1 transition opacity-0 group-hover:opacity-100">+ <span className="text-xs text-foreground">View logs</span>+ <ChevronRight size={14} className="text-foreground" />+ </div>+ </Link>+ ))}+ {allServicesOperational ? null : (+ <>+ <PopoverSeparator />+ <div className="flex gap-2 text-xs text-foreground-light px-3 py-2">+ <div className="mt-0.5">+ <InfoIcon />+ </div>+ Recently restored projects can take up to 5 minutes to become fully operational.+ </div>+ </>+ )}+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/SortableSection.tsx b/apps/studio/components/interfaces/HomeNew/SortableSection.tsxnew file mode 100644index 00000000000..78704e042da--- /dev/null+++ b/apps/studio/components/interfaces/HomeNew/SortableSection.tsx@@ -0,0 +1,36 @@+import { useSortable } from '@dnd-kit/sortable'+import { GripVertical } from 'lucide-react'+import type { CSSProperties, ReactNode } from 'react'+import { cn } from 'ui'++type SortableSectionProps = {+ id: string+ children: ReactNode+}++export const SortableSection = ({ id, children }: SortableSectionProps) => {+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({+ id,+ })++ const style: CSSProperties = {+ transform: transform+ ? `translate3d(${Math.round(transform.x)}px, ${Math.round(transform.y)}px, 0)`+ : undefined,+ transition,+ }++ return (+ <div ref={setNodeRef} style={style} className="relative will-change-transform">+ <button+ aria-label="Drag to reorder section"+ className="absolute -left-6 top-2 text-foreground-muted hover:text-foreground focus:outline-none cursor-grab active:cursor-grabbing"+ {...attributes}+ {...listeners}+ >+ <GripVertical size={14} />+ </button>+ <div className={cn(isDragging && 'opacity-70')}>{children}</div>+ </div>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/TopSection.tsx b/apps/studio/components/interfaces/HomeNew/TopSection.tsxnew file mode 100644index 00000000000..56c026709eb--- /dev/null+++ b/apps/studio/components/interfaces/HomeNew/TopSection.tsx@@ -0,0 +1,94 @@+import Link from 'next/link'++import { ActivityStats } from 'components/interfaces/HomeNew/ActivityStats'+import { ProjectPausedState } from 'components/layouts/ProjectLayout/PausedState/ProjectPausedState'+import { ComputeBadgeWrapper } from 'components/ui/ComputeBadgeWrapper'+import { InlineLink } from 'components/ui/InlineLink'+import { ProjectUpgradeFailedBanner } from 'components/ui/ProjectUpgradeFailedBanner'+import { ReactFlowProvider } from 'reactflow'+import { Badge, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'+import { InstanceConfiguration } from '../Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration'++interface TopSectionProps {+ projectName: string+ isMainBranch?: boolean+ parentProject?: { ref?: string; name?: string } | null+ isOrioleDb?: boolean+ project: any+ organization: any+ projectRef?: string+ isPaused: boolean+}++export const TopSection = ({+ projectName,+ isMainBranch,+ parentProject,+ isOrioleDb,+ project,+ organization,+ isPaused,+}: TopSectionProps) => {+ return (+ <div className="flex flex-col gap-y-4">+ <div className="grid grid-cols-1 md:grid-cols-2 gap-16 py-16 md:p-0 w-full items-center">+ <div className="flex flex-col">+ <div className="flex flex-col md:flex-row md:items-center gap-3 w-full">+ <div>+ {!isMainBranch && (+ <Link+ href={`/project/${parentProject?.ref}`}+ className="text-sm text-foreground-light"+ >+ {parentProject?.name}+ </Link>+ )}+ <h1 className="text-3xl">{projectName}</h1>+ </div>+ <div className="flex items-center gap-x-2">+ {isOrioleDb && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="warning">OrioleDB</Badge>+ </TooltipTrigger>+ <TooltipContent side="bottom" align="start" className="max-w-80 text-center">+ This project is using Postgres with OrioleDB which is currently in preview and+ not suitable for production workloads. View our{' '}+ <InlineLink href="https://supabase.com/docs/guides/database/orioledb">+ documentation+ </InlineLink>{' '}+ for all limitations.+ </TooltipContent>+ </Tooltip>+ )}+ <ComputeBadgeWrapper+ project={{+ ref: project?.ref,+ organization_slug: organization?.slug,+ cloud_provider: project?.cloud_provider,+ infra_compute_size: project?.infra_compute_size,+ }}+ />+ </div>+ </div>+ <div className="mt-8">+ <ActivityStats />+ </div>+ </div>+ <div>+ <div+ className={cn(+ 'w-full h-[400px] md:h-[500px] border border-muted rounded-md overflow-hidden flex flex-col relative'+ )}+ >+ <ReactFlowProvider>+ <InstanceConfiguration diagramOnly />+ </ReactFlowProvider>+ </div>+ </div>+ </div>+ <ProjectUpgradeFailedBanner />+ {isPaused && <ProjectPausedState />}+ </div>+ )+}diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxindex ea3cee853fc..f74301cc8c6 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx@@ -1,12 +1,13 @@import { PermissionAction } from '@supabase/shared-types/out/constants'-import { useParams } from 'common'import { partition } from 'lodash'import { ChevronDown, Globe2, Loader2, Network } from 'lucide-react'import { useTheme } from 'next-themes'+import Link from 'next/link'import { useEffect, useMemo, useRef, useState } from 'react'import ReactFlow, { Background, Edge, ReactFlowProvider, useReactFlow } from 'reactflow'import 'reactflow/dist/style.css'+import { useParams } from 'common'import AlertError from 'components/ui/AlertError'import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query'@@ -18,7 +19,6 @@ import {import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'import { useIsOrioleDb, useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { timeout } from 'lib/helpers'-import Link from 'next/link'import { type AWS_REGIONS_KEYS } from 'shared-data'import {Button,@@ -40,7 +40,11 @@ import MapView from './MapView'import { RestartReplicaConfirmationModal } from './RestartReplicaConfirmationModal'import { useShowNewReplicaPanel } from './use-show-new-replica'-const InstanceConfigurationUI = () => {+interface InstanceConfigurationUIProps {+ diagramOnly?: boolean+}++const InstanceConfigurationUI = ({ diagramOnly = false }: InstanceConfigurationUIProps) => {const reactFlow = useReactFlow()const isOrioleDb = useIsOrioleDb()const { resolvedTheme } = useTheme()@@ -210,9 +214,9 @@ const InstanceConfigurationUI = () => {}, [isSuccessReplicas, isSuccessLoadBalancers, nodes, edges, view])return (- <div className="nowheel border-y">+ <div className={cn('nowheel', diagramOnly ? 'h-full' : 'border-y')}><div- className={`h-[500px] w-full relative ${+ className={`${diagramOnly ? 'h-full' : 'h-[500px]'} w-full relative ${isSuccessReplicas && !isLoadingProject ? '' : 'flex items-center justify-center px-28'}`}>@@ -224,70 +228,72 @@ const InstanceConfigurationUI = () => {{isError && <AlertError error={error} subject="Failed to retrieve replicas" />}{isSuccessReplicas && !isLoadingProject && (<>- <div className="z-10 absolute top-4 right-4 flex items-center justify-center gap-x-2">- <div className="flex items-center justify-center">- <ButtonTooltip- type="default"- disabled={!canManageReplicas || isOrioleDb}- className={cn(replicas.length > 0 ? 'rounded-r-none' : '')}- onClick={() => setShowNewReplicaPanel(true)}- tooltip={{- content: {- side: 'bottom',- text: !canManageReplicas- ? 'You need additional permissions to deploy replicas'- : isOrioleDb- ? 'Read replicas are not supported with OrioleDB'- : undefined,- },- }}- >- Deploy a new replica- </ButtonTooltip>- {replicas.length > 0 && (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- type="default"- icon={<ChevronDown size={16} />}- className="px-1 rounded-l-none border-l-0"- />- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-52 *:space-x-2">- <DropdownMenuItem asChild>- <Link href={`/project/${projectRef}/settings/compute-and-disk`}>- Resize databases- </Link>- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem onClick={() => setShowDeleteAllModal(true)}>- <div>Remove all replicas</div>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- )}- </div>- {project?.cloud_provider === 'AWS' && (+ {!diagramOnly && (+ <div className="z-10 absolute top-4 right-4 flex items-center justify-center gap-x-2"><div className="flex items-center justify-center">- <Button+ <ButtonTooltiptype="default"- icon={<Network size={15} />}- className={`rounded-r-none transition ${- view === 'flow' ? 'opacity-100' : 'opacity-50'- }`}- onClick={() => setView('flow')}- />- <Button- type="default"- icon={<Globe2 size={15} />}- className={`rounded-l-none transition ${- view === 'map' ? 'opacity-100' : 'opacity-50'- }`}- onClick={() => setView('map')}- />+ disabled={!canManageReplicas || isOrioleDb}+ className={cn(replicas.length > 0 ? 'rounded-r-none' : '')}+ onClick={() => setShowNewReplicaPanel(true)}+ tooltip={{+ content: {+ side: 'bottom',+ text: !canManageReplicas+ ? 'You need additional permissions to deploy replicas'+ : isOrioleDb+ ? 'Read replicas are not supported with OrioleDB'+ : undefined,+ },+ }}+ >+ Deploy a new replica+ </ButtonTooltip>+ {replicas.length > 0 && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ type="default"+ icon={<ChevronDown size={16} />}+ className="px-1 rounded-l-none border-l-0"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-52 *:space-x-2">+ <DropdownMenuItem asChild>+ <Link href={`/project/${projectRef}/settings/compute-and-disk`}>+ Resize databases+ </Link>+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem onClick={() => setShowDeleteAllModal(true)}>+ <div>Remove all replicas</div>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}</div>- )}- </div>+ {project?.cloud_provider === 'AWS' && (+ <div className="flex items-center justify-center">+ <Button+ type="default"+ icon={<Network size={15} />}+ className={`rounded-r-none transition ${+ view === 'flow' ? 'opacity-100' : 'opacity-50'+ }`}+ onClick={() => setView('flow')}+ />+ <Button+ type="default"+ icon={<Globe2 size={15} />}+ className={`rounded-l-none transition ${+ view === 'map' ? 'opacity-100' : 'opacity-50'+ }`}+ onClick={() => setView('map')}+ />+ </div>+ )}+ </div>+ )}{view === 'flow' ? (<ReactFlowfitView@@ -322,43 +328,49 @@ const InstanceConfigurationUI = () => {)}</div>- <DeployNewReplicaPanel- visible={showNewReplicaPanel}- selectedDefaultRegion={newReplicaRegion}- onSuccess={() => setRefetchInterval(5000)}- onClose={() => {- setNewReplicaRegion(undefined)- setShowNewReplicaPanel(false)- }}- />+ {!diagramOnly && (+ <>+ <DeployNewReplicaPanel+ visible={showNewReplicaPanel}+ selectedDefaultRegion={newReplicaRegion}+ onSuccess={() => setRefetchInterval(5000)}+ onClose={() => {+ setNewReplicaRegion(undefined)+ setShowNewReplicaPanel(false)+ }}+ />- <DropReplicaConfirmationModal- selectedReplica={selectedReplicaToDrop}- onSuccess={() => setRefetchInterval(5000)}- onCancel={() => setSelectedReplicaToDrop(undefined)}- />+ <DropReplicaConfirmationModal+ selectedReplica={selectedReplicaToDrop}+ onSuccess={() => setRefetchInterval(5000)}+ onCancel={() => setSelectedReplicaToDrop(undefined)}+ />- <DropAllReplicasConfirmationModal- visible={showDeleteAllModal}- onSuccess={() => setRefetchInterval(5000)}- onCancel={() => setShowDeleteAllModal(false)}- />+ <DropAllReplicasConfirmationModal+ visible={showDeleteAllModal}+ onSuccess={() => setRefetchInterval(5000)}+ onCancel={() => setShowDeleteAllModal(false)}+ />- <RestartReplicaConfirmationModal- selectedReplica={selectedReplicaToRestart}- onSuccess={() => setRefetchInterval(5000)}- onCancel={() => setSelectedReplicaToRestart(undefined)}- />+ <RestartReplicaConfirmationModal+ selectedReplica={selectedReplicaToRestart}+ onSuccess={() => setRefetchInterval(5000)}+ onCancel={() => setSelectedReplicaToRestart(undefined)}+ />+ </>+ )}</div>)}-const InstanceConfiguration = () => {+interface InstanceConfigurationProps {+ diagramOnly?: boolean+}++export const InstanceConfiguration = ({ diagramOnly = false }: InstanceConfigurationProps) => {return (<ReactFlowProvider>- <InstanceConfigurationUI />+ <InstanceConfigurationUI diagramOnly={diagramOnly} /></ReactFlowProvider>)}--export default InstanceConfigurationdiff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsxindex c2e375ade9b..88c9a63eba5 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx@@ -24,7 +24,7 @@ import {TooltipTrigger,} from 'ui'import { ProjectUpgradeAlert } from '../General/Infrastructure/ProjectUpgradeAlert'-import InstanceConfiguration from './InfrastructureConfiguration/InstanceConfiguration'+import { InstanceConfiguration } from './InfrastructureConfiguration/InstanceConfiguration'import {ObjectsToBeDroppedWarning,ReadReplicasWarning,diff --git a/apps/studio/pages/project/[ref]/index.tsx b/apps/studio/pages/project/[ref]/index.tsxindex 567ecaa1800..b786f450fe3 100644--- a/apps/studio/pages/project/[ref]/index.tsx+++ b/apps/studio/pages/project/[ref]/index.tsx@@ -1,308 +1,22 @@-import dayjs from 'dayjs'-import Link from 'next/link'-import { useEffect, useMemo, useRef } from 'react'--import { useParams } from 'common'-import { ClientLibrary } from 'components/interfaces/Home'-import { AdvisorWidget } from 'components/interfaces/Home/AdvisorWidget'-import { ExampleProject } from 'components/interfaces/Home/ExampleProject'-import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants'-import { NewProjectPanel } from 'components/interfaces/Home/NewProjectPanel/NewProjectPanel'-import { ProjectUsageSection } from 'components/interfaces/Home/ProjectUsageSection'-import { ServiceStatus } from 'components/interfaces/Home/ServiceStatus'+import { useFlag } from 'common'+import { Home } from 'components/interfaces/Home/Home'+import { HomeV2 } from 'components/interfaces/HomeNew/Home'import DefaultLayout from 'components/layouts/DefaultLayout'-import { ProjectPausedState } from 'components/layouts/ProjectLayout/PausedState/ProjectPausedState'import { ProjectLayoutWithAuth } from 'components/layouts/ProjectLayout/ProjectLayout'-import { ComputeBadgeWrapper } from 'components/ui/ComputeBadgeWrapper'-import { InlineLink } from 'components/ui/InlineLink'-import { ProjectUpgradeFailedBanner } from 'components/ui/ProjectUpgradeFailedBanner'-import { useBranchesQuery } from 'data/branches/branches-query'-import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'-import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'-import { useTablesQuery } from 'data/tables/tables-query'-import { useCustomContent } from 'hooks/custom-content/useCustomContent'-import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'-import {- useIsOrioleDb,- useProjectByRefQuery,- useSelectedProjectQuery,-} from 'hooks/misc/useSelectedProject'-import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'-import { useAppStateSnapshot } from 'state/app-state'import type { NextPageWithLayout } from 'types'-import {- Badge,- cn,- Tabs_Shadcn_,- TabsContent_Shadcn_,- TabsList_Shadcn_,- TabsTrigger_Shadcn_,- Tooltip,- TooltipContent,- TooltipTrigger,-} from 'ui'-import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'--const Home: NextPageWithLayout = () => {- const { data: project } = useSelectedProjectQuery()- const { data: organization } = useSelectedOrganizationQuery()- const { data: parentProject } = useProjectByRefQuery(project?.parent_project_ref)- const isOrioleDb = useIsOrioleDb()- const snap = useAppStateSnapshot()- const { ref, enableBranching } = useParams()-- const { projectHomepageExampleProjects } = useCustomContent(['project_homepage:example_projects'])-- const {- projectHomepageShowAllClientLibraries: showAllClientLibraries,- projectHomepageShowInstanceSize: showInstanceSize,- projectHomepageShowExamples: showExamples,- } = useIsFeatureEnabled([- 'project_homepage:show_all_client_libraries',- 'project_homepage:show_instance_size',- 'project_homepage:show_examples',- ])-- const clientLibraries = useMemo(() => {- if (showAllClientLibraries) {- return CLIENT_LIBRARIES- }- return CLIENT_LIBRARIES.filter((library) => library.language === 'JavaScript')- }, [showAllClientLibraries])-- const hasShownEnableBranchingModalRef = useRef(false)- const isPaused = project?.status === PROJECT_STATUS.INACTIVE- const isNewProject = dayjs(project?.inserted_at).isAfter(dayjs().subtract(2, 'day'))-- useEffect(() => {- if (enableBranching && !hasShownEnableBranchingModalRef.current) {- hasShownEnableBranchingModalRef.current = true- snap.setShowCreateBranchModal(true)- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [enableBranching])-- const { data: tablesData, isLoading: isLoadingTables } = useTablesQuery({- projectRef: project?.ref,- connectionString: project?.connectionString,- schema: 'public',- })- const { data: functionsData, isLoading: isLoadingFunctions } = useEdgeFunctionsQuery({- projectRef: project?.ref,- })- const { data: replicasData, isLoading: isLoadingReplicas } = useReadReplicasQuery({- projectRef: project?.ref,- })-- const { data: branches } = useBranchesQuery({- projectRef: project?.parent_project_ref ?? project?.ref,- })- const mainBranch = branches?.find((branch) => branch.is_default)- const currentBranch = branches?.find((branch) => branch.project_ref === project?.ref)- const isMainBranch = currentBranch?.name === mainBranch?.name- let projectName = 'Welcome to your project'-- if (currentBranch && !isMainBranch) {- projectName = currentBranch?.name- } else if (project?.name) {- projectName = project?.name+const HomePage: NextPageWithLayout = () => {+ const isHomeNew = useFlag('homeNew')+ if (isHomeNew) {+ return <HomeV2 />}-- const tablesCount = Math.max(0, tablesData?.length ?? 0)- const functionsCount = Math.max(0, functionsData?.length ?? 0)- // [Joshen] JFYI minus 1 as the replicas endpoint returns the primary DB minimally- const replicasCount = Math.max(0, (replicasData?.length ?? 1) - 1)-- return (- <div className="w-full px-4">- <div className={cn('py-16 ', !isPaused && 'border-b border-muted ')}>- <div className="mx-auto max-w-7xl flex flex-col gap-y-4">- <div className="flex flex-col md:flex-row md:items-center gap-6 justify-between w-full">- <div className="flex flex-col md:flex-row md:items-end gap-3 w-full">- <div>- {!isMainBranch && (- <Link- href={`/project/${parentProject?.ref}`}- className="text-sm text-foreground-light"- >- {parentProject?.name}- </Link>- )}- <h1 className="text-3xl">{projectName}</h1>- </div>- <div className="flex items-center gap-x-2 mb-1">- {isOrioleDb && (- <Tooltip>- <TooltipTrigger asChild>- <Badge variant="warning">OrioleDB</Badge>- </TooltipTrigger>- <TooltipContent side="bottom" align="start" className="max-w-80 text-center">- This project is using Postgres with OrioleDB which is currently in preview and- not suitable for production workloads. View our{' '}- <InlineLink href="https://supabase.com/docs/guides/database/orioledb">- documentation- </InlineLink>{' '}- for all limitations.- </TooltipContent>- </Tooltip>- )}- {showInstanceSize && (- <ComputeBadgeWrapper- project={{- ref: project?.ref,- organization_slug: organization?.slug,- cloud_provider: project?.cloud_provider,- infra_compute_size: project?.infra_compute_size,- }}- />- )}- </div>- </div>- <div className="flex items-center">- {project?.status === PROJECT_STATUS.ACTIVE_HEALTHY && (- <div className="flex items-center gap-x-6">- <div className="flex flex-col gap-y-1">- <Link- href={`/project/${ref}/editor`}- className="transition text-foreground-light hover:text-foreground text-sm"- >- Tables- </Link>-- {isLoadingTables ? (- <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />- ) : (- <p className="text-2xl tabular-nums">{tablesCount}</p>- )}- </div>-- {IS_PLATFORM && (- <div className="flex flex-col gap-y-1">- <Link- href={`/project/${ref}/functions`}- className="transition text-foreground-light hover:text-foreground text-sm"- >- Functions- </Link>- {isLoadingFunctions ? (- <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />- ) : (- <p className="text-2xl tabular-nums">{functionsCount}</p>- )}- </div>- )}-- {IS_PLATFORM && (- <div className="flex flex-col gap-y-1">- <Link- href={`/project/${ref}/settings/infrastructure`}- className="transition text-foreground-light hover:text-foreground text-sm"- >- Replicas- </Link>- {isLoadingReplicas ? (- <ShimmeringLoader className="w-full h-[32px] w-6 p-0" />- ) : (- <p className="text-2xl tabular-nums">{replicasCount}</p>- )}- </div>- )}- </div>- )}- {IS_PLATFORM && project?.status === PROJECT_STATUS.ACTIVE_HEALTHY && (- <div className="ml-6 border-l flex items-center w-[145px] justify-end">- <ServiceStatus />- </div>- )}- </div>- </div>- <ProjectUpgradeFailedBanner />- {isPaused && <ProjectPausedState />}- </div>- </div>-- {!isPaused && (- <>- <div className="py-16 border-b border-muted">- <div className="mx-auto max-w-7xl space-y-16">- {IS_PLATFORM && project?.status !== PROJECT_STATUS.INACTIVE && (- <>{isNewProject ? <NewProjectPanel /> : <ProjectUsageSection />}</>- )}- {!isNewProject && project?.status !== PROJECT_STATUS.INACTIVE && <AdvisorWidget />}- </div>- </div>-- <div className="bg-surface-100/5 py-16">- <div className="mx-auto max-w-7xl space-y-16">- {project?.status !== PROJECT_STATUS.INACTIVE && (- <>- <div className="space-y-8">- <h2 className="text-lg">Client libraries</h2>- <div className="grid grid-cols-2 gap-x-8 gap-y-8 md:gap-12 mb-12 md:grid-cols-3">- {clientLibraries.map((library) => (- <ClientLibrary key={library.language} {...library} />- ))}- </div>- </div>- {showExamples && (- <div className="flex flex-col gap-y-8">- <h4 className="text-lg">Example projects</h4>- {!!projectHomepageExampleProjects ? (- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">- {projectHomepageExampleProjects- .sort((a, b) => a.title.localeCompare(b.title))- .map((project) => (- <ExampleProject key={project.url} {...project} />- ))}- </div>- ) : (- <div className="flex justify-center">- <Tabs_Shadcn_ defaultValue="app" className="w-full">- <TabsList_Shadcn_ className="flex gap-4 mb-8">- <TabsTrigger_Shadcn_ value="app">App Frameworks</TabsTrigger_Shadcn_>- <TabsTrigger_Shadcn_ value="mobile">- Mobile Frameworks- </TabsTrigger_Shadcn_>- </TabsList_Shadcn_>- <TabsContent_Shadcn_ value="app">- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">- {EXAMPLE_PROJECTS.filter((project) => project.type === 'app')- .sort((a, b) => a.title.localeCompare(b.title))- .map((project) => (- <ExampleProject key={project.url} {...project} />- ))}- </div>- </TabsContent_Shadcn_>- <TabsContent_Shadcn_ value="mobile">- <div className="grid gap-2 md:gap-8 md:grid-cols-2 lg:grid-cols-3">- {EXAMPLE_PROJECTS.filter((project) => project.type === 'mobile')- .sort((a, b) => a.title.localeCompare(b.title))- .map((project) => (- <ExampleProject key={project.url} {...project} />- ))}- </div>- </TabsContent_Shadcn_>- </Tabs_Shadcn_>- </div>- )}- </div>- )}- </>- )}- </div>- </div>- </>- )}- </div>- )+ return <Home />}-Home.getLayout = (page) => (+HomePage.getLayout = (page) => (<DefaultLayout><ProjectLayoutWithAuth>{page}</ProjectLayoutWithAuth></DefaultLayout>)-export default Home+export default HomePagediff --git a/packages/ui-patterns/src/TimestampInfo/index.tsx b/packages/ui-patterns/src/TimestampInfo/index.tsxindex f259abad456..7fa5d6e3b2f 100644--- a/packages/ui-patterns/src/TimestampInfo/index.tsx+++ b/packages/ui-patterns/src/TimestampInfo/index.tsx@@ -53,12 +53,14 @@ export const TimestampInfo = ({displayAs = 'local',format = 'DD MMM HH:mm:ss',labelFormat = 'DD MMM HH:mm:ss',+ label,}: {className?: stringutcTimestamp: string | numberdisplayAs?: 'local' | 'utc'format?: stringlabelFormat?: string+ label?: string}) => {const local = timestampLocalFormatter({ utcTimestamp, format })const utc = timestampUtcFormatter({ utcTimestamp, format })@@ -139,9 +141,11 @@ export const TimestampInfo = ({className={`text-xs ${className} border-b border-transparent hover:border-dashed hover:border-foreground-light`}><span>- {displayAs === 'local'- ? timestampLocalFormatter({ utcTimestamp, format: labelFormat })- : timestampUtcFormatter({ utcTimestamp, format: labelFormat })}+ {label+ ? label+ : displayAs === 'local'+ ? timestampLocalFormatter({ utcTimestamp, format: labelFormat })+ : timestampUtcFormatter({ utcTimestamp, format: labelFormat })}</span></TooltipTrigger><TooltipContent align={align} side="right" className="font-mono p-0 py-1 min-w-80">diff --git a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsxindex 6ec54244c17..20e15661f36 100644--- a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx+++ b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx@@ -9,9 +9,9 @@import { useTheme } from 'next-themes'import { Highlight, Language, Prism, themes } from 'prism-react-renderer'import { PropsWithChildren, useEffect, useRef, useState } from 'react'-import { Button } from './../Button'-import { cn } from './../../lib/utils/cn'import { copyToClipboard } from '../../lib/utils'+import { cn } from './../../lib/utils/cn'+import { Button } from './../Button'import { dart } from './prism'dart(Prism)@@ -65,7 +65,7 @@ export const SimpleCodeBlock = ({<div className="Code codeBlockWrapper group"><pre ref={target} className={cn('codeBlock', className, parentClassName)}>{tokens.map((line, i) => {- const lineProps = getLineProps({ line, key: i })+ const { key: _key, ...lineProps } = getLineProps({ line, key: i })if (highlightLines.includes(i + 1)) {lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`@@ -73,9 +73,10 @@ export const SimpleCodeBlock = ({return (<div key={i} {...lineProps}>- {line.map((token, key) => (- <span key={key} {...getTokenProps({ token, key })} />- ))}+ {line.map((token, key) => {+ const { key: _key, ...tokenProps } = getTokenProps({ token, key })+ return <span key={key} {...tokenProps} />+ })}</div>)})}