-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathPacketDisplay.tsx
More file actions
69 lines (68 loc) · 1.97 KB
/
PacketDisplay.tsx
File metadata and controls
69 lines (68 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { CloudArrowDownIcon } from "@heroicons/react/20/solid";
import { CodeBlock } from "~/components/code/CodeBlock";
import { InlineCode } from "~/components/code/InlineCode";
import { LinkButton } from "~/components/primitives/Buttons";
import { Header3 } from "~/components/primitives/Headers";
import { Paragraph } from "~/components/primitives/Paragraph";
import { TextLink } from "~/components/primitives/TextLink";
import { docsPath } from "~/utils/pathBuilder";
export function PacketDisplay({
data,
dataType,
title,
}: {
data: string;
dataType: string;
title: string;
}) {
switch (dataType) {
case "application/store": {
return (
<div className="mt-2 flex flex-col">
<Header3>{title}</Header3>
<Paragraph variant="small" className="mb-2">
This {title.toLowerCase()} exceeded the size limit and was automatically offloaded to
object storage. You can retrieve it using{" "}
<InlineCode variant="extra-small">runs.retrieve</InlineCode> or download it directly
below. <TextLink to={docsPath("limits#task-payloads-and-outputs")}>Learn more</TextLink>
.
</Paragraph>
<div>
<LinkButton
LeadingIcon={CloudArrowDownIcon}
to={data}
variant="secondary/small"
download
className="inline-flex text-text-bright"
>
Download {title.toLowerCase()}
</LinkButton>
</div>
</div>
);
}
case "text/plain": {
return (
<CodeBlock
language="markdown"
rowTitle={title}
code={data}
maxLines={20}
showLineNumbers={false}
/>
);
}
default: {
return (
<CodeBlock
language="json"
rowTitle={title}
code={data}
maxLines={20}
showLineNumbers={false}
showTextWrapping
/>
);
}
}
}