mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 09:59:03 +08:00
Follow-up to #48344: collapses the two resolution paths for the Admonition module into one. `src/admonition.tsx` was a back-compat shim re-exporting `src/Admonition/`. Two ways to resolve one module is exactly what produced the macOS self-import bug fixed in #48344, and the local typecheck errors that #48374 worked around. This removes the shim and standardizes on the PascalCase subpath, matching every other export in the package. **Changed:** - Codemodded all 246 `ui-patterns/admonition` imports to `ui-patterns/Admonition` (240 `.tsx`, 5 `.mdx`, 1 `.ts` across studio, docs, www, design-system, and lite-studio) - Pointed the 5 internal `'../admonition'` imports back at the `'../Admonition'` directory **Removed:** - `packages/ui-patterns/src/admonition.tsx`, and its `./admonition` entry in the exports map (regenerated with `pnpm gen:exports`) ## To test - `grep -r "ui-patterns/admonition" --include='*.ts*'` → no hits - `pnpm test:case-hazards` → passes - `pnpm typecheck` → all 15 tasks green - `pnpm --filter studio run lint:ratchet` → passes - `pnpm --filter ui-patterns vitest run src/Admonition` → 11 tests pass <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Standardized Admonition component imports across the application and documentation. * Improved compatibility with case-sensitive environments by using the canonical component path. * Removed the legacy Admonition import entry point. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
91 lines
3.2 KiB
TypeScript
91 lines
3.2 KiB
TypeScript
import { Settings, Trash2, TriangleAlert } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { Badge, Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
|
|
import { type ResourceGroup } from './MarketplaceIntegrationSettingsTab.types'
|
|
import { type ConnectedResource } from '@/components/interfaces/Integrations/Landing/Landing.utils'
|
|
|
|
export const ResourceGroupSection = ({
|
|
group,
|
|
onRemove,
|
|
}: {
|
|
group: ResourceGroup
|
|
onRemove: (resource: ConnectedResource) => void
|
|
}) => {
|
|
return (
|
|
<section className="flex flex-col gap-y-4 border-b py-8 first:pt-0 last:border-b-0">
|
|
<div className="flex flex-col gap-y-2">
|
|
<div className="flex items-center gap-x-2">
|
|
<h3 className="text-base text-foreground">{group.title}</h3>
|
|
{group.missing ? (
|
|
<Badge variant="warning" className="gap-x-1.5">
|
|
<TriangleAlert size={12} strokeWidth={1.5} />
|
|
Not connected
|
|
</Badge>
|
|
) : (
|
|
group.badge && (
|
|
<Badge variant="success" className="gap-x-1.5">
|
|
<span className="h-1.5 w-1.5 rounded-full bg-brand" />
|
|
{group.badge}
|
|
</Badge>
|
|
)
|
|
)}
|
|
</div>
|
|
<p className="text-sm text-foreground-light max-w-2xl">{group.description}</p>
|
|
</div>
|
|
|
|
<Admonition
|
|
type={group.missing ? 'warning' : 'default'}
|
|
className="m-0 max-w-2xl"
|
|
title={group.missing ? 'This resource is missing' : undefined}
|
|
>
|
|
{group.missing ? group.missingNote : group.note}
|
|
</Admonition>
|
|
|
|
{group.missing ? (
|
|
group.manageAction && (
|
|
<div className="max-w-2xl">
|
|
<Button asChild variant="default" icon={<Settings />}>
|
|
<Link href={group.manageAction.href}>{group.manageAction.label}</Link>
|
|
</Button>
|
|
</div>
|
|
)
|
|
) : (
|
|
<div className="max-w-2xl divide-y rounded-md border bg-surface-100">
|
|
{group.items.map((item) => (
|
|
<div
|
|
key={item.resource.key}
|
|
className="flex items-center justify-between gap-x-4 px-4 py-3"
|
|
>
|
|
<div className="flex min-w-0 flex-col">
|
|
<code
|
|
className="truncate font-mono text-sm text-foreground"
|
|
title={item.identifier}
|
|
>
|
|
{item.identifier}
|
|
</code>
|
|
{item.meta && <span className="text-xs text-foreground-lighter">{item.meta}</span>}
|
|
</div>
|
|
<div className="flex shrink-0 items-center gap-x-2">
|
|
{group.manageAction && (
|
|
<Button asChild variant="default" icon={<Settings />}>
|
|
<Link href={group.manageAction.href}>{group.manageAction.label}</Link>
|
|
</Button>
|
|
)}
|
|
<Button
|
|
variant="default"
|
|
icon={<Trash2 className="text-foreground-light" />}
|
|
onClick={() => onRemove(item.resource)}
|
|
>
|
|
Remove
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)}
|
|
</section>
|
|
)
|
|
}
|