Skip to content

feat(webhook-log): Add ascending/descending date sort controls to alert history#169

Open
NUMBER72857 wants to merge 1 commit into
Tx-wat:mainfrom
NUMBER72857:feat/103-alert-history-date-sorting
Open

feat(webhook-log): Add ascending/descending date sort controls to alert history#169
NUMBER72857 wants to merge 1 commit into
Tx-wat:mainfrom
NUMBER72857:feat/103-alert-history-date-sorting

Conversation

@NUMBER72857
Copy link
Copy Markdown

Summary

Adds a reusable useSortedLog hook and SortToggle button so users can switch between newest-first and oldest-first ordering in the webhook log / alert history.

Changes

  • hooks/useSortedLog.ts: generic sort hook; toggleSort(), setSortDirection(), memoised sorted array; immutable (never mutates source)
  • components/SortToggle.tsx: accessible button with ↑/↓ arrow and label; plugs into any table header
  • __tests__/useSortedLog.test.ts: 8 tests — default sort, direction init, toggle, immutability, empty list, malformed timestamps

Integration into WebhookLog.tsx

import { useSortedLog } from '@/hooks/useSortedLog';
import { SortToggle } from '@/components/SortToggle';

const { sortedEntries, sortDirection, toggleSort } = useSortedLog(entries);

// In the table header:
<th><SortToggle direction={sortDirection} onToggle={toggleSort} /></th>

// In the table body, iterate sortedEntries instead of entries

Closes #103

…t#103)

- useSortedLog<T>(): sort hook with desc/asc toggle, does not mutate source array
- Defaults to desc (newest first); malformed timestamps handled without throw
- SortToggle component: accessible button with arrow icon and 'Newest/Oldest first' label
- 8 unit tests: default sort, asc init, toggle flip, setSortDirection, immutability, empty, bad timestamp

Closes Tx-wat#103
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@NUMBER72857 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add date sorting controls to alert history

2 participants