Compare commits

...

3 Commits

+14 -1
View File
@@ -5,8 +5,15 @@
import Link from "@lib/components/Link.svelte" import Link from "@lib/components/Link.svelte"
import ContentLinkDetail from "@app/components/ContentLinkDetail.svelte" import ContentLinkDetail from "@app/components/ContentLinkDetail.svelte"
import ContentLinkBlockImage from "@app/components/ContentLinkBlockImage.svelte" import ContentLinkBlockImage from "@app/components/ContentLinkBlockImage.svelte"
import RelaySummary from "@app/components/RelaySummary.svelte"
import {pushModal} from "@app/util/modal" import {pushModal} from "@app/util/modal"
import {dufflepud, PLATFORM_URL, IMAGE_CONTENT_TYPES, VIDEO_CONTENT_TYPES} from "@app/core/state" import {
dufflepud,
PLATFORM_URL,
IMAGE_CONTENT_TYPES,
VIDEO_CONTENT_TYPES,
parseInviteLink,
} from "@app/core/state"
import {makeSpacePath} from "@app/util/routes" import {makeSpacePath} from "@app/util/routes"
const {value, event} = $props() const {value, event} = $props()
@@ -14,6 +21,7 @@
let hideImage = $state(false) let hideImage = $state(false)
const url = value.url.toString() const url = value.url.toString()
const inviteData = parseInviteLink(url)
const fileType = getTagValue("file-type", event.tags) || "" const fileType = getTagValue("file-type", event.tags) || ""
const [href, external] = call(() => { const [href, external] = call(() => {
if (isRelayUrl(url)) return [makeSpacePath(url), false] if (isRelayUrl(url)) return [makeSpacePath(url), false]
@@ -49,6 +57,11 @@
<button type="button" onclick={stopPropagation(preventDefault(expand))}> <button type="button" onclick={stopPropagation(preventDefault(expand))}>
<ContentLinkBlockImage {value} {event} class="m-auto max-h-96 rounded-box" /> <ContentLinkBlockImage {value} {event} class="m-auto max-h-96 rounded-box" />
</button> </button>
{:else if inviteData}
<div class="bg-alt flex max-w-xl flex-col gap-4 p-4 leading-normal">
<p class="text-sm opacity-75">Invitation to join a space:</p>
<RelaySummary url={inviteData.url} />
</div>
{:else} {:else}
{#await loadPreview()} {#await loadPreview()}
<div class="center my-12 w-full"> <div class="center my-12 w-full">