diff --git a/CHANGELOG.md b/CHANGELOG.md index 9766538..1a0684e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [0.0.5] - 2019-04-12 ### Added: - Child items to root items. Collapsable item now shows assignee, state, id and list all labels from the issue +- Label dependent icons ### Refactored: - Created two methods that are used in both classes (the closed and the open issues provider) diff --git a/README.md b/README.md index cc1a606..59d46dd 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ To setup a gitea issue tracked project you need to first select the issues tab a When you've finished you can press the refresh button in the open issues section and you'll see the issues of the first 10 pages (only open issues). +## Issue colors +In order to get nice looking issueicons in multiple colors you need to assigne any issue a label called either "feature" or "bug". A bug is going to be represented as an red issue, while a feature will have a green icon. If the issue does not have got a label it will receive a grey icon. If the label is not know (so neither "feature" nor "bug" not case sensitive) it will also get a grey icon. + ## Future - Implement a `Close Issue` Button - Create Issues via Webview diff --git a/package-lock.json b/package-lock.json index 681c165..d2237df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gitea-vscode", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e4b6edd..aa20a5e 100644 --- a/package.json +++ b/package.json @@ -90,4 +90,4 @@ "type": "github", "url": "https://github.com/IJustdev/Gitea-VSCode.git" } -} \ No newline at end of file +} diff --git a/resources/dark/bug.svg b/resources/dark/bug.svg new file mode 100644 index 0000000..a573efb --- /dev/null +++ b/resources/dark/bug.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/dark/feature.svg b/resources/dark/feature.svg new file mode 100644 index 0000000..c60518b --- /dev/null +++ b/resources/dark/feature.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/dark/issue.svg b/resources/dark/issue.svg new file mode 100644 index 0000000..1eca190 --- /dev/null +++ b/resources/dark/issue.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/light/bug.svg b/resources/light/bug.svg new file mode 100644 index 0000000..a573efb --- /dev/null +++ b/resources/light/bug.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/light/feature.svg b/resources/light/feature.svg new file mode 100644 index 0000000..c60518b --- /dev/null +++ b/resources/light/feature.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/light/issue.svg b/resources/light/issue.svg new file mode 100644 index 0000000..1eca190 --- /dev/null +++ b/resources/light/issue.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/issue.ts b/src/issue.ts index eb41703..884f321 100644 --- a/src/issue.ts +++ b/src/issue.ts @@ -1,4 +1,5 @@ import * as vscode from "vscode"; +import * as path from "path"; export class Issue extends vscode.TreeItem { @@ -16,5 +17,21 @@ export class Issue extends vscode.TreeItem { get tooltip() { return this.label + " - " + this.assignee; } + + labelDependentIcon(dark: boolean = false): string { + let filename = ""; + if (this.labels.length === 0) { + filename = "issue"; + } else { + this.labels[0].name.toLowerCase() === "feature" ? filename = "feature" : filename = this.labels[0].name.toLowerCase() === "bug" ? "bug" : "issue"; + } + return path.join(__filename, '..', '..', 'resources', dark ? 'dark' : 'light', filename + '.svg'); + } + + iconPath = { + light: this.labelDependentIcon(), + dark: this.labelDependentIcon(true) + }; + contextValue = 'issue'; } \ No newline at end of file