Open History to see the last commit
1import { TerminalIcon } from "lucide-react";
2
3import { cn } from "~/lib/utils";
4import {
5 COMPOSER_INLINE_CHIP_CLASS_NAME,
6 COMPOSER_INLINE_CHIP_ICON_CLASS_NAME,
7 COMPOSER_INLINE_CHIP_LABEL_CLASS_NAME,
8} from "../composerInlineChip";
9import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
10
11interface TerminalContextInlineChipProps {
12 label: string;
13 tooltipText: string;
14 expired?: boolean;
15}
16
17export function TerminalContextInlineChip(props: TerminalContextInlineChipProps) {
18 const { label, tooltipText, expired = false } = props;
19
20 return (
21 <Tooltip>
22 <TooltipTrigger
23 render={
24 <span
25 className={cn(
26 COMPOSER_INLINE_CHIP_CLASS_NAME,
27 expired && "border-destructive/35 bg-destructive/8 text-destructive",
28 )}
29 data-terminal-context-expired={expired ? "true" : undefined}
30 >
31 <TerminalIcon
32 className={cn(
33 COMPOSER_INLINE_CHIP_ICON_CLASS_NAME,
34 "size-3.5",
35 expired && "opacity-100",
36 )}
37 />
38 <span className={COMPOSER_INLINE_CHIP_LABEL_CLASS_NAME}>{label}</span>
39 </span>
40 }
41 />
42 <TooltipPopup side="top" className="max-w-80 whitespace-pre-wrap leading-tight">
43 {tooltipText}
44 </TooltipPopup>
45 </Tooltip>
46 );
47}