mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
* Update Supabase docs URLs to use env variable Co-authored-by: a <a@alaisteryoung.com> * Refactor: Use DOCS_URL constant for documentation links This change centralizes documentation links using a new DOCS_URL constant, improving maintainability and consistency. Co-authored-by: a <a@alaisteryoung.com> * Refactor: Use DOCS_URL constant for all documentation links This change replaces hardcoded documentation URLs with a centralized constant, improving maintainability and consistency. Co-authored-by: a <a@alaisteryoung.com> * replace more instances * ci: Autofix updates from GitHub workflow * remaining instances * fix duplicate useRouter --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: alaister <10985857+alaister@users.noreply.github.com>
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
import { AlertCircle } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
|
|
import { AlertTitle } from '@ui/components/shadcn/ui/alert'
|
|
import { DOCS_URL } from 'lib/constants'
|
|
import { AlertDescription_Shadcn_, Alert_Shadcn_, Button } from 'ui'
|
|
|
|
interface RAMWarningsProps {
|
|
isFreePlan: boolean
|
|
upgradeUrl: string
|
|
severity?: 'warning' | 'critical' | null
|
|
}
|
|
|
|
const RAMWarnings = ({ isFreePlan, upgradeUrl, severity }: RAMWarningsProps) => {
|
|
if (severity === 'warning') {
|
|
return (
|
|
<Alert_Shadcn_ variant="warning">
|
|
<AlertCircle />
|
|
<AlertTitle>Your memory usage has exceeded 80%</AlertTitle>
|
|
<AlertDescription_Shadcn_>
|
|
High memory usage could result in overall degraded performance, and in rare cases, your
|
|
instance may become unresponsive. If you need more resources, consider upgrading to a
|
|
larger compute add-on.
|
|
</AlertDescription_Shadcn_>
|
|
<div className="mt-3 flex items-center space-x-2">
|
|
<Button asChild type="default">
|
|
<Link href={`${DOCS_URL}/guides/troubleshooting/exhaust-ram`}>Learn more</Link>
|
|
</Button>
|
|
<Button asChild type="warning">
|
|
<Link href={upgradeUrl}>
|
|
{isFreePlan ? 'Upgrade project' : 'Change compute add-on'}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</Alert_Shadcn_>
|
|
)
|
|
}
|
|
|
|
if (severity === 'critical') {
|
|
return (
|
|
<Alert_Shadcn_ variant="destructive">
|
|
<AlertCircle />
|
|
<AlertTitle>Your memory usage has reached 100%</AlertTitle>
|
|
<AlertDescription_Shadcn_>
|
|
High memory usage could result in overall degraded performance, and in rare cases, your
|
|
instance may become unresponsive. If you need more resources, consider upgrading to a
|
|
larger compute add-on.
|
|
</AlertDescription_Shadcn_>
|
|
<div className="mt-3 flex items-center space-x-2">
|
|
<Button asChild type="default">
|
|
<Link href={`${DOCS_URL}/guides/troubleshooting/high-cpu-usage`}>Learn more</Link>
|
|
</Button>
|
|
<Button asChild type="danger">
|
|
<Link href={upgradeUrl}>
|
|
{isFreePlan ? 'Upgrade project' : 'Change compute add-on'}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</Alert_Shadcn_>
|
|
)
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
export default RAMWarnings
|