chore: ticket section implement sse

This commit is contained in:
2026-06-19 18:06:11 +05:30
parent a567a52e26
commit fffd8e3e12
25 changed files with 711 additions and 307 deletions

View File

@@ -6,14 +6,7 @@ import type { ColumnDef } from '@tanstack/react-table';
import type { TicketListItem } from '@/types';
import { TicketStatusBadge } from './TicketStatusBadge';
function formatDate(value: string | null | undefined) {
if (!value) return '-';
return new Intl.DateTimeFormat('en-IN', {
dateStyle: 'medium',
timeStyle: 'short',
}).format(new Date(value));
}
import { formatDate } from '@/utils/date';
export function useTicketColumns(): ColumnDef<TicketListItem>[] {
return useMemo(
@@ -32,21 +25,28 @@ export function useTicketColumns(): ColumnDef<TicketListItem>[] {
size: 150,
cell: ({ row }) => <TicketStatusBadge status={row.original.status} />,
},
{
accessorKey: 'chainage_name',
header: 'Segment',
size: 180,
cell: ({ row }) => row.original.chainage_name || 'N/A',
},
{
accessorKey: 'detection_count',
header: 'Detections',
size: 120,
},
{
accessorKey: 'assigned_to_email',
accessorKey: 'assigned_to_name',
header: 'Assigned To',
size: 220,
cell: ({ row }) => row.original.assigned_to_email || '-',
cell: ({ row }) => row.original.assigned_to_name || 'N/A',
},
{
accessorKey: 'created_by_email',
accessorKey: 'created_by_name',
header: 'Uploaded By',
size: 220,
cell: ({ row }) => row.original.created_by_name || 'N/A',
},
{
accessorKey: 'updated_at',

View File

@@ -2,7 +2,7 @@
import type { ReactNode } from 'react';
import type { ColumnDef } from '@tanstack/react-table';
import { BarChart3, Eye, ChartPie } from 'lucide-react';
import { Eye } from 'lucide-react';
import { DataTable } from '@/components/data-table';
import type { TicketListItem } from '@/types';
@@ -18,7 +18,6 @@ interface TicketTableProps {
onPageChange: (skip: number) => void;
onLimitChange: (limit: number) => void;
onView: (ticket: TicketListItem) => void;
onShowAnalytics: (ticket: TicketListItem) => void;
}
export function TicketTable({
@@ -32,7 +31,6 @@ export function TicketTable({
onPageChange,
onLimitChange,
onView,
onShowAnalytics,
}: TicketTableProps) {
return (
<DataTable
@@ -49,11 +47,6 @@ export function TicketTable({
icon: <Eye className="size-4" />,
onClick: onView,
},
{
label: 'Show Analytics',
icon: <ChartPie className="size-4" />,
onClick: onShowAnalytics,
},
]}
pagination={{
skip,