forgejo/web_src/js/features/issue.js

34 lines
954 B
JavaScript
Raw Normal View History

2026-02-17 04:11:37 -05:00
// Copyright 2026 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
2025-06-05 18:25:07 -04:00
export function getIssueIcon(issue) {
2025-06-07 14:27:15 -04:00
if (issue.is_pr) {
2025-06-07 12:21:15 -04:00
if (issue.state === 'open') {
2025-06-07 14:27:15 -04:00
if (issue.draft === true) {
2025-06-07 12:21:15 -04:00
return 'octicon-git-pull-request-draft'; // WIP PR
2025-06-05 18:25:07 -04:00
}
2025-06-07 12:21:15 -04:00
return 'octicon-git-pull-request'; // Open PR
2025-06-07 14:27:15 -04:00
} else if (issue.merged === true) {
2025-06-07 12:21:15 -04:00
return 'octicon-git-merge'; // Merged PR
2025-06-05 18:25:07 -04:00
}
2025-06-07 12:21:15 -04:00
return 'octicon-git-pull-request'; // Closed PR
} else if (issue.state === 'open') {
return 'octicon-issue-opened'; // Open Issue
2025-06-05 18:25:07 -04:00
}
2025-06-07 12:21:15 -04:00
return 'octicon-issue-closed'; // Closed Issue
}
export function getIssueColor(issue) {
2025-06-07 14:27:15 -04:00
if (issue.is_pr) {
if (issue.draft === true) {
return 'grey'; // WIP PR
2025-06-07 14:27:15 -04:00
} else if (issue.merged === true) {
return 'purple'; // Merged PR
2025-06-05 18:25:07 -04:00
}
}
if (issue.state === 'open') {
return 'green'; // Open Issue
}
return 'red'; // Closed Issue
}