mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 08:21:20 +00:00
Improve rendering for groups
This commit is contained in:
parent
85378a6723
commit
8911474e75
@ -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>
|
||||
|
8
src/app/shared/NoteContentKind34550.svelte
Normal file
8
src/app/shared/NoteContentKind34550.svelte
Normal 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()} />
|
8
src/app/shared/NoteContentKind35834.svelte
Normal file
8
src/app/shared/NoteContentKind35834.svelte
Normal 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()} />
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user