Improve rendering for groups

This commit is contained in:
Jon Staab 2024-02-15 14:34:28 -08:00
parent 85378a6723
commit 8911474e75
4 changed files with 46 additions and 12 deletions

View File

@ -18,6 +18,8 @@
import NoteContentKind31337 from "src/app/shared/NoteContentKind31337.svelte"
import NoteContentKind31923 from "src/app/shared/NoteContentKind31923.svelte"
import NoteContentKind32123 from "src/app/shared/NoteContentKind32123.svelte"
import NoteContentKind34550 from "src/app/shared/NoteContentKind34550.svelte"
import NoteContentKind35834 from "src/app/shared/NoteContentKind35834.svelte"
import {getSetting} from "src/engine"
export let note
@ -74,6 +76,10 @@
<NoteContentKind31923 {note} />
{:else if note.kind === 32123}
<NoteContentKind32123 {note} />
{:else if note.kind === 34550}
<NoteContentKind34550 {note} />
{:else if note.kind === 35834}
<NoteContentKind35834 {note} />
{:else}
<NoteContentKind1 {note} {maxLength} {showEntire} {showMedia} {expandable} {isQuote}>
<div slot="note-content" let:quote>

View File

@ -0,0 +1,8 @@
<script lang="ts">
import {Naddr} from 'src/util/nostr'
import GroupSummary from "src/app/shared/GroupSummary.svelte"
export let note
</script>
<GroupSummary address={Naddr.fromEvent(note).asTagValue()} />

View File

@ -0,0 +1,8 @@
<script lang="ts">
import {Naddr} from 'src/util/nostr'
import GroupSummary from "src/app/shared/GroupSummary.svelte"
export let note
</script>
<GroupSummary address={Naddr.fromEvent(note).asTagValue()} />

View File

@ -3,6 +3,7 @@
import {isShareableRelay} from "paravel"
import {filterVals} from "hurdak"
import {asArray} from "src/util/misc"
import {Naddr} from "src/util/nostr"
import Anchor from "src/partials/Anchor.svelte"
import Card from "src/partials/Card.svelte"
import Spinner from "src/partials/Spinner.svelte"
@ -35,7 +36,13 @@
const noteId = value.id || quote?.id
// stopPropagation wasn't working for some reason
if (noteId && e.detail.target.textContent !== "Show") {
if (e.detail.target.textContent === "Show") {
return
}
if (isGroup) {
router.at("groups").of(address, {relays}).at("notes").open()
} else if (noteId) {
router
.at("notes")
.of(noteId, {relays})
@ -48,6 +55,9 @@
muted = false
}
$: address = quote ? Naddr.fromEvent(quote).asTagValue() : ""
$: isGroup = address.match(/^(34550|35834):/)
onMount(async () => {
quote = await loadOne({
relays: relays,
@ -83,17 +93,19 @@
<Anchor class="underline" on:click={unmute}>Show</Anchor>
</p>
{:else}
<div class="mb-4 flex items-center gap-4">
<PersonCircle class="h-6 w-6" pubkey={quote.pubkey} />
<Anchor
modal
stopPropagation
type="unstyled"
class="flex items-center gap-2"
href={router.at("people").of(quote.pubkey).toString()}>
<h2 class="text-lg">{displayPubkey(quote.pubkey)}</h2>
</Anchor>
</div>
{#if !isGroup}
<div class="mb-4 flex items-center gap-4">
<PersonCircle class="h-6 w-6" pubkey={quote.pubkey} />
<Anchor
modal
stopPropagation
type="unstyled"
class="flex items-center gap-2"
href={router.at("people").of(quote.pubkey).toString()}>
<h2 class="text-lg">{displayPubkey(quote.pubkey)}</h2>
</Anchor>
</div>
{/if}
<slot name="note-content" {quote} />
{/if}
{:else}