'use client'; import {X} from 'lucide-react'; import {Badge} from '@/components/ui/badge'; import {Button} from '@/components/ui/button'; interface RuleListSectionProps { title: string; description: string; items: string[]; groupItems?: Array<{ id: number; name: string; enabled: boolean }>; tone: 'whitelist' | 'blacklist'; emptyText: string; onRemove: (item: string) => void; onRemoveGroup?: (id: number) => void; } export function RuleListSection({ title, description, items, groupItems = [], tone, emptyText, onRemove, onRemoveGroup, }: RuleListSectionProps) { const total = items.length + groupItems.length; const badgeVariant = tone === 'whitelist' ? 'secondary' : 'destructive'; return (

{title}

{description}

{total}
{total > 0 ? (
{groupItems.map((group) => ( IP组: {group.name} {!group.enabled ? ' (停用)' : ''} ))} {items.map((item) => ( {item} ))}
) : (

{emptyText}

)}
); }