diff --git a/packages/trace-viewer/src/ui/attachmentsTab.tsx b/packages/trace-viewer/src/ui/attachmentsTab.tsx index 6ba9e1303a..3f1908f3d3 100644 --- a/packages/trace-viewer/src/ui/attachmentsTab.tsx +++ b/packages/trace-viewer/src/ui/attachmentsTab.tsx @@ -22,6 +22,7 @@ import { PlaceholderPanel } from './placeholderPanel'; import type { AfterActionTraceEventAttachment } from '@trace/trace'; import { CodeMirrorWrapper } from '@web/components/codeMirrorWrapper'; import { isTextualMimeType } from '@isomorphic/mimeType'; +import { Expandable } from '@web/components/expandable'; type Attachment = AfterActionTraceEventAttachment & { traceUrl: string }; @@ -53,6 +54,18 @@ const TextAttachment: React.FunctionComponent = ({ attachme ; }; +const ExpandableAttachment: React.FunctionComponent<{ attachment: Attachment }> = ({ attachment }) => { + const [expanded, setExpanded] = React.useState(false); + return {attachment.name} + } expanded={expanded} setExpanded={exp => setExpanded(exp)}> + {isTextualMimeType(attachment.contentType) ? + : +
no preview available
+ } +
; +}; + export const AttachmentsTab: React.FunctionComponent<{ model: MultiTraceModel | undefined, }> = ({ model }) => { @@ -114,11 +127,7 @@ export const AttachmentsTab: React.FunctionComponent<{ return <> { i > 0 &&
}
- {a.name} - { isTextualMimeType(a.contentType) ? - : -
no preview available
- } +
; })}