Skip to content

Commit 7282b3e

Browse files
committed
Use local svgs
1 parent 80d3eb9 commit 7282b3e

8 files changed

Lines changed: 52 additions & 9 deletions

File tree

build/filters.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports.indentationFilter = [
4444
'!**/LICENSE',
4545
'!**/*.yml',
4646
'!resources/emojis.json',
47+
'!**/*.svg',
4748

4849
// except multiple specific files
4950
'!**/package.json',

resources/icons/copilot-error.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

src/common/resources.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,23 @@ import * as path from 'path';
77
import * as vscode from 'vscode';
88

99
export class Resource {
10-
static icons: any;
10+
static icons: {
11+
reactions: {
12+
THUMBS_UP: string;
13+
THUMBS_DOWN: string;
14+
CONFUSED: string;
15+
EYES: string;
16+
HEART: string;
17+
HOORAY: string;
18+
LAUGH: string;
19+
ROCKET: string;
20+
};
21+
copilot: {
22+
SUCCESS: string;
23+
INPROGRESS: string;
24+
ERROR: string;
25+
};
26+
};
1127

1228
static initialize(context: vscode.ExtensionContext) {
1329
Resource.icons = {
@@ -21,6 +37,11 @@ export class Resource {
2137
LAUGH: context.asAbsolutePath(path.join('resources', 'icons', 'reactions', 'laugh.png')),
2238
ROCKET: context.asAbsolutePath(path.join('resources', 'icons', 'reactions', 'rocket.png')),
2339
},
40+
copilot: {
41+
SUCCESS: context.asAbsolutePath(path.join('resources', 'icons', 'copilot-success.svg')),
42+
INPROGRESS: context.asAbsolutePath(path.join('resources', 'icons', 'copilot-in-progress.svg')),
43+
ERROR: context.asAbsolutePath(path.join('resources', 'icons', 'copilot-error.svg')),
44+
}
2445
};
2546
}
2647
}

src/github/interface.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as vscode from 'vscode';
76
import { ReviewStateValue } from '../common/timelineEvent';
87

98
export enum PRType {
@@ -183,7 +182,7 @@ export interface IIssueComment {
183182
export interface Reaction {
184183
label: string;
185184
count: number;
186-
icon?: vscode.Uri;
185+
icon?: string;
187186
viewerHasReacted: boolean;
188187
reactors: readonly string[];
189188
}

src/github/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ export function parseGraphQLReaction(reactionGroups: GraphQL.ReactionGroup[]): R
567567
const reactionContentEmojiMapping = getReactionGroup().reduce((prev, curr) => {
568568
prev[curr.title] = curr;
569569
return prev;
570-
}, {} as { [key: string]: { title: string; label: string; icon?: vscode.Uri } });
570+
}, {} as { [key: string]: { title: string; label: string; icon?: string } });
571571

572572
const reactions = reactionGroups
573573
.filter(group => group.reactors.totalCount > 0)
@@ -1293,7 +1293,7 @@ function parseGraphQLCommitContributions(
12931293
return items;
12941294
}
12951295

1296-
export function getReactionGroup(): { title: string; label: string; icon?: vscode.Uri }[] {
1296+
export function getReactionGroup(): { title: string; label: string; icon?: string }[] {
12971297
const ret = [
12981298
{
12991299
title: 'THUMBS_UP',

src/view/treeNodes/pullRequestNode.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Repository } from '../../api/api';
88
import { getCommentingRanges } from '../../common/commentingRanges';
99
import { InMemFileChange, SlimFileChange } from '../../common/file';
1010
import Logger from '../../common/logger';
11+
import { Resource } from '../../common/resources';
1112
import { FILE_LIST_LAYOUT, PR_SETTINGS_NAMESPACE, SHOW_PULL_REQUEST_NUMBER_IN_TREE } from '../../common/settingKeys';
1213
import { createPRNodeUri, DataUri, fromPRUri, Schemes } from '../../common/uri';
1314
import { FolderRepositoryManager } from '../../github/folderRepositoryManager';
@@ -260,15 +261,24 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
260261
});
261262
}
262263

263-
private async _getIcon(): Promise<vscode.Uri | vscode.ThemeIcon> {
264+
private async _getIcon(): Promise<vscode.Uri | vscode.ThemeIcon | { light: string | vscode.Uri; dark: string | vscode.Uri }> {
264265
const copilotWorkingStatus = await this.pullRequestModel.githubRepository.copilotWorkingStatus(this.pullRequestModel);
265266
switch (copilotWorkingStatus) {
266267
case CopilotWorkingStatus.InProgress:
267-
return new vscode.ThemeIcon('copilot-in-progress');
268+
return {
269+
light: Resource.icons.copilot.INPROGRESS,
270+
dark: Resource.icons.copilot.INPROGRESS
271+
};
268272
case CopilotWorkingStatus.Done:
269-
return new vscode.ThemeIcon('copilot-success');
273+
return {
274+
light: Resource.icons.copilot.SUCCESS,
275+
dark: Resource.icons.copilot.SUCCESS
276+
};
270277
case CopilotWorkingStatus.Error:
271-
return new vscode.ThemeIcon('copilot-error');
278+
return {
279+
light: Resource.icons.copilot.ERROR,
280+
dark: Resource.icons.copilot.ERROR
281+
};
272282
case CopilotWorkingStatus.NotCopilotIssue:
273283
default:
274284
return (await DataUri.avatarCirclesAsImageDataUris(this._folderReposManager.context, [this.pullRequestModel.author], 16, 16))[0]

0 commit comments

Comments
 (0)