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 NoteContentKind31337 from "src/app/shared/NoteContentKind31337.svelte"
|
||||||
import NoteContentKind31923 from "src/app/shared/NoteContentKind31923.svelte"
|
import NoteContentKind31923 from "src/app/shared/NoteContentKind31923.svelte"
|
||||||
import NoteContentKind32123 from "src/app/shared/NoteContentKind32123.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"
|
import {getSetting} from "src/engine"
|
||||||
|
|
||||||
export let note
|
export let note
|
||||||
@ -74,6 +76,10 @@
|
|||||||
<NoteContentKind31923 {note} />
|
<NoteContentKind31923 {note} />
|
||||||
{:else if note.kind === 32123}
|
{:else if note.kind === 32123}
|
||||||
<NoteContentKind32123 {note} />
|
<NoteContentKind32123 {note} />
|
||||||
|
{:else if note.kind === 34550}
|
||||||
|
<NoteContentKind34550 {note} />
|
||||||
|
{:else if note.kind === 35834}
|
||||||
|
<NoteContentKind35834 {note} />
|
||||||
{:else}
|
{:else}
|
||||||
<NoteContentKind1 {note} {maxLength} {showEntire} {showMedia} {expandable} {isQuote}>
|
<NoteContentKind1 {note} {maxLength} {showEntire} {showMedia} {expandable} {isQuote}>
|
||||||
<div slot="note-content" let:quote>
|
<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 {isShareableRelay} from "paravel"
|
||||||
import {filterVals} from "hurdak"
|
import {filterVals} from "hurdak"
|
||||||
import {asArray} from "src/util/misc"
|
import {asArray} from "src/util/misc"
|
||||||
|
import {Naddr} from "src/util/nostr"
|
||||||
import Anchor from "src/partials/Anchor.svelte"
|
import Anchor from "src/partials/Anchor.svelte"
|
||||||
import Card from "src/partials/Card.svelte"
|
import Card from "src/partials/Card.svelte"
|
||||||
import Spinner from "src/partials/Spinner.svelte"
|
import Spinner from "src/partials/Spinner.svelte"
|
||||||
@ -35,7 +36,13 @@
|
|||||||
const noteId = value.id || quote?.id
|
const noteId = value.id || quote?.id
|
||||||
|
|
||||||
// stopPropagation wasn't working for some reason
|
// 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
|
router
|
||||||
.at("notes")
|
.at("notes")
|
||||||
.of(noteId, {relays})
|
.of(noteId, {relays})
|
||||||
@ -48,6 +55,9 @@
|
|||||||
muted = false
|
muted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: address = quote ? Naddr.fromEvent(quote).asTagValue() : ""
|
||||||
|
$: isGroup = address.match(/^(34550|35834):/)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
quote = await loadOne({
|
quote = await loadOne({
|
||||||
relays: relays,
|
relays: relays,
|
||||||
@ -83,17 +93,19 @@
|
|||||||
<Anchor class="underline" on:click={unmute}>Show</Anchor>
|
<Anchor class="underline" on:click={unmute}>Show</Anchor>
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="mb-4 flex items-center gap-4">
|
{#if !isGroup}
|
||||||
<PersonCircle class="h-6 w-6" pubkey={quote.pubkey} />
|
<div class="mb-4 flex items-center gap-4">
|
||||||
<Anchor
|
<PersonCircle class="h-6 w-6" pubkey={quote.pubkey} />
|
||||||
modal
|
<Anchor
|
||||||
stopPropagation
|
modal
|
||||||
type="unstyled"
|
stopPropagation
|
||||||
class="flex items-center gap-2"
|
type="unstyled"
|
||||||
href={router.at("people").of(quote.pubkey).toString()}>
|
class="flex items-center gap-2"
|
||||||
<h2 class="text-lg">{displayPubkey(quote.pubkey)}</h2>
|
href={router.at("people").of(quote.pubkey).toString()}>
|
||||||
</Anchor>
|
<h2 class="text-lg">{displayPubkey(quote.pubkey)}</h2>
|
||||||
</div>
|
</Anchor>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<slot name="note-content" {quote} />
|
<slot name="note-content" {quote} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
Reference in New Issue
Block a user