2025-11-13 21:25:34 +00:00
|
|
|
<script lang="ts">
|
2026-07-28 16:16:26 +00:00
|
|
|
import {displayRelayUrl} from "@welshman/util"
|
2025-11-13 21:25:34 +00:00
|
|
|
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
|
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2026-07-03 16:20:45 +00:00
|
|
|
import MenuButton from "@lib/components/MenuButton.svelte"
|
2026-01-30 22:14:12 +00:00
|
|
|
import Modal from "@lib/components/Modal.svelte"
|
|
|
|
|
import ModalBody from "@lib/components/ModalBody.svelte"
|
2025-11-13 21:25:34 +00:00
|
|
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
2026-02-02 18:09:14 +00:00
|
|
|
import ModalTitle from "@lib/components/ModalTitle.svelte"
|
|
|
|
|
import ModalSubtitle from "@lib/components/ModalSubtitle.svelte"
|
2025-11-13 21:25:34 +00:00
|
|
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
|
|
|
|
import Profile from "@app/components/Profile.svelte"
|
2026-07-03 16:20:45 +00:00
|
|
|
import SpaceMemberBannedMenu from "@app/components/SpaceMemberBannedMenu.svelte"
|
2026-07-28 16:16:26 +00:00
|
|
|
import {deriveSpaceBannedPubkeyItems, deriveSpaceSupportedMethods} from "@app/management"
|
2025-11-13 21:25:34 +00:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
url: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const bans = deriveSpaceBannedPubkeyItems(url)
|
2026-07-28 16:16:26 +00:00
|
|
|
const supportedMethods = deriveSpaceSupportedMethods(url)
|
|
|
|
|
const canUnban = $derived($supportedMethods.includes("unbanpubkey"))
|
|
|
|
|
const canRestore = $derived($supportedMethods.includes("allowpubkey"))
|
2025-11-13 21:25:34 +00:00
|
|
|
|
|
|
|
|
const back = () => history.back()
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-01-30 22:14:12 +00:00
|
|
|
<Modal>
|
|
|
|
|
<ModalBody>
|
|
|
|
|
<ModalHeader>
|
2026-02-02 18:09:14 +00:00
|
|
|
<ModalTitle>Banned users</ModalTitle>
|
|
|
|
|
<ModalSubtitle>on {displayRelayUrl(url)}</ModalSubtitle>
|
2026-01-30 22:14:12 +00:00
|
|
|
</ModalHeader>
|
2026-02-10 19:39:29 +00:00
|
|
|
<div class="flex flex-col gap-2">
|
2026-06-22 20:36:57 +00:00
|
|
|
{#if $bans.length === 0}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="card bg-surface p-4 text-sm opacity-70">No banned users.</div>
|
2026-06-22 20:36:57 +00:00
|
|
|
{/if}
|
2026-02-10 19:39:29 +00:00
|
|
|
{#each $bans as { pubkey, reason } (pubkey)}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="card relative">
|
2026-02-10 19:39:29 +00:00
|
|
|
<div class="flex items-center justify-between gap-2">
|
|
|
|
|
<div class="min-w-0 flex-1">
|
|
|
|
|
<Profile {pubkey} {url} />
|
|
|
|
|
</div>
|
2026-02-26 21:35:13 +00:00
|
|
|
{#if canUnban || canRestore}
|
2026-07-03 16:20:45 +00:00
|
|
|
<MenuButton component={SpaceMemberBannedMenu} componentProps={{url, pubkey}} />
|
2026-02-26 21:35:13 +00:00
|
|
|
{/if}
|
2026-01-30 22:14:12 +00:00
|
|
|
</div>
|
2025-11-13 21:25:34 +00:00
|
|
|
</div>
|
2026-02-10 19:39:29 +00:00
|
|
|
{/each}
|
|
|
|
|
</div>
|
2026-01-30 22:14:12 +00:00
|
|
|
</ModalBody>
|
2025-11-13 21:25:34 +00:00
|
|
|
<ModalFooter>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-link" onclick={back}>
|
2025-11-13 21:25:34 +00:00
|
|
|
<Icon icon={AltArrowLeft} />
|
|
|
|
|
Got it
|
|
|
|
|
</Button>
|
|
|
|
|
</ModalFooter>
|
2026-01-30 22:14:12 +00:00
|
|
|
</Modal>
|