mirror of
https://github.com/supabase/supabase.git
synced 2026-07-03 15:54:23 +08:00
* Replace all usage of useProjectContext with useSelectedProjectQuery * Replace all usage of useSelectedProject with useSelectedProjectQuery * Replace all usage of useProjectByRef with useProjectByRefQuery * Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery * Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks * Deprecate ProjecContext
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import Link from 'next/link'
|
|
|
|
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
|
|
import { Badge, NavMenu, NavMenuItem } from 'ui'
|
|
|
|
type Props = {
|
|
active: 'pitr' | 'scheduled' | 'rtnp'
|
|
}
|
|
|
|
function DatabaseBackupsNav({ active }: Props) {
|
|
const { ref, cloud_provider } = useSelectedProjectQuery()?.data || {}
|
|
|
|
const navMenuItems = [
|
|
{
|
|
enabled: true,
|
|
id: 'scheduled',
|
|
label: 'Scheduled backups',
|
|
href: `/project/${ref}/database/backups/scheduled`,
|
|
},
|
|
{
|
|
enabled: true,
|
|
id: 'pitr',
|
|
label: 'Point in time',
|
|
href: `/project/${ref}/database/backups/pitr`,
|
|
},
|
|
{
|
|
enabled: cloud_provider !== 'FLY',
|
|
id: 'rtnp',
|
|
label: (
|
|
<div className="flex items-center gap-1">
|
|
Restore to new project{' '}
|
|
<Badge size="small" className="!text-[10px] px-1.5 py-0">
|
|
New
|
|
</Badge>
|
|
</div>
|
|
),
|
|
href: `/project/${ref}/database/backups/restore-to-new-project`,
|
|
},
|
|
] as const
|
|
|
|
return (
|
|
<NavMenu className="overflow-hidden overflow-x-auto">
|
|
{navMenuItems.map(
|
|
(item) =>
|
|
item.enabled && (
|
|
<NavMenuItem key={item.id} active={item.id === active}>
|
|
<Link href={item.href}>{item.label}</Link>
|
|
</NavMenuItem>
|
|
)
|
|
)}
|
|
</NavMenu>
|
|
)
|
|
}
|
|
|
|
export default DatabaseBackupsNav
|