-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathMachineLabelCombo.tsx
More file actions
61 lines (56 loc) · 1.4 KB
/
MachineLabelCombo.tsx
File metadata and controls
61 lines (56 loc) · 1.4 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
import { MachinePresetName } from "@trigger.dev/core/v3";
import { MachineIcon } from "~/assets/icons/MachineIcon";
import { cn } from "~/utils/cn";
export const machines = Object.values(MachinePresetName.enum);
export function MachineLabelCombo({
preset,
className,
iconClassName,
labelClassName,
}: {
preset?: MachinePresetName | null;
className?: string;
iconClassName?: string;
labelClassName?: string;
}) {
return (
<span className={cn("flex items-center gap-1", className)}>
<MachineIcon preset={preset ?? undefined} className={cn("size-5", iconClassName)} />
<MachineLabel preset={preset} className={labelClassName} />
</span>
);
}
export function MachineLabel({
preset,
className,
}: {
preset?: MachinePresetName | null;
className?: string;
}) {
return (
<span className={cn("text-text-dimmed", className)}>{formatMachinePresetName(preset)}</span>
);
}
export function formatMachinePresetName(preset?: MachinePresetName | null): string {
if (!preset) {
return "No machine yet";
}
switch (preset) {
case "micro":
return "Micro";
case "small-1x":
return "Small 1x";
case "small-2x":
return "Small 2x";
case "medium-1x":
return "Medium 1x";
case "medium-2x":
return "Medium 2x";
case "large-1x":
return "Large 1x";
case "large-2x":
return "Large 2x";
default:
return preset;
}
}