- {commit_id_shorthand}
+
+
Changes:
+
+ {commit_id_shorthand}
+
-
-
-
+{/if}
diff --git a/src/lib/components/events/content/Repo.svelte b/src/lib/components/events/content/Repo.svelte
new file mode 100644
index 0000000..f1877a7
--- /dev/null
+++ b/src/lib/components/events/content/Repo.svelte
@@ -0,0 +1,19 @@
+
+
+{#if repo}
+
+ Git Repository: {repo.name} by
+
+{/if}
diff --git a/src/lib/components/events/content/utils.ts b/src/lib/components/events/content/utils.ts
index 8aae4fc..ac3650c 100644
--- a/src/lib/components/events/content/utils.ts
+++ b/src/lib/components/events/content/utils.ts
@@ -1,5 +1,6 @@
import type { NDKTag } from '@nostr-dev-kit/ndk'
import { nip19 } from 'nostr-tools'
+import type { AddressPointer, EventPointer } from 'nostr-tools/lib/types/nip19'
import { last } from 'ramda'
export const TOPIC = 'topic'
@@ -67,31 +68,29 @@ export const NOSTR_NOTE = 'nostr:note'
type PartTypeNote = 'nostr:note'
export type ParsedNote = {
type: PartTypeNote
- id: string
- relays: string[]
+ data: EventPointer
}
export const NOSTR_NEVENT = 'nostr:nevent'
type PartTypeNevent = 'nostr:nevent'
export type ParsedNevent = {
type: PartTypeNevent
- id: string
- relays: string[]
+ data: EventPointer
}
-
export const NOSTR_NADDR = 'nostr:naddr'
type PartTypeNaddr = 'nostr:naddr'
export type ParsedNaddr = {
type: PartTypeNaddr
- identifier: string
- pubkey: string
- kind: number
- relays: string[]
+ data: AddressPointer
}
-
-export type ParsedNostrLink = ParsedNpub | ParsedNprofile | ParsedNevent | ParsedNote | ParsedNaddr
+export type ParsedNostrLink =
+ | ParsedNpub
+ | ParsedNprofile
+ | ParsedNevent
+ | ParsedNote
+ | ParsedNaddr
export const TEXT = 'text'
type PartTypeText = 'text'
@@ -113,7 +112,11 @@ export const isParsedLink = (part: ParsedPart): part is ParsedLink =>
part.type == LINK
export const isParsedNostrLink = (part: ParsedPart): part is ParsedNostrLink =>
- part.type == NOSTR_NPUB || part.type == NOSTR_NPROFILE || part.type == NOSTR_NEVENT || part.type == NOSTR_NOTE || part.type == NOSTR_NADDR
+ part.type == NOSTR_NPUB ||
+ part.type == NOSTR_NPROFILE ||
+ part.type == NOSTR_NEVENT ||
+ part.type == NOSTR_NOTE ||
+ part.type == NOSTR_NADDR
export const isParsedNpub = (part: ParsedPart): part is ParsedNpub =>
part.type == NOSTR_NPUB
@@ -219,13 +222,13 @@ export const parseContent = (content: string, tags: NDKTag[]): ParsedPart[] => {
return [bech32, { type: NOSTR_NPUB, hex: decoded.data.pubkey }]
}
if (decoded.type === 'note') {
- return [bech32, { type: NOSTR_NOTE, id: decoded.data, relays: [] }]
+ return [bech32, { type: NOSTR_NOTE, data: { id: decoded.data } }]
}
if (decoded.type === 'nevent') {
- return [bech32, { type: NOSTR_NEVENT, id: decoded.data.id, relays: decoded.data.relays || [] }]
+ return [bech32, { type: NOSTR_NEVENT, data: decoded.data }]
}
if (decoded.type === 'naddr') {
- return [bech32, { ...decoded.data, type: NOSTR_NADDR, relays: decoded.data.relays || [] }]
+ return [bech32, { type: NOSTR_NADDR, data: decoded.data }]
}
} catch {}
}
@@ -266,6 +269,14 @@ export const isCoverLetter = (s: string): boolean => {
return s.indexOf('PATCH 0/') > 0
}
+export function extractTagContent(
+ name: string,
+ tags: NDKTag[]
+): string | undefined {
+ const tag = tags.find((tag) => tag[0] === name)
+ return tag ? tag[1] : undefined
+}
+
/** this doesn't work for all patch formats and options */
export const extractPatchMessage = (s: string): string | undefined => {
try {
diff --git a/src/lib/wrappers/EventCard.svelte b/src/lib/wrappers/EventCard.svelte
index 5f12ff4..245310d 100644
--- a/src/lib/wrappers/EventCard.svelte
+++ b/src/lib/wrappers/EventCard.svelte
@@ -5,7 +5,12 @@
import Patch from '$lib/components/events/content/Patch.svelte'
import ParsedContent from '$lib/components/events/content/ParsedContent.svelte'
import { defaults as user_defaults } from '$lib/components/users/type'
- import { patch_kind, proposal_status_kinds } from '$lib/kinds'
+ import {
+ issue_kind,
+ patch_kind,
+ proposal_status_kinds,
+ repo_kind,
+ } from '$lib/kinds'
import { ensureUser } from '$lib/stores/users'
import type { NDKEvent } from '@nostr-dev-kit/ndk'
import { onDestroy } from 'svelte'
@@ -14,9 +19,12 @@
extractPatchMessage,
isCoverLetter,
} from '$lib/components/events/content/utils'
+ import Repo from '$lib/components/events/content/Repo.svelte'
+ import IssuePreview from '$lib/components/events/content/IssuePreview.svelte'
export let event: NDKEvent
export let type: 'proposal' | 'issue' = 'proposal'
+ export let preview = false
let author = writable({ ...user_defaults })
let author_unsubsriber: Unsubscriber
@@ -45,6 +53,18 @@
added to '{getDtag(event) || 'unknown'}' list by
+{:else if event.kind && event.kind == repo_kind}
+
+
+
+{:else if preview && event.kind && event.kind === patch_kind}
+
+
+
+{:else if preview && event.kind && event.kind === issue_kind}
+
+
+
{:else}
{#if event.kind == patch_kind}
@@ -54,7 +74,7 @@
tags={event.tags}
/>
{:else}
-
+
{/if}
{:else if event.kind && proposal_status_kinds.includes(event.kind)}
diff --git a/src/lib/wrappers/EventPreview.svelte b/src/lib/wrappers/EventPreview.svelte
index 71e0c07..aee4a97 100644
--- a/src/lib/wrappers/EventPreview.svelte
+++ b/src/lib/wrappers/EventPreview.svelte
@@ -1,58 +1,72 @@
-
- {#if $event && $event.pubkey}
-
- {:else if cannot_find_event}
- cannot find event
- {:else}
- loading...
- {/if}
-
-
+
+ {#if repo && $repo}
+
+
+
+ {:else if $event && $event.pubkey}
+
+
+
+ {:else if cannot_find_event}
+
cannot find event
+ {:else}
+
loading...
+ {/if}
+