"use client"; import { TrashIcon } from "lucide-react"; import { useTranslations } from "next-intl"; import { useState } from "react"; import { errorToast } from "../../../../components/errors"; import { Button, ConfirmDialog } from "../../../../shadcnui"; import { AiConnectionInterface, AiConnectionService } from "../../data"; import { useAiConnections } from "../../contexts/AiConnectionsContext"; export type AiConnectionDeleterProps = { connection: AiConnectionInterface; }; /** * Removes one link from a fallback chain. * * Built on ConfirmDialog, which is controlled and trigger-less by design — the * caller owns the trigger button, so none of Base UI's trigger-composition * pitfalls apply (no asChild, no nested { try { await AiConnectionService.delete({ id: connection.id }); await refresh(); } catch (error) { errorToast({ title: t("ai_connections.admin.delete.title"), error }); throw error; // keeps the dialog open — ConfirmDialog swallows rejections } }} /> ); }