mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 00:19:08 +00:00
Part 2 of a 6-PR stack migrating all `next/link` imports in `apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known external URLs) and removing `compat/next/link.tsx`. | Part | PR | Scope | | --- | --- | --- | | 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and `components/ui/**` | | **2** | **#54305 ← this PR** | **`components/layouts/**` and top-level shell components** | | 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor, BranchManagement, Branching, Functions, Realtime | | 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues, Linter, Reports, QueryPerformance, QuerySources, ConfigDrift, DiskManagement, Compute | | 5 | #54308 | Remaining `components/interfaces/**` (Org, Billing, Auth, Support, Home, SignIn, ConnectSheet, etc.) | | 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and update basePath tests/docs | Migrates all `apps/studio/components/layouts/**` files and top-level navigation shell components off `next/link`. **Changed:** - Replaced `next/link` across `components/layouts/**` (`AccountLayout`, `AppLayout`, `AuthLayout`, `BranchLayout`, `DatabaseLayout`, `EdgeFunctionsLayout`, `ExplorerLayout`, `IssuesLayout`, `LogsLayout`, `Navigation`, `ObservabilityLayout`, `ProjectLayout`, `ProjectNeedsSecuring`, `SQLEditorLayout`, `SignInLayout`, `TableEditorLayout`, `Tabs`) and top-level shell components (`Sidebar.tsx`, `UserDropdown.tsx`, `LocalDropdown.tsx`, `HomePageActions.tsx`) - Removed `vi.mock('next/link', ...)` from `LocalDropdown.test.tsx` and `ProjectNeedsSecuring.test.tsx` - Added accessible labels where external icon/logo links switched from `<Link>` to plain `<a>` (`AdminStudioButton.tsx`, `ForgotPasswordLayout.tsx`) Addresses [FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link) ## To test - [ ] Navigate across top header, left sidebar, user/local dropdown, and project/org/branch switchers - [ ] Verify mobile navigation menu items and recent-tab links navigate with expected query params - [ ] Verify sign-in and forgot-password layout links work cleanly --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { Link } from '@tanstack/react-router'
|
|
import { useParams } from 'common'
|
|
import { ClockIcon } from 'lucide-react'
|
|
import { Button } from 'ui'
|
|
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import { FGA_PERMISSIONS, useAsyncCheckPermissionsV2 } from '@/hooks/misc/useCheckPermissionsV2'
|
|
import { useAppStateSnapshot } from '@/state/app-state'
|
|
|
|
export const BranchingPITRNotice = () => {
|
|
const { ref } = useParams()
|
|
const snap = useAppStateSnapshot()
|
|
|
|
const { can: canUpdateSubscription } = useAsyncCheckPermissionsV2(
|
|
FGA_PERMISSIONS.ORGANIZATION.BILLING_WRITE
|
|
)
|
|
|
|
return (
|
|
<div className="flex flex-row gap-4">
|
|
<div>
|
|
<figure className="w-10 h-10 rounded-md border flex items-center justify-center">
|
|
<ClockIcon 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"
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: 'You need additional permissions to amend subscriptions',
|
|
},
|
|
}}
|
|
>
|
|
Enable PITR add-on
|
|
</ButtonTooltip>
|
|
) : (
|
|
<Button size="tiny" asChild>
|
|
<Link
|
|
to="/project/$ref/settings/addons"
|
|
params={{ ref: ref ?? '_' }}
|
|
search={{ panel: 'pitr' }}
|
|
onClick={() => snap.setShowCreateBranchModal(false)}
|
|
>
|
|
Enable PITR
|
|
</Link>
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|