Files
Alaister YoungandAlaister Young 680633ee4f [FE-5108] (part 5) refactor(studio): migrate remaining interfaces off next/link (#54308)
Part 5 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 | `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 ← this PR** | **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 the remaining `components/interfaces/**` directories off
`next/link`, leaving zero `next/link` component imports in
`apps/studio`.

**Changed:**

- Replaced `next/link` across all 73 remaining interface files
(`Organization`, `OrganizationInvite`, `Billing`, `Auth`, `Support`,
`ProjectHome`, `Home`, `Project`, `ProjectCreation`, `ProjectAPIDocs`,
`ApiAuthorization`, `App`, `ConnectSheet`, `SignIn`, `APIKeys`,
`Account`, `CliLogin`, `Docs`, `JwtSecrets`, `Platform`)
- Converted the sole remaining `UrlObject` link (`<Link href={{
pathname: '/sign-in-sso', query }}>`) in `SignInSSOForm.tsx` to `<Link
to="/sign-in-sso" search={query}>`
- Migrated `SupportLink.tsx` onto `DynamicLink`
(`createSupportFormUrl(...)`)
- Standardized external `target="_blank"` anchors with `rel="noreferrer
noopener"`, switched `OverviewMetrics.tsx` observability link to typed
`<Link to="/project/$ref/observability/auth">`, and adopted `InlineLink`
/ `InlineLinkClassName` on inline paragraph links per review feedback

Addresses
[FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link)

## To test

- [ ] Check Organization (billing, usage, team, documents, AWS
Marketplace), Auth (providers, templates, rate limits, users, OAuth
apps), Support form/links, Project Home, Connect sheet, and Sign-In/SSO
links
- [ ] Verify `SignInWithSSOButton` preserves query params when
navigating to `/sign-in-sso`
- [ ] Verify `SupportLink` pre-populates support form query parameters
cleanly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 17:33:03 +08:00

137 lines
4.6 KiB
TypeScript

// End of third-party imports
import { CLIENT_LIBRARIES } from 'common/constants'
import { ExternalLinkIcon } from 'lucide-react'
import type { UseFormReturn } from 'react-hook-form'
import {
Button,
cn,
FormControl,
FormField,
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import type { ExtendedSupportCategories } from './Support.constants'
import type { SupportFormValues } from './SupportForm.schema'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
interface ClientLibraryInfoProps {
form: UseFormReturn<SupportFormValues>
category: ExtendedSupportCategories
library: string | undefined
}
export function ClientLibraryInfo({ form, category, library }: ClientLibraryInfoProps) {
const showClientLibraries = useIsFeatureEnabled('support:show_client_libraries')
if (!showClientLibraries) return null
if (category !== 'Problem') return null
return (
<div className="flex flex-col gap-y-1">
<FormField
name="library"
control={form.control}
render={({ field }) => (
<FormItemLayout layout="vertical" label="Which library are you having issues with">
<FormControl>
<Select {...field} defaultValue={field.value} onValueChange={field.onChange}>
<SelectTrigger
data-support-field="library"
className="w-full"
aria-label="Select a library"
>
<SelectValue placeholder="Select a library" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
{CLIENT_LIBRARIES.map((option) => (
<SelectItem key={option.language} value={option.language}>
{option.language}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
</FormControl>
</FormItemLayout>
)}
/>
{library && library.length > 0 && <LibrarySuggestions library={library} />}
</div>
)
}
interface LibrarySuggestionsProps {
library: string
}
const LibrarySuggestions = ({ library }: LibrarySuggestionsProps) => {
const selectedLibrary = CLIENT_LIBRARIES.find((lib) => lib.language === library)
const selectedClientLibraries = selectedLibrary?.libraries.filter((library) =>
library.name.includes('supabase-')
)
return (
<div className="flex flex-col gap-y-4">
<div className="space-y-2">
<p className="text-sm text-foreground-light">
Found an issue or a bug? Try searching our GitHub issues or submit a new one.
</p>
</div>
<div className="flex items-center space-x-4 overflow-x-auto">
{selectedClientLibraries?.map((lib) => {
const libraryLanguage = library === 'Dart (Flutter)' ? lib.name.split('-')[1] : library
return (
<div
key={lib.name}
className="w-[230px] min-w-[230px] min-h-[128px] rounded-sm border border-control bg-surface-100 space-y-3 px-4 py-3"
>
<div className="space-y-1">
<p className="text-sm">{lib.name}</p>
<p className="text-sm text-foreground-light">
For issues regarding the {libraryLanguage} client library
</p>
</div>
<div>
<Button asChild icon={<ExternalLinkIcon size={14} strokeWidth={1.5} />}>
<a href={lib.url} target="_blank" rel="noreferrer noopener">
View GitHub issues
</a>
</Button>
</div>
</div>
)
})}
<div
className={cn(
'px-4 py-3 rounded-sm border border-control bg-surface-100',
'w-[230px] min-w-[230px] min-h-[128px] flex flex-col justify-between space-y-3'
)}
>
<div className="space-y-1">
<p className="text-sm">supabase</p>
<p className="text-sm text-foreground-light">For any issues about our API</p>
</div>
<div>
<Button asChild icon={<ExternalLinkIcon size={14} strokeWidth={1.5} />}>
<a
href="https://github.com/supabase/supabase"
target="_blank"
rel="noreferrer noopener"
>
View GitHub issues
</a>
</Button>
</div>
</div>
</div>
</div>
)
}