mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 00:10:52 +00:00
Add support for kind 30023
This commit is contained in:
parent
41a08f7167
commit
d2b82ec418
@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# 0.2.33
|
||||||
|
|
||||||
|
- [x] Add rendering support for kind 1985 (labels and reviews)
|
||||||
|
- [x] Add rendering support for kind 9802 (highlights)
|
||||||
|
- [x] Add rendering support for kind 1063 (image header)
|
||||||
|
- [x] Add rendering support for kind 30023 (long form content)
|
||||||
|
|
||||||
# 0.2.32
|
# 0.2.32
|
||||||
|
|
||||||
- [x] Add note preview when composing
|
- [x] Add note preview when composing
|
||||||
|
@ -45,8 +45,10 @@
|
|||||||
"fuse.js": "^6.6.2",
|
"fuse.js": "^6.6.2",
|
||||||
"hurdak": "github:ConsignCloud/hurdak",
|
"hurdak": "github:ConsignCloud/hurdak",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
|
"insane": "^2.6.2",
|
||||||
"lokijs": "^1.5.12",
|
"lokijs": "^1.5.12",
|
||||||
"lru-cache": "^7.18.3",
|
"lru-cache": "^7.18.3",
|
||||||
|
"marked": "^5.1.0",
|
||||||
"nostr-tools": "^1.7.4",
|
"nostr-tools": "^1.7.4",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"paravel": "^0.1.15",
|
"paravel": "^0.1.15",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
import {pluck, omit, objOf} from "ramda"
|
import {pluck, omit, objOf} from "ramda"
|
||||||
import {debounce} from "throttle-debounce"
|
import {debounce} from "throttle-debounce"
|
||||||
import {createLocalDate, formatTimestampAsDate} from "src/util/misc"
|
import {createLocalDate, formatTimestampAsDate} from "src/util/misc"
|
||||||
import {displayPerson} from "src/util/nostr"
|
import {displayPerson, noteKinds} from "src/util/nostr"
|
||||||
import Chip from "src/partials/Chip.svelte"
|
import Chip from "src/partials/Chip.svelte"
|
||||||
import Input from "src/partials/Input.svelte"
|
import Input from "src/partials/Input.svelte"
|
||||||
import Anchor from "src/partials/Anchor.svelte"
|
import Anchor from "src/partials/Anchor.svelte"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const applyFilter = () => {
|
const applyFilter = () => {
|
||||||
const newFilter = {} as DynamicFilter
|
const newFilter = {kinds: noteKinds} as DynamicFilter
|
||||||
|
|
||||||
if (_filter.since) {
|
if (_filter.since) {
|
||||||
newFilter.since = createLocalDate(_filter.since).setHours(23, 59, 59, 0) / 1000
|
newFilter.since = createLocalDate(_filter.since).setHours(23, 59, 59, 0) / 1000
|
||||||
@ -155,10 +155,10 @@
|
|||||||
<slot name="controls" />
|
<slot name="controls" />
|
||||||
</div>
|
</div>
|
||||||
{#if parts.length > 0}
|
{#if parts.length > 0}
|
||||||
<div class="mr-2 mb-2 inline-block py-1">Showing notes:</div>
|
<div class="mb-2 mr-2 inline-block py-1">Showing notes:</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#each parts as { keys, label }}
|
{#each parts as { keys, label }}
|
||||||
<Chip class="mr-2 mb-2 inline-block" onClick={keys ? () => removePart(keys) : null}
|
<Chip class="mb-2 mr-2 inline-block" onClick={keys ? () => removePart(keys) : null}
|
||||||
>{label}</Chip>
|
>{label}</Chip>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import NoteContentKind1985 from "src/app/shared/NoteContentKind1985.svelte"
|
import NoteContentKind1985 from "src/app/shared/NoteContentKind1985.svelte"
|
||||||
import NoteContentKind9802 from "src/app/shared/NoteContentKind9802.svelte"
|
import NoteContentKind9802 from "src/app/shared/NoteContentKind9802.svelte"
|
||||||
import NoteContentKind1063 from "src/app/shared/NoteContentKind1063.svelte"
|
import NoteContentKind1063 from "src/app/shared/NoteContentKind1063.svelte"
|
||||||
|
import NoteContentKind30023 from "src/app/shared/NoteContentKind30023.svelte"
|
||||||
import user from "src/agent/user"
|
import user from "src/agent/user"
|
||||||
|
|
||||||
export let note
|
export let note
|
||||||
@ -18,6 +19,8 @@
|
|||||||
<NoteContentKind9802 {note} {anchorId} {maxLength} {showEntire} {showMedia} />
|
<NoteContentKind9802 {note} {anchorId} {maxLength} {showEntire} {showMedia} />
|
||||||
{:else if note.kind === 1063}
|
{:else if note.kind === 1063}
|
||||||
<NoteContentKind1063 {note} {showMedia} />
|
<NoteContentKind1063 {note} {showMedia} />
|
||||||
|
{:else if note.kind === 30023}
|
||||||
|
<NoteContentKind30023 {note} {showEntire} {showMedia} />
|
||||||
{:else}
|
{:else}
|
||||||
<NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} {showMedia} />
|
<NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} {showMedia} />
|
||||||
{/if}
|
{/if}
|
||||||
|
44
src/app/shared/NoteContentKind30023.svelte
Normal file
44
src/app/shared/NoteContentKind30023.svelte
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import {marked} from 'marked'
|
||||||
|
import insane from 'insane'
|
||||||
|
import {Tags} from 'src/util/nostr'
|
||||||
|
import {canDisplayUrl} from 'src/util/notes'
|
||||||
|
import {modal} from "src/partials/state"
|
||||||
|
import Chip from 'src/partials/Chip.svelte'
|
||||||
|
import NoteContentLink from "src/app/shared/NoteContentLink.svelte"
|
||||||
|
|
||||||
|
export let note, showEntire
|
||||||
|
export let showMedia = false
|
||||||
|
|
||||||
|
const tags = Tags.from(note)
|
||||||
|
const {title, summary, image} = tags.asMeta()
|
||||||
|
|
||||||
|
const openTopic = topic => {
|
||||||
|
modal.push({type: "topic/feed", topic})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 overflow-hidden text-ellipsis">
|
||||||
|
<h3 class="text-2xl staatliches">{title}</h3>
|
||||||
|
{#if summary && !showEntire}
|
||||||
|
<p>{summary}</p>
|
||||||
|
{/if}
|
||||||
|
{#if showMedia && image && canDisplayUrl(image)}
|
||||||
|
<NoteContentLink value={{url: image, canDisplay: true}} showMedia />
|
||||||
|
{/if}
|
||||||
|
<div>
|
||||||
|
{#each tags.topics() as topic}
|
||||||
|
<Chip
|
||||||
|
class="mr-2 mb-2 inline-block cursor-pointer"
|
||||||
|
on:click={() => openTopic(topic)}>
|
||||||
|
#{topic}
|
||||||
|
</Chip>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if showEntire}
|
||||||
|
<div class="flex flex-col gap-4 leading-6">
|
||||||
|
{@html insane(marked.parse(note.content))}
|
||||||
|
</div>
|
||||||
|
{/if}
|
@ -10,7 +10,7 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={className}>
|
<div class={className} on:click>
|
||||||
<div class="flex items-center gap-2 whitespace-nowrap">
|
<div class="flex items-center gap-2 whitespace-nowrap">
|
||||||
{#if onClick}
|
{#if onClick}
|
||||||
<i class="fa fa-times cursor-pointer" on:click|preventDefault={onClick} />
|
<i class="fa fa-times cursor-pointer" on:click|preventDefault={onClick} />
|
||||||
|
@ -5,8 +5,7 @@ import {ensurePlural, ellipsize, first} from "hurdak/lib/hurdak"
|
|||||||
import {tryJson, avg} from "src/util/misc"
|
import {tryJson, avg} from "src/util/misc"
|
||||||
import {invoiceAmount} from "src/util/lightning"
|
import {invoiceAmount} from "src/util/lightning"
|
||||||
|
|
||||||
export const noteKinds = [1, 1985, 30023, 30018, 10001, 1063, 9802]
|
export const noteKinds = [1, 1985, 30023, 1063, 9802]
|
||||||
// export const noteKinds = [1063]
|
|
||||||
export const personKinds = [0, 2, 3, 10001, 10002]
|
export const personKinds = [0, 2, 3, 10001, 10002]
|
||||||
export const userKinds = personKinds.concat([10000, 30001, 30078])
|
export const userKinds = personKinds.concat([10000, 30001, 30078])
|
||||||
export const appDataKeys = [
|
export const appDataKeys = [
|
||||||
@ -47,6 +46,12 @@ export class Tags {
|
|||||||
relays() {
|
relays() {
|
||||||
return uniq(flatten(this.tags).filter(isShareableRelay)).map(objOf("url"))
|
return uniq(flatten(this.tags).filter(isShareableRelay)).map(objOf("url"))
|
||||||
}
|
}
|
||||||
|
topics() {
|
||||||
|
return this.type("t")
|
||||||
|
.values()
|
||||||
|
.all()
|
||||||
|
.map(t => t.replace(/^#/, ""))
|
||||||
|
}
|
||||||
pubkeys() {
|
pubkeys() {
|
||||||
return this.type("p").values().all()
|
return this.type("p").values().all()
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type {Event, Filter} from "nostr-tools"
|
import type {Event} from "nostr-tools"
|
||||||
|
|
||||||
export type Relay = {
|
export type Relay = {
|
||||||
url: string
|
url: string
|
||||||
@ -38,6 +38,4 @@ export type Room = {
|
|||||||
picture?: string
|
picture?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DynamicFilter = Filter & {
|
export type DynamicFilter = Record<string, any>
|
||||||
authors?: string | string[]
|
|
||||||
} & Record<string, any>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user