mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
94 lines
3.3 KiB
TypeScript
94 lines
3.3 KiB
TypeScript
import Link from 'next/link'
|
|
import {
|
|
Button,
|
|
Dialog,
|
|
DialogContent,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogSection,
|
|
DialogSectionSeparator,
|
|
DialogTitle,
|
|
} from 'ui'
|
|
|
|
import { TIER_QUERY_LIMITS } from './Logs.constants'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
|
|
interface Props {
|
|
show: boolean
|
|
setShowUpgradePrompt: (value: boolean) => void
|
|
title?: string
|
|
description?: string
|
|
source?: string
|
|
}
|
|
/**
|
|
* @param show - whether to show the modal
|
|
* @param setShowUpgradePrompt - function to set the show state
|
|
* @param title - title of the modal
|
|
* @param description - description of the modal
|
|
* @param source - source of the upgrade prompt used to track the source of the upgrade prompt in the billing page
|
|
* @returns
|
|
*/
|
|
const UpgradePrompt: React.FC<Props> = ({
|
|
show,
|
|
setShowUpgradePrompt,
|
|
title = 'Log retention',
|
|
description = 'Logs can be retained up to a duration of 3 months depending on the plan that your project is on.',
|
|
source = 'logsRetentionUpgradePrompt',
|
|
}) => {
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
|
|
return (
|
|
<Dialog open={show} onOpenChange={() => setShowUpgradePrompt(false)}>
|
|
<DialogContent size="medium">
|
|
<DialogHeader>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
</DialogHeader>
|
|
<DialogSectionSeparator />
|
|
<DialogSection>
|
|
<div className="space-y-4">
|
|
<p className="text-sm">{description}</p>
|
|
<div className="border-control bg-surface-300 rounded-sm border">
|
|
<div className="flex items-center px-4 pt-2 pb-1">
|
|
<p className="text-foreground-light w-[40%] text-sm">Plan</p>
|
|
<p className="text-foreground-light w-[60%] text-sm">Retention duration</p>
|
|
</div>
|
|
<div className="py-1">
|
|
<div className="flex items-center px-4 py-1">
|
|
<p className="w-[40%] text-sm">Free</p>
|
|
<p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.FREE.text}</p>
|
|
</div>
|
|
<div className="flex items-center px-4 py-1">
|
|
<p className="w-[40%] text-sm">Pro</p>
|
|
<p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.PRO.text}</p>
|
|
</div>
|
|
<div className="flex items-center px-4 py-1">
|
|
<p className="w-[40%] text-sm">Team</p>
|
|
<p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.TEAM.text}</p>
|
|
</div>
|
|
<div className="flex items-center px-4 py-1">
|
|
<p className="w-[40%] text-sm">Enterprise</p>
|
|
<p className="w-[60%] text-sm">{TIER_QUERY_LIMITS.ENTERPRISE.text}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</DialogSection>
|
|
<DialogFooter className="flex justify-end gap-3">
|
|
<Button variant="default" onClick={() => setShowUpgradePrompt(false)}>
|
|
Close
|
|
</Button>
|
|
<Button asChild size="tiny">
|
|
<Link
|
|
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=${source}`}
|
|
>
|
|
Upgrade
|
|
</Link>
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|
|
|
|
export default UpgradePrompt
|