Skip to content

Commit 1c292f0

Browse files
authored
Merge pull request #196 from Preeti9764/issue-label
added Standard closed label for issues
2 parents 7d983de + 53a260c commit 1c292f0

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/popup.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ <h3 id="scrumHelperHeading" class="text-3xl font-semibold cursor-pointer">Scrum
169169
<div style="margin-bottom: 1rem;">
170170
<br />
171171
<input type="checkbox" id="showOpenLabel" class="form-checkbox text-blue-600">
172+
172173
<label id="checkboxLabel" for="showOpenLabel" class="font-medium text-sm"
173174
style="margin-left: 4px;" data-i18n="showOpenClosedLabel">Show
174175
PRs Labels</label>
176+
175177
</div>
176178
<div class="my-4 githubOnlySection">
177179
<div class="flex items-center">
178180
<input type="checkbox" id="showCommits" checked class="form-checkbox text-blue-600 ">
181+
179182
<label id="showCommitsLabel" for="showCommits"
180183
class="font-medium text-sm flex items-center pl-5 ml-4" style="margin-left: 4px;"
181184
data-i18n="showCommitsLabel">Show commits on open PRs</label><span
@@ -185,6 +188,7 @@ <h3 id="scrumHelperHeading" class="text-3xl font-semibold cursor-pointer">Scrum
185188
Github Token required, add it in the settings.
186189
</span>
187190
</span>
191+
188192
</div>
189193
</div>
190194

src/scripts/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ let yesterdayContributionElement = document.getElementById('yesterdayContributio
77
let startingDateElement = document.getElementById('startingDate');
88
let endingDateElement = document.getElementById('endingDate');
99
let showOpenLabelElement = document.getElementById('showOpenLabel');
10-
let userReasonElement = null; // userReason element removed from UI
10+
11+
let userReasonElement = null;
12+
1113
let showCommitsElement = document.getElementById('showCommits');
1214

1315
function handleBodyOnLoad() {
@@ -33,7 +35,9 @@ function handleBodyOnLoad() {
3335
'startingDate',
3436
'endingDate',
3537
'showOpenLabel',
38+
3639
'userReason',
40+
3741
'yesterdayContribution',
3842
'cacheInput',
3943
'githubToken',
@@ -229,4 +233,5 @@ showCommitsElement.addEventListener('change', handleShowCommitsChange);
229233
endingDateElement.addEventListener('change', handleEndingDateChange);
230234
yesterdayContributionElement.addEventListener('change', handleYesterdayContributionChange);
231235
showOpenLabelElement.addEventListener('change', handleOpenLabelChange);
236+
232237
document.addEventListener('DOMContentLoaded', handleBodyOnLoad);

src/scripts/scrumHelper.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ function allIncluded(outputTarget = 'email') {
7070
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #d73a49;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--red">closed</div>';
7171
let issue_opened_button =
7272
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #2cbe4e;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--green">open</div>';
73+
let issue_closed_completed_button =
74+
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #6f42c1;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--purple">closed</div>';
75+
let issue_closed_notplanned_button =
76+
'<div style="vertical-align:middle;display: inline-block;padding: 0px 4px;font-size:9px;font-weight: 600;color: #fff;text-align: center;background-color: #808080;border-radius: 3px;line-height: 12px;margin-bottom: 2px;" class="State State--gray">closed</div>';
7377

7478
function getChromeData() {
7579
console.log("[DEBUG] getChromeData called for outputTarget:", outputTarget);
@@ -1334,8 +1338,18 @@ ${userReason}`;
13341338
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_opened_button : ''}</li>`;
13351339

13361340
} else if (item.state === 'closed') {
1337-
// Always show closed label for closed issues
1338-
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a>${showOpenLabel ? ' ' + issue_closed_button : ''}</li>`;
1341+
1342+
1343+
// Use state_reason to distinguish closure reason
1344+
if (item.state_reason === 'completed') {
1345+
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_completed_button}</li>`;
1346+
} else if (item.state_reason === 'not_planned') {
1347+
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_notplanned_button}</li>`;
1348+
} else {
1349+
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`;
1350+
}
1351+
1352+
13391353
} else {
13401354
// Fallback for unexpected state
13411355
li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a></li>`;

0 commit comments

Comments
 (0)