"use client"; import { useState } from "react"; import { ExternalLink, Save, Lock } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import type { McpEnvVar } from "@/lib/api/settings"; import { useUpdateMcpEnv } from "@/lib/api/settings"; import { toast } from "sonner"; import { DriftBadge } from "./drift-badge"; import { EnvVarEditor } from "./env-var-editor"; type Props = { spec: McpEnvVar; coolifyAppUuid: string; coolifyAvailable: boolean; onPendingRedeploy: () => void; }; export function EnvVarRow({ spec, coolifyAppUuid, coolifyAvailable, onPendingRedeploy, }: Props) { const [draft, setDraft] = useState(spec.coolify_value ?? ""); const update = useUpdateMcpEnv(); const dirty = draft !== (spec.coolify_value ?? ""); function handleSave() { update.mutate( { key: spec.key, value: draft }, { onSuccess: (res) => { toast.success(res.message); onPendingRedeploy(); }, onError: (err) => toast.error(`שגיאה: ${err.message}`), }, ); } const coolifyEnvUrl = `https://coolify.nautilus.marcusgroup.org/project/applications/${coolifyAppUuid}/environment-variables`; return (
{spec.key} {spec.type} {spec.is_secret && ( secret )} {spec.has_duplicates && ( duplicates )}

{spec.description}

Coolify: {spec.is_editable ? ( ) : ( {spec.coolify_value ?? — לא מוגדר —} )}
Container: {spec.container_value ?? — לא מוגדר —}
{!spec.is_editable && ( ערוך ב-Coolify )} {spec.is_editable && ( )}
); }