import { useState, type ReactNode } from "react"; import { Trans, useTranslation } from "react-i18next"; import { I18nKey } from "#/i18n/declaration"; import ChevronDownIcon from "#/icons/chevron-down.svg?react"; import MessageSquareShareIcon from "#/icons/message-square-share.svg?react"; import { cn } from "#/utils/utils"; import { BrandButton } from "#/components/features/settings/brand-button"; import { useLaunchSkillInChat } from "#/hooks/use-launch-skill-in-chat"; import { useActiveBackend } from "#/contexts/active-backend-context"; import { useTracking } from "#/hooks/use-tracking"; import { getAutomationsDocsUrl } from "#/manifests/automation-interface"; function InlineExampleWrap({ children }: { children?: ReactNode }) { return {children}; } function InlineCodeChip({ children }: { children?: ReactNode }) { return ( {children} ); } function InlinePunctuation({ children }: { children?: ReactNode }) { return <>{children}; } const CREATE_INSTRUCTIONS_INLINE_COMPONENTS = { example: , cmd: , punct: , }; interface CreateInstructionsProps { /** If true, the instructions are collapsible and start collapsed */ collapsible?: boolean; } interface CreateInstructionsContentProps { onLaunch?: () => void; } export function CreateInstructionsContent({ onLaunch, }: CreateInstructionsContentProps = {}) { const { t } = useTranslation("openhands"); const launchInChat = useLaunchSkillInChat(); const active = useActiveBackend(); const { trackAutomationCreatedButton } = useTracking(); const handleCreateAutomation = () => { trackAutomationCreatedButton({ backendKind: active.backend.kind }); launchInChat(t(I18nKey.AUTOMATIONS$CREATE_AUTOMATION_PROMPT), onLaunch); }; return (

{" "} {t(I18nKey.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)}{" "} {t(I18nKey.AUTOMATIONS$EMPTY_LEARN_MORE)}

} > {t(I18nKey.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)}
); } export function CreateInstructions({ collapsible = false, }: CreateInstructionsProps) { const { t } = useTranslation("openhands"); const [isExpanded, setIsExpanded] = useState(!collapsible); if (collapsible) { return (
{isExpanded ? (
) : null}
); } return (
); }