import Link from 'next/link' import { PropsWithChildren } from 'react' import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button, WarningIcon, } from 'ui' export interface AlertErrorProps { projectRef?: string subject?: string error?: { message: string } | null className?: string showIcon?: boolean } // [Joshen] To standardize the language for all error UIs const AlertError = ({ projectRef, subject, error, className, showIcon = true, children, }: PropsWithChildren) => { const subjectString = subject?.replace(/ /g, '%20') let href = `/support/new?category=dashboard_bug` if (projectRef) href += `&ref=${projectRef}` if (subjectString) href += `&subject=${subjectString}` if (error) href += `&error=${error.message}` const formattedErrorMessage = error?.message?.includes('503') ? '503 Service Temporarily Unavailable' : error?.message return ( {showIcon && } {subject}
{error?.message &&

Error: {formattedErrorMessage}

}

Try refreshing your browser, but if the issue persists for more than a few minutes, please reach out to us via support.

{children}
) } export default AlertError