Browse Source

Combines avatar columns

main
Keith Daulton 1 year ago
parent
commit
3812af3ba6
3 changed files with 66 additions and 24 deletions
  1. +30
    -10
      src/webviews/apps/plus/focus/components/issue-row.ts
  2. +30
    -10
      src/webviews/apps/plus/focus/components/pull-request-row.ts
  3. +6
    -4
      src/webviews/apps/plus/focus/focus.html

+ 30
- 10
src/webviews/apps/plus/focus/components/issue-row.ts View File

@ -1,5 +1,5 @@
import { css, customElement, FASTElement, html, observable, volatile, when } from '@microsoft/fast-element';
import type { IssueShape } from '../../../../../git/models/issue';
import type { IssueMember, IssueShape } from '../../../../../git/models/issue';
import { fromNow } from '../../../../../system/date';
import { focusOutline, srOnly } from '../../../shared/components/styles/a11y';
import { elementBase } from '../../../shared/components/styles/base';
@ -28,15 +28,21 @@ const template = html`
</small>
</table-cell>
<table-cell>
<avatar-stack>
<avatar-item
media="${x => x.issue!.author?.avatarUrl}"
title="${x => x.issue!.author?.name}"
></avatar-item>
</avatar-stack>
</table-cell>
<table-cell>
<git-avatars :avatars="${x => x.issue!.assignees}"></git-avatars>
${when(
x => x.issue!.author != null,
html<IssueRow>`
<avatar-stack>
<avatar-item
media="${x => x.issue!.author?.avatarUrl}"
title="${x => x.issue!.author?.name} (author)"
></avatar-item>
</avatar-stack>
`,
)}
${when(
x => x.assignees.length > 0,
html<IssueRow>`<git-avatars :avatars="${x => x.issue!.assignees}"></git-avatars>`,
)}
</table-cell>
<table-cell>${x => x.issue!.commentsCount}</table-cell>
<table-cell>${x => x.issue!.thumbsUpCount}</table-cell>
@ -203,4 +209,18 @@ export class IssueRow extends FASTElement {
get indicatorLabel() {
return undefined;
}
@volatile
get assignees() {
const assignees = this.issue?.assignees;
if (assignees == null) {
return [];
}
const author: IssueMember | undefined = this.issue!.author;
if (author != null) {
return assignees.filter(assignee => assignee.url !== author.url);
}
return assignees;
}
}

+ 30
- 10
src/webviews/apps/plus/focus/components/pull-request-row.ts View File

@ -1,5 +1,5 @@
import { css, customElement, FASTElement, html, observable, volatile, when } from '@microsoft/fast-element';
import type { PullRequestShape } from '../../../../../git/models/pullRequest';
import type { PullRequestMember, PullRequestShape } from '../../../../../git/models/pullRequest';
import { fromNow } from '../../../../../system/date';
import { focusOutline, srOnly } from '../../../shared/components/styles/a11y';
import { elementBase } from '../../../shared/components/styles/base';
@ -78,15 +78,21 @@ const template = html`
</small>
</table-cell>
<table-cell>
<avatar-stack>
<avatar-item
media="${x => x.pullRequest!.author?.avatarUrl}"
title="${x => x.pullRequest!.author?.name}"
></avatar-item>
</avatar-stack>
</table-cell>
<table-cell>
<git-avatars :avatars="${x => x.pullRequest!.assignees}"></git-avatars>
${when(
x => x.pullRequest!.author != null,
html<PullRequestRow>`
<avatar-stack>
<avatar-item
media="${x => x.pullRequest!.author.avatarUrl}"
title="${x => x.pullRequest!.author.name} (author)"
></avatar-item>
</avatar-stack>
`,
)}
${when(
x => x.assignees.length > 0,
html<PullRequestRow>`<git-avatars :avatars="${x => x.pullRequest!.assignees}"></git-avatars>`,
)}
</table-cell>
<table-cell>${x => x.pullRequest!.comments}</table-cell>
<table-cell class="stats"
@ -275,4 +281,18 @@ export class PullRequestRow extends FASTElement {
get indicatorLabel() {
return undefined;
}
@volatile
get assignees() {
const assignees = this.pullRequest?.assignees;
if (assignees == null) {
return [];
}
const author: PullRequestMember | undefined = this.pullRequest!.author;
if (author != null) {
return assignees.filter(assignee => assignee.name !== author.name);
}
return assignees;
}
}

+ 6
- 4
src/webviews/apps/plus/focus/focus.html View File

@ -45,8 +45,9 @@
<code-icon icon="gl-clock"></code-icon>
</table-cell>
<table-cell class="data-body" header="column" pinned>Pull Request</table-cell>
<table-cell class="data-author" header="column" pinned>Author</table-cell>
<table-cell class="data-assigned" header="column" pinned>Assigned</table-cell>
<!-- <table-cell class="data-author" header="column" pinned>Author</table-cell>
<table-cell class="data-assigned" header="column" pinned>Assigned</table-cell> -->
<table-cell class="data-participants" header="column" pinned>Participants</table-cell>
<table-cell class="data-comments" header="column" pinned title="Comments">
<code-icon icon="comment-discussion"></code-icon>
</table-cell>
@ -89,8 +90,9 @@
<code-icon icon="gl-clock"></code-icon>
</table-cell>
<table-cell header="column" pinned>Title</table-cell>
<table-cell class="data-author" header="column" pinned>Author</table-cell>
<table-cell class="data-assigned" header="column" pinned>Assigned</table-cell>
<!-- <table-cell class="data-author" header="column" pinned>Author</table-cell>
<table-cell class="data-assigned" header="column" pinned>Assigned</table-cell> -->
<table-cell class="data-participants" header="column" pinned>Participants</table-cell>
<table-cell class="data-comments" header="column" pinned title="Comments">
<code-icon icon="comment-discussion"></code-icon>
</table-cell>

Loading…
Cancel
Save