Skip to content

Commit

Permalink
show reviewers group
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Jan 22, 2025
1 parent df4e95a commit 85b5a20
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import BranchStatusBadge from '../review/BranchStatusBadge.svelte';
import CommitsGraph from '../review/CommitsGraph.svelte';
import { BranchService } from '@gitbutler/shared/branches/branchService';
import {
Expand All @@ -18,7 +19,6 @@
import AvatarGroup from '@gitbutler/ui/avatar/AvatarGroup.svelte';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import BranchStatusBadge from '../review/BranchStatusBadge.svelte';
dayjs.extend(relativeTime);
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/components/changes/ChangeIndexCard.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import PatchReviewersGroup from '../review/PatchReviewersGroup.svelte';
import { PatchService } from '@gitbutler/shared/branches/patchService';
import { getPatch } from '@gitbutler/shared/branches/patchesPreview.svelte';
import {
Expand Down Expand Up @@ -73,7 +74,7 @@
{/await}
</div>
</td>
<td><div></div></td>
<td><div><PatchReviewersGroup {patch} /></div></td>
<td><div></div></td>
</tr>
{/snippet}
Expand Down
27 changes: 27 additions & 0 deletions apps/web/src/lib/components/review/PatchReviewersGroup.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script lang="ts">
import AvatarGroup from '@gitbutler/ui/avatar/AvatarGroup.svelte';
import { gravatarUrlFromEmail } from '@gitbutler/ui/avatar/gravatar';
import type { Patch } from '@gitbutler/shared/branches/types';
type Props = {
patch: Patch;
};
const { patch }: Props = $props();
async function getContributorsWithAvatars(patch: Patch) {
return await Promise.all(
patch.reviewAll.viewed.map(async (contributor) => {
return {
srcUrl: await gravatarUrlFromEmail(contributor),
name: contributor
};
})
);
}
const avatars = $derived(getContributorsWithAvatars(patch));
</script>

{#await avatars then avatars}
<div class="container"><AvatarGroup {avatars} /></div>
{/await}

0 comments on commit 85b5a20

Please sign in to comment.