Skip to content

Commit b1d37bc

Browse files
authored
Merge pull request #147 from vedansh-5/commits
using graphQL for commit fetching solving the api exemption issue.
2 parents cb4cc83 + a9fd5ac commit b1d37bc

File tree

5 files changed

+1091
-900
lines changed

5 files changed

+1091
-900
lines changed

src/index.css

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,5 +416,28 @@ hr,
416416
}
417417

418418
.dark-mode .token-preview-char {
419-
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
419+
box-shadow: 0 1px 4px rgba(0,0,0,0.18);
420+
}
421+
422+
.popup-commit-list {
423+
margin: 8px 0 8px 18px;
424+
padding-left: 0;
425+
border-left: 2px solid #e0e7ff;
426+
background: #f8fafc;
427+
border-radius: 6px;
428+
}
429+
.popup-commit-list li {
430+
list-style: none;
431+
margin: 8px 0 8px 0;
432+
padding-left: 0;
433+
}
434+
.popup-commit-list .commit-meta {
435+
color: #64748b;
436+
font-size: 11px;
437+
margin-left: 8px;
438+
}
439+
.popup-commit-list a {
440+
color: #2563eb;
441+
font-weight: 500;
442+
text-decoration: underline;
420443
}

src/popup.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,22 @@ <h4>Your Github Token</h4>
169169
<i id="tokenEyeIcon" class="fa fa-eye text-gray-600"></i>
170170
</button>
171171
</div>
172-
<input id="githubToken" type="password"
173-
class="w-full border-2 border-gray-200 bg-gray-200 rounded-xl text-gray-800 p-2 my-2 pr-10"
174-
placeholder="Required for making authenticated requests">
172+
<input id="githubToken" type="password" class="w-full border-2 border-gray-200 bg-gray-200 rounded-xl text-gray-800 p-2 my-2 pr-10" placeholder="Required for making authenticated requests">
173+
174+
175+
176+
<div class="col s12 my-4 ">
177+
<div class="flex items-center gap-2">
178+
<input type="checkbox" id="showCommits" checked class="form-checkbox h-4 w-4 text-blue-600 ">
179+
<label id="showCommitsLabel" for="showCommits" class="text-gray-700 font-medium text-sm flex items-center gap-1 ">Show commits made within date range in Open PRs</label> <span class="tooltip-container">
180+
<i class="fa fa-question-circle question-icon"></i>
181+
<span class="tooltip-bubble">
182+
Github Token required.
183+
</span>
184+
</span>
185+
</div>
186+
</div>
187+
175188
<p class="text-sm font-medium">Enter cache TTL <span class="text-sm font-normal">(in minutes)</span>
176189
<span class="tooltip-container">
177190
<i class="fa fa-question-circle question-icon"></i>
@@ -186,6 +199,7 @@ <h4>Your Github Token</h4>
186199
class="w-full border-2 border-gray-200 bg-gray-200 rounded-xl text-gray-800 p-2 my-2"
187200
placeholder="Write Cache TTL in minutes (Default 10 minutes)">
188201
</div>
202+
189203
<div class="">
190204
<button id="refreshCache"
191205
class="w-full mt-3 bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded flex items-center justify-center gap-2 transition-colors duration-200">

src/scripts/main.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ let startingDateElement = document.getElementById('startingDate');
99
let endingDateElement = document.getElementById('endingDate');
1010
let showOpenLabelElement = document.getElementById('showOpenLabel');
1111
let userReasonElement = document.getElementById('userReason');
12+
let showCommitsElement = document.getElementById('showCommits');
1213

1314
function handleBodyOnLoad() {
1415
chrome.storage.local.get(
@@ -24,6 +25,7 @@ function handleBodyOnLoad() {
2425
'yesterdayContribution',
2526
'cacheInput',
2627
'githubToken',
28+
'showCommits',
2729
],
2830
(items) => {
2931
if (items.githubUsername) {
@@ -77,6 +79,12 @@ function handleBodyOnLoad() {
7779
yesterdayContributionElement.checked = true;
7880
handleYesterdayContributionChange();
7981
}
82+
if (items.showCommits){
83+
showCommitsElement.checked = items.showCommits;
84+
} else {
85+
showCommitsElement.checked = false;
86+
handleShowCommitsChange();
87+
}
8088
},
8189
);
8290
}
@@ -241,12 +249,19 @@ function handleUserReasonChange() {
241249
let value = userReasonElement.value;
242250
chrome.storage.local.set({ userReason: value });
243251
}
252+
253+
function handleShowCommitsChange() {
254+
let value = showCommitsElement.checked;
255+
chrome.storage.local.set({ showCommits: value });
256+
}
257+
244258
enableToggleElement.addEventListener('change', handleEnableChange);
245259
githubUsernameElement.addEventListener('keyup', handleGithubUsernameChange);
246260
githubTokenElement.addEventListener('keyup', handleGithubTokenChange);
247261
cacheInputElement.addEventListener('keyup', handleCacheInputChange);
248262
projectNameElement.addEventListener('keyup', handleProjectNameChange);
249263
startingDateElement.addEventListener('change', handleStartingDateChange);
264+
showCommitsElement.addEventListener('change', handleShowCommitsChange);
250265
endingDateElement.addEventListener('change', handleEndingDateChange);
251266
lastWeekContributionElement.addEventListener('change', handleLastWeekContributionChange);
252267
yesterdayContributionElement.addEventListener('change', handleYesterdayContributionChange);

src/scripts/popup.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ document.addEventListener('DOMContentLoaded', function () {
129129
'githubToken',
130130
'projectName',
131131
'settingsToggle',
132+
132133
];
133134

134135
const radios = document.querySelectorAll('input[name="timeframe"]');
@@ -525,9 +526,7 @@ document.getElementById('refreshCache').addEventListener('click', async function
525526

526527
try {
527528
// Clear local cache
528-
await new Promise(resolve => {
529-
chrome.storage.local.remove('githubCache', resolve);
530-
});
529+
await forceGithubDataRefresh();
531530

532531
// Clear the scrum report
533532
const scrumReport = document.getElementById('scrumReport');

0 commit comments

Comments
 (0)