diff --git a/__snapshots__/repo-summary-card--long-and-no-spaces.png b/__snapshots__/repo-summary-card--long-and-no-spaces.png index 293e8b5..3259356 100644 Binary files a/__snapshots__/repo-summary-card--long-and-no-spaces.png and b/__snapshots__/repo-summary-card--long-and-no-spaces.png differ diff --git a/__snapshots__/repo-summary-card--long-details.png b/__snapshots__/repo-summary-card--long-details.png index 68625fb..83775c9 100644 Binary files a/__snapshots__/repo-summary-card--long-details.png and b/__snapshots__/repo-summary-card--long-details.png differ diff --git a/__snapshots__/repo-summary-card--multiple-maintainers.png b/__snapshots__/repo-summary-card--multiple-maintainers.png new file mode 100644 index 0000000..a4a1472 Binary files /dev/null and b/__snapshots__/repo-summary-card--multiple-maintainers.png differ diff --git a/__snapshots__/repo-summary-card--short-details.png b/__snapshots__/repo-summary-card--short-details.png index 748efcc..6b67f5b 100644 Binary files a/__snapshots__/repo-summary-card--short-details.png and b/__snapshots__/repo-summary-card--short-details.png differ diff --git a/__snapshots__/repo-summary-card.test.js.snap b/__snapshots__/repo-summary-card.test.js.snap index be17e8f..8b6df8e 100644 --- a/__snapshots__/repo-summary-card.test.js.snap +++ b/__snapshots__/repo-summary-card.test.js.snap @@ -1,7 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Repo/Summary/Card Long Details smoke-test 1`] = ` -
+
+

+ + +

+
+
+
+
+ Rather Long Display Name +
+
+
+ Rather Long Display Name +
+
+
+
+

@@ -14,7 +37,30 @@ exports[`Repo/Summary/Card Long Details smoke-test 1`] = ` `; exports[`Repo/Summary/Card Long and No Spaces smoke-test 1`] = ` -
+ `; +exports[`Repo/Summary/Card Multiple Maintainers smoke-test 1`] = ` + +`; + exports[`Repo/Summary/Card No Details smoke-test 1`] = ` -
+
+

+ + +

+
+
+
+
+
+
+
+
+
+
+
+
+
+

@@ -39,7 +175,30 @@ exports[`Repo/Summary/Card No Details smoke-test 1`] = ` `; exports[`Repo/Summary/Card Short Details smoke-test 1`] = ` -
+
+

+ + +

+
+
+
+
+ Will +
+
+
+ Will +
+
+
+
+

@@ -52,7 +211,9 @@ exports[`Repo/Summary/Card Short Details smoke-test 1`] = ` `; exports[`Repo/Summary/Card loading smoke-test 1`] = ` -
+
diff --git a/__snapshots__/repo-summary-list--default.png b/__snapshots__/repo-summary-list--default.png index b72a666..117082d 100644 Binary files a/__snapshots__/repo-summary-list--default.png and b/__snapshots__/repo-summary-list--default.png differ diff --git a/__snapshots__/repo-summary-list--multiple-maintainers.png b/__snapshots__/repo-summary-list--multiple-maintainers.png new file mode 100644 index 0000000..93e8c84 Binary files /dev/null and b/__snapshots__/repo-summary-list--multiple-maintainers.png differ diff --git a/__snapshots__/repo-summary-list--no-title.png b/__snapshots__/repo-summary-list--no-title.png index a293680..5af19de 100644 Binary files a/__snapshots__/repo-summary-list--no-title.png and b/__snapshots__/repo-summary-list--no-title.png differ diff --git a/__snapshots__/repo-summary-list--partially-loaded.png b/__snapshots__/repo-summary-list--partially-loaded.png index 7370049..1ac9289 100644 Binary files a/__snapshots__/repo-summary-list--partially-loaded.png and b/__snapshots__/repo-summary-list--partially-loaded.png differ diff --git a/__snapshots__/repo-summary-list.test.js.snap b/__snapshots__/repo-summary-list.test.js.snap index f806a37..413a31e 100644 --- a/__snapshots__/repo-summary-list.test.js.snap +++ b/__snapshots__/repo-summary-list.test.js.snap @@ -8,7 +8,30 @@ exports[`Repo/Summary/List Default smoke-test 1`] = `
-
-
+
-
+
-
+
@@ -85,10 +227,145 @@ exports[`Repo/Summary/List Loading smoke-test 1`] = `
`; +exports[`Repo/Summary/List Multiple Maintainers smoke-test 1`] = ` +
+
+

+ Multiple Maintainers +

+
+
+
+

+ + +

+
+
+
+
+ Will +
+
+
+ Will +
+
+
+
+
+
+
+
+
+ DanConwayDev +
+
+
+ DanConwayDev +
+
+
+
+
+
+
+
+
+ sectore +
+
+
+ sectore +
+
+
+
+

+ + Short Name + +

+ short description +

+
+
+

+ + +

+
+
+
+
+ Rather Long Display Name +
+
+
+ Rather Long Display Name +
+
+
+
+

+ + Long Name that goes on and on and on and on a... + +

+ Lorem ipsum dolor sit amet, consectetur adipi... +

+
+
+
+`; + exports[`Repo/Summary/List No Title smoke-test 1`] = `
-
+ -
+
-
+ -
+ -
+
diff --git a/src/lib/components/RepoSummaryCard.stories.svelte b/src/lib/components/RepoSummaryCard.stories.svelte index 92080c0..c0efa8e 100644 --- a/src/lib/components/RepoSummaryCard.stories.svelte +++ b/src/lib/components/RepoSummaryCard.stories.svelte @@ -24,3 +24,5 @@ + + diff --git a/src/lib/components/RepoSummaryCard.svelte b/src/lib/components/RepoSummaryCard.svelte index 7c05521..7e8c54d 100644 --- a/src/lib/components/RepoSummaryCard.svelte +++ b/src/lib/components/RepoSummaryCard.svelte @@ -1,5 +1,6 @@ -
+
{#if loading}
{:else} -
{short_name} -

{short_descrption}

+

+ + {#each maintainers as user} +

+ +
+ {/each} +

+ {short_name} +

+ {short_descrption} +

{/if}
diff --git a/src/lib/components/ReposSummaryList.stories.svelte b/src/lib/components/ReposSummaryList.stories.svelte index f08a0f2..6e10a00 100644 --- a/src/lib/components/ReposSummaryList.stories.svelte +++ b/src/lib/components/ReposSummaryList.stories.svelte @@ -19,7 +19,12 @@ name="Default" args={{ title: 'Featured Repositories', - repos: [vectors.Short, vectors.Long, vectors.LongNoSpaces], + repos: [ + vectors.Short, + vectors.Long, + vectors.LongNoSpaces, + vectors.MulipleMaintainers, + ], }} /> @@ -54,3 +59,11 @@ loading: true, }} /> + + diff --git a/src/lib/components/ReposSummaryList.svelte b/src/lib/components/ReposSummaryList.svelte index 548c593..6e440e2 100644 --- a/src/lib/components/ReposSummaryList.svelte +++ b/src/lib/components/ReposSummaryList.svelte @@ -17,8 +17,8 @@

None

{:else}
- {#each repos as { name, description, repo_id }} - + {#each repos as { name, description, repo_id, maintainers }} + {/each} {#if loading} diff --git a/src/lib/components/repo/vectors.ts b/src/lib/components/repo/vectors.ts index f8e296c..1df29c5 100644 --- a/src/lib/components/repo/vectors.ts +++ b/src/lib/components/repo/vectors.ts @@ -5,16 +5,32 @@ export const RepoSummaryCardArgsVectors = { Short: { name: 'Short Name', description: 'short description', + maintainers: [withName(UserVectors.default, 'Will')], } as RepoSummary, Long: { name: 'Long Name that goes on and on and on and on and on and on and on and on and on', description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis nisl eget turpis congue molestie. Nulla vitae purus nec augue accumsan facilisis sed sed ligula. Vestibulum sed risus lacinia risus lacinia molestie. Ut lorem quam, consequat eget tempus in, rhoncus vel nunc. Duis efficitur a leo vel sodales. Nam id fermentum lacus. Etiam nec placerat velit. Praesent ac consectetur est. Aenean iaculis commodo enim.', + maintainers: [withName(UserVectors.default, 'Rather Long Display Name')], } as RepoSummary, LongNoSpaces: { name: 'LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName', description: 'LoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsumLoremipsum>', + maintainers: [ + { + ...UserVectors.default, + }, + ], + } as RepoSummary, + MulipleMaintainers: { + name: 'Short Name', + description: 'short description', + maintainers: [ + withName(UserVectors.default, 'Will'), + withName(UserVectors.default, 'DanConwayDev'), + withName(UserVectors.default, 'sectore'), + ], } as RepoSummary, } const base: Repo = { diff --git a/src/lib/stores/repo.ts b/src/lib/stores/repo.ts index e50190d..f7d2359 100644 --- a/src/lib/stores/repo.ts +++ b/src/lib/stores/repo.ts @@ -45,6 +45,24 @@ export const ensureSelectedRepo = async (repo_id: string): Promise => { sub.on('event', (event) => { try { if (event.kind == repo_kind && event.tagValue('d') == repo_id) { + const maintainers = [ + { + hexpubkey: event.pub_key, + loading: true, + npub: '', + } as User, + ] + event.getMatchingTags('maintainers').forEach((t: string[]) => { + t.forEach((v, i) => { + if (i > 0 && v !== maintainers[0].hexpubkey) { + maintainers.push({ + hexpubkey: v, + loading: true, + npub: '', + } as User) + } + }) + }) selected_repo.set({ loading: false, repo_id: event.replaceableDTag(), @@ -53,32 +71,23 @@ export const ensureSelectedRepo = async (repo_id: string): Promise => { description: event.tagValue('description') || '', clone: event.tagValue('clone') || '', tags: event.getMatchingTags('t') || [], - maintainers: event.getMatchingTags('p').map( - (t: string[]) => - ({ - hexpubkey: t[1], - loading: true, - npub: '', - }) as User - ), + maintainers, relays: event.getMatchingTags('relay').map((t: string[]) => t[1]), }) const old_unsubscribers = maintainers_unsubscribers - maintainers_unsubscribers = event - .getMatchingTags('p') - .map((t: string[]) => { - return ensureUser(t[1]).subscribe((u: User) => { - selected_repo.update((repo) => { - return { - ...repo, - maintainers: repo.maintainers.map((m) => { - if (m.hexpubkey == u.hexpubkey) return { ...u } - else return { ...m } - }), - } - }) + maintainers_unsubscribers = maintainers.map((m: User) => { + return ensureUser(m.hexpubkey).subscribe((u: User) => { + selected_repo.update((repo) => { + return { + ...repo, + maintainers: repo.maintainers.map((m) => { + if (m.hexpubkey == u.hexpubkey) return { ...u } + else return { ...m } + }), + } }) }) + }) old_unsubscribers.forEach((unsubscriber) => unsubscriber()) } } catch {} diff --git a/src/lib/wrappers/ReposRecent.svelte b/src/lib/wrappers/ReposRecent.svelte index a5a77e6..9e2321b 100644 --- a/src/lib/wrappers/ReposRecent.svelte +++ b/src/lib/wrappers/ReposRecent.svelte @@ -1,10 +1,13 @@