Some checks failed
cache-seeder / prune (push) Has been skipped
cache-seeder / frontend (push) Failing after 3s
cache-seeder / python (push) Failing after 3s
cache-seeder / gobuild (push) Failing after 4s
cache-seeder / lint (bindata, lint-backend) (push) Failing after 3s
giteabot backport / giteabot (push) Has been skipped
giteabot / giteabot (push) Has been skipped
cache-prune / prune (push) Has been skipped
release-nightly-snapcraft / build-and-publish (ubuntu-24.04) (push) Has been cancelled
release-nightly-snapcraft / build-and-publish (ubuntu-24.04-arm) (push) Has been cancelled
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-container (push) Has been cancelled
cron-renovate / cron-renovate (push) Has been skipped
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type {Issue} from '../types.ts';
|
|
|
|
// the getIssueIcon/getIssueColorClass logic should be kept the same as "templates/shared/issueicon.tmpl"
|
|
|
|
export function getIssueIcon(issue: Issue) {
|
|
if (issue.pull_request) {
|
|
if (issue.state === 'open') {
|
|
if (issue.pull_request.draft) {
|
|
return 'octicon-git-pull-request-draft'; // WIP PR
|
|
}
|
|
return 'octicon-git-pull-request'; // Open PR
|
|
} else if (issue.pull_request.merged) {
|
|
return 'octicon-git-merge'; // Merged PR
|
|
}
|
|
return 'octicon-git-pull-request-closed'; // Closed PR
|
|
}
|
|
|
|
if (issue.state === 'open') {
|
|
return 'octicon-issue-opened'; // Open Issue
|
|
}
|
|
return 'octicon-issue-closed'; // Closed Issue
|
|
}
|
|
|
|
export function getIssueColorClass(issue: Issue) {
|
|
if (issue.pull_request) {
|
|
if (issue.state === 'open') {
|
|
if (issue.pull_request.draft) {
|
|
return 'tw-text-text-light'; // WIP PR
|
|
}
|
|
return 'tw-text-green'; // Open PR
|
|
} else if (issue.pull_request.merged) {
|
|
return 'tw-text-purple'; // Merged PR
|
|
}
|
|
return 'tw-text-red'; // Closed PR
|
|
}
|
|
|
|
if (issue.state === 'open') {
|
|
return 'tw-text-green'; // Open Issue
|
|
}
|
|
return 'tw-text-red'; // Closed Issue
|
|
}
|