diff --git a/__snapshots__/proposals-status--closed.png b/__snapshots__/proposals-status--closed.png
new file mode 100644
index 0000000..28682c9
Binary files /dev/null and b/__snapshots__/proposals-status--closed.png differ
diff --git a/__snapshots__/prs-list-item--no-details.png b/__snapshots__/proposals-status--draft.png
similarity index 60%
rename from __snapshots__/prs-list-item--no-details.png
rename to __snapshots__/proposals-status--draft.png
index b22b18a..f86a496 100644
Binary files a/__snapshots__/prs-list-item--no-details.png and b/__snapshots__/proposals-status--draft.png differ
diff --git a/__snapshots__/prs-status--loading.png b/__snapshots__/proposals-status--loading.png
similarity index 83%
rename from __snapshots__/prs-status--loading.png
rename to __snapshots__/proposals-status--loading.png
index bb56cc4..dd3c559 100644
Binary files a/__snapshots__/prs-status--loading.png and b/__snapshots__/proposals-status--loading.png differ
diff --git a/__snapshots__/proposals-status--merged.png b/__snapshots__/proposals-status--merged.png
new file mode 100644
index 0000000..06120e3
Binary files /dev/null and b/__snapshots__/proposals-status--merged.png differ
diff --git a/__snapshots__/proposals-status--open-edit-mode.png b/__snapshots__/proposals-status--open-edit-mode.png
new file mode 100644
index 0000000..75e9fb0
Binary files /dev/null and b/__snapshots__/proposals-status--open-edit-mode.png differ
diff --git a/__snapshots__/prs-status--open.png b/__snapshots__/proposals-status--open.png
similarity index 54%
rename from __snapshots__/prs-status--open.png
rename to __snapshots__/proposals-status--open.png
index 0ce1915..4a0af22 100644
Binary files a/__snapshots__/prs-status--open.png and b/__snapshots__/proposals-status--open.png differ
diff --git a/__snapshots__/proposals-status.test.js.snap b/__snapshots__/proposals-status.test.js.snap
new file mode 100644
index 0000000..349fd30
--- /dev/null
+++ b/__snapshots__/proposals-status.test.js.snap
@@ -0,0 +1,60 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Proposals/Status Closed smoke-test 1`] = `
+
+ Closed
+
+`;
+
+exports[`Proposals/Status Draft smoke-test 1`] = `
+
+ Draft
+
+`;
+
+exports[`Proposals/Status Loading smoke-test 1`] = `
+
+
+`;
+
+exports[`Proposals/Status Merged smoke-test 1`] = `
+
+ Merged
+
+`;
+
+exports[`Proposals/Status Open Edit Mode smoke-test 1`] = `
+
+`;
+
+exports[`Proposals/Status Open smoke-test 1`] = `
+
+ Open
+
+`;
diff --git a/__snapshots__/prs-header--author-loading.png b/__snapshots__/prs-header--author-loading.png
deleted file mode 100644
index 50536cd..0000000
Binary files a/__snapshots__/prs-header--author-loading.png and /dev/null differ
diff --git a/__snapshots__/prs-header--long-and-no-spaces.png b/__snapshots__/prs-header--long-and-no-spaces.png
deleted file mode 100644
index a80c11c..0000000
Binary files a/__snapshots__/prs-header--long-and-no-spaces.png and /dev/null differ
diff --git a/__snapshots__/prs-header--long-details.png b/__snapshots__/prs-header--long-details.png
deleted file mode 100644
index 1fb5dbc..0000000
Binary files a/__snapshots__/prs-header--long-details.png and /dev/null differ
diff --git a/__snapshots__/prs-header--short-details.png b/__snapshots__/prs-header--short-details.png
deleted file mode 100644
index f2c2345..0000000
Binary files a/__snapshots__/prs-header--short-details.png and /dev/null differ
diff --git a/__snapshots__/prs-list-item--author-loading.png b/__snapshots__/prs-list-item--author-loading.png
deleted file mode 100644
index 467eedd..0000000
Binary files a/__snapshots__/prs-list-item--author-loading.png and /dev/null differ
diff --git a/__snapshots__/prs-list-item--long-and-no-spaces.png b/__snapshots__/prs-list-item--long-and-no-spaces.png
deleted file mode 100644
index b70b00c..0000000
Binary files a/__snapshots__/prs-list-item--long-and-no-spaces.png and /dev/null differ
diff --git a/__snapshots__/prs-list-item--short-details.png b/__snapshots__/prs-list-item--short-details.png
deleted file mode 100644
index e443194..0000000
Binary files a/__snapshots__/prs-list-item--short-details.png and /dev/null differ
diff --git a/__snapshots__/prs-list-list--default.png b/__snapshots__/prs-list-list--default.png
deleted file mode 100644
index 2a702f8..0000000
Binary files a/__snapshots__/prs-list-list--default.png and /dev/null differ
diff --git a/__snapshots__/prs-list-list--empty.png b/__snapshots__/prs-list-list--empty.png
deleted file mode 100644
index 38c880d..0000000
Binary files a/__snapshots__/prs-list-list--empty.png and /dev/null differ
diff --git a/__snapshots__/prs-list-list--loading.png b/__snapshots__/prs-list-list--loading.png
deleted file mode 100644
index d77b4dc..0000000
Binary files a/__snapshots__/prs-list-list--loading.png and /dev/null differ
diff --git a/__snapshots__/prs-list-list--partially-loaded.png b/__snapshots__/prs-list-list--partially-loaded.png
deleted file mode 100644
index 59826e9..0000000
Binary files a/__snapshots__/prs-list-list--partially-loaded.png and /dev/null differ
diff --git a/__snapshots__/prs-status--closed.png b/__snapshots__/prs-status--closed.png
deleted file mode 100644
index f01fc4e..0000000
Binary files a/__snapshots__/prs-status--closed.png and /dev/null differ
diff --git a/__snapshots__/prs-status--draft.png b/__snapshots__/prs-status--draft.png
deleted file mode 100644
index 1c05702..0000000
Binary files a/__snapshots__/prs-status--draft.png and /dev/null differ
diff --git a/__snapshots__/prs-status--merged.png b/__snapshots__/prs-status--merged.png
deleted file mode 100644
index ae43bc6..0000000
Binary files a/__snapshots__/prs-status--merged.png and /dev/null differ
diff --git a/__snapshots__/prs-status--open-edit-mode.png b/__snapshots__/prs-status--open-edit-mode.png
deleted file mode 100644
index 3a70644..0000000
Binary files a/__snapshots__/prs-status--open-edit-mode.png and /dev/null differ
diff --git a/__snapshots__/prs-status.test.js.snap b/__snapshots__/prs-status.test.js.snap
deleted file mode 100644
index e3b762d..0000000
--- a/__snapshots__/prs-status.test.js.snap
+++ /dev/null
@@ -1,95 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`PRs/Status Closed smoke-test 1`] = `
-
-`;
-
-exports[`PRs/Status Draft smoke-test 1`] = `
-
-`;
-
-exports[`PRs/Status Loading smoke-test 1`] = `
-
-
-`;
-
-exports[`PRs/Status Merged smoke-test 1`] = `
-
-`;
-
-exports[`PRs/Status Open Edit Mode smoke-test 1`] = `
-
-`;
-
-exports[`PRs/Status Open smoke-test 1`] = `
-
-`;
diff --git a/src/lib/components/events/content/Kind19851985.svelte b/src/lib/components/events/content/Kind19851985.svelte
index 9ed6e19..ca467c1 100644
--- a/src/lib/components/events/content/Kind19851985.svelte
+++ b/src/lib/components/events/content/Kind19851985.svelte
@@ -1,6 +1,6 @@
-
+
diff --git a/src/lib/components/prs/PRHeader.svelte b/src/lib/components/proposals/ProposalHeader.svelte
similarity index 100%
rename from src/lib/components/prs/PRHeader.svelte
rename to src/lib/components/proposals/ProposalHeader.svelte
diff --git a/src/lib/components/proposals/ProposalsList.stories.svelte b/src/lib/components/proposals/ProposalsList.stories.svelte
new file mode 100644
index 0000000..d43e2e0
--- /dev/null
+++ b/src/lib/components/proposals/ProposalsList.stories.svelte
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/lib/components/proposals/ProposalsList.svelte b/src/lib/components/proposals/ProposalsList.svelte
new file mode 100644
index 0000000..1afff8c
--- /dev/null
+++ b/src/lib/components/proposals/ProposalsList.svelte
@@ -0,0 +1,31 @@
+
+
+
+ {#if title.length > 0}
+
+
{title}
+
+ {/if}
+ {#if proposals.length == 0 && !loading}
+
None
+ {/if}
+
+ {#each proposals as proposal}
+
+ {/each}
+ {#if loading}
+
+ {#if proposals.length == 0}
+
+
+ {/if}
+ {/if}
+
+
diff --git a/src/lib/components/prs/PRsListItem.stories.svelte b/src/lib/components/proposals/ProposalsListItem.stories.svelte
similarity index 72%
rename from src/lib/components/prs/PRsListItem.stories.svelte
rename to src/lib/components/proposals/ProposalsListItem.stories.svelte
index f9733fc..1611f71 100644
--- a/src/lib/components/prs/PRsListItem.stories.svelte
+++ b/src/lib/components/proposals/ProposalsListItem.stories.svelte
@@ -1,18 +1,18 @@
-
+
diff --git a/src/lib/components/prs/PRsListItem.svelte b/src/lib/components/proposals/ProposalsListItem.svelte
similarity index 92%
rename from src/lib/components/prs/PRsListItem.svelte
rename to src/lib/components/proposals/ProposalsListItem.svelte
index a59af5d..1d36b40 100644
--- a/src/lib/components/prs/PRsListItem.svelte
+++ b/src/lib/components/proposals/ProposalsListItem.svelte
@@ -6,7 +6,7 @@
import relativeTime from 'dayjs/plugin/relativeTime'
import { summary_defaults } from './type'
import { getName } from '../users/type'
- import { pr_icon_path } from './icons'
+ import { proposal_icon_path } from './icons'
import UserHeader from '../users/UserHeader.svelte'
dayjs.extend(relativeTime)
@@ -46,32 +46,32 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-success pt-1"
- >
{:else if status === 'Closed'}
{:else if status === 'Draft'}
{:else if status === 'Merged'}
{/if}
{#if loading}
diff --git a/src/lib/components/prs/Status.stories.svelte b/src/lib/components/proposals/Status.stories.svelte
similarity index 95%
rename from src/lib/components/prs/Status.stories.svelte
rename to src/lib/components/proposals/Status.stories.svelte
index 33ca895..61e987d 100644
--- a/src/lib/components/prs/Status.stories.svelte
+++ b/src/lib/components/proposals/Status.stories.svelte
@@ -4,7 +4,7 @@
import { Story, Template } from '@storybook/addon-svelte-csf'
export const meta: Meta = {
- title: 'PRs/Status',
+ title: 'Proposals/Status',
component: Status,
tags: ['autodocs'],
}
diff --git a/src/lib/components/prs/Status.svelte b/src/lib/components/proposals/Status.svelte
similarity index 90%
rename from src/lib/components/prs/Status.svelte
rename to src/lib/components/proposals/Status.svelte
index 2ab0084..07458d1 100644
--- a/src/lib/components/prs/Status.svelte
+++ b/src/lib/components/proposals/Status.svelte
@@ -5,7 +5,7 @@
proposal_status_draft,
proposal_status_open,
} from '$lib/kinds'
- import { pr_icon_path } from './icons'
+ import { proposal_icon_path } from './icons'
export let status: number | undefined = undefined
export let edit_mode = false
@@ -31,7 +31,7 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 18 18"
class="h-5 w-5 flex-none fill-success-content pt-1"
- >
+ >
Open
{:else if status === proposal_status_applied}
@@ -40,7 +40,7 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-primary-content pt-1"
- >
Merged
{:else if status === proposal_status_closed}
@@ -49,7 +49,7 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-neutral-content pt-1"
- >
Closed
{:else if status === proposal_status_draft}
@@ -58,7 +58,7 @@
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-neutral-content pt-1"
- >
Draft
{:else}
diff --git a/src/lib/components/prs/StatusSelector.svelte b/src/lib/components/proposals/StatusSelector.svelte
similarity index 84%
rename from src/lib/components/prs/StatusSelector.svelte
rename to src/lib/components/proposals/StatusSelector.svelte
index 2ab4c69..66c46a3 100644
--- a/src/lib/components/prs/StatusSelector.svelte
+++ b/src/lib/components/proposals/StatusSelector.svelte
@@ -1,7 +1,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/lib/components/prs/PRsList.svelte b/src/lib/components/prs/PRsList.svelte
deleted file mode 100644
index 4b2e2a4..0000000
--- a/src/lib/components/prs/PRsList.svelte
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- {#if title.length > 0}
-
-
{title}
-
- {/if}
- {#if prs.length == 0 && !loading}
-
None
- {/if}
-
- {#each prs as pr}
-
- {/each}
- {#if loading}
-
- {#if prs.length == 0}
-
-
- {/if}
- {/if}
-
-
diff --git a/src/lib/kinds.ts b/src/lib/kinds.ts
index e482c7c..01619bd 100644
--- a/src/lib/kinds.ts
+++ b/src/lib/kinds.ts
@@ -4,7 +4,7 @@ export const proposal_status_open: number = 1630
export const proposal_status_applied: number = 1631
export const proposal_status_closed: number = 1632
export const proposal_status_draft: number = 1633
-export const pr_status_kinds: number[] = [
+export const proposal_status_kinds: number[] = [
proposal_status_open,
proposal_status_applied,
proposal_status_closed,
diff --git a/src/lib/stores/PR.ts b/src/lib/stores/Proposal.ts
similarity index 62%
rename from src/lib/stores/PR.ts
rename to src/lib/stores/Proposal.ts
index 68ef476..f73f458 100644
--- a/src/lib/stores/PR.ts
+++ b/src/lib/stores/Proposal.ts
@@ -3,62 +3,67 @@ import { writable, type Unsubscriber, type Writable } from 'svelte/store'
import { ndk } from './ndk'
import type { User } from '$lib/components/users/type'
import { ensureUser } from './users'
-import { type PRFull, full_defaults } from '$lib/components/prs/type'
-import { pr_status_kinds, proposal_status_open } from '$lib/kinds'
+import {
+ type ProposalFull,
+ full_defaults,
+} from '$lib/components/proposals/type'
+import { proposal_status_kinds, proposal_status_open } from '$lib/kinds'
import { ensureSelectedRepo } from './repo'
import { extractPatchMessage } from '$lib/components/events/content/utils'
import { goto } from '$app/navigation'
-export const selected_pr_full: Writable = writable({ ...full_defaults })
+export const selected_proposal_full: Writable = writable({
+ ...full_defaults,
+})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-let selected_pr_repo_id: string = ''
-let selected_pr_id: string = ''
-let pr_summary_author_unsubsriber: Unsubscriber | undefined
+let selected_proposal_repo_id: string = ''
+let selected_proposal_id: string = ''
+let proposal_summary_author_unsubsriber: Unsubscriber | undefined
-export const selected_pr_replies: Writable = writable([])
+export const selected_proposal_replies: Writable = writable([])
-let selected_pr_status_date = 0
+let selected_proposal_status_date = 0
let sub: NDKSubscription
let sub_replies: NDKSubscription
-export const ensurePRFull = (repo_id: string, pr_id: string) => {
- if (selected_pr_id == pr_id) return
- if (pr_id == '') {
- selected_pr_full.set({ ...full_defaults })
- selected_pr_replies.set([])
+export const ensureProposalFull = (repo_id: string, proposal_id: string) => {
+ if (selected_proposal_id == proposal_id) return
+ if (proposal_id == '') {
+ selected_proposal_full.set({ ...full_defaults })
+ selected_proposal_replies.set([])
return
}
if (sub) sub.stop()
if (sub_replies) sub_replies.stop()
- selected_pr_repo_id = repo_id
- selected_pr_id = pr_id
- selected_pr_status_date = 0
- selected_pr_replies.set([])
+ selected_proposal_repo_id = repo_id
+ selected_proposal_id = proposal_id
+ selected_proposal_status_date = 0
+ selected_proposal_replies.set([])
- selected_pr_full.set({
+ selected_proposal_full.set({
...full_defaults,
summary: {
...full_defaults.summary,
- id: pr_id,
+ id: proposal_id,
repo_id: repo_id,
loading: true,
},
loading: true,
})
- if (pr_summary_author_unsubsriber) pr_summary_author_unsubsriber()
- pr_summary_author_unsubsriber = undefined
+ if (proposal_summary_author_unsubsriber) proposal_summary_author_unsubsriber()
+ proposal_summary_author_unsubsriber = undefined
new Promise(async (r) => {
const repo = await ensureSelectedRepo(repo_id)
sub = ndk.subscribe(
{
- ids: [pr_id],
+ ids: [proposal_id],
limit: 50,
},
{
@@ -71,15 +76,17 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
sub.on('event', (event: NDKEvent) => {
try {
- if (event.id == pr_id) {
+ if (event.id == proposal_id) {
const event_repo_id = event.tagValue('a')?.split(':')[2]
if (event_repo_id && event_repo_id !== repo_id) {
- goto(`/repo/${encodeURIComponent(event_repo_id)}/pr/${pr_id}`)
+ goto(
+ `/repo/${encodeURIComponent(event_repo_id)}/proposal/${proposal_id}`
+ )
}
- selected_pr_full.update((full) => {
+ selected_proposal_full.update((full) => {
return {
...full,
- pr_event: event,
+ proposal_event: event,
summary: {
...full.summary,
title: (
@@ -101,26 +108,25 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
}
})
- pr_summary_author_unsubsriber = ensureUser(event.pubkey).subscribe(
- (u: User) => {
- selected_pr_full.update((full) => {
- return {
- ...full,
- summary: {
- ...full.summary,
- author:
- event.pubkey == u.hexpubkey ? u : full.summary.author,
- },
- }
- })
- }
- )
+ proposal_summary_author_unsubsriber = ensureUser(
+ event.pubkey
+ ).subscribe((u: User) => {
+ selected_proposal_full.update((full) => {
+ return {
+ ...full,
+ summary: {
+ ...full.summary,
+ author: event.pubkey == u.hexpubkey ? u : full.summary.author,
+ },
+ }
+ })
+ })
}
} catch {}
})
sub.on('eose', () => {
- selected_pr_full.update((full) => {
+ selected_proposal_full.update((full) => {
const updated = {
...full,
summary: {
@@ -137,7 +143,7 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
sub_replies = ndk.subscribe(
{
- '#e': [pr_id],
+ '#e': [proposal_id],
},
{
closeOnEose: false,
@@ -147,15 +153,15 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
: undefined
)
- const process_replies = (event: NDKEvent) => {
+ const proposalocess_replies = (event: NDKEvent) => {
if (
event.kind &&
- pr_status_kinds.includes(event.kind) &&
+ proposal_status_kinds.includes(event.kind) &&
event.created_at &&
- selected_pr_status_date < event.created_at
+ selected_proposal_status_date < event.created_at
) {
- selected_pr_status_date = event.created_at
- selected_pr_full.update((full) => {
+ selected_proposal_status_date = event.created_at
+ selected_proposal_full.update((full) => {
return {
...full,
summary: {
@@ -167,7 +173,7 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
}
})
}
- selected_pr_replies.update((replies) => {
+ selected_proposal_replies.update((replies) => {
return [...replies, event].sort(
(a, b) => (a.created_at || 0) - (b.created_at || 0)
)
@@ -175,7 +181,7 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
if (event.tags.some((t) => t.length > 1 && t[1] === 'revision-root')) {
const sub_revision_replies = ndk.subscribe(
{
- ids: [pr_id],
+ ids: [proposal_id],
limit: 50,
},
{
@@ -186,17 +192,17 @@ export const ensurePRFull = (repo_id: string, pr_id: string) => {
: undefined
)
sub_revision_replies.on('event', (event: NDKEvent) => {
- process_replies(event)
+ proposalocess_replies(event)
})
}
}
sub_replies.on('event', (event: NDKEvent) => {
- process_replies(event)
+ proposalocess_replies(event)
})
sub_replies.on('eose', () => {
- selected_pr_full.update((full) => {
+ selected_proposal_full.update((full) => {
const updated = {
...full,
summary: {
diff --git a/src/lib/stores/PRs.ts b/src/lib/stores/Proposals.ts
similarity index 74%
rename from src/lib/stores/PRs.ts
rename to src/lib/stores/Proposals.ts
index 03b522d..e1f9083 100644
--- a/src/lib/stores/PRs.ts
+++ b/src/lib/stores/Proposals.ts
@@ -6,21 +6,21 @@ import {
} from '@nostr-dev-kit/ndk'
import { writable, type Unsubscriber, type Writable } from 'svelte/store'
import { ndk } from './ndk'
-import { summary_defaults } from '$lib/components/prs/type'
+import { summary_defaults } from '$lib/components/proposals/type'
import type { User } from '$lib/components/users/type'
import { ensureUser } from './users'
-import type { PRSummaries } from '$lib/components/prs/type'
+import type { ProposalSummaries } from '$lib/components/proposals/type'
import { ensureSelectedRepo } from './repo'
import {
patch_kind,
- pr_status_kinds,
+ proposal_status_kinds,
proposal_status_open,
repo_kind,
} from '$lib/kinds'
import type { Repo } from '$lib/components/repo/type'
import { extractPatchMessage } from '$lib/components/events/content/utils'
-export const pr_summaries: Writable = writable({
+export const proposal_summaries: Writable = writable({
id: '',
summaries: [],
loading: false,
@@ -32,9 +32,9 @@ let authors_unsubscribers: Unsubscriber[] = []
let sub: NDKSubscription
-export const ensurePRSummaries = async (repo_id: string) => {
+export const ensureProposalSummaries = async (repo_id: string) => {
if (selected_repo_id == repo_id) return
- pr_summaries.set({
+ proposal_summaries.set({
id: repo_id,
summaries: [],
loading: repo_id !== '',
@@ -85,11 +85,11 @@ export const ensurePRSummaries = async (repo_id: string) => {
event.content.length > 0 &&
!event.tags.some((t) => t.length > 1 && t[1] === 'revision-root')
) {
- pr_summaries.update((prs) => {
+ proposal_summaries.update((proposals) => {
return {
- ...prs,
+ ...proposals,
summaries: [
- ...prs.summaries,
+ ...proposals.summaries,
{
...summary_defaults,
id: event.id,
@@ -117,10 +117,10 @@ export const ensurePRSummaries = async (repo_id: string) => {
authors_unsubscribers.push(
ensureUser(event.pubkey).subscribe((u: User) => {
- pr_summaries.update((prs) => {
+ proposal_summaries.update((proposals) => {
return {
- ...prs,
- summaries: prs.summaries.map((o) => ({
+ ...proposals,
+ summaries: proposals.summaries.map((o) => ({
...o,
author: event.pubkey === o.author.hexpubkey ? u : o.author,
})),
@@ -131,10 +131,10 @@ export const ensurePRSummaries = async (repo_id: string) => {
} catch {}
})
sub.on('eose', () => {
- pr_summaries.update((prs) => {
- getAndUpdatePRStatus(prs, repo)
+ proposal_summaries.update((proposals) => {
+ getAndUpdateProposalStatus(proposals, repo)
return {
- ...prs,
+ ...proposals,
loading: false,
}
})
@@ -143,13 +143,16 @@ export const ensurePRSummaries = async (repo_id: string) => {
let sub_statuses: NDKSubscription
-function getAndUpdatePRStatus(prs: PRSummaries, repo: Repo): void {
+function getAndUpdateProposalStatus(
+ proposals: ProposalSummaries,
+ repo: Repo
+): void {
if (sub_statuses) sub_statuses.stop()
sub_statuses = ndk.subscribe(
{
- kinds: pr_status_kinds,
- '#e': prs.summaries.map((pr) => pr.id),
- '#r': [`r-${prs.id}`],
+ kinds: proposal_status_kinds,
+ '#e': proposals.summaries.map((proposal) => proposal.id),
+ '#r': [`r-${proposals.id}`],
},
{
closeOnEose: false,
@@ -157,19 +160,19 @@ function getAndUpdatePRStatus(prs: PRSummaries, repo: Repo): void {
NDKRelaySet.fromRelayUrls(repo.relays, ndk)
)
sub_statuses.on('event', (event: NDKEvent) => {
- const tagged_pr_event = event.tagValue('e')
+ const tagged_proposal_event = event.tagValue('e')
if (
event.kind &&
- pr_status_kinds.includes(event.kind) &&
- tagged_pr_event &&
+ proposal_status_kinds.includes(event.kind) &&
+ tagged_proposal_event &&
event.created_at
) {
- pr_summaries.update((prs) => {
+ proposal_summaries.update((proposals) => {
return {
- ...prs,
- summaries: prs.summaries.map((o) => {
+ ...proposals,
+ summaries: proposals.summaries.map((o) => {
if (
- o.id === tagged_pr_event &&
+ o.id === tagged_proposal_event &&
event.created_at &&
o.status_date < event.created_at
) {
@@ -188,10 +191,10 @@ function getAndUpdatePRStatus(prs: PRSummaries, repo: Repo): void {
})
sub_statuses.on('eose', () => {
- pr_summaries.update((prs) => {
+ proposal_summaries.update((proposals) => {
return {
- ...prs,
- summaries: prs.summaries.map((o) => ({
+ ...proposals,
+ summaries: proposals.summaries.map((o) => ({
...o,
status: o.status || proposal_status_open,
})),
diff --git a/src/lib/wrappers/Compose.svelte b/src/lib/wrappers/Compose.svelte
index 53c46bc..04bd6bf 100644
--- a/src/lib/wrappers/Compose.svelte
+++ b/src/lib/wrappers/Compose.svelte
@@ -5,28 +5,28 @@
import { getUserRelays, logged_in_user } from '$lib/stores/users'
import { selected_repo } from '$lib/stores/repo'
import Compose from '$lib/components/events/Compose.svelte'
- import { selected_pr_full } from '$lib/stores/PR'
+ import { selected_proposal_full } from '$lib/stores/Proposal'
export let reply_to_event_id = ''
let repo_id: string
- let pr_id: string
+ let proposal_id: string
let submitting = false
let submitted = false
let edit_mode = false
$: {
repo_id = $selected_repo.repo_id
- pr_id = $selected_pr_full.summary.id
+ proposal_id = $selected_proposal_full.summary.id
- edit_mode = repo_id.length > 0 && pr_id.length > 0 && !submitted
+ edit_mode = repo_id.length > 0 && proposal_id.length > 0 && !submitted
}
async function sendReply(content: string) {
if (!$logged_in_user) return
let event = new NDKEvent(ndk)
event.kind = reply_kind
- event.tags.push(['e', pr_id, 'root'])
+ event.tags.push(['e', proposal_id, 'root'])
if (reply_to_event_id.length > 0) {
event.tags.push(['e', reply_to_event_id, 'reply'])
}
@@ -56,7 +56,7 @@
...(user_relays.ndk_relays
? user_relays.ndk_relays.writeRelayUrls
: []),
- // TODO: pr event pubkey relays
+ // TODO: proposal event pubkey relays
]
} catch {
alert('failed to get user relays')
diff --git a/src/lib/wrappers/EventCard.svelte b/src/lib/wrappers/EventCard.svelte
index 64436d5..2ea6283 100644
--- a/src/lib/wrappers/EventCard.svelte
+++ b/src/lib/wrappers/EventCard.svelte
@@ -4,7 +4,7 @@
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, pr_status_kind } from '$lib/kinds'
+ import { patch_kind, proposal_status_kind } from '$lib/kinds'
import { ensureUser } from '$lib/stores/users'
import type { NDKEvent } from '@nostr-dev-kit/ndk'
import { onDestroy } from 'svelte'
@@ -33,7 +33,7 @@
>
{#if event.kind == patch_kind}
- {:else if event.kind === pr_status_kind}
+ {:else if event.kind === proposal_status_kind}
{:else}
diff --git a/src/lib/wrappers/OpenPRs.svelte b/src/lib/wrappers/OpenPRs.svelte
deleted file mode 100644
index bc0c79e..0000000
--- a/src/lib/wrappers/OpenPRs.svelte
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
diff --git a/src/lib/wrappers/OpenProposals.svelte b/src/lib/wrappers/OpenProposals.svelte
new file mode 100644
index 0000000..4e6860b
--- /dev/null
+++ b/src/lib/wrappers/OpenProposals.svelte
@@ -0,0 +1,17 @@
+
+
+
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 1951d50..9df5803 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -45,7 +45,7 @@
a command-line tool to
create,
list and
-
apply PRs and patches
+
apply Proposals and patches
install ngit
diff --git a/src/routes/repo/[repo_id]/+page.svelte b/src/routes/repo/[repo_id]/+page.svelte
index 3172994..c2cb105 100644
--- a/src/routes/repo/[repo_id]/+page.svelte
+++ b/src/routes/repo/[repo_id]/+page.svelte
@@ -1,6 +1,6 @@
@@ -40,7 +40,7 @@
{/if}
-{#if pr_error}
+{#if proposal_error}
- Error! cannot find PR {repo_error ? 'or repo ' : ''}event
+ Error! cannot find Proposal {repo_error ? 'or repo ' : ''}event
{:else}
-
+
- {#if $selected_pr_full.pr_event && $selected_pr_full.pr_event.kind === patch_kind}
+ {#if $selected_proposal_full.proposal_event && $selected_proposal_full.proposal_event.kind === patch_kind}
{:else}
-
+
{/if}
- {#each $selected_pr_replies as event}
+ {#each $selected_proposal_replies as event}
{/each}
@@ -106,10 +110,10 @@
diff --git a/src/routes/repo/[repo_id]/pr/[pr_id]/+page.ts b/src/routes/repo/[repo_id]/proposal/[proposal_id]/+page.ts
similarity index 73%
rename from src/routes/repo/[repo_id]/pr/[pr_id]/+page.ts
rename to src/routes/repo/[repo_id]/proposal/[proposal_id]/+page.ts
index 701c3b6..7fc7c6b 100644
--- a/src/routes/repo/[repo_id]/pr/[pr_id]/+page.ts
+++ b/src/routes/repo/[repo_id]/proposal/[proposal_id]/+page.ts
@@ -1,6 +1,6 @@
export const load = ({ params }) => {
return {
repo_id: decodeURIComponent(params.repo_id),
- pr_id: params.pr_id,
+ proposal_id: params.proposal_id,
}
}
diff --git a/src/routes/repo/[repo_id]/proposal/[proposal_id]/page.svelte b/src/routes/repo/[repo_id]/proposal/[proposal_id]/page.svelte
new file mode 100644
index 0000000..c41d904
--- /dev/null
+++ b/src/routes/repo/[repo_id]/proposal/[proposal_id]/page.svelte
@@ -0,0 +1,121 @@
+
+
+{#if !repo_error}
+
+{/if}
+
+{#if proposal_error}
+
+
+
+
Error! cannot find Proposal {repo_error ? 'or repo ' : ''}event
+
+
+{:else}
+
+
+
+
+
+
+
+
+ view proposal in local git repository
+
+
+ install ngit, run
+ ngit list from the local repository and select the proposal title
+
+
+
+
+ {#if $selected_proposal_full.proposal_event && $selected_proposal_full.proposal_event.kind === patch_kind}
+
+ {:else}
+
+ {/if}
+
+ {#each $selected_proposal_replies as event}
+
+ {/each}
+
+
+
+
+
+
+
+{/if}