Move relay modal to nested modal

This commit is contained in:
Jonathan Staab 2023-02-24 12:20:21 -06:00
parent 1ae66cbc88
commit 3e66ae08fc
2 changed files with 13 additions and 11 deletions

View File

@ -234,12 +234,6 @@
<NoteCreate pubkey={$modal.pubkey} />
{:else if $modal.type === 'relay/add'}
<AddRelay />
{:else if $modal.type === 'relay/list'}
<Content>
{#each $modal.relays as relay}
<RelayCard theme="black" showControls {relay} />
{/each}
</Content>
{:else if $modal.type === 'signUp'}
<SignUp />
{:else if $modal.type === 'room/edit'}

View File

@ -10,6 +10,9 @@
import {Tags, findRootId, findReplyId, displayPerson, isLike} from "src/util/nostr"
import {extractUrls} from "src/util/html"
import ImageCircle from 'src/partials/ImageCircle.svelte'
import Content from 'src/partials/Content.svelte'
import RelayCard from 'src/views/relays/RelayCard.svelte'
import Modal from 'src/partials/Modal.svelte'
import Preview from 'src/partials/Preview.svelte'
import Anchor from 'src/partials/Anchor.svelte'
import {toast, modal} from "src/app/ui"
@ -38,6 +41,7 @@
let replyMentions = getDefaultReplyMentions()
let replyContainer = null
let visibleNotes = []
let showRelays = false
const {profile} = user
const links = extractUrls(note.content)
@ -85,10 +89,6 @@
modal.set({type: 'note/detail', note: {id: findRootId(note)}, relays})
}
const showActiveRelays = () => {
modal.set({type: 'relay/list', relays: [{url: note.seen_on}]})
}
const react = async content => {
if (!$profile) {
return navigate('/login')
@ -285,7 +285,7 @@
</div>
</div>
<div
class="cursor-pointer flex gap-1 items-center" on:click={showActiveRelays}>
class="cursor-pointer flex gap-1 items-center" on:click={() => { showRelays = true }}>
<i class="fa fa-server" />
<div
class="h-1 w-1 rounded-full"
@ -342,4 +342,12 @@
</div>
{/if}
{#if showRelays}
<Modal nested onEscape={() => { showRelays = false }}>
<Content>
<RelayCard theme="black" showControls relay={{url: note.seen_on}} />
</Content>
</Modal>
{/if}
{/if}