Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/relative-time-card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@workflow/web-shared': minor
---

Add RelativeTimeCard.
2 changes: 2 additions & 0 deletions packages/web-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"format": "biome format --write"
},
"dependencies": {
"@radix-ui/react-slot": "1.1.1",
"@tailwindcss/postcss": "4.3.0",
"@workflow/core": "workspace:*",
"@workflow/utils": "workspace:*",
Expand All @@ -58,6 +59,7 @@
"react": "19.1.0",
"react-dom": "19.1.0",
"react-inspector": "9.0.0",
"react-use-measure": "2.1.1",
"react-virtuoso": "4.18.1",
"shiki": "4.2.0",
"sonner": "2.0.7",
Expand Down
11 changes: 10 additions & 1 deletion packages/web-shared/src/components/event-list-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { isEncryptedMarker } from '../lib/hydration';
import { useToast } from '../lib/toast';
import { formatDuration } from '../lib/utils';
import { ContextCardProvider } from './ui/context-card';
import { DataInspector, DecryptClickContext } from './ui/data-inspector';
import { DecryptButton } from './ui/decrypt-button';
import {
Expand Down Expand Up @@ -1162,7 +1163,7 @@ function EventRow({
// Main component
// ──────────────────────────────────────────────────────────────────────────

export function EventListView({
function EventListViewInner({
events,
run,
onLoadEventData,
Expand Down Expand Up @@ -1745,3 +1746,11 @@ export function EventListView({
</DecryptClickContext.Provider>
);
}

export function EventListView(props: EventsListProps) {
return (
<ContextCardProvider>
<EventListViewInner {...props} />
</ContextCardProvider>
);
}
239 changes: 118 additions & 121 deletions packages/web-shared/src/components/sidebar/attribute-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
import { parseStepName, parseWorkflowName } from '@workflow/utils/parse-name';
import type { Event, Hook, Step, WorkflowRun } from '@workflow/world';
import type { ModelMessage } from 'ai';
import { format } from 'date-fns';
import { Lock } from 'lucide-react';
import { Spinner } from '../ui/spinner';
import type { KeyboardEvent, ReactNode } from 'react';
import { useCallback, useContext, useMemo, useState } from 'react';
import { isEncryptedMarker, isExpiredMarker } from '../../lib/hydration';
import { useToast } from '../../lib/toast';
import { extractConversation, isDoStreamStep } from '../../lib/utils';
import { ContextCardProvider } from '../ui/context-card';
import { DecryptClickContext, StreamClickContext } from '../ui/data-inspector';
import { ErrorCard } from '../ui/error-card';
import { ErrorStackBlock, isStructuredError } from '../ui/error-stack-block';
import { Skeleton } from '../ui/skeleton';
import { Spinner } from '../ui/spinner';
import { TimestampTooltip } from '../ui/timestamp-tooltip';
import { ConversationView } from './conversation-view';
import { CopyableDataBlock } from './copyable-data-block';
Expand Down Expand Up @@ -352,23 +354,14 @@ const parseDateValue = (value: unknown): Date | null => {
};

const formatLocalMillisecondTime = (date: Date): string =>
date.toLocaleString(undefined, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
fractionalSecondDigits: 3,
});
format(date, 'MMM dd HH:mm:ss.SS OO').toUpperCase();

export const localMillisecondTime = (value: unknown): string => {
const date = parseDateValue(value);
if (!date) {
return '-';
}

// e.g. 12/17/2025, 9:08:55.182 AM
return formatLocalMillisecondTime(date);
};

Expand Down Expand Up @@ -828,122 +821,126 @@ export const AttributePanel = ({
}, []);

return (
<StreamClickContext.Provider value={onStreamClick}>
<DecryptClickContext.Provider
value={onDecrypt ? { onDecrypt, isDecrypting } : undefined}
>
<div>
{/* Basic attributes in a vertical layout with border */}
{visibleBasicAttributes.length > 0 && (
<div
className="mb-3 flex flex-col overflow-hidden rounded-lg border"
style={{
borderColor: 'var(--ds-gray-300)',
}}
>
{orderedBasicAttributes.map((attribute, index) => {
const displayValue = attributeToDisplayFn[
attribute as keyof typeof attributeToDisplayFn
]?.(displayData[attribute as keyof typeof displayData]);
const isModuleSpecifier = attribute === 'moduleSpecifier';
const moduleSpecifierValue =
typeof displayValue === 'string'
? displayValue
: String(displayValue ?? displayData.moduleSpecifier ?? '');
const shouldCapitalizeLabel =
attribute !== 'workflowCoreVersion';
const showResumeAtSkeleton =
isLoading && resource === 'sleep' && !displayData.resumeAt;
const showDivider =
index < orderedBasicAttributes.length - 1 ||
showResumeAtSkeleton;

return (
<div key={attribute} className="py-1">
<ContextCardProvider>
<StreamClickContext.Provider value={onStreamClick}>
<DecryptClickContext.Provider
value={onDecrypt ? { onDecrypt, isDecrypting } : undefined}
>
<div>
{/* Basic attributes in a vertical layout with border */}
{visibleBasicAttributes.length > 0 && (
<div
className="mb-3 flex flex-col overflow-hidden rounded-lg border"
style={{
borderColor: 'var(--ds-gray-300)',
}}
>
{orderedBasicAttributes.map((attribute, index) => {
const displayValue = attributeToDisplayFn[
attribute as keyof typeof attributeToDisplayFn
]?.(displayData[attribute as keyof typeof displayData]);
const isModuleSpecifier = attribute === 'moduleSpecifier';
const moduleSpecifierValue =
typeof displayValue === 'string'
? displayValue
: String(
displayValue ?? displayData.moduleSpecifier ?? ''
);
const shouldCapitalizeLabel =
attribute !== 'workflowCoreVersion';
const showResumeAtSkeleton =
isLoading && resource === 'sleep' && !displayData.resumeAt;
const showDivider =
index < orderedBasicAttributes.length - 1 ||
showResumeAtSkeleton;

return (
<div key={attribute} className="py-1">
<div className="flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1">
<span
className={
shouldCapitalizeLabel
? 'text-[14px] first-letter:uppercase'
: 'text-[14px]'
}
style={{ color: 'var(--ds-gray-700)' }}
>
{getAttributeDisplayName(attribute)}
</span>
{isModuleSpecifier ? (
<button
type="button"
className="min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono"
style={{
color: 'var(--ds-gray-1000)',
background: 'transparent',
border: 'none',
padding: 0,
}}
title={moduleSpecifierValue}
onClick={() =>
handleCopyModuleSpecifier(moduleSpecifierValue)
}
>
{moduleSpecifierValue}
</button>
) : (
<span
className="min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono"
style={{ color: 'var(--ds-gray-1000)' }}
>
{displayValue}
</span>
)}
</div>
{showDivider ? (
<div
className="mx-2.5 border-b"
style={{ borderColor: 'var(--ds-gray-300)' }}
/>
) : null}
</div>
);
})}
{isLoading && resource === 'sleep' && !displayData.resumeAt && (
<div className="py-1">
<div className="flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1">
<span
className={
shouldCapitalizeLabel
? 'text-[14px] first-letter:uppercase'
: 'text-[14px]'
}
className="text-[14px] first-letter:uppercase"
style={{ color: 'var(--ds-gray-700)' }}
>
{getAttributeDisplayName(attribute)}
resumeAt
</span>
{isModuleSpecifier ? (
<button
type="button"
className="min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono"
style={{
color: 'var(--ds-gray-1000)',
background: 'transparent',
border: 'none',
padding: 0,
}}
title={moduleSpecifierValue}
onClick={() =>
handleCopyModuleSpecifier(moduleSpecifierValue)
}
>
{moduleSpecifierValue}
</button>
) : (
<span
className="min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono"
style={{ color: 'var(--ds-gray-1000)' }}
>
{displayValue}
</span>
)}
<Skeleton className="h-4 w-[55%]" />
</div>
{showDivider ? (
<div
className="mx-2.5 border-b"
style={{ borderColor: 'var(--ds-gray-300)' }}
/>
) : null}
</div>
);
})}
{isLoading && resource === 'sleep' && !displayData.resumeAt && (
<div className="py-1">
<div className="flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1">
<span
className="text-[14px] first-letter:uppercase"
style={{ color: 'var(--ds-gray-700)' }}
>
resumeAt
</span>
<Skeleton className="h-4 w-[55%]" />
</div>
</div>
)}
</div>
)}
{error ? (
<ErrorCard
title="Failed to load resource details"
details={error.message}
className="my-4"
/>
) : hasExpired ? (
<ExpiredDataMessage />
) : (
<>
{resolvedAttributes.map((attribute) => (
<AttributeBlock
isLoading={isLoading}
key={attribute}
attribute={attribute}
value={displayData[attribute as keyof typeof displayData]}
context={displayContext}
/>
))}
</>
)}
</div>
</DecryptClickContext.Provider>
</StreamClickContext.Provider>
)}
</div>
)}
{error ? (
<ErrorCard
title="Failed to load resource details"
details={error.message}
className="my-4"
/>
) : hasExpired ? (
<ExpiredDataMessage />
) : (
<>
{resolvedAttributes.map((attribute) => (
<AttributeBlock
isLoading={isLoading}
key={attribute}
attribute={attribute}
value={displayData[attribute as keyof typeof displayData]}
context={displayContext}
/>
))}
</>
)}
</div>
</DecryptClickContext.Provider>
</StreamClickContext.Provider>
</ContextCardProvider>
);
};
Loading
Loading