Skip to content

Commit 285ad9a

Browse files
committed
Warm start components
1 parent 02ae9f4 commit 285ad9a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { WarmStartIcon } from "~/assets/icons/WarmStartIcon";
2+
import { InfoIconTooltip, SimpleTooltip } from "./primitives/Tooltip";
3+
import { cn } from "~/utils/cn";
4+
import { Paragraph } from "./primitives/Paragraph";
5+
6+
export function WarmStartCombo({
7+
isWarmStart,
8+
showTooltip = false,
9+
className,
10+
}: {
11+
isWarmStart: boolean;
12+
showTooltip?: boolean;
13+
className?: string;
14+
}) {
15+
return (
16+
<div className={cn("flex items-center gap-1 text-sm text-text-dimmed", className)}>
17+
<WarmStartIcon isWarmStart={isWarmStart} className="size-5" />
18+
<span>{isWarmStart ? "Warm Start" : "Cold Start"}</span>
19+
{showTooltip && <InfoIconTooltip content={<WarmStartTooltipContent />} />}
20+
</div>
21+
);
22+
}
23+
24+
export function WarmStartIconWithTooltip({
25+
isWarmStart,
26+
className,
27+
}: {
28+
isWarmStart: boolean;
29+
className?: string;
30+
}) {
31+
return (
32+
<SimpleTooltip
33+
className="relative z-[9999]"
34+
button={<WarmStartIcon isWarmStart={isWarmStart} className={className} />}
35+
content={<WarmStartTooltipContent />}
36+
/>
37+
);
38+
}
39+
40+
function WarmStartTooltipContent() {
41+
return (
42+
<div className="flex max-w-xs flex-col gap-4 p-1">
43+
<div>
44+
<WarmStartCombo isWarmStart={false} className="mb-0.5 text-text-bright" />
45+
<Paragraph variant="small" className="!text-wrap text-text-dimmed">
46+
A cold start happens when we need to boot up a new machine for your run to execute. This
47+
takes longer than a warm start.
48+
</Paragraph>
49+
</div>
50+
<div>
51+
<WarmStartCombo isWarmStart={true} className="mb-0.5 text-text-bright" />
52+
<Paragraph variant="small" className="!text-wrap text-text-dimmed">
53+
A warm start happens when we can reuse a machine from a run that recently finished. This
54+
takes less time than a cold start.
55+
</Paragraph>
56+
</div>
57+
</div>
58+
);
59+
}

0 commit comments

Comments
 (0)