mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +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>
135 lines
5.3 KiB
TypeScript
135 lines
5.3 KiB
TypeScript
import { Link } from '@tanstack/react-router'
|
|
import { useParams } from 'common'
|
|
import { formatRelative } from 'date-fns'
|
|
import { BadgeCheckIcon, RefreshCwIcon } from 'lucide-react'
|
|
import { Button, Card, CardContent, CardHeader, CardTitle } from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionDescription,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
|
|
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
|
|
|
|
import { isInstalled, isSyncRunning, isUninstalling } from './stripe-sync-status'
|
|
import { ConstrainedIntegrationTabScaffold } from '@/components/interfaces/Integrations/ConstrainedIntegrationTabScaffold'
|
|
import { useStripeSyncStatus } from '@/components/interfaces/Integrations/templates/StripeSyncEngine/useStripeSyncStatus'
|
|
|
|
export const StripeSyncSettingsPage = () => {
|
|
const { ref } = useParams()
|
|
|
|
const {
|
|
schemaComment: { status: installationStatus },
|
|
syncState,
|
|
} = useStripeSyncStatus()
|
|
const installed = isInstalled(installationStatus)
|
|
const isSyncing = isSyncRunning(syncState)
|
|
const uninstalling = isUninstalling(installationStatus)
|
|
|
|
if (!installed || uninstalling) {
|
|
return (
|
|
<ConstrainedIntegrationTabScaffold>
|
|
<PageSection className="py-0">
|
|
<Admonition type="default" description="Stripe Sync Engine is not installed." />
|
|
</PageSection>
|
|
</ConstrainedIntegrationTabScaffold>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ConstrainedIntegrationTabScaffold>
|
|
<PageSection className="py-0!">
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Manage Stripe data</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
Access and manage the synced Stripe data in your database.
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle className="text-foreground-lighter">
|
|
{!syncState ? (
|
|
<ShimmeringLoader className="py-2" />
|
|
) : (
|
|
<div className="flex items-center justify-between gap-2">
|
|
{isSyncing ? (
|
|
<>
|
|
<div className="flex items-center gap-x-3 text-foreground-light">
|
|
<RefreshCwIcon size={14} className="animate-spin" />
|
|
<p>Sync in progress</p>
|
|
</div>
|
|
{syncState.started_at && (
|
|
<p className="text-foreground-light">
|
|
Started{' '}
|
|
<TimestampInfo
|
|
utcTimestamp={syncState.started_at}
|
|
label={
|
|
syncState.started_at
|
|
? formatRelative(new Date(syncState.started_at), new Date())
|
|
: 'recently'
|
|
}
|
|
/>
|
|
</p>
|
|
)}
|
|
</>
|
|
) : (
|
|
<>
|
|
<div className="flex items-center gap-x-3 text-foreground-light">
|
|
<BadgeCheckIcon size={14} />
|
|
<p>All up to date</p>
|
|
</div>
|
|
{syncState.closed_at && (
|
|
<p className="text-foreground-light">
|
|
Last synced{' '}
|
|
<TimestampInfo
|
|
utcTimestamp={syncState.closed_at}
|
|
label={
|
|
syncState.closed_at
|
|
? formatRelative(new Date(syncState.closed_at), new Date())
|
|
: 'recently'
|
|
}
|
|
/>
|
|
</p>
|
|
)}
|
|
</>
|
|
)}
|
|
</div>
|
|
)}
|
|
</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="@container">
|
|
<div className="flex flex-col items-start justify-between gap-4 @md:flex-row @md:items-center">
|
|
<div className="flex flex-col gap-1">
|
|
<h5 className="text-sm">View Stripe data in Table Editor</h5>
|
|
<p className="text-sm text-foreground-light text-balance">
|
|
The Stripe Sync Engine stores all synced data in the{' '}
|
|
<code className="break-keep!">stripe</code> schema. You can view and query this
|
|
data directly in the Table Editor.
|
|
</p>
|
|
</div>
|
|
|
|
<Button asChild className="ml-8 @md:ml-0">
|
|
<Link
|
|
to="/project/$ref/editor"
|
|
params={{ ref: ref ?? '_' }}
|
|
search={{ schema: 'stripe' }}
|
|
>
|
|
Open Table Editor
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
</ConstrainedIntegrationTabScaffold>
|
|
)
|
|
}
|