Browse Source

Updates focus view with PullRequests

main
Keith Daulton 1 year ago
committed by Keith Daulton
parent
commit
8fd1709fa3
7 changed files with 530 additions and 231 deletions
  1. +20
    -1
      src/plus/webviews/workspaces/protocol.ts
  2. +54
    -13
      src/plus/webviews/workspaces/workspacesWebview.ts
  3. +66
    -0
      src/webviews/apps/plus/workspaces/components/git-avatars.ts
  4. +249
    -0
      src/webviews/apps/plus/workspaces/components/pull-request-row.ts
  5. +59
    -214
      src/webviews/apps/plus/workspaces/workspaces.html
  6. +63
    -0
      src/webviews/apps/plus/workspaces/workspaces.scss
  7. +19
    -3
      src/webviews/apps/plus/workspaces/workspaces.ts

+ 20
- 1
src/plus/webviews/workspaces/protocol.ts View File

@ -1 +1,20 @@
export type State = Record<string, unknown>;
import type { IssueShape } from '../../../git/models/issue';
import type { PullRequestShape } from '../../../git/models/pullRequest';
export type State = {
pullRequests?: PullRequestResult[];
issues?: IssueResult[];
[key: string]: unknown;
};
export interface SearchResultBase {
reasons: string[];
}
export interface IssueResult extends SearchResultBase {
issue: IssueShape;
}
export interface PullRequestResult extends SearchResultBase {
pullRequest: PullRequestShape;
}

+ 54
- 13
src/plus/webviews/workspaces/workspacesWebview.ts View File

@ -3,9 +3,13 @@ import { Commands, ContextKeys } from '../../../constants';
import type { Container } from '../../../container';
import { setContext } from '../../../context';
import type { SearchedIssue } from '../../../git/models/issue';
import { serializeIssue } from '../../../git/models/issue';
// import { serializeIssue } from '../../../git/models/issue';
import type { SearchedPullRequest } from '../../../git/models/pullRequest';
import { serializePullRequest } from '../../../git/models/pullRequest';
import {
PullRequestMergeableState,
PullRequestReviewDecision,
serializePullRequest,
} from '../../../git/models/pullRequest';
import type { GitRemote } from '../../../git/models/remote';
import type { RichRemoteProvider } from '../../../git/remotes/richRemoteProvider';
import { registerCommand } from '../../../system/command';
@ -53,22 +57,24 @@ export class WorkspacesWebview extends WebviewBase {
}
private async getState(): Promise<State> {
// return Promise.resolve({});
const prs = await this.getMyPullRequests();
const serializedPrs = prs.map(pr => ({
pullRequest: serializePullRequest(pr.pullRequest),
reasons: pr.reasons,
}));
const issues = await this.getMyIssues();
const serializedIssues = issues.map(issue => ({
issue: serializeIssue(issue.issue),
reasons: issue.reasons,
}));
// const issues = await this.getMyIssues();
// const serializedIssues = issues.map(issue => ({
// issue: serializeIssue(issue.issue),
// reasons: issue.reasons,
// }));
return {
// workspaces: await this.getWorkspaces(),
myPullRequests: serializedPrs,
myIssues: serializedIssues,
pullRequests: serializedPrs,
// myIssues: serializedIssues,
};
}
@ -97,10 +103,45 @@ export class WorkspacesWebview extends WebviewBase {
if (prs == null) {
continue;
}
allPrs.push(...prs);
allPrs.push(...prs.filter(pr => pr.reasons.length > 0));
}
function getScore(pr: SearchedPullRequest) {
let score = 0;
if (pr.reasons.includes('author')) {
score += 1000;
} else if (pr.reasons.includes('assignee')) {
score += 900;
} else if (pr.reasons.includes('reviewer')) {
score += 800;
} else if (pr.reasons.includes('mentioned')) {
score += 700;
}
if (pr.pullRequest.reviewDecision === PullRequestReviewDecision.Approved) {
if (pr.pullRequest.mergeableState === PullRequestMergeableState.Mergeable) {
score += 100;
} else if (pr.pullRequest.mergeableState === PullRequestMergeableState.Conflicting) {
score += 90;
} else {
score += 80;
}
} else if (pr.pullRequest.reviewDecision === PullRequestReviewDecision.ChangesRequested) {
score += 70;
}
return score;
}
return allPrs;
return allPrs.sort((a, b) => {
const scoreA = getScore(a);
const scoreB = getScore(b);
if (scoreA === scoreB) {
return a.pullRequest.date.getTime() - b.pullRequest.date.getTime();
}
return (scoreB ?? 0) - (scoreA ?? 0);
});
}
private async getMyIssues(): Promise<SearchedIssue[]> {
@ -111,9 +152,9 @@ export class WorkspacesWebview extends WebviewBase {
if (issues == null) {
continue;
}
allIssues.push(...issues);
allIssues.push(...issues.filter(pr => pr.reasons.length > 0));
}
return allIssues;
return allIssues.sort((a, b) => b.issue.date.getTime() - a.issue.date.getTime());
}
}

+ 66
- 0
src/webviews/apps/plus/workspaces/components/git-avatars.ts View File

@ -0,0 +1,66 @@
import { css, customElement, FASTElement, html, observable, repeat, volatile, when } from '@microsoft/fast-element';
import '../../../shared/components/avatars/avatar-item';
import '../../../shared/components/avatars/avatar-stack';
const template = html<GitAvatars>`
<avatar-stack>
${repeat(
x => x.avatarItems,
html<AvatarShape>`<avatar-item media="${x => x.avatarUrl}" title="${x => x.name}"></avatar-item>`,
)}
${when(
x => x.avatarPlusItems != null,
html<GitAvatars>`<avatar-item title="${x => x.avatarPlusLabel}"
>+${x => x.avatarPlusItems?.length}</avatar-item
>`,
)}
</avatar-stack>
`;
const styles = css``;
interface AvatarShape {
name: string;
avatarUrl: string;
url: string;
}
@customElement({
name: 'git-avatars',
template: template,
styles: styles,
})
export class GitAvatars extends FASTElement {
@observable
avatars: AvatarShape[] = [];
@volatile
get avatarItems(): AvatarShape[] {
if (this.avatars.length <= 3) {
return this.avatars;
}
return this.avatars.slice(0, 2);
}
@volatile
get avatarPlusItems(): AvatarShape[] | undefined {
const len = this.avatars.length;
if (len <= 3) {
return undefined;
}
return this.avatars.slice(2);
}
@volatile
get avatarPlusLabel(): string | undefined {
if (this.avatarPlusItems == null) {
return undefined;
}
const len = this.avatarPlusItems.length;
return this.avatarPlusItems.reduce(
(all, current, i) => `${all}, ${len === i - 1 ? 'and ' : ''}${current.name}`,
'',
);
}
}

+ 249
- 0
src/webviews/apps/plus/workspaces/components/pull-request-row.ts View File

@ -0,0 +1,249 @@
import { css, customElement, FASTElement, html, observable, ref, volatile, when } from '@microsoft/fast-element';
import type { 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';
import '../../../shared/components/table/table-cell';
import '../../../shared/components/avatars/avatar-item';
import '../../../shared/components/avatars/avatar-stack';
import '../../../shared/components/code-icon';
import './git-avatars';
const template = html<PullRequestRow>`
<template role="row">
<table-cell class="status">
${when(
x => x.pullRequest!.isDraft === true,
html`<code-icon icon="git-pull-request-draft" title="draft"></code-icon>`,
)}
${when(
x => x.pullRequest!.isDraft !== true,
html`<code-icon class="pull-request-draft" icon="git-pull-request" title="open"></code-icon>`,
)}
${when(
x => x.indicator === 'changes',
html`<code-icon class="indicator-error" icon="request-changes" title="changes requested"></code-icon>`,
)}
${when(
x => x.indicator === 'ready',
html`<code-icon class="indicator-info" icon="pass" title="approved and ready to merge"></code-icon>`,
)}
${when(
x => x.indicator === 'conflicting',
html`<code-icon
class="indicator-error"
icon="bracket-error"
title="cannot be merged due to merge conflicts"
></code-icon>`,
)}
</table-cell>
<table-cell class="time">${x => x.lastUpdated}</table-cell>
<table-cell>
${x => x.pullRequest!.title} <a href="${x => x.pullRequest!.url}">#${x => x.pullRequest!.id}</a><br />
<small>
<span class="tag"><code-icon icon="repo"></code-icon>${x => x.pullRequest!.refs?.base.repo}</span>
into
${when(
x => x.pullRequest!.refs?.isCrossRepository !== true,
html<PullRequestRow>`
<span class="tag"
><code-icon icon="source-control"></code-icon>${x => x.pullRequest!.refs?.base.branch}</span
>
from
<span class="tag"
><code-icon icon="source-control"></code-icon>${x => x.pullRequest!.refs?.head.branch}</span
>
`,
)}
${when(
x => x.pullRequest!.refs?.isCrossRepository === true,
html<PullRequestRow>`
<span class="tag"
><code-icon icon="source-control"></code-icon>${x => x.pullRequest!.refs?.base.owner}:${x =>
x.pullRequest!.refs?.base.branch}</span
>
from
<span class="tag"
><code-icon icon="source-control"></code-icon>${x => x.pullRequest!.refs?.head.owner}:${x =>
x.pullRequest!.refs?.head.branch}</span
>
`,
)}
</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>
</table-cell>
<table-cell>${x => x.pullRequest!.comments}</table-cell>
<table-cell class="icon-only">
${when(x => x.checks == null, html`<code-icon icon="dash" title="none"></code-icon>`)}
${when(x => x.checks === false, html`<code-icon icon="error" title="failed"></code-icon>`)}
${when(x => x.checks === true, html`<code-icon icon="pass" title="passed"></code-icon>`)}
</table-cell>
<table-cell class="stats"
><span class="stat-added">+${x => x.pullRequest!.additions}</span>
<span class="stat-deleted">-${x => x.pullRequest!.deletions}</span></table-cell
>
<table-cell class="actions">
<a href="${x => x.pullRequest!.url}" title="Open pull request on remote"
><code-icon icon="globe"></code-icon
></a>
</table-cell>
</template>
`;
const styles = css`
${elementBase}
:host {
display: table-row;
}
:host(:focus) {
${focusOutline}
}
a {
color: var(--vscode-textLink-foreground);
text-decoration: none;
}
a:hover {
color: var(--vscode-textLink-activeForeground);
text-decoration: underline;
}
a:focus {
${focusOutline}
}
code-icon {
font-size: inherit;
}
.tag {
display: inline-block;
padding: 0.1rem 0.2rem;
background-color: var(--background-05);
color: var(--color-foreground--85);
white-space: nowrap;
}
.tag code-icon {
margin-right: 0.2rem;
}
.status {
}
.time {
}
.icon-only {
}
.stats {
}
.actions {
text-align: right;
}
.stat-added {
color: var(--vscode-gitDecoration-addedResourceForeground);
}
.stat-deleted {
color: var(--vscode-gitDecoration-deletedResourceForeground);
}
.issue-open {
color: var(--vscode-gitlens-openAutolinkedIssueIconColor);
}
.issue-closed {
color: var(--vscode-gitlens-closedAutolinkedIssueIconColor);
}
.indicator-info {
color: var(--color-alert-infoBorder);
}
.indicator-warning {
color: var(--color-alert-warningBorder);
}
.indicator-error {
color: var(--color-alert-errorBorder);
}
.indicator-neutral {
color: var(--color-alert-neutralBorder);
}
.pull-request-draft {
/* color: var(--vscode-pullRequests-draft); */
color: var(--color-foreground--85);
}
.pull-request-open {
color: var(--vscode-gitlens-openPullRequestIconColor);
}
.pull-request-merged {
color: var(--vscode-gitlens-mergedPullRequestIconColor);
}
.pull-request-closed {
color: var(--vscode-gitlens-closedPullRequestIconColor);
}
.pull-request-notification {
color: var(--vscode-pullRequests-notification);
}
${srOnly}
`;
@customElement({
name: 'pull-request-row',
template: template,
styles: styles,
})
export class PullRequestRow extends FASTElement {
@observable
public pullRequest?: PullRequestShape;
@observable
public reasons?: string[];
@observable
public checks?: boolean;
@volatile
get lastUpdated() {
return fromNow(new Date(this.pullRequest!.date), true);
}
@volatile
get indicator() {
if (this.pullRequest == null) return '';
console.log(this.pullRequest);
if (this.pullRequest.reviewDecision === 'ChangesRequested') {
return 'changes';
} else if (this.pullRequest.reviewDecision === 'Approved' && this.pullRequest.mergeableState === 'Mergeable') {
return 'ready';
}
if (this.pullRequest.mergeableState === 'Conflicting') {
return 'conflicting';
}
return '';
}
@volatile
get indicatorLabel() {
return undefined;
}
}

+ 59
- 214
src/webviews/apps/plus/workspaces/workspaces.html View File

@ -6,159 +6,38 @@
<body class="preload app">
<header class="app__header">
<h1><code-icon icon="layers"></code-icon> Workspaces</h1>
<h1>Focus View</h1>
</header>
<main class="app__main">
<section class="workspace-section app__section">
<header class="workspace-section__header">
<h2>My Pull Requests Issues</h2>
<h2>My Pull Requests</h2>
</header>
<div class="workspace-section__content">
<table-container>
<table-container id="pull-requests">
<table-row slot="head">
<table-cell header="column" pinned>
<table-cell class="pr-status" header="column" pinned title="PR status"
><code-icon icon="git-pull-request"></code-icon
></table-cell>
<table-cell class="pr-time" header="column" pinned title="Last updated">
<code-icon icon="gl-clock"></code-icon>
</table-cell>
<table-cell header="column" pinned>Repo</table-cell>
<table-cell header="column" pinned>Title</table-cell>
<table-cell header="column" pinned>Author</table-cell>
<table-cell header="column" pinned>Assigned</table-cell>
<table-cell header="column" pinned>
<table-cell class="pr-body" header="column" pinned>Pull Request</table-cell>
<table-cell class="pr-author" header="column" pinned>Author</table-cell>
<table-cell class="pr-assigned" header="column" pinned>Assigned</table-cell>
<table-cell class="pr-comments" header="column" pinned title="Comments">
<code-icon icon="comment-discussion"></code-icon>
</table-cell>
<table-cell header="column" pinned>
<code-icon icon="pass"></code-icon>
</table-cell>
<table-cell header="column" pinned>
<table-cell class="pr-checks" header="column" pinned title="Checks">
<code-icon icon="tasklist"></code-icon>
</table-cell>
<table-cell header="column" pinned>
<table-cell class="pr-stats" header="column" pinned title="Change stats">
<code-icon icon="add"></code-icon>
</table-cell>
<table-cell header="column" pinned>
<code-icon icon="dash"></code-icon>
</table-cell>
<table-cell header="column" pinned>Links</table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
></table-cell>
</table-row>
<table-row>
<table-cell>7h</table-cell>
<table-cell><a href="#">GitKraken</a></table-cell>
<table-cell><a href="#">#7094</a> GK-1769 Engine Mods</table-cell>
<table-cell>eamodio</table-cell>
<table-cell>d13 +2</table-cell>
<table-cell>10</table-cell>
<table-cell><code-icon icon="check"></code-icon></table-cell>
<table-cell><code-icon icon="close"></code-icon></table-cell>
<table-cell>471</table-cell>
<table-cell>-206</table-cell>
<table-cell
><a href="#"><code-icon icon="link"></code-icon></a
<table-cell class="pr-actions" header="column" pinned
><code-icon icon="blank" title="actions"></code-icon
></table-cell>
</table-row>
</table-container>
@ -172,89 +51,44 @@
<div class="workspace-section__content">
<table-container>
<table-row slot="head">
<table-cell header="column" pinned>
<table-cell class="pr-time" header="column" pinned title="Last updated">
<code-icon icon="gl-clock"></code-icon>
</table-cell>
<table-cell header="column" pinned>Repo</table-cell>
<table-cell header="column" pinned>Title</table-cell>
<table-cell header="column" pinned>Author</table-cell>
<table-cell header="column" pinned>Assigned</table-cell>
<table-cell header="column" pinned>
<table-cell class="pr-author" header="column" pinned>Author</table-cell>
<table-cell class="pr-assigned" header="column" pinned>Assignees</table-cell>
<table-cell class="pr-comments" header="column" pinned title="Comments">
<code-icon icon="comment-discussion"></code-icon>
</table-cell>
<table-cell header="column" pinned>
<table-cell class="pr-checks" header="column" pinned title="Thumbs up">
<code-icon icon="thumbsup"></code-icon>
</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
<table-row>
<table-cell>6d</table-cell>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><a href="#">#2058</a> Improve git blame contrast</table-cell>
<table-cell>mejiaj</table-cell>
<table-cell>d13</table-cell>
<table-cell>
Improve git blame contrast <a href="#">#2058</a><br />
<small>
<span class="tag"><code-icon icon="repo"></code-icon>vscode-gitlens</span>
</small>
</table-cell>
<table-cell>
<avatar-stack>
<avatar-item
media="https://www.gravatar.com/avatar/00000000000000000000000000000000?s=32&d=robohash"
title="eamodio"
></avatar-item>
</avatar-stack>
</table-cell>
<table-cell>
<avatar-stack>
<avatar-item
media="https://www.gravatar.com/avatar/00000000000000000000000000000000?s=32&d=robohash"
title="d13"
></avatar-item>
<avatar-item title="ramint and jschmoe">+2</avatar-item>
</avatar-stack>
</table-cell>
<table-cell>2</table-cell>
<table-cell>0</table-cell>
</table-row>
@ -270,15 +104,26 @@
<table-container>
<table-row slot="head">
<table-cell header="column" pinned>Repo</table-cell>
<table-cell header="column" pinned>Branch</table-cell>
<table-cell header="column" pinned>Stats</table-cell>
<table-cell header="column" pinned>Branch</table-cell>
<table-cell header="column" pinned>Remote</table-cell>
</table-row>
<table-row>
<table-cell><a href="#">vscode-gitlens</a></table-cell>
<table-cell><code-icon icon="source-control"></code-icon> feature/workspaces</table-cell>
<table-cell>+100 -50</table-cell>
<table-cell><a href="#">gitkraken/vscode-gitlens</a></table-cell>
<table-cell>vscode-gitlens</table-cell>
<table-cell
><span class="stat-added">+50</span> <span class="stat-modified">~100</span>
<span class="stat-deleted">-206</span></table-cell
>
<table-cell
><span class="tag"
><code-icon icon="source-control"></code-icon>feature/workspaces</span
></table-cell
>
<table-cell
><span class="tag"
><code-icon icon="repo"></code-icon>gitkraken/vscode-gitlens</span
></table-cell
>
</table-row>
</table-container>
</div>

+ 63
- 0
src/webviews/apps/plus/workspaces/workspaces.scss View File

@ -82,6 +82,17 @@ code-icon {
font-size: inherit;
}
.tag {
display: inline-block;
padding: 0.1rem 0.2rem;
background-color: var(--color-background--lighten-05);
color: var(--color-foreground--85);
code-icon {
margin-right: 0.2rem;
}
}
.button {
width: 2.4rem;
height: 2.4rem;
@ -149,3 +160,55 @@ code-icon {
flex: 0 1 auto;
}
}
.tag {
display: inline-block;
padding: 0.1rem 0.2rem;
background-color: var(--background-05);
color: var(--color-foreground--85);
white-space: nowrap;
}
.tag code-icon {
margin-right: 0.2rem;
}
.stat-added {
white-space: nowrap;
color: var(--vscode-gitDecoration-addedResourceForeground);
}
.stat-deleted {
white-space: nowrap;
color: var(--vscode-gitDecoration-deletedResourceForeground);
}
.stat-modified {
white-space: nowrap;
color: var(--vscode-gitDecoration-modifiedResourceForeground);
}
.pr {
&-status {
width: 5rem;
}
&-time {
width: 4rem;
}
&-body {
}
&-author {
width: 8.8rem;
}
&-assigned {
width: 8.8rem;
}
&-comments {
width: 4rem;
}
&-checks {
width: 3.2rem;
}
&-stats {
width: 9.2rem;
}
&-actions {
}
}

+ 19
- 3
src/webviews/apps/plus/workspaces/workspaces.ts View File

@ -1,13 +1,13 @@
import type { State } from '../../../../plus/webviews/workspaces/protocol';
import { App } from '../../shared/appBase';
import type { PullRequestRow } from './components/pull-request-row';
import '../../shared/components/code-icon';
import '../../shared/components/avatars/avatar-item';
import '../../shared/components/avatars/avatar-stack';
import '../../shared/components/table/table-container';
import '../../shared/components/table/table-row';
import '../../shared/components/table/table-cell';
import './components/workspace-list';
import './components/workspace-item';
import './components/pull-request-row';
import './workspaces.scss';
export class WorkspacesApp extends App<State> {
@ -21,7 +21,23 @@ export class WorkspacesApp extends App {
console.log(this.state);
}
renderContent() {}
renderContent() {
this.renderPullRequests();
}
renderPullRequests() {
const prTableEl = document.getElementById('pull-requests');
if (this.state.pullRequests != null && this.state.pullRequests?.length > 0) {
const els = this.state.pullRequests.map(({ pullRequest }) => {
const prRowEl = document.createElement('pull-request-row') as PullRequestRow;
prRowEl.pullRequest = pullRequest;
return prRowEl;
});
prTableEl?.append(...els);
}
}
}
new WorkspacesApp();

Loading…
Cancel
Save