mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 15:49:09 +03:00
* Update support form status page button to use incident query + make maintenance banner dismissible * Clean up * Nit * Attempt to fix tests * Fix tests
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { LOCAL_STORAGE_KEYS } from 'common'
|
|
import { HeaderBanner } from 'components/interfaces/Organization/HeaderBanner'
|
|
import { InlineLink } from 'components/ui/InlineLink'
|
|
|
|
import { useIncidentStatusQuery } from '@/data/platform/incident-status-query'
|
|
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
|
|
|
|
/**
|
|
* Used to display ongoing maintenance
|
|
*/
|
|
export function MaintenanceBanner() {
|
|
const { data: allStatusPageEvents } = useIncidentStatusQuery()
|
|
const { maintenanceEvents = [] } = allStatusPageEvents ?? {}
|
|
const currentEventId = maintenanceEvents[0]?.id ?? ''
|
|
|
|
const [dismissed, setDismissed] = useLocalStorageQuery(
|
|
LOCAL_STORAGE_KEYS.MAINTENANCE_BANNER_DISMISSED(currentEventId),
|
|
false
|
|
)
|
|
|
|
if (dismissed) return null
|
|
|
|
return (
|
|
<HeaderBanner
|
|
variant="note"
|
|
title="Scheduled maintenance is in progress"
|
|
description={
|
|
<>
|
|
Follow the <InlineLink href="https://status.supabase.com">status page</InlineLink> for
|
|
updates
|
|
</>
|
|
}
|
|
onDismiss={() => setDismissed(true)}
|
|
/>
|
|
)
|
|
}
|