'use client'; import { Download, Eye, Pencil, Play, Trash2 } from 'lucide-react'; import { useTranslations } from 'next-intl'; 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, WAFIPGroupType } from '@/lib/services/openflare'; import { formatDateTime } from '@/lib/utils'; 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) { const t = useTranslations('ipGroups'); const typeLabel = (type: WAFIPGroupType) => t(`types.${type}`); return ( {t('columns.name')} {t('columns.type')} {t('columns.status')} {t('columns.ipCount')} {t('columns.refCount')} {t('columns.syncStatus')} {t('columns.updatedAt')} {t('columns.actions')} {groups.map((group) => ( {group.name} {typeLabel(group.type)} {group.enabled ? t('enabled') : t('disabled')} {group.ip_list.length} {group.referenced_by_rule_count} {group.last_sync_status ? `${group.last_sync_status}: ${group.last_sync_message}` : t('noSyncRecord')} {group.updated_at ? formatDateTime(group.updated_at) : '—'}
{group.type === 'automatic' ? ( ) : null} {group.type === 'subscription' || group.type === 'automatic' ? ( ) : null}
))}
); }