mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03: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>
67 lines
2.7 KiB
TypeScript
67 lines
2.7 KiB
TypeScript
import { AnimatePresence, motion } from 'framer-motion'
|
|
import { CardContent, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
|
|
import { Markdown } from '@/components/interfaces/Markdown'
|
|
import { ValidateSpamResponse } from '@/data/auth/validate-spam-mutation'
|
|
|
|
interface SpamValidationProps {
|
|
spamRules?: ValidateSpamResponse['rules']
|
|
}
|
|
|
|
// [Joshen] According to API, we label as a spam risk as long as there are spam
|
|
// rules identified with scores above 0. Scores are irrelevant in our context and
|
|
// are hence not visualized in the UI
|
|
|
|
export const SpamValidation = ({ spamRules = [] }: SpamValidationProps) => {
|
|
const rules = spamRules.filter((rule) => rule.score >= 0)
|
|
|
|
return (
|
|
<AnimatePresence>
|
|
{rules.length > 0 && (
|
|
<motion.div
|
|
className="border-b"
|
|
initial={{ height: 0, opacity: 0 }}
|
|
animate={{ height: 'auto', opacity: 1 }}
|
|
exit={{ height: 0, opacity: 0 }}
|
|
transition={{ duration: 0.2, ease: 'easeOut' }}
|
|
>
|
|
<CardContent className="py-6 flex flex-col gap-2">
|
|
<Admonition
|
|
type="destructive"
|
|
title="Issues to resolve"
|
|
description="This email is likely to be marked as spam by email servers. Please resolve the below issues before saving."
|
|
className="bg-destructive-300/50 dark:bg-destructive-200 border-destructive-400"
|
|
/>
|
|
|
|
<div className="flex flex-col gap-1">
|
|
<div className="w-full border rounded-md overflow-hidden">
|
|
<Table>
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead>Warning</TableHead>
|
|
<TableHead>Description</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{rules.map((rule) => (
|
|
<TableRow key={rule.name}>
|
|
<TableCell className="font-mono">{rule.name}</TableCell>
|
|
<TableCell>{rule.desc}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
</div>
|
|
<Markdown
|
|
className="max-w-none! text-foreground-lighter text-xs mt-2"
|
|
content="Spam validation is powered by [SpamAssassin](https://spamassassin.apache.org/doc.html). Full list of all available warnings can be found [here](https://gist.github.com/ychaouche/a2faff159c2a1fea16019156972c7f8b)."
|
|
/>
|
|
</div>
|
|
</CardContent>
|
|
</motion.div>
|
|
)}
|
|
</AnimatePresence>
|
|
)
|
|
}
|