Skip to content

Commit c2f6b80

Browse files
authored
feat: Add 'Sent At' timestamp column to webhook deliveries table (#6499)
* Add 'Sent At' timestamp column to webhook deliveries table - Add FormattedDateTime import for proper date formatting - Add new 'Sent At' column showing webhook delivery timestamp - Enable sorting on created_at field - Update colspan calculation for expanded rows (4→5 columns) - Display timestamp with short date and time format for readability Fixes #6316 * Fix enableSorting for created_at column Set enableSorting to false for consistency with other columns
1 parent 16dbafd commit c2f6b80

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

clients/apps/web/src/components/Settings/Webhook/WebhookDeliveriesTable.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
DataTableColumnDef,
2323
DataTableColumnHeader,
2424
} from '@polar-sh/ui/components/atoms/DataTable'
25+
import FormattedDateTime from '@polar-sh/ui/components/atoms/FormattedDateTime'
2526
import { CellContext } from '@tanstack/react-table'
2627
import { useRouter } from 'next/navigation'
2728
import React, { useCallback } from 'react'
@@ -195,6 +196,31 @@ const DeliveriesTable: React.FC<DeliveriesTableProps> = ({
195196
return <pre>{payload['type']}</pre>
196197
},
197198
},
199+
{
200+
accessorKey: 'created_at',
201+
enableSorting: false,
202+
header: ({ column }) => (
203+
<DataTableColumnHeader column={column} title="Sent At" />
204+
),
205+
206+
cell: (props) => {
207+
const { row } = props
208+
const { original: delivery } = row
209+
210+
if (delivery.isSubRow) {
211+
return null
212+
}
213+
214+
return (
215+
<FormattedDateTime
216+
datetime={delivery.created_at}
217+
resolution="time"
218+
dateStyle="short"
219+
timeStyle="short"
220+
/>
221+
)
222+
},
223+
},
198224
]
199225

200226
return (
@@ -213,7 +239,7 @@ const DeliveriesTable: React.FC<DeliveriesTableProps> = ({
213239
getCellColSpan={(cell) => {
214240
if (cell.row.original.isSubRow) {
215241
if (cell.column.id === 'id') {
216-
return 4
242+
return 5
217243
}
218244
// hide cell
219245
return 0

0 commit comments

Comments
 (0)