import { Match, Switch } from "solid-js"; import { Trans } from "@lingui-solid/solid/macro"; import { useMutation } from "@tanstack/solid-query"; import { Dialog, DialogProps } from "@revolt/ui"; import { useModals } from ".."; import { Modals } from "../types"; /** * Modal to delete a channel */ export function DeleteChannelModal( props: DialogProps & Modals & { type: "delete_channel" }, ) { const { showError } = useModals(); const deleteChannel = useMutation(() => ({ mutationFn: () => props.channel.delete(), onError: showError, })); return ( Delete {props.channel.name}?}> Leave {props.channel.name}? Close conversation with {props.channel.recipient?.displayName}? } actions={[ { text: Cancel }, { text: ( Delete}> Leave Close ), onClick: () => deleteChannel.mutateAsync(), }, ]} isDisabled={deleteChannel.isPending} > Once it's deleted, there's no going back.} > You won't be able to rejoin unless you are re-invited. You can re-open it later, but it will disappear on both sides. ); }