Bump welshman, fix nested quote background

This commit is contained in:
Jon Staab
2024-10-02 11:57:36 -07:00
parent 54bf6add16
commit a422d59f4b
5 changed files with 214 additions and 99 deletions
+46 -45
View File
@@ -73,51 +73,52 @@
$: ellipsize = expandable && shortContent.find(isEllipsis)
</script>
<div
class="overflow-hidden text-ellipsis"
style={ellipsize ? "mask-image: linear-gradient(0deg, transparent 0px, black 100px)" : ""}>
{#each shortContent as parsed, i}
{#if isNewline(parsed)}
<ContentNewline value={parsed.value.slice(isNextToBlock(i) ? 1 : 0)} />
{:else if isTopic(parsed)}
<ContentTopic value={parsed.value} />
{:else if isCode(parsed)}
<ContentCode value={parsed.value} />
{:else if isCashu(parsed) || isInvoice(parsed)}
<ContentToken value={parsed.value} />
{:else if isLink(parsed)}
{#if isStartOrEnd(i) && !hideMedia}
<ContentLinkBlock value={parsed.value} />
<div class="relative">
<div
class="overflow-hidden text-ellipsis"
style={ellipsize ? "mask-image: linear-gradient(0deg, transparent 0px, black 100px)" : ""}>
{#each shortContent as parsed, i}
{#if isNewline(parsed)}
<ContentNewline value={parsed.value.slice(isNextToBlock(i) ? 1 : 0)} />
{:else if isTopic(parsed)}
<ContentTopic value={parsed.value} />
{:else if isCode(parsed)}
<ContentCode value={parsed.value} />
{:else if isCashu(parsed) || isInvoice(parsed)}
<ContentToken value={parsed.value} />
{:else if isLink(parsed)}
{#if isStartOrEnd(i) && !hideMedia}
<ContentLinkBlock value={parsed.value} />
{:else}
<ContentLinkInline value={parsed.value} />
{/if}
{:else if isProfile(parsed)}
<ContentMention value={parsed.value} />
{:else if isEvent(parsed) || isAddress(parsed)}
{#if isStartOrEnd(i) && depth < 2 && !hideMedia}
<ContentQuote value={parsed.value} {depth}>
<div slot="note-content" let:event>
<svelte:self {hideMedia} {event} depth={depth + 1} />
</div>
</ContentQuote>
{:else}
<Link
external
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={entityLink(parsed.raw)}>
{fromNostrURI(parsed.raw).slice(0, 16) + "…"}
</Link>
{/if}
{:else}
<ContentLinkInline value={parsed.value} />
{@html renderParsed(parsed)}
{/if}
{:else if isProfile(parsed)}
<ContentMention value={parsed.value} />
{:else if isEvent(parsed) || isAddress(parsed)}
{#if isStartOrEnd(i) && depth < 2 && !hideMedia}
<ContentQuote value={parsed.value} {depth}>
<div slot="note-content" let:event>
<svelte:self {hideMedia} {event} depth={depth + 1} />
</div>
</ContentQuote>
{:else}
<Link
external
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={entityLink(parsed.raw)}>
{fromNostrURI(parsed.raw).slice(0, 16) + "…"}
</Link>
{/if}
{:else}
{@html renderParsed(parsed)}
{/if}
{/each}
</div>
{#if ellipsize}
<div class="z-feature relative -mt-24 mb-0 flex justify-center bg-gradient-to-t from-base-100 pt-12" class:-ml-12={depth > 0}>
<button type="button" class="btn" on:click|stopPropagation|preventDefault={expand}>
See more
</button>
{/each}
</div>
{/if}
{#if ellipsize}
<div class="z-feature relative flex justify-center bg-gradient-to-t from-base-100 pt-12 -m-6">
<button type="button" class="btn" on:click|stopPropagation|preventDefault={expand}>
See more
</button>
</div>
{/if}
</div>
+13 -3
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import {onMount} from 'svelte'
import {getAddress, Address} from "@welshman/util"
import Spinner from "@lib/components/Spinner.svelte"
import NoteCard from "@app/components/NoteCard.svelte"
@@ -11,17 +12,26 @@
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
const event = deriveEvent(idOrAddress, relays)
let element: Element
let bgClass = "bg-base-300"
$: address = $event ? getAddress($event) : ""
$: isGroup = address.match(/^(34550|35834):/)
onMount(() => {
if (element.closest('.bg-base-300')) {
bgClass = 'bg-base-100'
}
})
</script>
<button class="text-left my-2 max-w-full" on:click|stopPropagation>
<button class="block text-left my-2 max-w-full" bind:this={element} on:click|stopPropagation>
{#if $event}
<NoteCard event={$event} class="p-4 rounded-box bg-base-300">
<NoteCard event={$event} class="p-4 rounded-box {bgClass}">
<slot name="note-content" event={$event} {depth} />
</NoteCard>
{:else}
<div class="p-4 rounded-box bg-base-300">
<div class="p-4 rounded-box {bgClass}">
<Spinner loading>Loading event...</Spinner>
</div>
{/if}