Skip to content

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

fix(web): compact images hug their box, Media heading matches the other sections (#18317)

Trang Nguyen1330257edfee
diff --git a/web/src/components/MediaFileCard/MediaFileCard.tsx b/web/src/components/MediaFileCard/MediaFileCard.tsx
index 35ba45fca1..d5c09a1710 100644
--- a/web/src/components/MediaFileCard/MediaFileCard.tsx
+++ b/web/src/components/MediaFileCard/MediaFileCard.tsx
@@ -45,7 +45,7 @@ export function MediaFileCard({
title={fileName}
className="from-accent-light-green/30 to-muted hover:from-accent-light-green/40 hover:to-muted/90 dark:from-accent-dark-green/20 dark:to-muted dark:hover:from-accent-dark-green/30 group relative flex h-24 w-24 shrink-0 flex-col items-center justify-center gap-2 rounded-md border bg-linear-to-br px-2 transition-colors"
>
- <Icon className="h-5 w-5 transition-transform group-hover:scale-110" />
+ <Icon className="h-5 w-5" />
<div className="flex w-full min-w-0 flex-col items-center gap-1">
<span
className={
diff --git a/web/src/components/ui/resizable-image.tsx b/web/src/components/ui/resizable-image.tsx
index 3a0b5fb67a..ccf472e663 100644
--- a/web/src/components/ui/resizable-image.tsx
+++ b/web/src/components/ui/resizable-image.tsx
@@ -123,9 +123,9 @@ export const ResizableImage = ({
<div
className={cn(
"group relative overflow-hidden",
- fitContent
- ? "w-full"
- : cn("w-full", isZoomedIn ? "h-1/2 w-1/2" : "h-full w-full"),
+ fitContent && "w-full",
+ !fitContent && isZoomedIn && "w-fit max-w-full min-w-10",
+ !fitContent && !isZoomedIn && "h-full w-full",
)}
>
{isImageVisible && safeSrc && isValidImage.data?.isValid ? (
@@ -140,7 +140,11 @@ export const ResizableImage = ({
title={safeSrc ?? src}
className={cn(
"rounded border",
- fitContent ? "h-auto w-full" : "h-full w-full object-contain",
+ fitContent && "h-auto w-full",
+ !fitContent &&
+ isZoomedIn &&
+ "h-auto max-h-52 w-auto max-w-full",
+ !fitContent && !isZoomedIn && "h-full w-full object-contain",
)}
onError={() => {
// An image failing to load is an <img> error Event (a
diff --git a/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx b/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx
index dded12a424..8389be8b71 100644
--- a/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx
+++ b/web/src/features/traces/components/IOPreview/components/SectionMedia.tsx
@@ -12,8 +12,10 @@ export interface SectionMediaProps {
export function SectionMedia({ media }: SectionMediaProps) {
return (
<>
- <div className="text-muted-foreground my-1 py-1 text-xs">Media</div>
- <div className="ph-no-capture flex flex-wrap gap-2 pt-1 pb-4">
+ <div className="io-message-header px-1 py-1 text-base font-bold">
+ Media
+ </div>
+ <div className="ph-no-capture flex flex-wrap gap-2 pb-4">
{media.map((m) => (
<LangfuseMediaView
mediaAPIReturnValue={m}