feat(design): migrate the Incidents list to TableCard with server-side views, sort, filters and paging

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 09:33:44 +08:00
co-authored by Claude Haiku 4.5
parent 9ba708ecb7
commit a64b951922
15 changed files with 576 additions and 547 deletions
@@ -2423,8 +2423,8 @@ describe('IncidentTable', () => {
it('renders rows with reference, label pills and type', () => {
render(<IncidentTable {...props} />)
expect(screen.getAllByText('SCW1-202607-0001').length).toBeGreaterThan(0)
expect(screen.getAllByText('Reported')[0].className).toContain('bg-st-amber-bg')
expect(screen.getAllByText('CAPA pending')[0].className).toContain('bg-st-orange-bg')
expect(screen.getAllByText('Reported').some(el => el.className.includes('bg-st-amber-bg'))).toBe(true)
expect(screen.getAllByText('CAPA pending').some(el => el.className.includes('bg-st-orange-bg'))).toBe(true)
expect(screen.getAllByText('Near Miss').length).toBeGreaterThan(0)
expect(screen.getAllByText('Injury / Medical').length).toBeGreaterThan(0)
})
@@ -2450,7 +2450,7 @@ describe('IncidentTable', () => {
render(<IncidentTable {...props} />)
fireEvent.click(screen.getByRole('button', { name: /Reference/ }))
expect(replace).toHaveBeenCalledWith('/hse/incidents?sort=reference_no&dir=asc')
expect(screen.getByText('Reported').closest('th')?.getAttribute('aria-sort')).toBe('descending')
expect(screen.getByRole('columnheader', { name: /Reported/ }).getAttribute('aria-sort')).toBe('descending')
})
it('changes a filter chip through the URL and clears it', () => {