forked from coracle/flotilla
Add qr code to invite screen
This commit is contained in:
@@ -26,8 +26,8 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button class="max-w-full {props.class}" onclick={copy}>
|
<Button class="flex w-full justify-center {props.class}" onclick={copy}>
|
||||||
<div bind:this={wrapper} style={`height: ${height}px`}>
|
<div bind:this={wrapper} class="w-md" style={`height: ${height}px`}>
|
||||||
<canvas
|
<canvas
|
||||||
class="rounded-box"
|
class="rounded-box"
|
||||||
bind:this={canvas}
|
bind:this={canvas}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {displayUrl} from "@welshman/lib"
|
import {displayUrl} from "@welshman/lib"
|
||||||
import {AuthStatus} from "@welshman/net"
|
import {AuthStatus} from "@welshman/net"
|
||||||
import {waitForThunkError} from "@welshman/app"
|
|
||||||
import {preventDefault} from "@lib/html"
|
import {preventDefault} from "@lib/html"
|
||||||
import Spinner from "@lib/components/Spinner.svelte"
|
import Spinner from "@lib/components/Spinner.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
@@ -15,7 +14,7 @@
|
|||||||
import SpaceJoinConfirm, {confirmSpaceJoin} from "@app/components/SpaceJoinConfirm.svelte"
|
import SpaceJoinConfirm, {confirmSpaceJoin} from "@app/components/SpaceJoinConfirm.svelte"
|
||||||
import {pushToast} from "@app/util/toast"
|
import {pushToast} from "@app/util/toast"
|
||||||
import {pushModal} from "@app/util/modal"
|
import {pushModal} from "@app/util/modal"
|
||||||
import {publishJoinRequest} from "@app/core/commands"
|
import {checkRelayAccess} from "@app/core/commands"
|
||||||
import {deriveSocket} from "@app/core/state"
|
import {deriveSocket} from "@app/core/state"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -32,11 +31,10 @@
|
|||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const thunk = publishJoinRequest({url, claim})
|
const message = await checkRelayAccess(url, claim)
|
||||||
const error = await waitForThunkError(thunk)
|
|
||||||
|
|
||||||
if (error) {
|
if (message) {
|
||||||
return pushToast({theme: "error", message: error, timeout: 30_000})
|
return pushToast({theme: "error", message, timeout: 30_000})
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($socket.auth.status === AuthStatus.None) {
|
if ($socket.auth.status === AuthStatus.None) {
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
import {sleep, nthEq} from "@welshman/lib"
|
import {sleep, nthEq} from "@welshman/lib"
|
||||||
import {request} from "@welshman/net"
|
import {request} from "@welshman/net"
|
||||||
import {displayRelayUrl, AUTH_INVITE} from "@welshman/util"
|
import {displayRelayUrl, AUTH_INVITE} from "@welshman/util"
|
||||||
import {slide} from "@lib/transition"
|
import LinkRound from "@assets/icons/link-round.svg?dataurl"
|
||||||
|
import Copy from "@assets/icons/copy.svg?dataurl"
|
||||||
import Spinner from "@lib/components/Spinner.svelte"
|
import Spinner from "@lib/components/Spinner.svelte"
|
||||||
import Field from "@lib/components/Field.svelte"
|
import Field from "@lib/components/Field.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
import LinkRound from "@assets/icons/link-round.svg?dataurl"
|
|
||||||
import Copy from "@assets/icons/copy.svg?dataurl"
|
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
|
import QRCode from "@app/components/QRCode.svelte"
|
||||||
import {clip} from "@app/util/toast"
|
import {clip} from "@app/util/toast"
|
||||||
import {PLATFORM_URL} from "@app/core/state"
|
import {PLATFORM_URL} from "@app/core/state"
|
||||||
|
|
||||||
@@ -62,11 +62,12 @@
|
|||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
<div>
|
<div>
|
||||||
{#if loading}
|
{#if loading}
|
||||||
<p class="center" out:slide>
|
<p class="center">
|
||||||
<Spinner {loading}>Requesting an invite link...</Spinner>
|
<Spinner {loading}>Requesting an invite link...</Spinner>
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<div in:slide>
|
<div class="flex flex-col items-center gap-6">
|
||||||
|
<QRCode code={invite} />
|
||||||
<Field>
|
<Field>
|
||||||
{#snippet input()}
|
{#snippet input()}
|
||||||
<label class="input input-bordered flex w-full items-center gap-2">
|
<label class="input input-bordered flex w-full items-center gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user