mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 11:55:05 +03:00
## Problem Two visual regressions surfaced after the Tailwind v4 migration (#45318): 1. The Postgres upgrade-failed banner used the deprecated `Alert` component, whose `warning` variant relies on custom `amber-1100` / `amber-1200` color tokens that no longer resolve. The title rendered as near-white on the yellow background. 2. The sonner toast close button forced `bg-transparent! hover:bg-transparent!`, letting the library's default translucent circle bleed through against the toast's overlay background on hover. ## Fix - Migrate `ProjectUpgradeFailedBanner` to `Admonition` (the recommended replacement per the deprecation note on `Alert`), which uses semantic `warning-*` tokens defined in the theme. - Drop the transparent-bg overrides on the sonner close button and give it a proper `hover:bg-surface-200` with a fixed `size-6` hit area so the X has a clean hover target. ## Before <img width="2940" height="338" alt="image" src="https://github.com/user-attachments/assets/2cf2cf52-cdf2-429d-b50c-5dc4e5b9c84b" /> ## After <img width="1642" height="506" alt="CleanShot 2026-05-06 at 11 14 03@2x" src="https://github.com/user-attachments/assets/b6c9b3e2-9d3e-437d-92a6-95d12730e842" /> ## Testing - [ ] Trigger a failed Postgres upgrade state and confirm the banner title/description/actions are all readable on the amber background. - [ ] Fire a toast and hover the close button — the hover should show a subtle square background, not a translucent circle. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fix** * Project upgrade failure banner now only appears when an upgrade has failed and no longer supports dismissing. * **Style** * Replaced the warning banner UI with a streamlined admonition that shows only a “Contact support” action. * Improved toast close-button styling for clearer sizing, color, and interaction states. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
import { SupportCategories } from '@supabase/shared-types/out/constants'
|
|
import { DatabaseUpgradeStatus } from '@supabase/shared-types/out/events'
|
|
import { useParams } from 'common'
|
|
import dayjs from 'dayjs'
|
|
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns'
|
|
|
|
import { InlineLink } from './InlineLink'
|
|
import { SupportLink } from '@/components/interfaces/Support/SupportLink'
|
|
import { useProjectUpgradingStatusQuery } from '@/data/config/project-upgrade-status-query'
|
|
import { IS_PLATFORM } from '@/lib/constants'
|
|
import { guessLocalTimezone } from '@/lib/dayjs'
|
|
|
|
// [Joshen] Think twice about the category though - it doesn't correspond
|
|
|
|
export const ProjectUpgradeFailedBanner = () => {
|
|
const { ref } = useParams()
|
|
const { data } = useProjectUpgradingStatusQuery({ projectRef: ref }, { enabled: IS_PLATFORM })
|
|
const { status, initiated_at, latest_status_at, error } = data?.databaseUpgradeStatus ?? {}
|
|
|
|
const isFailed = status === DatabaseUpgradeStatus.Failed
|
|
const initiatedAt = dayjs
|
|
.utc(initiated_at ?? 0)
|
|
.tz(guessLocalTimezone())
|
|
.format('DD MMM YYYY HH:mm:ss')
|
|
|
|
const subject = 'Upgrade failed for project'
|
|
const message = `Upgrade information:\n• Initiated at: ${initiated_at}\n• Error: ${error}`
|
|
|
|
const initiatedAtEncoded = encodeURIComponent(
|
|
dayjs.utc(initiated_at ?? 0).format('YYYY-MM-DDTHH:mm:ss')
|
|
)
|
|
const latestStatusAtEncoded = encodeURIComponent(
|
|
dayjs
|
|
.utc(latest_status_at ?? 0)
|
|
.utcOffset(0)
|
|
.format('YYYY-MM-DDTHH:mm:ss')
|
|
)
|
|
const timestampFilter = `its=${initiatedAtEncoded}&ite=${latestStatusAtEncoded}`
|
|
|
|
if (!isFailed) return null
|
|
|
|
return (
|
|
<div className="max-w-7xl">
|
|
<Admonition
|
|
type="warning"
|
|
title={`Postgres version upgrade was not successful (Initiated at ${initiatedAt})`}
|
|
actions={
|
|
<Button asChild type="default">
|
|
<SupportLink
|
|
queryParams={{
|
|
category: SupportCategories.DATABASE_UNRESPONSIVE,
|
|
projectRef: ref,
|
|
subject,
|
|
message,
|
|
}}
|
|
>
|
|
Contact support
|
|
</SupportLink>
|
|
</Button>
|
|
}
|
|
>
|
|
<div>
|
|
Your project and its data are not affected. Please reach out to us via our support form
|
|
for assistance with the upgrade.
|
|
</div>
|
|
<div>
|
|
You may also view logs related to the failed upgrade in your{' '}
|
|
<InlineLink href={`/project/${ref}/logs/pg-upgrade-logs?${timestampFilter}`}>
|
|
project's logs
|
|
</InlineLink>
|
|
.
|
|
</div>
|
|
</Admonition>
|
|
</div>
|
|
)
|
|
}
|