Skip to content

Commit 6f18324

Browse files
committed
feat: sort activity logs chronologically (oldest first)
- Add sorting by createdAt timestamp in ascending order - Timeline now shows progression from oldest to newest events - Update isLast calculation to use sorted array length - Provides better chronological narrative of transaction activity
1 parent 9a42ff8 commit 6f18324

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,19 @@ function ActivityLogCard({
394394
</p>
395395
) : (
396396
<div className="space-y-4">
397-
{activityLogs.map((log, index) => (
398-
<ActivityLogEntryItem
399-
isLast={index === activityLogs.length - 1}
400-
key={log.id}
401-
log={log}
402-
/>
403-
))}
397+
{activityLogs
398+
.sort(
399+
(a, b) =>
400+
new Date(a.createdAt).getTime() -
401+
new Date(b.createdAt).getTime(),
402+
)
403+
.map((log, index, sortedArray) => (
404+
<ActivityLogEntryItem
405+
isLast={index === sortedArray.length - 1}
406+
key={log.id}
407+
log={log}
408+
/>
409+
))}
404410
</div>
405411
)}
406412
</CardContent>

0 commit comments

Comments
 (0)