mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
* fix: response error codes * upgrade docs * remove request url modification middleware * move api routes for self-hosted to platform folder * remove some lib/common/fetch usage * docs: use middleware for openapi-fetch (#30600) Get rid of the unauthedAllowedPost function (I don't think there's any harm in letting any requests that require authentication to just 403, they should be disabled at the React Query level and if not they will fail gracefully enough...) * fix local count query * add default values for clone mutation * fix ts and codegen * add missing lodash dep to playwright tests * Fix the playwright tests to match the new folder structure for selfhosted variant. * remove unused import * Remove unused state * remove unused sql debug mutation * remove unused export * fix notifications query * fix jwt updating status * fix typescript * save sql snippet after renaming * update codegen & fix ts error * override array querySerializer --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import Link from 'next/link'
|
|
|
|
import type { ResponseError } from 'types'
|
|
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,
|
|
}: AlertErrorProps) => {
|
|
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 (
|
|
<Alert_Shadcn_ className={className} variant="warning" title={subject}>
|
|
{showIcon && <WarningIcon className="h-4 w-4" strokeWidth={2} />}
|
|
<AlertTitle_Shadcn_ className="text-foreground">{subject}</AlertTitle_Shadcn_>
|
|
<AlertDescription_Shadcn_ className="flex flex-col gap-3 break-words">
|
|
<div>
|
|
{error?.message && <p className="text-left">Error: {formattedErrorMessage}</p>}
|
|
<p className="text-left">
|
|
Try refreshing your browser, but if the issue persists, please reach out to us via
|
|
support.
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<Button asChild type="warning">
|
|
<Link href={href}>Contact support</Link>
|
|
</Button>
|
|
</div>
|
|
</AlertDescription_Shadcn_>
|
|
</Alert_Shadcn_>
|
|
)
|
|
}
|
|
|
|
export default AlertError
|