Skip to content

Commit 707076d

Browse files
committed
feat: improve activity log visual indicators and timestamp handling
- Add color-coded dot icons based on event type: * Success events: green * Nack events: yellow * Failed/Error events: red - Fix timestamp parsing by ensuring 'Z' suffix for proper UTC handling - Resolves '55 years ago' timestamp display issue - Improve visual distinction between different event types in timeline
1 parent a29b8c7 commit 707076d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,21 @@ function ActivityLogEntryItem({
417417
}) {
418418
const [isExpanded, setIsExpanded] = useState(false);
419419

420+
// Fix timestamp by ensuring it has 'Z' suffix for proper UTC parsing
421+
const fixedTimestamp = log.timestamp.endsWith("Z")
422+
? log.timestamp
423+
: `${log.timestamp}Z`;
424+
const timestamp = new Date(fixedTimestamp);
425+
426+
// Get dot color based on event type
427+
const getDotColor = (eventType: string) => {
428+
const type = eventType.toLowerCase();
429+
if (type.includes("success")) return "bg-green-500";
430+
if (type.includes("nack")) return "bg-yellow-500";
431+
if (type.includes("failed") || type.includes("error")) return "bg-red-500";
432+
return "bg-primary"; // default color
433+
};
434+
420435
return (
421436
<div className="relative">
422437
{/* Timeline line */}
@@ -427,7 +442,9 @@ function ActivityLogEntryItem({
427442
<div className="flex items-start gap-4">
428443
{/* Timeline dot */}
429444
<div className="relative flex h-8 w-8 items-center justify-center rounded-full bg-muted">
430-
<div className="h-3 w-3 rounded-full bg-primary" />
445+
<div
446+
className={`h-3 w-3 rounded-full ${getDotColor(log.eventType)}`}
447+
/>
431448
</div>
432449

433450
{/* Content */}
@@ -440,7 +457,7 @@ function ActivityLogEntryItem({
440457
<div className="flex items-center gap-2">
441458
<span className="font-medium text-sm">{log.stageName}</span>
442459
<span className="text-muted-foreground text-xs">
443-
{formatDistanceToNowStrict(new Date(log.timestamp), {
460+
{formatDistanceToNowStrict(timestamp, {
444461
addSuffix: true,
445462
})}
446463
</span>
@@ -470,7 +487,7 @@ function ActivityLogEntryItem({
470487
<div>
471488
<div className="text-muted-foreground">Timestamp</div>
472489
<div className="font-mono text-xs">
473-
{format(new Date(log.timestamp), "PP pp z")}
490+
{format(timestamp, "PP pp z")}
474491
</div>
475492
</div>
476493
</div>

0 commit comments

Comments
 (0)