'use client'; import { Download, Eye, Pencil, Play, Trash2 } from 'lucide-react'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import type { WAFIPGroup } from '@/lib/services/openflare'; import { formatDateTime } from '@/lib/utils'; import { ipGroupTypeLabels } from './helpers'; interface IPGroupsTableProps { groups: WAFIPGroup[]; syncingId: number | null; onView: (group: WAFIPGroup) => void; onEdit: (group: WAFIPGroup) => void; onDelete: (group: WAFIPGroup) => void; onSync: (group: WAFIPGroup) => void; onTest: (group: WAFIPGroup) => void; } export function IPGroupsTable({ groups, syncingId, onView, onEdit, onDelete, onSync, onTest, }: IPGroupsTableProps) { return ( 名称 类型 状态 IP 数 引用次数 同步状态 更新时间 操作 {groups.map((group) => ( {group.name} {ipGroupTypeLabels[group.type]} {group.enabled ? '启用' : '停用'} {group.ip_list.length} {group.referenced_by_rule_count} {group.last_sync_status ? `${group.last_sync_status}: ${group.last_sync_message}` : '尚无同步记录'} {group.updated_at ? formatDateTime(group.updated_at) : '—'}
{group.type === 'automatic' ? ( ) : null} {group.type === 'subscription' || group.type === 'automatic' ? ( ) : null}
))}
); }