Fix join page on white labeled instance
This commit is contained in:
parent
9ca73eb162
commit
e52cbcc23b
4 changed files with 43 additions and 39 deletions
|
|
@ -33,9 +33,10 @@
|
||||||
type Props = {
|
type Props = {
|
||||||
invite: string
|
invite: string
|
||||||
back?: () => void
|
back?: () => void
|
||||||
|
hideHeader?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
let {invite = "", back = () => history.back()}: Props = $props()
|
let {invite = "", back = () => history.back(), hideHeader}: Props = $props()
|
||||||
|
|
||||||
const toggleScanner = () => {
|
const toggleScanner = () => {
|
||||||
showScanner = !showScanner
|
showScanner = !showScanner
|
||||||
|
|
@ -95,27 +96,29 @@
|
||||||
|
|
||||||
<Modal tag="form" onsubmit={preventDefault(join)}>
|
<Modal tag="form" onsubmit={preventDefault(join)}>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<ModalHeader>
|
{#if !hideHeader}
|
||||||
<ModalTitle>Join a Space</ModalTitle>
|
<ModalHeader>
|
||||||
<ModalSubtitle
|
<ModalTitle>Join a Space</ModalTitle>
|
||||||
>Enter a relay URL or invite link below to join an existing space.</ModalSubtitle>
|
<ModalSubtitle
|
||||||
</ModalHeader>
|
>Enter a relay URL or invite link below to join an existing space.</ModalSubtitle>
|
||||||
<Field>
|
</ModalHeader>
|
||||||
{#snippet label()}
|
<Field>
|
||||||
<p>Invite Link*</p>
|
{#snippet label()}
|
||||||
{/snippet}
|
<p>Invite Link*</p>
|
||||||
{#snippet input()}
|
{/snippet}
|
||||||
<label class="input flex w-full items-center gap-2">
|
{#snippet input()}
|
||||||
<Icon icon={LinkRound} />
|
<label class="input flex w-full items-center gap-2">
|
||||||
<input bind:value={invite} class="grow" type="text" />
|
<Icon icon={LinkRound} />
|
||||||
<Button onclick={toggleScanner} class="flex items-center justify-center">
|
<input bind:value={invite} class="grow" type="text" />
|
||||||
<Icon icon={QrCode} />
|
<Button onclick={toggleScanner} class="flex items-center justify-center">
|
||||||
</Button>
|
<Icon icon={QrCode} />
|
||||||
</label>
|
</Button>
|
||||||
{/snippet}
|
</label>
|
||||||
</Field>
|
{/snippet}
|
||||||
{#if showScanner}
|
</Field>
|
||||||
<Scanner onscan={onScan} />
|
{#if showScanner}
|
||||||
|
<Scanner onscan={onScan} />
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if inviteData}
|
{#if inviteData}
|
||||||
<div class="-my-4">
|
<div class="-my-4">
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import {
|
||||||
getRelaysFromList,
|
getRelaysFromList,
|
||||||
} from "@welshman/util"
|
} from "@welshman/util"
|
||||||
import {makeChatId} from "@app/chats"
|
import {makeChatId} from "@app/chats"
|
||||||
import {entityLink, PLATFORM_URL} from "@app/env"
|
import {entityLink, PLATFORM_URL, PLATFORM_RELAYS} from "@app/env"
|
||||||
import {encodeRelay, hasNip29} from "@app/relays"
|
import {encodeRelay, hasNip29} from "@app/relays"
|
||||||
import {DM_KINDS} from "@app/content"
|
import {DM_KINDS} from "@app/content"
|
||||||
import {ROOM} from "@app/groups"
|
import {ROOM} from "@app/groups"
|
||||||
|
|
@ -101,6 +101,14 @@ export const goToSpace = (url: string, hash = "") => {
|
||||||
return goto(makeSpacePath(url) + hash, {replaceState: true})
|
return goto(makeSpacePath(url) + hash, {replaceState: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const goToHome = () => {
|
||||||
|
if (PLATFORM_RELAYS.length > 0) {
|
||||||
|
goToSpace(PLATFORM_RELAYS[0], get(page).url.hash)
|
||||||
|
} else {
|
||||||
|
goto("/home" + get(page).url.hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Content types, events
|
// Content types, events
|
||||||
|
|
||||||
export const makeMessagePath = (url: string, event: TrustedEvent) => {
|
export const makeMessagePath = (url: string, event: TrustedEvent) => {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {goto} from "$app/navigation"
|
import {goToHome} from "@app/routes"
|
||||||
import {page} from "$app/stores"
|
|
||||||
import {goToSpace} from "@app/routes"
|
|
||||||
import {PLATFORM_RELAYS} from "@app/env"
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(goToHome)
|
||||||
if (PLATFORM_RELAYS.length > 0) {
|
|
||||||
goToSpace(PLATFORM_RELAYS[0], $page.url.hash)
|
|
||||||
} else {
|
|
||||||
goto("/home" + $page.url.hash)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,20 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import {goto} from "$app/navigation"
|
|
||||||
import Dialog from "@lib/components/Dialog.svelte"
|
import Dialog from "@lib/components/Dialog.svelte"
|
||||||
import SpaceInviteAccept from "@app/components/SpaceInviteAccept.svelte"
|
import SpaceInviteAccept from "@app/components/SpaceInviteAccept.svelte"
|
||||||
|
import {goToHome} from "@app/routes"
|
||||||
const close = () => goto("/home")
|
import {modal} from "@app/modal"
|
||||||
|
|
||||||
const children = {
|
const children = {
|
||||||
component: SpaceInviteAccept,
|
component: SpaceInviteAccept,
|
||||||
props: {
|
props: {
|
||||||
|
hideHeader: true,
|
||||||
invite: $page.url.href,
|
invite: $page.url.href,
|
||||||
back: close,
|
back: goToHome,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Dialog {children} onClose={close} />
|
{#if !$modal}
|
||||||
|
<Dialog {children} onClose={goToHome} />
|
||||||
|
{/if}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue