mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
Part 4 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 ← this PR** | **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 `components/interfaces/{Integrations,Settings,Observability,LogDrains,Issues,Linter,Reports,QueryPerformance,QuerySources,ConfigDrift,DiskManagement,Compute}/` off `next/link`. **Changed:** - Replaced `next/link` across all 72 files in Integrations, Settings, Observability, LogDrains, Issues, Linter, Reports, QueryPerformance, QuerySources, ConfigDrift, DiskManagement, and Compute interfaces - Updated legacy permanent-redirect hrefs (`/settings/database` → `/database/settings`, `/settings/vault/secrets` → `/integrations/vault/secrets`, `/reports/database#database-size-report` → `/observability/database#database-size-report`) to canonical routes - Flattened legacy nested `<Link><a>...</a></Link>` markup in `DatabaseReadOnlyAlert.tsx` and dropped `passHref` in `Integrations/Queues/QueueTab.tsx` - Standardized external `target="_blank"` anchors with `rel="noreferrer noopener"`, switched `ObservabilityOverviewFooter.tsx` to `InlineLink` + `DOCS_URL`, and applied `InlineLinkClassName` to the typed billing links in `DatabaseReadOnlyAlert.tsx` per review feedback - Removed `vi.mock('next/link', ...)` from `Settings/General/Project.test.tsx` and `MobileIssuesNavigation.platform.test.tsx` Addresses [FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link) ## To test - [ ] Navigate across Integrations (marketplace, cron, queues, wrappers, Vercel/GitHub), Settings (database, infrastructure, read replicas, logs), Observability, Issues, and Compute pages - [ ] Verify Logs Preview → Logs Explorer links preserve multi-line SQL queries in search params - [ ] Verify billing and database-size links preserve query parameters and hash fragments --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
121 lines
4.2 KiB
TypeScript
121 lines
4.2 KiB
TypeScript
import { Link } from '@tanstack/react-router'
|
|
import { BadgeCheckIcon } from 'lucide-react'
|
|
import { Badge, Card, CardContent, cn } from 'ui'
|
|
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import { IntegrationDefinition } from './Integrations.constants'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
|
|
type IntegrationCardProps = IntegrationDefinition & {
|
|
isInstalled?: boolean
|
|
featured?: boolean
|
|
image?: string
|
|
}
|
|
|
|
const INTEGRATION_CARD_STYLE = cn(
|
|
'w-full h-full bg-surface-100 hover:bg-surface-200 hover:border-strong',
|
|
'border border-border rounded-md ease-out duration-200 transition-all'
|
|
)
|
|
|
|
export const IntegrationLoadingCard = () => {
|
|
return (
|
|
<div className={cn(INTEGRATION_CARD_STYLE, 'pl-5 pr-6 py-3 gap-3 inline-flex h-[110px]')}>
|
|
<div className="w-10 h-10 relative">
|
|
<ShimmeringLoader className="w-full h-full bg-foreground-light border rounded-md" />
|
|
</div>
|
|
<div className="grow basis-0 w-full flex flex-col justify-between items-start gap-y-2">
|
|
<div className="w-full flex-col justify-start items-start gap-y-1 flex">
|
|
<ShimmeringLoader className="w-3/4 py-2.5" />
|
|
<ShimmeringLoader className="w-full py-2.5" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const IntegrationCard = ({
|
|
id,
|
|
listingId,
|
|
status,
|
|
name,
|
|
icon,
|
|
description,
|
|
isInstalled,
|
|
featured = false,
|
|
image,
|
|
}: IntegrationCardProps) => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const shouldShowOfficialBadge = !listingId
|
|
|
|
if (featured) {
|
|
return (
|
|
<Link
|
|
to="/project/$ref/integrations/$id/$pageId"
|
|
params={{ ref: project?.ref ?? '_', id, pageId: 'overview' }}
|
|
className="h-full"
|
|
>
|
|
<Card className="h-full">
|
|
{/* Full-width image/icon at the top */}
|
|
<div className="w-full h-24 bg-surface-400 rounded-t-md flex items-center justify-center overflow-hidden relative">
|
|
{image ? (
|
|
<img
|
|
src={image}
|
|
alt=""
|
|
aria-hidden="true"
|
|
className="absolute inset-0 w-full h-full object-cover"
|
|
/>
|
|
) : (
|
|
<div className="w-12 h-12 text-foreground relative">
|
|
{icon({ className: 'w-full h-full text-foreground' })}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<CardContent className="p-6 px-4">
|
|
<div className="flex-col justify-start items-center text-center gap-y-0.5 flex">
|
|
<h3>{name}</h3>
|
|
<p className="text-foreground-light text-sm line-clamp-3">{description}</p>
|
|
<div className="flex items-center gap-x-1 mt-4">
|
|
{status && <Badge variant="warning">{status}</Badge>}
|
|
{shouldShowOfficialBadge && <Badge>Official</Badge>}
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Link
|
|
to="/project/$ref/integrations/$id/$pageId"
|
|
params={{ ref: project?.ref ?? '_', id, pageId: 'overview' }}
|
|
className="h-full"
|
|
>
|
|
<Card className="h-full">
|
|
<CardContent className="flex flex-col p-4 @2xl:p-6 h-full">
|
|
<div className="flex items-start justify-between mb-4">
|
|
<div className="shrink-0 w-10 h-10 relative bg-white border rounded-md flex items-center justify-center">
|
|
{icon()}
|
|
</div>
|
|
{isInstalled && (
|
|
<div className="flex items-center gap-x-1">
|
|
<BadgeCheckIcon size={14} className="text-primary" />
|
|
<span className="text-primary text-xs">Installed</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
<div className="flex-col justify-start items-start gap-y-0.5 flex flex-1">
|
|
<h3 className="text-foreground text-sm">{name}</h3>
|
|
|
|
<p className="text-foreground-light text-xs flex-1">{description}</p>
|
|
<div className="flex items-center gap-x-1 mt-4">
|
|
{status && <Badge variant="warning">{status}</Badge>}
|
|
{shouldShowOfficialBadge && <Badge>Official</Badge>}
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</Link>
|
|
)
|
|
}
|