import React from "react"; import { useTranslation } from "react-i18next"; import PlusIcon from "#/icons/u-plus.svg?react"; import CheckmarkIcon from "#/icons/checkmark.svg?react"; import RemoveIcon from "#/icons/x-mark.svg?react"; import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip"; import { I18nKey } from "#/i18n/declaration"; import { cn } from "#/utils/utils"; interface CirclePlusCheckToggleProps { testId?: string; isSelected: boolean; onToggle: (selected: boolean) => void; isDisabled?: boolean; className?: string; enableLabelKey?: I18nKey; disableLabelKey?: I18nKey; enableTooltipKey?: I18nKey; disableTooltipKey?: I18nKey; removeTooltipKey?: I18nKey; } export function CirclePlusBadge({ className, testId, tooltipKey = I18nKey.AUTOMATIONS$ADD_AUTOMATION, }: { className?: string; testId?: string; tooltipKey?: I18nKey; }) { const { t } = useTranslation("openhands"); return ( ); } export function CirclePlusCheckToggle({ testId, isSelected, onToggle, isDisabled = false, className, enableLabelKey = I18nKey.SETTINGS$SKILLS_ENABLE_SKILL, disableLabelKey = I18nKey.SETTINGS$SKILLS_DISABLE_SKILL, enableTooltipKey = I18nKey.COMMON$ENABLE, disableTooltipKey, removeTooltipKey = I18nKey.COMMON$REMOVE, }: CirclePlusCheckToggleProps) { const { t } = useTranslation("openhands"); const [isPointerOver, setIsPointerOver] = React.useState(false); const handleClick = (event: React.MouseEvent) => { event.stopPropagation(); if (isDisabled) { return; } onToggle(!isSelected); event.currentTarget.blur(); }; const showRemoveIcon = isSelected && isPointerOver; const selectedTooltipKey = disableTooltipKey ?? removeTooltipKey; const tooltipLabel = t(isSelected ? selectedTooltipKey : enableTooltipKey); const ariaLabel = t(isSelected ? disableLabelKey : enableLabelKey); return ( ); }