diff --git a/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx b/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx
index 22464a7a5fb..4612f6c4b76 100644
--- a/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx
+++ b/apps/studio/components/interfaces/HomeNew/ActivityStats.tsx
@@ -1,9 +1,9 @@
import dayjs from 'dayjs'
-import { GitBranch } from 'lucide-react'
-import Link from 'next/link'
+import { Archive, Database, GitBranch } from 'lucide-react'
import { useMemo } from 'react'
import { useParams } from 'common'
+import { SingleStat } from 'components/ui/SingleStat'
import { useBranchesQuery } from 'data/branches/branches-query'
import { useBackupsQuery } from 'data/database/backups-query'
import { useMigrationsQuery } from 'data/database/migrations-query'
@@ -55,17 +55,15 @@ export const ActivityStats = () => {
return (
-
-
+
+
-
-
Last migration
-
-
- {isLoadingMigrations ? (
+
}
+ label={
Last migration}
+ value={
+ isLoadingMigrations ? (
) : latestMigration ? (
{
/>
) : (
No migrations
- )}
-
-
+ )
+ }
+ />
-
-
Last backup
-
-
- {isLoadingBackups ? (
+
}
+ label={
Last backup}
+ value={
+ isLoadingBackups ? (
) : backupsData?.pitr_enabled ? (
PITR enabled
@@ -95,25 +94,26 @@ export const ActivityStats = () => {
/>
) : (
No backups
- )}
-
-
+ )
+ }
+ />
-
-
- {isDefaultProject ? 'Recent branch' : 'Branch Created'}
-
-
-
- {isLoadingBranches ? (
+
}
+ label={
{isDefaultProject ? 'Recent branch' : 'Branch Created'}}
+ value={
+ isLoadingBranches ? (
) : isDefaultProject ? (
-
-
-
- {latestNonDefaultBranch?.name ?? 'No branches'}
-
-
+
+ {latestNonDefaultBranch?.name ?? 'No branches'}
+
) : currentBranch?.created_at ? (
{
/>
) : (
Unknown
- )}
-
-
+ )
+ }
+ />
)
diff --git a/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx
index 768c0de480a..0b1539a933e 100644
--- a/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx
+++ b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx
@@ -1,9 +1,9 @@
-import { AlertTriangle, CheckCircle2, ChevronDown, ChevronRight, Loader2 } from 'lucide-react'
+import { AlertTriangle, CheckCircle2, 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 { SingleStat } from 'components/ui/SingleStat'
import { useBranchesQuery } from 'data/branches/branches-query'
import { useEdgeFunctionServiceStatusQuery } from 'data/service-status/edge-functions-status-query'
import {
@@ -12,14 +12,7 @@ import {
} 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'
+import { 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
@@ -85,7 +78,6 @@ const StatusIcon = ({
export const ServiceStatus = () => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
- const [open, setOpen] = useState(false)
const {
projectAuthAll: authEnabled,
@@ -262,27 +254,29 @@ export const ServiceStatus = () => {
: 'Healthy'
return (
-
-
- }
+
+
+
- ) : (
-
- )
+
+ {services.map((service, index) => (
+
+ ))}
+
}
- >
- {overallStatusLabel}
-
+ label={Health}
+ value={{overallStatusLabel}}
+ />
{services.map((service) => (
diff --git a/apps/studio/components/ui/SingleStat.tsx b/apps/studio/components/ui/SingleStat.tsx
new file mode 100644
index 00000000000..e34ea09773c
--- /dev/null
+++ b/apps/studio/components/ui/SingleStat.tsx
@@ -0,0 +1,45 @@
+import Link from 'next/link'
+import type { ReactNode } from 'react'
+
+type SingleStatProps = {
+ icon: ReactNode
+ label: ReactNode
+ value: ReactNode
+ className?: string
+ href?: string
+ onClick?: () => void
+}
+
+export const SingleStat = ({ icon, label, value, className, href, onClick }: SingleStatProps) => {
+ const content = (
+
+
+ {icon}
+
+
+
{label}
+
+ {value}
+
+
+
+ )
+
+ if (href) {
+ return (
+
+ {content}
+
+ )
+ }
+
+ if (onClick) {
+ return (
+
+ )
+ }
+
+ return content
+}