import type * as React from 'react' import { Button } from '@/components/ui/button' import { Codicon } from '@/components/ui/codicon' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' import { useI18n } from '@/i18n' import { Eye, EyeOff, ExternalLink, Trash2 } from '@/lib/icons' import { triggerHaptic } from '@/lib/haptics' import { cn } from '@/lib/utils' interface EnvVarActionsMenuProps extends Pick, 'align' | 'sideOffset'> { children: React.ReactNode clearDisabled?: boolean docsUrl?: string | null isRevealed?: boolean isSet: boolean label: string onClear?: () => void onEdit: () => void onReveal?: () => void showReveal?: boolean } export function EnvVarActionsMenu({ align = 'end', children, clearDisabled = false, docsUrl, isRevealed = false, isSet, label, onClear, onEdit, onReveal, showReveal = true, sideOffset = 6 }: EnvVarActionsMenuProps) { const { t } = useI18n() const copy = t.settings.envActions const hasClear = isSet && onClear const hasReveal = isSet && showReveal && onReveal const hasDocs = Boolean(docsUrl?.trim()) return ( {children} {hasDocs && ( { event.preventDefault() triggerHaptic('selection') window.open(docsUrl!, '_blank', 'noopener,noreferrer') }} > {copy.docs} )} {hasReveal && ( { triggerHaptic('selection') onReveal() }} > {isRevealed ? : } {isRevealed ? copy.hideValue : copy.revealValue} )} { triggerHaptic('selection') onEdit() }} > {isSet ? copy.replace : copy.set} {hasClear && ( <> { triggerHaptic('warning') onClear() }} variant="destructive" > {copy.clear} )} ) } interface EnvVarActionsTriggerProps extends Omit, 'size' | 'variant'> { label: string } export function EnvVarActionsTrigger({ className, label, ...props }: EnvVarActionsTriggerProps) { const { t } = useI18n() const copy = t.settings.envActions return ( ) }