Files
supabase/apps/studio/components/interfaces/Auth/EmailTemplates/SpamValidation.tsx
Ivan VasilovandJordi Enric 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

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'
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>
)
}