ui: update pull request icons (#4455)

Added a new icon for closed PRs (similar to GitHub, GitLab, etc),
Fixes https://codeberg.org/forgejo/forgejo/issues/4454.

Before:
- https://codeberg.org/attachments/b17c5846-506f-4b32-97c9-03f31c5ff758
- https://codeberg.org/attachments/babcd011-d340-4a9e-94db-ea17ef6d3c2b
- https://codeberg.org/attachments/dbca009a-413e-48ab-84b1-55ad7f4fcd3d

After:
- https://codeberg.org/attachments/3e161f7b-4172-4a8c-a8eb-54bcf81c0cae
- https://codeberg.org/attachments/0c308f7e-25a0-49a3-9c86-1b1f9ab39467
- https://codeberg.org/attachments/b982b6b8-c78a-4332-8269-50d01de834e0

Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4455
Reviewed-by: Caesar Schinas <caesar@caesarschinas.com>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Bram Hagens <bram@bramh.me>
Co-committed-by: Bram Hagens <bram@bramh.me>
This commit is contained in:
Bram Hagens 2024-07-16 14:38:46 +00:00 committed by 0ko
parent fb10e63489
commit 8e56f61d0f
7 changed files with 444 additions and 46 deletions

View file

@ -30,33 +30,44 @@ export default {
icon() {
if (this.issue.pull_request !== null) {
if (this.issue.state === 'open') {
if (this.issue.pull_request.draft === true) {
return 'octicon-git-pull-request-draft'; // WIP PR
}
return 'octicon-git-pull-request'; // Open PR
} else if (this.issue.pull_request.merged === true) {
if (this.issue.pull_request.merged === true) {
return 'octicon-git-merge'; // Merged PR
}
return 'octicon-git-pull-request'; // Closed PR
} else if (this.issue.state === 'open') {
return 'octicon-issue-opened'; // Open Issue
if (this.issue.state === 'closed') {
return 'octicon-git-pull-request-closed'; // Closed PR
}
if (this.issue.pull_request.draft === true) {
return 'octicon-git-pull-request-draft'; // WIP PR
}
return 'octicon-git-pull-request'; // Open PR
}
return 'octicon-issue-closed'; // Closed Issue
if (this.issue.state === 'closed') {
return 'octicon-issue-closed'; // Closed issue
}
return 'octicon-issue-opened'; // Open issue
},
color() {
if (this.issue.pull_request !== null) {
if (this.issue.pull_request.draft === true) {
return 'grey'; // WIP PR
} else if (this.issue.pull_request.merged === true) {
if (this.issue.pull_request.merged === true) {
return 'purple'; // Merged PR
}
if (this.issue.pull_request.draft === true && this.issue.state === 'open') {
return 'grey'; // WIP PR
}
}
if (this.issue.state === 'open') {
return 'green'; // Open Issue
if (this.issue.state === 'closed') {
return 'red'; // Closed issue
}
return 'red'; // Closed Issue
return 'green'; // Open issue
},
labels() {