mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Add support for kind 40 notes (because they might show up as bech32 strings)
This commit is contained in:
parent
e2cf48eed9
commit
d5b3d935a4
@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import NoteContentKind1 from "src/app/shared/NoteContentKind1.svelte"
|
||||
import NoteContentKind40 from "src/app/shared/NoteContentKind40.svelte"
|
||||
import NoteContentKind1985 from "src/app/shared/NoteContentKind1985.svelte"
|
||||
import NoteContentKind9802 from "src/app/shared/NoteContentKind9802.svelte"
|
||||
import NoteContentKind1063 from "src/app/shared/NoteContentKind1063.svelte"
|
||||
@ -13,7 +14,9 @@
|
||||
export let showMedia = user.getSetting("showMedia")
|
||||
</script>
|
||||
|
||||
{#if note.kind === 1985}
|
||||
{#if note.kind === 40}
|
||||
<NoteContentKind40 {note} />
|
||||
{:else if note.kind === 1985}
|
||||
<NoteContentKind1985 {note} {anchorId} {maxLength} {showEntire} />
|
||||
{:else if note.kind === 9802}
|
||||
<NoteContentKind9802 {note} {anchorId} {maxLength} {showEntire} {showMedia} />
|
||||
|
29
src/app/shared/NoteContentKind40.svelte
Normal file
29
src/app/shared/NoteContentKind40.svelte
Normal file
@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import {navigate} from "svelte-routing"
|
||||
import {nip19} from "nostr-tools"
|
||||
import {tryJson} from "src/util/misc"
|
||||
import Card from "src/partials/Card.svelte"
|
||||
import Content from "src/partials/Content.svelte"
|
||||
import ImageCircle from "src/partials/ImageCircle.svelte"
|
||||
import {watch} from "src/agent/db"
|
||||
|
||||
export let note
|
||||
|
||||
const {name, picture, about} = tryJson(() => JSON.parse(note.content))
|
||||
const room = watch("rooms", t => t.get(note.id) || {id: note.id, name, picture, about})
|
||||
const noteId = nip19.noteEncode(note.id)
|
||||
</script>
|
||||
|
||||
<Card interactive invertColors on:click={() => navigate(`/chat/${noteId}`)}>
|
||||
<Content>
|
||||
<div class="flex items-center gap-2">
|
||||
{#if $room.picture}
|
||||
<ImageCircle size={10} src={$room.picture} />
|
||||
{/if}
|
||||
<h3 class="staatliches text-2xl">{$room.name}</h3>
|
||||
</div>
|
||||
{#if $room.about}
|
||||
<p>{$room.about}</p>
|
||||
{/if}
|
||||
</Content>
|
||||
</Card>
|
@ -23,8 +23,6 @@
|
||||
} catch (e) {
|
||||
warn(e)
|
||||
}
|
||||
|
||||
console.log(type, data)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user