diff --git a/.changeset/shy-frogs-juggle.md b/.changeset/shy-frogs-juggle.md new file mode 100644 index 0000000000..1bf0488992 --- /dev/null +++ b/.changeset/shy-frogs-juggle.md @@ -0,0 +1,5 @@ +--- +'@workflow/web-shared': patch +--- + +Replace static trace viewer styles with Tailwind theme utilities. diff --git a/packages/web-shared/src/components/trace-viewer/components/timeline.tsx b/packages/web-shared/src/components/trace-viewer/components/timeline.tsx index d08a473399..bd9af074da 100644 --- a/packages/web-shared/src/components/trace-viewer/components/timeline.tsx +++ b/packages/web-shared/src/components/trace-viewer/components/timeline.tsx @@ -1,7 +1,7 @@ 'use client'; import { ArrowLeft, ArrowRight } from 'lucide-react'; -import type { CSSProperties, ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { Fragment, memo, @@ -28,7 +28,7 @@ import { computeSpanGaps, computeSpanMarkers, computeSpanSegments, - getResourceColor, + getResourceClassNames, getSpanDurationMs, isSpanErrored, } from '../utils'; @@ -62,11 +62,6 @@ const SEGMENT_CLASSES: Record = { received: 'bg-blue-200 border border-blue-500', }; -const TIMELINE_INSET_STYLE: CSSProperties = { - left: TIMELINE_PADDING_PX, - right: TIMELINE_PADDING_PX, -}; - const STRIPED_SEGMENT_STATUSES: ReadonlySet = new Set([ 'pending', 'running', @@ -260,18 +255,18 @@ function BoundaryArrow({ } function PlainBar({ - bg, - border, + className, label, }: { - bg: string; - border: string; + className: string; label: string | null; }): ReactNode { return (
{label ? : null}
@@ -352,14 +347,13 @@ function SegmentBar({
{STRIPED_SEGMENT_STATUSES.has(seg.status) ? ( @@ -457,13 +451,10 @@ const TimelineBar = memo(function TimelineBar({ markers.length > 0 || offscreen.left !== null || offscreen.right !== null; const isErrored = isSpanErrored(span); - const colors = getResourceColor(span.resource); - const fallbackBg = isErrored - ? (colors.errorBg ?? 'var(--ds-red-200)') - : colors.bg; - const fallbackBorder = isErrored - ? (colors.errorBorder ?? 'var(--ds-red-500)') - : colors.border; + const colors = getResourceClassNames(span.resource); + const fallbackClassName = isErrored + ? (colors.errorClassName ?? 'border-red-500 bg-red-200') + : colors.className; const totalLabel = formatDurationPrecise(totalDurationMs); const showTotalLabel = @@ -486,7 +477,7 @@ const TimelineBar = memo(function TimelineBar({ )} onClick={handleClick} > -
+
) : geometry.mode.kind === 'tiny' ? (
) : segments.length > 0 ? ( ) : ( )} @@ -612,10 +601,9 @@ const DeltaMeasureLine = memo(function DeltaMeasureLine({ return ( <>
@@ -781,8 +769,7 @@ export function Timeline({ >
{markers.map((marker) => // Skip the "0s" origin marker since the left edge already implies it. @@ -796,10 +783,7 @@ export function Timeline({ )}
{hover != null && ( -
+
{gapMeasurements.map((gap) => (
diff --git a/packages/web-shared/src/components/trace-viewer/components/trace-viewer-skeleton.tsx b/packages/web-shared/src/components/trace-viewer/components/trace-viewer-skeleton.tsx index 7977ace4ae..fa06154a2a 100644 --- a/packages/web-shared/src/components/trace-viewer/components/trace-viewer-skeleton.tsx +++ b/packages/web-shared/src/components/trace-viewer/components/trace-viewer-skeleton.tsx @@ -1,19 +1,62 @@ import { Skeleton } from '../../ui/skeleton'; -import { DEFAULT_START_PX, paneColTemplate } from './pane-constants'; -// Mirrors SplitPane's initial column template so the skeleton lines up with -// the real viewer's first paint. -const COL_TEMPLATE = paneColTemplate(DEFAULT_START_PX); - -const ROWS: { id: string; name: number; off: number; bar: number }[] = [ - { id: 'r0', name: 62, off: 0, bar: 72 }, - { id: 'r1', name: 78, off: 6, bar: 48 }, - { id: 'r2', name: 50, off: 10, bar: 55 }, - { id: 'r3', name: 84, off: 18, bar: 30 }, - { id: 'r4', name: 45, off: 18, bar: 42 }, - { id: 'r5', name: 66, off: 34, bar: 38 }, - { id: 'r6', name: 55, off: 41, bar: 25 }, - { id: 'r7', name: 40, off: 50, bar: 30 }, +const ROWS = [ + { + id: 'r0', + nameClassName: 'w-[62%]', + offsetClassName: 'left-0', + barClassName: 'w-[72%]', + topClassName: 'top-0', + }, + { + id: 'r1', + nameClassName: 'w-[78%]', + offsetClassName: 'left-[6%]', + barClassName: 'w-[48%]', + topClassName: 'top-[3.5px]', + }, + { + id: 'r2', + nameClassName: 'w-1/2', + offsetClassName: 'left-[10%]', + barClassName: 'w-[55%]', + topClassName: 'top-[7px]', + }, + { + id: 'r3', + nameClassName: 'w-[84%]', + offsetClassName: 'left-[18%]', + barClassName: 'w-[30%]', + topClassName: 'top-[10.5px]', + }, + { + id: 'r4', + nameClassName: 'w-[45%]', + offsetClassName: 'left-[18%]', + barClassName: 'w-[42%]', + topClassName: 'top-[14px]', + }, + { + id: 'r5', + nameClassName: 'w-[66%]', + offsetClassName: 'left-[34%]', + barClassName: 'w-[38%]', + topClassName: 'top-[17.5px]', + }, + { + id: 'r6', + nameClassName: 'w-[55%]', + offsetClassName: 'left-[41%]', + barClassName: 'w-1/4', + topClassName: 'top-[21px]', + }, + { + id: 'r7', + nameClassName: 'w-2/5', + offsetClassName: 'left-1/2', + barClassName: 'w-[30%]', + topClassName: 'top-[24.5px]', + }, ]; const HEADER_MARKERS = ['m0', 'm1', 'm2', 'm3']; @@ -36,25 +79,17 @@ export function TraceViewerSkeleton() { {/* Minimap strip: thin density lines tracing the same shape as the bars */}
- {ROWS.map((row, index) => ( + {ROWS.map((row) => ( ))}
{/* Header row: search header | divider | timeline header */} -
+
@@ -70,10 +105,7 @@ export function TraceViewerSkeleton() {
{/* Content row: event list | gutter | timeline */} -
+
{/* Sidebar event rows */}
    @@ -81,10 +113,7 @@ export function TraceViewerSkeleton() {
  • - +
  • @@ -101,8 +130,7 @@ export function TraceViewerSkeleton() {
    diff --git a/packages/web-shared/src/components/trace-viewer/icons.tsx b/packages/web-shared/src/components/trace-viewer/icons.tsx index 24a031d285..18ee467f9e 100644 --- a/packages/web-shared/src/components/trace-viewer/icons.tsx +++ b/packages/web-shared/src/components/trace-viewer/icons.tsx @@ -1,10 +1,10 @@ const WorkflowIcon = () => { return (