import React from 'react'; import { useNavigate } from 'react-router-dom'; import { ShieldCheck, Clock, ExternalLink } from 'lucide-react'; import { formatTimelineDate } from '../../utils/dateUtils'; const categoryDotColors = { 'Hardware': '#f97316', 'Network': '#3b82f6', 'Access': '#8b5cf6', 'Software': '#16a34a', 'Human Resources': '#ec4899', 'Other': '#6b7280' }; const TicketTable = ({ tickets = [], isLoading = false, limit = null }) => { const navigate = useNavigate(); const teamMap = { 'Network': 'Network Services', 'Hardware': 'IT Inventory', 'Software': 'Cloud Apps Team', 'Access': 'Security Ops', 'Human Resources': 'HR Systems', 'Other': 'IT Service Desk' }; const getPriorityStyle = (priority) => { const p = priority?.toLowerCase(); if (p === 'critical') return { background: '#FEF2F2', color: '#DC2626', border: '1px solid #FECACA' }; if (p === 'high') return { background: '#FFF7ED', color: '#EA580C', border: '1px solid #FED7AA' }; if (p === 'medium') return { background: '#FEFCE8', color: '#CA8A04', border: '1px solid #FDE68A' }; return { background: '#F0FDF4', color: '#16A34A', border: '1px solid #BBF7D0' }; }; const getStatusStyle = (status) => { const s = status?.toLowerCase() || ''; if (s.includes('resolv')) return { bg: '#f1f5f9', text: '#64748b', border: '#e2e8f0' }; if (s.includes('progress')) return { bg: '#eff6ff', text: '#2563eb', border: '#bfdbfe' }; return { bg: '#fffbeb', text: '#d97706', border: '#fde68a' }; }; const displayTickets = limit ? tickets.slice(0, limit) : tickets; if (isLoading) return (
Synchronizing System Data...
All systems green. No tickets require review.
| {h} | ))}|||||
|---|---|---|---|---|---|
|
#{truncId}
|
{/* Incident Context - FIXED */}
{profilePic ? (
{initial}
)}
{truncSubject}
{effectiveCategory || 'General'}
|
{/* Category with colored dot */}
{effectiveCategory}
{effectiveSubcategory && {effectiveSubcategory}}
|
{/* Risk Factor */}
{effectivePriority || 'NORMAL'} | {/* Assigned Ops */}
{effectiveTeam?.charAt(0)}
{effectiveTeam}
|
{/* Status */}
{ticket.status?.replace('by Human Support', '').trim()} |