Skip to content

Commit

Permalink
fix(dashboard): Another create with UI fixes (#7583)
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros authored Jan 24, 2025
1 parent 60d3174 commit 73e2232
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 52 deletions.
72 changes: 34 additions & 38 deletions apps/dashboard/src/components/activity/activity-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,46 +83,42 @@ export function ActivityPanel({
transition={{ duration: 0.5, ease: 'easeOut' }}
className="h-full"
>
<div>
<div
className={cn(
'flex items-center gap-2 border-b border-t border-neutral-200 border-b-neutral-100 px-3 pb-2 pt-[7px]',
headerClassName,
overviewHeaderClassName
)}
>
<RiRouteFill className="h-3 w-3" />
<span className="text-foreground-950 text-sm font-medium">
{activity.template?.name || 'Deleted workflow'}
</span>
</div>
<ActivityOverview activity={activity} />

<div className={cn('flex items-center gap-2 border-b border-t border-neutral-100 p-2 px-3', headerClassName)}>
<RiPlayCircleLine className="h-3 w-3" />
<span className="text-foreground-950 text-sm font-medium">Logs</span>
</div>

{isMerged && (
<div className="px-3 py-3">
<InlineToast
ctaClassName="text-foreground-950"
variant={'tip'}
ctaLabel="View Execution"
onCtaClick={(e) => {
e.stopPropagation();
e.preventDefault();

if (activity._digestedNotificationId) {
onActivitySelect(activity._digestedNotificationId);
}
}}
description="Remaining execution has been merged to an active Digest of an existing workflow execution."
/>
</div>
<div
className={cn(
'flex items-center gap-2 border-b border-t border-neutral-200 border-b-neutral-100 px-3 pb-2 pt-[7px]',
headerClassName,
overviewHeaderClassName
)}
<LogsSection jobs={activity.jobs} />
>
<RiRouteFill className="h-3 w-3" />
<span className="text-foreground-950 text-sm font-medium">{activity.template?.name || 'Deleted workflow'}</span>
</div>
<ActivityOverview activity={activity} />

<div className={cn('flex items-center gap-2 border-b border-t border-neutral-100 p-2 px-3', headerClassName)}>
<RiPlayCircleLine className="h-3 w-3" />
<span className="text-foreground-950 text-sm font-medium">Logs</span>
</div>

{isMerged && (
<div className="px-3 py-3">
<InlineToast
ctaClassName="text-foreground-950"
variant={'tip'}
ctaLabel="View Execution"
onCtaClick={(e) => {
e.stopPropagation();
e.preventDefault();

if (activity._digestedNotificationId) {
onActivitySelect(activity._digestedNotificationId);
}
}}
description="Remaining execution has been merged to an active Digest of an existing workflow execution."
/>
</div>
)}
<LogsSection jobs={activity.jobs} />
</motion.div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/components/activity/activity-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function ActivityTable({
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.2 }}
className="flex min-h-full min-w-[800px] flex-1 flex-col"
className="flex min-h-full flex-1 flex-col"
>
<Table
isLoading={isLoading}
Expand Down Expand Up @@ -181,7 +181,7 @@ function getSubscriberDisplay(subscriber?: Pick<ISubscriber, '_id' | 'subscriber
if (!subscriber) return '';

if (subscriber.firstName || subscriber.lastName) {
return `• ${subscriber.firstName || ''} ${subscriber.lastName || ''}`;
return `• ${subscriber.firstName || ''} ${subscriber.lastName || ''}`.trim();
}

return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export function ActivityOverview({ activity }: ActivityOverviewProps) {

<OverviewItem label="Transaction ID" value={activity.transactionId} isCopyable />

<OverviewItem label="Subscriber ID" value={activity.subscriber?.subscriberId ?? ''} isCopyable />
<OverviewItem
label="Subscriber ID"
isDeleted={!activity.subscriber}
value={(activity.subscriber?.subscriberId || activity._subscriberId) ?? ''}
isCopyable
/>

<OverviewItem label="Triggered at" value={format(new Date(activity.createdAt), 'MMM d yyyy, HH:mm:ss')}>
<TimeDisplayHoverCard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
import { CopyButton } from '@/components/primitives/copy-button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/primitives/tooltip';
import { cn } from '@/utils/ui';
import { ReactNode } from 'react';

interface OverviewItemProps {
label: string;
value?: string;
children?: ReactNode;
className?: string;
isMonospace?: boolean;
isCopyable?: boolean;
children?: ReactNode;
isDeleted?: boolean;
isMonospace?: boolean;
label: string;
value?: string;
}

export function OverviewItem({
label,
value,
children,
className = '',
isMonospace = true,
isCopyable = false,
children,
isDeleted = false,
isMonospace = true,
label,
value,
}: OverviewItemProps) {
const childrenComponent = children || (
<span className={cn('text-foreground-600 text-xs', { 'font-mono': isMonospace, 'line-through': isDeleted })}>
{value}
</span>
);

const wrappedChildren = isDeleted ? (
<Tooltip>
<TooltipTrigger>{childrenComponent}</TooltipTrigger>
<TooltipContent>Resource was deleted.</TooltipContent>
</Tooltip>
) : (
childrenComponent
);

return (
<div className={cn('group flex items-center justify-between', className)}>
<span className="text-foreground-950 text-xs font-medium">{label}</span>
Expand All @@ -31,7 +49,7 @@ export function OverviewItem({
className="text-foreground-600 mr-0 size-3 gap-0 p-0 opacity-0 transition-opacity group-hover:opacity-100"
></CopyButton>
)}
{children || <span className={cn('text-foreground-600 text-xs', isMonospace && 'font-mono')}>{value}</span>}
{wrappedChildren}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/pages/activity-feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function ActivityFeed() {
/>
<div className="relative flex h-[calc(100vh-88px)]">
<ResizablePanelGroup direction="horizontal">
<ResizablePanel defaultSize={70} minSize={40}>
<ResizablePanel defaultSize={70} minSize={50}>
<ActivityTable
selectedActivityId={activityItemId}
onActivitySelect={handleActivitySelect}
Expand All @@ -56,7 +56,7 @@ export function ActivityFeed() {
{activityItemId && (
<>
<ResizableHandle />
<ResizablePanel defaultSize={30} minSize={30} maxSize={50}>
<ResizablePanel defaultSize={35} minSize={35} maxSize={50}>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
Expand Down

0 comments on commit 73e2232

Please sign in to comment.