diff --git a/components/anti-cheat-badge.tsx b/components/anti-cheat-badge.tsx new file mode 100644 index 0000000..bd009e6 --- /dev/null +++ b/components/anti-cheat-badge.tsx @@ -0,0 +1,80 @@ +import { Shield, ShieldCheck, ShieldX, ShieldQuestion } from "lucide-react"; +import { cn } from "~/lib/utils"; + +interface AntiCheatBadgeProps { + antiCheatRelevant: boolean; + antiCheatStatus: "none" | "supported" | "unsupported" | "unknown" | null; + antiCheatName?: string | null; + compact?: boolean; // for list views + className?: string; +} + +const statusConfig = { + supported: { + icon: ShieldCheck, + label: "Anti-Cheat: Supported", + color: "bg-green-500/15 text-green-400 border-green-500/30", + }, + unsupported: { + icon: ShieldX, + label: "Anti-Cheat: Unsupported", + color: "bg-red-500/15 text-red-400 border-red-500/30", + }, + unknown: { + icon: ShieldQuestion, + label: "Anti-Cheat: Unknown", + color: "bg-yellow-500/15 text-yellow-400 border-yellow-500/30", + }, + none: { + icon: Shield, + label: "No Anti-Cheat", + color: "bg-zinc-500/15 text-zinc-400 border-zinc-500/30", + }, +} as const; + +export function AntiCheatBadge({ + antiCheatRelevant, + antiCheatStatus, + antiCheatName, + compact = false, + className, +}: AntiCheatBadgeProps) { + if (!antiCheatRelevant || !antiCheatStatus || antiCheatStatus === "none") { + return null; + } + + const config = statusConfig[antiCheatStatus]; + const Icon = config.icon; + + if (compact) { + return ( + + + {antiCheatStatus === "unsupported" && "AC"} + + ); + } + + return ( +
+ + {config.label} + {antiCheatName && ( + ({antiCheatName}) + )} +
+ ); +}