Skip to content

Commit e82de0c

Browse files
Refactor activity log entry UI with improved event type styling
Co-authored-by: joaquim.verges <[email protected]>
1 parent 6f18324 commit e82de0c

File tree

1 file changed

+40
-24
lines changed

1 file changed

+40
-24
lines changed

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

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export function TransactionDetailsUI({
5454
executionResult && "error" in executionResult
5555
? executionResult.error.message
5656
: executionResult && "revertData" in executionResult
57-
? executionResult.revertData?.revertReason
58-
: null;
57+
? executionResult.revertData?.revertReason
58+
: null;
5959
const errorDetails =
6060
executionResult && "error" in executionResult
6161
? executionResult.error
@@ -423,15 +423,34 @@ function ActivityLogEntryItem({
423423
}) {
424424
const [isExpanded, setIsExpanded] = useState(false);
425425

426-
// Get dot color based on event type
427-
const getDotColor = (eventType: string) => {
426+
// Get colors based on event type
427+
const getEventTypeColors = (eventType: string) => {
428428
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("failure")) return "bg-red-500";
432-
return "bg-primary"; // default color
429+
if (type.includes("success"))
430+
return {
431+
dot: "bg-green-500",
432+
badge:
433+
"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300",
434+
};
435+
if (type.includes("nack"))
436+
return {
437+
dot: "bg-yellow-500",
438+
badge:
439+
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",
440+
};
441+
if (type.includes("failure"))
442+
return {
443+
dot: "bg-red-500",
444+
badge: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300",
445+
};
446+
return {
447+
dot: "bg-primary",
448+
badge: "bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-300",
449+
};
433450
};
434451

452+
const colors = getEventTypeColors(log.eventType);
453+
435454
return (
436455
<div className="relative">
437456
{/* Timeline line */}
@@ -442,9 +461,7 @@ function ActivityLogEntryItem({
442461
<div className="flex items-start gap-4">
443462
{/* Timeline dot */}
444463
<div className="relative flex h-8 w-8 items-center justify-center rounded-full bg-muted">
445-
<div
446-
className={`h-3 w-3 rounded-full ${getDotColor(log.eventType)}`}
447-
/>
464+
<div className={`h-3 w-3 rounded-full ${colors.dot}`} />
448465
</div>
449466

450467
{/* Content */}
@@ -456,34 +473,33 @@ function ActivityLogEntryItem({
456473
>
457474
<div className="flex items-center gap-2">
458475
<span className="font-medium text-sm">{log.stageName}</span>
476+
<span
477+
className={`px-2 py-1 text-xs rounded-full ${colors.badge}`}
478+
>
479+
{log.eventType}
480+
</span>
481+
</div>
482+
<div className="flex items-center gap-2">
459483
<span className="text-muted-foreground text-xs">
460484
{formatDistanceToNowStrict(new Date(log.createdAt), {
461485
addSuffix: true,
462486
})}
463487
</span>
488+
{isExpanded ? (
489+
<ChevronDownIcon className="h-4 w-4 text-muted-foreground" />
490+
) : (
491+
<ChevronRightIcon className="h-4 w-4 text-muted-foreground" />
492+
)}
464493
</div>
465-
{isExpanded ? (
466-
<ChevronDownIcon className="h-4 w-4 text-muted-foreground" />
467-
) : (
468-
<ChevronRightIcon className="h-4 w-4 text-muted-foreground" />
469-
)}
470494
</button>
471495

472496
{isExpanded && (
473497
<div className="mt-2 space-y-3 px-2">
474498
<div className="grid grid-cols-2 gap-4 text-sm">
475-
<div>
476-
<div className="text-muted-foreground">Event Type</div>
477-
<div className="font-mono">{log.eventType}</div>
478-
</div>
479499
<div>
480500
<div className="text-muted-foreground">Executor</div>
481501
<div className="font-mono">{log.executorName}</div>
482502
</div>
483-
<div>
484-
<div className="text-muted-foreground">Batch Index</div>
485-
<div className="font-mono">{log.batchIndex}</div>
486-
</div>
487503
<div>
488504
<div className="text-muted-foreground">Created At</div>
489505
<div className="font-mono text-xs">

0 commit comments

Comments
 (0)