import { UnplugIcon } from "lucide-react"; import { useNavigate } from "react-router"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "src/components/ui/alert-dialog"; import { Button } from "src/components/ui/button"; import { SUBWALLET_APPSTORE_APP_ID } from "src/constants"; import { useDeleteApp } from "src/hooks/useDeleteApp"; import { App } from "src/types"; export function DisconnectApp({ app, onClose, }: { app: App; onClose: () => void; }) { const navigate = useNavigate(); const { deleteApp, isDeleting } = useDeleteApp(app, () => { navigate( app.metadata?.app_store_app_id !== SUBWALLET_APPSTORE_APP_ID ? "/apps?tab=connected-apps" : "/sub-wallets" ); }); // Check if this is a sub-wallet with a lightning address const isSubwallet = app.metadata?.app_store_app_id === SUBWALLET_APPSTORE_APP_ID; const hasLightningAddress = !!app.metadata?.lud16; return ( Are you sure you want to delete this connection? Connected apps will no longer be able to use this connection. {app.isolated && ( <> {" "} No funds will be lost during this process, the balance will remain in your wallet. )} {isSubwallet && hasLightningAddress && (

This sub-wallet has a lightning address ({app.metadata?.lud16}) that will also be deleted.

)}
Cancel Confirm
); }