Files
supabase/apps/studio/components/interfaces/Support/useSupportStatus.ts
Charis 27e6259a39 chore(studio): remove legacy status banner and incidentIoStatusPage flag (#51852)
## Summary

The incident.io status page is now the only status banner for everyone,
so the legacy status banner path is removed:

- Removed the `incidentIoStatusPage` ConfigCat flag. The incident.io
path is unconditional.
- Deleted the legacy status banner code (`StatusPageBanner` and its
utils/visibility hook) and its tests.
- Deleted the legacy API endpoints `/api/incident-banner`,
`/api/incident-status`, and `/api/status-override` (pages, app, and
routes variants), along with their data hooks, query keys, and lib
helpers.
- Removed `STATUSPAGE_*` env vars from the Turbo config and the
`INCIDENT_BANNER_DISMISSED_IDS` local storage key from
`packages/common`.
- Updated the AI tools and SQL generation endpoint that read the flag.

`NEXT_PUBLIC_ONGOING_INCIDENT` / the `ongoingIncident` override is kept.

The `incident_status_cache` table and its migration are intentionally
untouched. Studio no longer reads it, and dropping it is a separate
cleanup.

## Testing

- Studio typecheck passes.
- Related vitest suites pass (414 tests).
2026-10-16 14:18:32 -04:00

34 lines
999 B
TypeScript

import { useQuery } from '@tanstack/react-query'
import {
getStatusPillLabel,
getSupportAdmonitionCopy,
prioritizeActiveItems,
type SupportStatus,
} from './SupportStatus.utils'
import { statusPageQueryOptions } from '@/data/platform/status-page-query'
import { IS_PLATFORM } from '@/lib/constants'
import { normalizeStatusPage } from '@/lib/status-page/status-page.utils'
export function useSupportStatus(): SupportStatus {
const statusQuery = useQuery({
...statusPageQueryOptions(),
select: normalizeStatusPage,
enabled: IS_PLATFORM,
})
if (statusQuery.isPending) return { status: 'pending' }
if (statusQuery.isError) return { status: 'error' }
const { pageUrl, items } = statusQuery.data
const activeItems = prioritizeActiveItems(items)
return {
status: 'success',
hasActiveIncidents: activeItems.some((item) => item.kind === 'incident'),
pillLabel: getStatusPillLabel(items),
admonition: getSupportAdmonitionCopy(items),
pageUrl,
}
}