mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
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>
180 lines
6.2 KiB
TypeScript
180 lines
6.2 KiB
TypeScript
import { useParams } from 'common'
|
|
import { Logs } from 'icons'
|
|
import { BookOpenIcon } from 'lucide-react'
|
|
import { useTheme } from 'next-themes'
|
|
import { useEffect, useState } from 'react'
|
|
import { AiIconAnimation, Button, Card, CardContent, CardHeader, CardTitle } from 'ui'
|
|
import { Image } from 'ui-patterns/Image'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
|
|
import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
|
|
import { DynamicLink } from '@/components/ui/DynamicLink'
|
|
import { BASE_PATH, DOCS_URL } from '@/lib/constants'
|
|
import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
|
|
import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
|
|
|
|
export const OverviewLearnMore = () => {
|
|
const [isMounted, setIsMounted] = useState(false)
|
|
const { ref } = useParams()
|
|
const aiSnap = useAiAssistantStateSnapshot()
|
|
const { openSidebar } = useSidebarManagerSnapshot()
|
|
const { resolvedTheme } = useTheme()
|
|
|
|
useEffect(() => {
|
|
setIsMounted(true)
|
|
}, [])
|
|
|
|
const isLight = resolvedTheme === 'light'
|
|
|
|
const LearnMoreCards = [
|
|
{
|
|
label: 'Docs',
|
|
title: 'Auth docs',
|
|
description: 'Read more on Supabase auth, managing users and more.',
|
|
image: isLight
|
|
? `${BASE_PATH}/img/auth-overview/auth-overview-docs-light.jpg`
|
|
: `${BASE_PATH}/img/auth-overview/auth-overview-docs.jpg`,
|
|
actions: [
|
|
{
|
|
label: 'Docs',
|
|
href: `${DOCS_URL}/guides/auth`,
|
|
icon: <BookOpenIcon />,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: 'Assistant',
|
|
title: 'Explain auth errors',
|
|
description: 'Our Assistant can help you debug and fix authentication errors.',
|
|
image: isLight
|
|
? `${BASE_PATH}/img/auth-overview/auth-overview-assistant-light.jpg`
|
|
: `${BASE_PATH}/img/auth-overview/auth-overview-assistant.jpg`,
|
|
actions: [
|
|
{
|
|
label: 'Ask Assistant',
|
|
onClick: () => {
|
|
openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
|
|
aiSnap.newChat({
|
|
name: 'Auth Help',
|
|
initialInput:
|
|
'Look at my logs related to Supabase Auth and help me debug the recent errors.',
|
|
suggestions: {
|
|
title: 'I can help you with authentication issues. Here are some common problems:',
|
|
prompts: [
|
|
{
|
|
label: 'Login Issues',
|
|
description: 'Why are users unable to log in to my app?',
|
|
},
|
|
{
|
|
label: 'JWT Problems',
|
|
description: 'Help me understand and fix JWT token issues',
|
|
},
|
|
{
|
|
label: 'RLS Policies',
|
|
description: 'Explain my Row Level Security policies and fix issues',
|
|
},
|
|
{
|
|
label: 'Provider Setup',
|
|
description: 'Help me configure OAuth providers correctly',
|
|
},
|
|
],
|
|
},
|
|
})
|
|
},
|
|
icon: <AiIconAnimation size={14} />,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: 'Logs',
|
|
title: 'Dive into the logs',
|
|
description: 'Auth logs provide a deeper view into your auth requests.',
|
|
image: isLight
|
|
? `${BASE_PATH}/img/auth-overview/auth-overview-logs-light.jpg`
|
|
: `${BASE_PATH}/img/auth-overview/auth-overview-logs.jpg`,
|
|
actions: [
|
|
{
|
|
label: 'Go to logs',
|
|
href: `/project/${ref}/logs/auth-logs`,
|
|
icon: <Logs />,
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
if (!isMounted) return null
|
|
|
|
return (
|
|
<PageSection>
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Learn more</PageSectionTitle>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
|
{LearnMoreCards.map((card) => (
|
|
<Card key={card.label} className="relative">
|
|
<CardHeader className="absolute top-0 left-0 right-0 border-b-0">
|
|
<CardTitle className="text-foreground-lighter">{card.label}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="p-0">
|
|
<div className="bg-black/20 flex w-full">
|
|
<Image
|
|
src={card.image && card?.image}
|
|
alt={card.title}
|
|
width={620}
|
|
height={324}
|
|
className="object-fit"
|
|
/>
|
|
</div>
|
|
<div className="p-4 flex flex-col">
|
|
<div className="flex flex-col gap-1 mb-4 flex-1">
|
|
<h4>{card.title}</h4>
|
|
<p className="text-sm text-foreground-lighter">{card.description}</p>
|
|
</div>
|
|
<div className="flex flex-col gap-2 items-start mt-auto">
|
|
{card.actions.map((action) => {
|
|
if ('href' in action) {
|
|
return (
|
|
<Button
|
|
key={action.label}
|
|
className="inline-flex"
|
|
icon={action.icon}
|
|
asChild
|
|
>
|
|
<DynamicLink href={action.href} className="inline-flex">
|
|
{action.label}
|
|
</DynamicLink>
|
|
</Button>
|
|
)
|
|
} else {
|
|
return (
|
|
<Button
|
|
key={action.label}
|
|
onClick={action.onClick}
|
|
className="inline-flex"
|
|
icon={action.icon}
|
|
>
|
|
{action.label}
|
|
</Button>
|
|
)
|
|
}
|
|
})}
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
))}
|
|
</div>
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
)
|
|
}
|