Skip to content

Commit 3bc09f8

Browse files
authored
Merge branch 'master' into preview-bug
2 parents f109509 + 695840d commit 3bc09f8

File tree

4 files changed

+123
-98
lines changed

4 files changed

+123
-98
lines changed

src/popup.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ <h4>Your Github Username</h4>
7474
<p class="text-sm">Fetch your contributions between:</p>
7575
<div class="flex justify-between items-center my-2 mx-4">
7676
<div class="flex items-center gap-2">
77-
<input type="radio" id="lastWeekContribution" name="timeframe" class="form-radio"
78-
onclick="toggleRadio(this)">
77+
<input type="radio" id="lastWeekContribution" name="timeframe" class="form-radio">
7978
<label for="lastWeekContribution">Last 7 days</label>
8079
</div>
8180
<div class="flex items-center gap-2">
82-
<input type="radio" id="yesterdayContribution" name="timeframe" class="form-radio"
83-
onclick="toggleRadio(this)">
81+
<input type="radio" id="yesterdayContribution" name="timeframe" class="form-radio">
8482
<label for="yesterdayContribution">Last 1 day</label>
8583
</div>
8684
</div>
@@ -132,19 +130,19 @@ <h6 class="text-base font-semibold">Scrum Report</h6>
132130
<div id="settingsSection" class="tab-content hidden">
133131
<div class="">
134132
<div class="flex items-center mt-4">
135-
<h4>Organisation Name</h4>
133+
<h4>Organization Name</h4>
136134
<span class="tooltip-container ml-2">
137135
<i class="fa fa-question-circle question-icon"></i>
138136
<span class="tooltip-bubble">
139-
<b>Which organisation's GitHub activity?</b><br>
140-
Enter the GitHub organisation name to fetch activites for. Default is <b>fossasia</b>.
141-
Organisation name is not case-sensitive.
137+
<b>Which organization's GitHub activity?</b><br>
138+
Enter the GitHub organization name to fetch activites for. Default is <b>fossasia</b>.
139+
Organization name is not case-sensitive.
142140
</span>
143141
</span>
144142
</div>
145143
<input id="orgInput" type="text"
146144
class="w-full border-2 border-gray-200 bg-gray-200 rounded-xl text-gray-800 p-2 my-2"
147-
placeholder="Enter organisation name (default: fossasia)">
145+
placeholder="Enter organization name (default: fossasia)">
148146
</div>
149147
<div class="">
150148
<div class="flex items-center justify-between">

src/scripts/main.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ function handleBodyOnLoad() {
1919
'startingDate',
2020
'endingDate',
2121
'showOpenLabel',
22-
'showClosedLabel',
2322
'userReason',
2423
'lastWeekContribution',
2524
'yesterdayContribution',
@@ -99,7 +98,7 @@ document.getElementById('refreshCache').addEventListener('click', async (e) => {
9998

10099
Materialize.toast({ html: 'Data refreshed successfully!', classes: 'green' });
101100
} catch (err) {
102-
console.error('Refresh failed:', err);
101+
console.log('Refresh successful',);
103102
} finally {
104103
setTimeout(() => {
105104
button.classList.remove('loading');
@@ -124,19 +123,19 @@ function handleLastWeekContributionChange() {
124123
let value = lastWeekContributionElement.checked;
125124
let labelElement = document.querySelector("label[for='lastWeekContribution']");
126125
if (value) {
127-
startingDateElement.disabled = true;
128-
endingDateElement.disabled = true;
129-
endingDateElement.value = getToday();
130-
startingDateElement.value = getLastWeek();
131-
handleEndingDateChange();
132-
handleStartingDateChange();
133-
labelElement.classList.add("selectedLabel");
134-
labelElement.classList.remove("unselectedLabel");
126+
startingDateElement.readOnly = true;
127+
endingDateElement.readOnly = true;
128+
endingDateElement.value = getToday();
129+
startingDateElement.value = getLastWeek();
130+
handleEndingDateChange();
131+
handleStartingDateChange();
132+
labelElement.classList.add("selectedLabel");
133+
labelElement.classList.remove("unselectedLabel");
135134
} else {
136-
startingDateElement.disabled = false;
137-
endingDateElement.disabled = false;
138-
labelElement.classList.add("unselectedLabel");
139-
labelElement.classList.remove("selectedLabel");
135+
startingDateElement.readOnly = false;
136+
endingDateElement.readOnly = false;
137+
labelElement.classList.add("unselectedLabel");
138+
labelElement.classList.remove("selectedLabel");
140139
}
141140

142141
chrome.storage.local.set({ lastWeekContribution: value });
@@ -147,17 +146,17 @@ function handleYesterdayContributionChange() {
147146
let labelElement = document.querySelector("label[for='yesterdayContribution']");
148147

149148
if (value) {
150-
startingDateElement.disabled = true;
151-
endingDateElement.disabled = true;
149+
startingDateElement.readOnly = true;
150+
endingDateElement.readOnly = true;
152151
endingDateElement.value = getToday();
153152
startingDateElement.value = getYesterday();
154153
handleEndingDateChange();
155154
handleStartingDateChange();
156155
labelElement.classList.add("selectedLabel");
157156
labelElement.classList.remove("unselectedLabel");
158157
} else {
159-
startingDateElement.disabled = false;
160-
endingDateElement.disabled = false;
158+
startingDateElement.readOnly = false;
159+
endingDateElement.readOnly = false;
161160
labelElement.classList.add("unselectedLabel");
162161
labelElement.classList.remove("selectedLabel");
163162
}

src/scripts/popup.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ document.addEventListener('DOMContentLoaded', function () {
256256

257257
const startDateInput = document.getElementById('startingDate');
258258
const endDateInput = document.getElementById('endingDate');
259-
startDateInput.disabled = false;
260-
endDateInput.disabled = false;
259+
startDateInput.readOnly = false;
260+
endDateInput.readOnly = false;
261261

262262
chrome.storage.local.set({
263263
lastWeekContribution: false,
@@ -294,9 +294,8 @@ document.addEventListener('DOMContentLoaded', function () {
294294
startDateInput.value = getYesterday();
295295
endDateInput.value = getToday();
296296
}
297-
298-
startDateInput.disabled = endDateInput.disabled = true;
299-
297+
startDateInput.readOnly = endDateInput.readOnly = true;
298+
300299
chrome.storage.local.set({
301300
startingDate: startDateInput.value,
302301
endingDate: endDateInput.value,
@@ -369,11 +368,9 @@ document.addEventListener('DOMContentLoaded', function () {
369368
.then(res => {
370369
console.log('[Org Check] Response status for', org, ':', res.status);
371370
if (res.status === 404) {
372-
console.log('[Org Check] Organisation not found on GitHub:', org);
373-
// Remove any existing toast with the same id
371+
console.log('[Org Check] Organization not found on GitHub:', org);
374372
const oldToast = document.getElementById('invalid-org-toast');
375373
if (oldToast) oldToast.parentNode.removeChild(oldToast);
376-
// Create a new toast div
377374
const toastDiv = document.createElement('div');
378375
toastDiv.id = 'invalid-org-toast';
379376
toastDiv.className = 'toast';
@@ -387,32 +384,34 @@ document.addEventListener('DOMContentLoaded', function () {
387384
toastDiv.style.left = '50%';
388385
toastDiv.style.transform = 'translateX(-50%)';
389386
toastDiv.style.zIndex = '9999';
390-
toastDiv.innerText = 'Organisation not found on GitHub.';
387+
toastDiv.innerText = 'Organization not found on GitHub.';
391388
document.body.appendChild(toastDiv);
392389
setTimeout(() => {
393390
if (toastDiv.parentNode) toastDiv.parentNode.removeChild(toastDiv);
394391
}, 3000);
395-
// Do NOT update storage or fetch data for invalid org
396392
return;
397393
}
398-
// Remove any existing toast with the same id (for valid orgs)
399394
const oldToast = document.getElementById('invalid-org-toast');
400395
if (oldToast) oldToast.parentNode.removeChild(oldToast);
401396
console.log('[Org Check] Organisation exists on GitHub:', org);
397+
<<<<<<< preview-bug
402398
// Valid org: update storage and fetch data
403399
chrome.storage.local.set({ orgName: org, githubCache: null }, function () {
404400
const scrumReport = document.getElementById('scrumReport');
405401
if (scrumReport) {
406402
scrumReport.innerHTML = '<p style="text-align: center; color: #666; padding: 20px;">Organisation changed. Click "Generate Report" to fetch new data.</p>';
407403
}
404+
=======
405+
console.log('[Org Check] Organization exists on GitHub:', org);
406+
chrome.storage.local.set({ orgName: org }, function () {
407+
if (window.generateScrumReport) window.generateScrumReport();
408+
>>>>>>> master
408409
});
409410
})
410411
.catch((err) => {
411412
console.log('[Org Check] Error validating organisation:', org, err);
412-
// Remove any existing toast with the same id
413413
const oldToast = document.getElementById('invalid-org-toast');
414414
if (oldToast) oldToast.parentNode.removeChild(oldToast);
415-
// Create a new toast div
416415
const toastDiv = document.createElement('div');
417416
toastDiv.id = 'invalid-org-toast';
418417
toastDiv.className = 'toast';
@@ -426,12 +425,11 @@ document.addEventListener('DOMContentLoaded', function () {
426425
toastDiv.style.left = '50%';
427426
toastDiv.style.transform = 'translateX(-50%)';
428427
toastDiv.style.zIndex = '9999';
429-
toastDiv.innerText = 'Error validating organisation.';
428+
toastDiv.innerText = 'Error validating organization.';
430429
document.body.appendChild(toastDiv);
431430
setTimeout(() => {
432431
if (toastDiv.parentNode) toastDiv.parentNode.removeChild(toastDiv);
433432
}, 3000);
434-
// Do NOT update storage or fetch data for invalid org
435433
});
436434
}, 2500);
437435

@@ -488,8 +486,8 @@ document.querySelectorAll('input[name="timeframe"]').forEach(radio => {
488486

489487
const startDateInput = document.getElementById('startingDate');
490488
const endDateInput = document.getElementById('endingDate');
491-
startDateInput.disabled = false;
492-
endDateInput.disabled = false;
489+
startDateInput.readOnly = false;
490+
endDateInput.readOnly = false;
493491

494492
chrome.storage.local.set({
495493
lastWeekContribution: false,
@@ -561,7 +559,7 @@ function toggleRadio(radio) {
561559
endDateInput.value = getToday();
562560
}
563561

564-
startDateInput.disabled = endDateInput.disabled = true;
562+
startDateInput.readOnly = endDateInput.readOnly = true;
565563

566564
chrome.storage.local.set({
567565
startingDate: startDateInput.value,
@@ -579,7 +577,7 @@ function toggleRadio(radio) {
579577
});
580578
}
581579

582-
const cacheInput = document.getElementById('cacheInput');
580+
let cacheInput = document.getElementById('cacheInput');
583581
if (cacheInput) {
584582
chrome.storage.local.get(['cacheInput'], function (result) {
585583
if (result.cacheInput) {

0 commit comments

Comments
 (0)