2024-08-16 17:50:38 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import {goto} from "$app/navigation"
|
2024-09-11 17:48:34 +00:00
|
|
|
import {displayRelayUrl} from "@welshman/util"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {publish} from "@welshman/app"
|
2025-02-04 03:28:29 +00:00
|
|
|
import {preventDefault} from "@lib/html"
|
2024-08-16 17:50:38 +00:00
|
|
|
import Spinner from "@lib/components/Spinner.svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
2025-09-10 22:26:39 +00:00
|
|
|
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
|
2024-08-16 17:50:38 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2026-01-30 22:14:12 +00:00
|
|
|
import Modal from "@lib/components/Modal.svelte"
|
|
|
|
|
import ModalBody from "@lib/components/ModalBody.svelte"
|
2024-10-10 21:33:50 +00:00
|
|
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
2026-02-02 18:09:14 +00:00
|
|
|
import ModalTitle from "@lib/components/ModalTitle.svelte"
|
2024-10-10 21:33:50 +00:00
|
|
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
2026-07-20 23:35:24 +00:00
|
|
|
import {publishLeaveRequest} from "@app/access"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {roomLists} from "@app/core"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {removeTrustedRelay} from "@app/settings"
|
2024-08-16 17:50:38 +00:00
|
|
|
|
2025-02-04 01:21:46 +00:00
|
|
|
const {url} = $props()
|
2024-08-16 17:50:38 +00:00
|
|
|
|
|
|
|
|
const back = () => history.back()
|
|
|
|
|
|
|
|
|
|
const exit = async () => {
|
|
|
|
|
loading = true
|
|
|
|
|
|
|
|
|
|
try {
|
2026-07-28 16:16:26 +00:00
|
|
|
await $roomLists.removeRelay(url).then(publish)
|
|
|
|
|
await publishLeaveRequest(url)
|
2025-09-03 16:02:54 +00:00
|
|
|
await removeTrustedRelay(url)
|
2024-08-16 17:50:38 +00:00
|
|
|
} finally {
|
|
|
|
|
loading = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goto("/home")
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
let loading = $state(false)
|
2024-08-16 17:50:38 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-30 22:14:12 +00:00
|
|
|
<Modal tag="form" onsubmit={preventDefault(exit)}>
|
|
|
|
|
<ModalBody>
|
|
|
|
|
<ModalHeader>
|
2026-02-02 18:09:14 +00:00
|
|
|
<ModalTitle>
|
|
|
|
|
You are leaving<br /><span class="text-primary">{displayRelayUrl(url)}</span>
|
|
|
|
|
</ModalTitle>
|
2026-01-30 22:14:12 +00:00
|
|
|
</ModalHeader>
|
|
|
|
|
<p class="text-center">Are you sure you want to leave?</p>
|
|
|
|
|
</ModalBody>
|
2024-10-10 21:33:50 +00:00
|
|
|
<ModalFooter>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-link" onclick={back}>
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon icon={AltArrowLeft} />
|
2024-08-16 17:50:38 +00:00
|
|
|
Go back
|
|
|
|
|
</Button>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button type="submit" class="button button-primary" disabled={loading}>
|
2024-08-16 17:50:38 +00:00
|
|
|
<Spinner {loading}>Confirm</Spinner>
|
|
|
|
|
</Button>
|
2024-10-10 21:33:50 +00:00
|
|
|
</ModalFooter>
|
2026-01-30 22:14:12 +00:00
|
|
|
</Modal>
|