Add support for kind 40 notes (because they might show up as bech32 strings)

This commit is contained in:
Jonathan Staab 2023-06-19 12:11:06 -07:00
parent e2cf48eed9
commit d5b3d935a4
3 changed files with 33 additions and 3 deletions

View File

@ -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} />

View 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>

View File

@ -23,8 +23,6 @@
} catch (e) {
warn(e)
}
console.log(type, data)
})
</script>