import { memo, useState } from 'react' import { capitalize } from 'lodash-es' import { RiDeleteBinLine, RiEditLine, RiLock2Line } from '@remixicon/react' import { Env } from '@/app/components/base/icons/src/vender/line/others' import { useStore } from '@/app/components/workflow/store' import type { EnvironmentVariable } from '@/app/components/workflow/types' import cn from '@/utils/classnames' type EnvItemProps = { env: EnvironmentVariable onEdit: (env: EnvironmentVariable) => void onDelete: (env: EnvironmentVariable) => void } const EnvItem = ({ env, onEdit, onDelete, }: EnvItemProps) => { const envSecrets = useStore(s => s.envSecrets) const [destructive, setDestructive] = useState(false) return (
{env.name}
{capitalize(env.value_type)}
{env.value_type === 'secret' && }
onEdit(env)}/>
setDestructive(true)} onMouseOut={() => setDestructive(false)} > onDelete(env)} />
{env.value_type === 'secret' ? envSecrets[env.id] : env.value}
) } export default memo(EnvItem)