Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(trace): tighter spacing (#10395)

Nimard3a5ab145beb
diff --git a/web/src/components/trace/CopyIdsPopover.tsx b/web/src/components/trace/CopyIdsPopover.tsx
index 7e3b9ffcd8..a82b7a1a00 100644
--- a/web/src/components/trace/CopyIdsPopover.tsx
+++ b/web/src/components/trace/CopyIdsPopover.tsx
@@ -7,7 +7,6 @@ import {
PopoverTrigger,
} from "@/src/components/ui/popover";
import { cn } from "@/src/utils/tailwind";
-import { Label } from "@/src/components/ui/label";
import { copyTextToClipboard } from "@/src/utils/clipboard";
interface IdItem {
@@ -62,45 +61,40 @@ export const CopyIdsPopover = ({
</Button>
</PopoverTrigger>
<PopoverContent
- className="max-h-[50vh] w-auto min-w-[300px] overflow-y-auto p-0"
+ className="max-h-[50vh] w-auto min-w-[280px] overflow-y-auto p-1"
align="start"
>
- <Label className="p-2 text-base capitalize">Copy IDs</Label>
- <div className="bg-card text-card-foreground shadow-sm">
- <div className="flex flex-col">
- {idItems.map((item) => (
- <div
- key={item.id}
- className="flex items-center justify-between border-b p-2 last:border-0"
- >
- <div className="flex flex-col">
- <span className="text-xs font-medium text-muted-foreground">
- {item.name}
- </span>
- <div className="flex items-center">
- <span
- className="mr-2 max-w-[250px] truncate font-mono text-sm"
- title={item.id}
- >
- {item.id}
- </span>
- </div>
- </div>
- <Button
- variant="ghost"
- size="icon"
- className="h-8 w-8"
- onClick={() => handleCopy(item.id)}
+ <div className="flex flex-col gap-0.5">
+ {idItems.map((item) => (
+ <div
+ key={item.id}
+ className="group flex items-center justify-between gap-2 rounded-sm px-2 py-1.5 transition-colors hover:bg-muted/50"
+ >
+ <div className="flex min-w-0 flex-col gap-0.5">
+ <span className="text-xs font-medium text-muted-foreground">
+ {item.name}
+ </span>
+ <span
+ className="max-w-[220px] truncate font-mono text-xs"
+ title={item.id}
>
- {copiedId === item.id ? (
- <CheckIcon className="h-3 w-3 text-muted-green" />
- ) : (
- <CopyIcon className="h-3 w-3" />
- )}
- </Button>
+ {item.id}
+ </span>
</div>
- ))}
- </div>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-6 w-6 shrink-0 opacity-70 transition-opacity group-hover:opacity-100"
+ onClick={() => handleCopy(item.id)}
+ >
+ {copiedId === item.id ? (
+ <CheckIcon className="h-3 w-3 text-muted-green" />
+ ) : (
+ <CopyIcon className="h-3 w-3" />
+ )}
+ </Button>
+ </div>
+ ))}
</div>
</PopoverContent>
</Popover>
diff --git a/web/src/components/trace/IOPreview.tsx b/web/src/components/trace/IOPreview.tsx
index bbfdfebb70..70ead1e60d 100644
--- a/web/src/components/trace/IOPreview.tsx
+++ b/web/src/components/trace/IOPreview.tsx
@@ -197,13 +197,18 @@ export const IOPreview: React.FC<{
<>
{/* Show tools at the top if available */}
{allTools.length > 0 && (
- <div className="mb-4 border-b border-border pb-4">
- <div className="px-1 py-1 text-sm font-medium capitalize">Tools</div>
- <ToolCallDefinitionCard
- tools={allTools}
- toolCallCounts={toolCallCounts}
- toolNameToDefinitionNumber={toolNameToDefinitionNumber}
- />
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
+ <div className="mb-4 border-b border-border pb-4">
+ <div className="io-message-header px-1 py-1 text-sm font-medium capitalize">
+ Tools
+ </div>
+ <ToolCallDefinitionCard
+ tools={allTools}
+ toolCallCounts={toolCallCounts}
+ toolNameToDefinitionNumber={toolNameToDefinitionNumber}
+ className="px-2"
+ />
+ </div>
</div>
)}
@@ -238,20 +243,22 @@ export const IOPreview: React.FC<{
style={{ display: selectedView === "pretty" ? "block" : "none" }}
>
{canDisplayAsChat ? (
- <OpenAiMessageView
- messages={allMessages}
- shouldRenderMarkdown={shouldRenderMarkdownSafely}
- additionalInput={
- Object.keys(additionalInput ?? {}).length > 0
- ? additionalInput
- : undefined
- }
- media={media ?? []}
- currentView={selectedView}
- messageToToolCallNumbers={messageToToolCallNumbers}
- />
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
+ <OpenAiMessageView
+ messages={allMessages}
+ shouldRenderMarkdown={shouldRenderMarkdownSafely}
+ additionalInput={
+ Object.keys(additionalInput ?? {}).length > 0
+ ? additionalInput
+ : undefined
+ }
+ media={media ?? []}
+ currentView={selectedView}
+ messageToToolCallNumbers={messageToToolCallNumbers}
+ />
+ </div>
) : (
- <>
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
{!(hideIfNull && !input) && !hideInput ? (
<PrettyJsonView
title="Input"
@@ -274,38 +281,40 @@ export const IOPreview: React.FC<{
onExternalExpansionChange={onOutputExpansionChange}
/>
) : null}
- </>
+ </div>
)}
</div>
{/* JSON view content */}
<div style={{ display: selectedView === "json" ? "block" : "none" }}>
- {!(hideIfNull && !input) && !hideInput ? (
- <PrettyJsonView
- title="Input"
- json={input ?? null}
- isLoading={isLoading}
- media={media?.filter((m) => m.field === "input") ?? []}
- currentView={selectedView}
- externalExpansionState={inputExpansionState}
- onExternalExpansionChange={onInputExpansionChange}
- />
- ) : null}
- {!(hideIfNull && !output) && !hideOutput ? (
- <PrettyJsonView
- title="Output"
- json={output}
- isLoading={isLoading}
- media={media?.filter((m) => m.field === "output") ?? []}
- currentView={selectedView}
- externalExpansionState={outputExpansionState}
- onExternalExpansionChange={onOutputExpansionChange}
- />
- ) : null}
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
+ {!(hideIfNull && !input) && !hideInput ? (
+ <PrettyJsonView
+ title="Input"
+ json={input ?? null}
+ isLoading={isLoading}
+ media={media?.filter((m) => m.field === "input") ?? []}
+ currentView={selectedView}
+ externalExpansionState={inputExpansionState}
+ onExternalExpansionChange={onInputExpansionChange}
+ />
+ ) : null}
+ {!(hideIfNull && !output) && !hideOutput ? (
+ <PrettyJsonView
+ title="Output"
+ json={output}
+ isLoading={isLoading}
+ media={media?.filter((m) => m.field === "output") ?? []}
+ currentView={selectedView}
+ externalExpansionState={outputExpansionState}
+ onExternalExpansionChange={onOutputExpansionChange}
+ />
+ ) : null}
+ </div>
</div>
</>
) : (
- <>
+ <div className="[&_.io-message-content]:px-2 [&_.io-message-header]:px-2">
{!(hideIfNull && !input) && !hideInput ? (
<PrettyJsonView
title="Input"
@@ -328,7 +337,7 @@ export const IOPreview: React.FC<{
onExternalExpansionChange={onOutputExpansionChange}
/>
) : null}
- </>
+ </div>
)}
</>
);
diff --git a/web/src/components/trace/ObservationPreview.tsx b/web/src/components/trace/ObservationPreview.tsx
index 2d1dd2a9d1..12b1d6790c 100644
--- a/web/src/components/trace/ObservationPreview.tsx
+++ b/web/src/components/trace/ObservationPreview.tsx
@@ -138,8 +138,8 @@ export const ObservationPreview = ({
return (
<div className="col-span-2 flex h-full flex-1 flex-col overflow-hidden md:col-span-3">
- <div className="flex h-full flex-1 flex-col items-start gap-1 overflow-hidden">
- <div className="mt-2 grid w-full grid-cols-[auto,auto] items-start justify-between gap-2">
+ <div className="flex h-full flex-1 flex-col items-start gap-1 overflow-hidden @container">
+ <div className="mt-2 grid w-full grid-cols-1 items-start gap-2 px-2 @2xl:grid-cols-[auto,auto] @2xl:justify-between">
<div className="flex w-full flex-row items-start gap-1">
<div className="mt-1.5">
<ItemBadge type={preloadedObservation.type} isSmall />
@@ -154,7 +154,7 @@ export const ObservationPreview = ({
]}
/>
</div>
- <div className="mr-3 flex h-full flex-wrap content-start items-start justify-end gap-1">
+ <div className="flex h-full flex-wrap content-start items-start justify-start gap-0.5 @2xl:mr-1 @2xl:justify-end">
{observationWithInputAndOutput.data && (
<NewDatasetItemFromExistingObject
traceId={preloadedObservation.traceId}
@@ -164,6 +164,7 @@ export const ObservationPreview = ({
output={observationWithInputAndOutput.data.output}
metadata={observationWithInputAndOutput.data.metadata}
key={preloadedObservation.id}
+ size="sm"
/>
)}
{viewType === "detailed" && (
@@ -182,12 +183,14 @@ export const ObservationPreview = ({
projectId: projectId,
environment: preloadedObservation.environment,
}}
+ size="sm"
/>
<CreateNewAnnotationQueueItem
projectId={projectId}
objectId={preloadedObservation.id}
objectType={AnnotationQueueObjectType.OBSERVATION}
+ size="sm"
/>
</div>
{observationWithInputAndOutput.data &&
@@ -197,6 +200,7 @@ export const ObservationPreview = ({
generation={observationWithInputAndOutput.data}
analyticsEventName="trace_detail:test_in_playground_button_click"
className={cn(isTimeline ? "!hidden" : "")}
+ size="sm"
/>
)}
<CommentDrawerButton
@@ -204,6 +208,7 @@ export const ObservationPreview = ({
objectId={preloadedObservation.id}
objectType="OBSERVATION"
count={commentCounts?.get(preloadedObservation.id)}
+ size="sm"
/>
</>
)}
@@ -213,11 +218,12 @@ export const ObservationPreview = ({
objectId={preloadedObservation.id}
objectType="OBSERVATION"
count={commentCounts?.get(preloadedObservation.id)}
+ size="sm"
/>
)}
</div>
</div>
- <div className="grid w-full min-w-0 items-center justify-between">
+ <div className="grid w-full min-w-0 items-center justify-between px-2">
<div className="flex min-w-0 max-w-full flex-shrink flex-col">
<div className="mb-1 flex min-w-0 max-w-full flex-wrap items-center gap-1">
<LocalIsoDate
@@ -420,7 +426,7 @@ export const ObservationPreview = ({
)}
<TabsBarContent
value="preview"
- className="mt-0 flex max-h-full min-h-0 w-full flex-1 pr-3"
+ className="mt-0 flex max-h-full min-h-0 w-full flex-1 pr-2"
>
<div className="mb-2 flex max-h-full min-h-0 w-full flex-col gap-2 overflow-y-auto">
<div>
@@ -458,7 +464,7 @@ export const ObservationPreview = ({
/>
)}
</div>
- <div>
+ <div className="px-2">
{observationWithInputAndOutput.data?.metadata && (
<PrettyJsonView
key={observationWithInputAndOutput.data.id + "-metadata"}
diff --git a/web/src/components/trace/ToolCallInvocationsView.tsx b/web/src/components/trace/ToolCallInvocationsView.tsx
index f4f5b5528b..11e8114319 100644
--- a/web/src/components/trace/ToolCallInvocationsView.tsx
+++ b/web/src/components/trace/ToolCallInvocationsView.tsx
@@ -40,7 +40,7 @@ export function ToolCallInvocationsView({
<div
key={`${toolCall.id}-${index}`}
className={cn(
- "w-full border-t px-1 py-2",
+ "w-full border-t px-2 py-2",
(message.role === "assistant" ||
message.name === "Output" ||
message.name === "Model") &&
@@ -69,7 +69,7 @@ export function ToolCallInvocationsView({
</div>
{/* Arguments view */}
- <div className="py-2">
+ <div className="py-2 [&_.io-message-content]:px-0">
<div className="mb-1.5 text-xs font-medium text-muted-foreground">
Arguments
</div>
diff --git a/web/src/components/trace/TraceLogView.tsx b/web/src/components/trace/TraceLogView.tsx
index a9e4bf0aa3..6a106744c9 100644
--- a/web/src/components/trace/TraceLogView.tsx
+++ b/web/src/components/trace/TraceLogView.tsx
@@ -245,7 +245,7 @@ export const TraceLogView = ({
// prevents partial rendering and improves performance
if (isLoading) {
return (
- <div className="flex h-full w-full flex-col overflow-hidden pr-3">
+ <div className="flex h-full w-full flex-col overflow-hidden px-2">
<div className="mb-2 flex max-h-full min-h-0 w-full flex-col gap-2 overflow-y-auto">
<div className="rounded-md border p-4">
<div className="text-sm text-muted-foreground">
@@ -258,8 +258,8 @@ export const TraceLogView = ({
}
return (
- <div className="flex h-full w-full flex-col overflow-hidden pr-3">
- <div className="mb-2 flex max-h-full min-h-0 w-full flex-col gap-2 overflow-y-auto">
+ <div className="flex h-full w-full flex-col overflow-hidden pr-2">
+ <div className="mb-2 flex max-h-full min-h-0 w-full flex-col gap-2 overflow-y-auto px-2">
<PrettyJsonView
key="trace-log-view"
title="Concatenated Observation Log"
diff --git a/web/src/components/trace/TracePreview.tsx b/web/src/components/trace/TracePreview.tsx
index 877c1cfebf..869eb259f6 100644
--- a/web/src/components/trace/TracePreview.tsx
+++ b/web/src/components/trace/TracePreview.tsx
@@ -155,8 +155,8 @@ export const TracePreview = ({
return (
<div className="col-span-2 flex h-full flex-1 flex-col overflow-hidden md:col-span-3">
- <div className="flex h-full flex-1 flex-col items-start gap-1 overflow-hidden">
- <div className="mt-2 grid w-full grid-cols-[auto,auto] items-start justify-between gap-2">
+ <div className="flex h-full flex-1 flex-col items-start gap-1 overflow-hidden @container">
+ <div className="mt-2 grid w-full grid-cols-1 items-start gap-2 px-2 @2xl:grid-cols-[auto,auto] @2xl:justify-between">
<div className="flex w-full flex-row items-start gap-1">
<div className="mt-1.5">
<ItemBadge type="TRACE" isSmall />
@@ -166,7 +166,7 @@ export const TracePreview = ({
</span>
<CopyIdsPopover idItems={[{ id: trace.id, name: "Trace ID" }]} />
</div>
- <div className="mr-3 flex h-full flex-wrap content-start items-start justify-end gap-1">
+ <div className="flex h-full flex-wrap content-start items-start justify-start gap-0.5 @2xl:mr-1 @2xl:justify-end">
<NewDatasetItemFromExistingObject
traceId={trace.id}
projectId={trace.projectId}
@@ -174,6 +174,7 @@ export const TracePreview = ({
output={trace.output}
metadata={trace.metadata}
key={trace.id}
+ size="sm"
/>
{viewType === "detailed" && (
<>
@@ -190,11 +191,13 @@ export const TracePreview = ({
projectId: trace.projectId,
environment: trace.environment,
}}
+ size="sm"
/>
<CreateNewAnnotationQueueItem
projectId={trace.projectId}
objectId={trace.id}
objectType={AnnotationQueueObjectType.TRACE}
+ size="sm"
/>
</div>
<CommentDrawerButton
@@ -202,6 +205,7 @@ export const TracePreview = ({
objectId={trace.id}
objectType="TRACE"
count={commentCounts?.get(trace.id)}
+ size="sm"
/>
</>
)}
@@ -211,11 +215,12 @@ export const TracePreview = ({
objectId={trace.id}
objectType="TRACE"
count={commentCounts?.get(trace.id)}
+ size="sm"
/>
)}
</div>
</div>
- <div className="grid w-full min-w-0 items-center justify-between">
+ <div className="grid w-full min-w-0 items-center justify-between px-2">
<div className="flex min-w-0 max-w-full flex-shrink flex-col">
<div className="mb-1 flex min-w-0 max-w-full flex-wrap items-center gap-1">
<LocalIsoDate
@@ -384,7 +389,7 @@ export const TracePreview = ({
{/* show preview always if not detailed view */}
<TabsBarContent
value="preview"
- className="mt-0 flex max-h-full min-h-0 w-full flex-1 pr-3"
+ className="mt-0 flex max-h-full min-h-0 w-full flex-1 pr-2"
>
<div className="mb-2 flex max-h-full min-h-0 w-full flex-col gap-2 overflow-y-auto">
<IOPreview
@@ -404,24 +409,26 @@ export const TracePreview = ({
}
/>
- <div className="text-sm font-medium">{"Tags"}</div>
- <div className="flex flex-wrap gap-x-1 gap-y-1">
+ <div className="px-2 text-sm font-medium">{"Tags"}</div>
+ <div className="flex flex-wrap gap-x-1 gap-y-1 px-2">
<TagList selectedTags={trace.tags} isLoading={false} />
</div>
- <PrettyJsonView
- key={trace.id + "-metadata"}
- title="Metadata"
- json={trace.metadata}
- media={
- traceMedia.data?.filter((m) => m.field === "metadata") ?? []
- }
- currentView={currentView}
- externalExpansionState={expansionState.metadata}
- onExternalExpansionChange={(expansion) =>
- setFieldExpansion("metadata", expansion)
- }
- />
+ <div className="px-2">
+ <PrettyJsonView
+ key={trace.id + "-metadata"}
+ title="Metadata"
+ json={trace.metadata}
+ media={
+ traceMedia.data?.filter((m) => m.field === "metadata") ?? []
+ }
+ currentView={currentView}
+ externalExpansionState={expansionState.metadata}
+ onExternalExpansionChange={(expansion) =>
+ setFieldExpansion("metadata", expansion)
+ }
+ />
+ </div>
</div>
</TabsBarContent>
<TabsBarContent value="log">
diff --git a/web/src/components/trace/TraceTree.tsx b/web/src/components/trace/TraceTree.tsx
index f33acc82aa..d8ef018053 100644
--- a/web/src/components/trace/TraceTree.tsx
+++ b/web/src/components/trace/TraceTree.tsx
@@ -210,7 +210,7 @@ const UnmemoizedTreeNodeComponent = ({
<Fragment>
<div
className={cn(
- "relative flex w-full cursor-pointer rounded-md px-0 hover:rounded-lg",
+ "relative flex w-full cursor-pointer rounded-md px-0",
isSelected ? "bg-muted" : "hover:bg-muted/50",
)}
style={{
diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsx
index 872cd8a510..9ac90f4033 100644
--- a/web/src/components/trace/index.tsx
+++ b/web/src/components/trace/index.tsx
@@ -613,7 +613,7 @@ export function Trace(props: {
{/* Preview Panel - Mobile */}
<div className="flex-1 pt-4">
- <div className="h-full pl-3">{previewContent}</div>
+ <div className="h-full">{previewContent}</div>
</div>
</div>
)}
@@ -1003,7 +1003,7 @@ export function Trace(props: {
defaultSize={70}
className="min-w-56 overflow-hidden md:h-full"
>
- <div className="h-full pl-3">{previewContent}</div>
+ <div className="h-full">{previewContent}</div>
</ResizablePanel>
</ResizablePanelGroup>
</div>
diff --git a/web/src/components/ui/CodeJsonViewer.tsx b/web/src/components/ui/CodeJsonViewer.tsx
index 3e7f1f6db1..e57fd16f2c 100644
--- a/web/src/components/ui/CodeJsonViewer.tsx
+++ b/web/src/components/ui/CodeJsonViewer.tsx
@@ -86,7 +86,7 @@ export function JSONView(props: {
<>
<div
className={cn(
- "flex gap-2 whitespace-pre-wrap break-words p-3 text-xs",
+ "io-message-content flex gap-2 whitespace-pre-wrap break-words p-2 text-xs",
props.title === "assistant" || props.title === "Output"
? "bg-accent-light-green dark:border-accent-dark-green"
: "",
diff --git a/web/src/components/ui/MarkdownJsonView.tsx b/web/src/components/ui/MarkdownJsonView.tsx
index 707317a324..7d9eb7cb5a 100644
--- a/web/src/components/ui/MarkdownJsonView.tsx
+++ b/web/src/components/ui/MarkdownJsonView.tsx
@@ -32,7 +32,7 @@ export function MarkdownJsonViewHeader({
const [isCopied, setIsCopied] = useState(false);
return (
- <div className="flex flex-row items-center justify-between px-1 py-1 text-sm font-medium capitalize transition-colors group-hover:bg-muted/80">
+ <div className="io-message-header flex flex-row items-center justify-between px-1 py-1 text-sm font-medium capitalize transition-colors group-hover:bg-muted/80">
<div className="flex items-center gap-2">
{titleIcon}
{title}
diff --git a/web/src/components/ui/MarkdownViewer.tsx b/web/src/components/ui/MarkdownViewer.tsx
index da71c6a72f..dca84b7b3e 100644
--- a/web/src/components/ui/MarkdownViewer.tsx
+++ b/web/src/components/ui/MarkdownViewer.tsx
@@ -362,17 +362,20 @@ export function MarkdownView({
return (
<div className={cn("overflow-hidden")} key={theme}>
{title ? (
- <MarkdownJsonViewHeader
- title={title}
- titleIcon={titleIcon}
- handleOnValueChange={handleOnValueChange}
- handleOnCopy={handleOnCopy}
- controlButtons={controlButtons}
- />
+ <>
+ <MarkdownJsonViewHeader
+ title={title}
+ titleIcon={titleIcon}
+ handleOnValueChange={handleOnValueChange}
+ handleOnCopy={handleOnCopy}
+ controlButtons={controlButtons}
+ />
+ <div className="border-t" />
+ </>
) : null}
<div
className={cn(
- "grid grid-flow-row gap-2 border-t px-1 py-3",
+ "io-message-content grid grid-flow-row gap-2 px-1 py-2",
title === "assistant" || title === "Output" || title === "Model"
? "bg-accent-light-green"
: "",
diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsx
index 3320b9983e..6646cfac14 100644
--- a/web/src/components/ui/PrettyJsonView.tsx
+++ b/web/src/components/ui/PrettyJsonView.tsx
@@ -1047,67 +1047,78 @@ export function PrettyJsonView(props: {
const body = (
<>
{emptyValueDisplay && isPrettyView ? (
- <div
- className={cn(
- "flex items-center",
- getContainerClasses(
- props.title,
- props.scrollable,
- props.codeClassName,
- ),
- )}
- >
+ <div className="io-message-content">
+ <div
+ className={cn(
+ "flex items-center",
+ getContainerClasses(
+ props.title,
+ props.scrollable,
+ props.codeClassName,
+ ),
+ )}
+ >
+ {props.isLoading ? (
+ <Skeleton className="h-3 w-3/4" />
+ ) : (
+ <span className={`font-mono ${PREVIEW_TEXT_CLASSES}`}>
+ {emptyValueDisplay}
+ </span>
+ )}
+ </div>
+ </div>
+ ) : isMarkdownMode ? (
+ <div className="io-message-content">
{props.isLoading ? (
<Skeleton className="h-3 w-3/4" />
) : (
- <span className={`font-mono ${PREVIEW_TEXT_CLASSES}`}>
- {emptyValueDisplay}
- </span>
+ <MarkdownView markdown={markdownContent || ""} />
)}
</div>
- ) : isMarkdownMode ? (
- props.isLoading ? (
- <Skeleton className="h-3 w-3/4" />
- ) : (
- <MarkdownView markdown={markdownContent || ""} />
- )
) : (
<>
{/* Always render JsonPrettyTable to preserve internal React Table state */}
<div
- className={getContainerClasses(
- props.title,
- props.scrollable,
- props.codeClassName,
- "flex whitespace-pre-wrap break-words text-xs",
- )}
+ className="io-message-content"
style={{ display: shouldUseTableView ? "flex" : "none" }}
>
- {props.isLoading ? (
- <Skeleton className="m-3 h-3 w-3/4" />
- ) : (
- <JsonPrettyTable
- data={tableData}
- expandAllRef={expandAllRef}
- onExpandStateChange={setAllRowsExpanded}
- noBorder={true}
- expanded={
- actualExpansionState === false ? {} : actualExpansionState
- }
- onExpandedChange={handleTableExpandedChange}
- onLazyLoadChildren={handleLazyLoadChildren}
- onForceUpdate={handleForceUpdate}
- smartDefaultsLevel={null}
- expandedCells={expandedCells}
- toggleCellExpansion={toggleCellExpansion}
- stickyTopLevelKey={props.stickyTopLevelKey}
- showObservationTypeBadge={props.showObservationTypeBadge}
- />
- )}
+ <div
+ className={getContainerClasses(
+ props.title,
+ props.scrollable,
+ props.codeClassName,
+ "flex whitespace-pre-wrap break-words text-xs",
+ )}
+ >
+ {props.isLoading ? (
+ <Skeleton className="m-3 h-3 w-3/4" />
+ ) : (
+ <JsonPrettyTable
+ data={tableData}
+ expandAllRef={expandAllRef}
+ onExpandStateChange={setAllRowsExpanded}
+ noBorder={true}
+ expanded={
+ actualExpansionState === false ? {} : actualExpansionState
+ }
+ onExpandedChange={handleTableExpandedChange}
+ onLazyLoadChildren={handleLazyLoadChildren}
+ onForceUpdate={handleForceUpdate}
+ smartDefaultsLevel={null}
+ expandedCells={expandedCells}
+ toggleCellExpansion={toggleCellExpansion}
+ stickyTopLevelKey={props.stickyTopLevelKey}
+ showObservationTypeBadge={props.showObservationTypeBadge}
+ />
+ )}
+ </div>
</div>
{/* Always render JSONView to preserve its state too */}
- <div style={{ display: shouldUseTableView ? "none" : "block" }}>
+ <div
+ className="io-message-content"
+ style={{ display: shouldUseTableView ? "none" : "block" }}
+ >
<JSONView
json={props.json}
title={props.title} // Title value used for background styling
diff --git a/web/src/components/ui/button.tsx b/web/src/components/ui/button.tsx
index 84cf087de7..0aa53a96da 100644
--- a/web/src/components/ui/button.tsx
+++ b/web/src/components/ui/button.tsx
@@ -29,7 +29,7 @@ const buttonVariants = cva(
size: {
default: "h-8 px-3 py-1",
xs: "h-4 px-1 rounded-sm",
- sm: "h-6 rounded-md px-3",
+ sm: "h-6 rounded-md px-2.5",
lg: "h-9 rounded-md px-8",
icon: "h-8 w-8",
"icon-xs": "h-6 w-6",
diff --git a/web/src/features/annotation-queues/components/CreateNewAnnotationQueueItem.tsx b/web/src/features/annotation-queues/components/CreateNewAnnotationQueueItem.tsx
index 2c9f8a0d42..6eb2b21ef4 100644
--- a/web/src/features/annotation-queues/components/CreateNewAnnotationQueueItem.tsx
+++ b/web/src/features/annotation-queues/components/CreateNewAnnotationQueueItem.tsx
@@ -22,11 +22,13 @@ export const CreateNewAnnotationQueueItem = ({
objectId,
objectType,
variant = "secondary",
+ size = "default",
}: {
projectId: string;
objectId: string;
objectType: AnnotationQueueObjectType;
variant?: "outline" | "secondary";
+ size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";
}) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const session = useSession();
@@ -92,6 +94,7 @@ export const CreateNewAnnotationQueueItem = ({
return (
<Button
variant={variant}
+ size={size}
disabled={session.status !== "authenticated"}
className="rounded-l-none rounded-r-md border-l-2"
>
@@ -115,6 +118,7 @@ export const CreateNewAnnotationQueueItem = ({
<DropdownMenuTrigger asChild>
<Button
variant={variant}
+ size={size}
disabled={!hasAccess}
className="rounded-l-none rounded-r-md border-l-2"
>
diff --git a/web/src/features/comments/CommentDrawerButton.tsx b/web/src/features/comments/CommentDrawerButton.tsx
index 512a26c5aa..dac8362991 100644
--- a/web/src/features/comments/CommentDrawerButton.tsx
+++ b/web/src/features/comments/CommentDrawerButton.tsx
@@ -21,6 +21,7 @@ export function CommentDrawerButton({
count,
variant = "secondary",
className,
+ size = "default",
}: {
projectId: string;
objectId: string;
@@ -28,6 +29,7 @@ export function CommentDrawerButton({
count?: number;
variant?: "secondary" | "outline";
className?: string;
+ size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";
}) {
const router = useRouter();
const [isMentionDropdownOpen, setIsMentionDropdownOpen] = useState(false);
@@ -89,8 +91,20 @@ export function CommentDrawerButton({
if (!hasReadAccess || (!hasWriteAccess && !count))
return (
- <Button type="button" variant="secondary" className={className} disabled>
- <MessageCircleOff className="h-4 w-4 text-muted-foreground" />
+ <Button
+ type="button"
+ variant="secondary"
+ size={size}
+ className={className}
+ disabled
+ >
+ <MessageCircleOff
+ className={
+ size === "sm"
+ ? "h-3.5 w-3.5 text-muted-foreground"
+ : "h-4 w-4 text-muted-foreground"
+ }
+ />
</Button>
);
@@ -130,18 +144,23 @@ export function CommentDrawerButton({
<Button
type="button"
variant={variant}
+ size={size}
className={className}
id="comment-drawer-button"
>
{!!count ? (
<div className="flex items-center gap-1">
- <MessageCircleIcon className="h-4 w-4" />
+ <MessageCircleIcon
+ className={size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4"}
+ />
<span className="flex h-3.5 w-fit items-center justify-center rounded-sm bg-primary/50 px-1 text-xs text-primary-foreground shadow-sm">
{count > 99 ? "99+" : count}
</span>
</div>
) : (
- <MessageCircleIcon className="h-4 w-4" />
+ <MessageCircleIcon
+ className={size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4"}
+ />
)}
</Button>
</DrawerTrigger>
diff --git a/web/src/features/datasets/components/NewDatasetItemFromExistingObject.tsx b/web/src/features/datasets/components/NewDatasetItemFromExistingObject.tsx
index fa9ce06cb1..034bd6eb72 100644
--- a/web/src/features/datasets/components/NewDatasetItemFromExistingObject.tsx
+++ b/web/src/features/datasets/components/NewDatasetItemFromExistingObject.tsx
@@ -44,6 +44,7 @@ export const NewDatasetItemFromExistingObject = (props: {
metadata: MetadataDomainClient;
isCopyItem?: boolean;
buttonVariant?: "outline" | "secondary";
+ size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";
}) => {
const parsedInput =
props.input && typeof props.input === "string"
@@ -76,13 +77,14 @@ export const NewDatasetItemFromExistingObject = (props: {
});
const capture = usePostHogClientCapture();
const buttonVariant = props.buttonVariant || "secondary";
+ const buttonSize = props.size || "default";
return (
<>
{props.isCopyItem ? (
<ActionButton
variant="outline"
- size="icon"
+ size={buttonSize === "sm" ? "icon-xs" : "icon"}
hasAccess={hasAccess}
title="Copy item"
aria-label="Copy item"
@@ -97,7 +99,11 @@ export const NewDatasetItemFromExistingObject = (props: {
<div>
<DropdownMenu open={hasAccess ? undefined : false}>
<DropdownMenuTrigger asChild>
- <Button variant="secondary" disabled={!hasAccess}>
+ <Button
+ variant="secondary"
+ size={buttonSize}
+ disabled={!hasAccess}
+ >
<span>{`In ${observationInDatasets.data.length} dataset(s)`}</span>
<ChevronDown className="ml-2 h-3 w-3" />
</Button>
@@ -140,11 +146,15 @@ export const NewDatasetItemFromExistingObject = (props: {
});
}}
variant={buttonVariant}
+ size={buttonSize}
disabled={!hasAccess}
>
{hasAccess ? (
<PlusIcon
- className={cn("-ml-0.5 mr-1.5 h-4 w-4")}
+ className={cn(
+ "-ml-0.5 mr-1.5",
+ buttonSize === "sm" ? "h-3.5 w-3.5" : "h-4 w-4",
+ )}
aria-hidden="true"
/>
) : null}
diff --git a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
index 1cefa0d25b..a26d367b06 100644
--- a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
+++ b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
@@ -67,6 +67,7 @@ type JumpToPlaygroundButtonProps = (
) & {
variant?: "outline" | "secondary";
className?: string;
+ size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";
};
export const JumpToPlaygroundButton: React.FC<JumpToPlaygroundButtonProps> = (
@@ -193,6 +194,7 @@ export const JumpToPlaygroundButton: React.FC<JumpToPlaygroundButtonProps> = (
<DropdownMenuTrigger asChild>
<Button
variant={props.variant ?? "secondary"}
+ size={props.size ?? "default"}
disabled={!isAvailable}
title={tooltipMessage}
className={cn(
@@ -200,7 +202,9 @@ export const JumpToPlaygroundButton: React.FC<JumpToPlaygroundButtonProps> = (
!isAvailable ? "cursor-not-allowed opacity-50" : "cursor-pointer",
)}
>
- <Terminal className="h-4 w-4" />
+ <Terminal
+ className={props.size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4"}
+ />
<span className={cn("hidden md:inline", props.className)}>
Playground
</span>
diff --git a/web/src/features/scores/components/AnnotateDrawer.tsx b/web/src/features/scores/components/AnnotateDrawer.tsx
index e5afed71c4..6d97300486 100644
--- a/web/src/features/scores/components/AnnotateDrawer.tsx
+++ b/web/src/features/scores/components/AnnotateDrawer.tsx
@@ -22,7 +22,10 @@ export function AnnotateDrawer<Target extends ScoreTarget>({
},
scoreMetadata,
buttonVariant = "secondary",
-}: AnnotateDrawerProps<Target>) {
+ size = "default",
+}: AnnotateDrawerProps<Target> & {
+ size?: "default" | "sm" | "xs" | "lg" | "icon" | "icon-xs" | "icon-sm";
+}) {
const capture = usePostHogClientCapture();
const hasAccess = useHasProjectAccess({
projectId,
@@ -34,6 +37,7 @@ export function AnnotateDrawer<Target extends ScoreTarget>({
<DrawerTrigger asChild>
<Button
variant={buttonVariant}
+ size={size}
disabled={!hasAccess}
className="rounded-r-none"
onClick={() => {
@@ -48,7 +52,11 @@ export function AnnotateDrawer<Target extends ScoreTarget>({
{!hasAccess ? (
<LockIcon className="mr-1.5 h-3 w-3" />
) : (
- <SquarePen className="mr-1.5 h-4 w-4" />
+ <SquarePen
+ className={
+ size === "sm" ? "mr-1.5 h-3.5 w-3.5" : "mr-1.5 h-4 w-4"
+ }
+ />
)}
<span>Annotate</span>
</Button>