mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 13:19:09 +03:00
* Update perms checking in audit logs * Deprecate useCheckPermissions, useIsPermissionsLoaded and useCheckProjectPermissions as they're no longer used * Rename useAsyncCheckProjectPermissions to useAsyncCheckPermissions * Fix TS
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { Clock } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
|
|
import { useParams } from 'common'
|
|
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
|
|
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
|
import { useAppStateSnapshot } from 'state/app-state'
|
|
import { Button } from 'ui'
|
|
|
|
export const BranchingPITRNotice = () => {
|
|
const { ref } = useParams()
|
|
const snap = useAppStateSnapshot()
|
|
|
|
const { can: canUpdateSubscription } = useAsyncCheckPermissions(
|
|
PermissionAction.BILLING_WRITE,
|
|
'stripe.subscriptions'
|
|
)
|
|
|
|
return (
|
|
<div className="flex flex-row gap-4">
|
|
<div>
|
|
<figure className="w-10 h-10 rounded-md border flex items-center justify-center">
|
|
<Clock className="text-warning-700" size={20} strokeWidth={2} />
|
|
</figure>
|
|
</div>
|
|
<div className="flex grow items-center justify-between gap-4">
|
|
<div className="flex flex-col gap-y-1">
|
|
<p className="text-sm text-foreground">Consider enabling Point in Time Recovery (PITR)</p>
|
|
<p className="text-sm text-foreground-light">
|
|
This ensures you can recover production data if you merge a bad migration (e.g. delete a
|
|
column).
|
|
</p>
|
|
</div>
|
|
{!canUpdateSubscription ? (
|
|
<ButtonTooltip
|
|
disabled
|
|
size="tiny"
|
|
type="default"
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: 'You need additional permissions to amend subscriptions',
|
|
},
|
|
}}
|
|
>
|
|
Enable PITR add-on
|
|
</ButtonTooltip>
|
|
) : (
|
|
<Button size="tiny" type="default" asChild>
|
|
<Link
|
|
href={`/project/${ref}/settings/addons?panel=pitr`}
|
|
onClick={() => snap.setShowCreateBranchModal(false)}
|
|
>
|
|
Enable PITR
|
|
</Link>
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|