Skip to content

Commit 275e748

Browse files
author
Harshit Kedia
committed
add support for gsoc and other improvements
1 parent 6a24c94 commit 275e748

File tree

9 files changed

+214
-94
lines changed

9 files changed

+214
-94
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "scrum_helper_extension",
33
"version": "1.0.0",
4-
"description": "This extension helps in writing Srums in google groups, particularly related to FOSSASIA. It converts a link to a github PR or an Issue to display the PR or the Issue's name along with the link to it.",
4+
"description": "This extension helps in writing Scrums in google groups, particularly related to FOSSASIA. It converts a link to a github PR or an Issue to display the PR or the Issue's name along with the link to it.",
55
"devDependencies": {
66
"eslint": "^4.7.2"
77
},

src/docs/screenshots/popup.png

-6.83 KB
Loading

src/docs/screenshots/scrum.png

-8.73 KB
Loading

src/index.css

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,51 @@
11
body{
2-
margin: 0;
3-
padding: 0;
4-
background-color: rgba(251, 251, 251, 0.6);
5-
}
6-
html{
7-
width: 340px;
8-
height: 400px;
2+
margin: 0;
3+
padding: 0;
4+
background-color: rgba(251, 251, 251, 0.6);
95
}
6+
107
*{
11-
box-sizing: border-box;
8+
box-sizing: border-box;
129
}
1310
.datepicker{
14-
margin-bottom: 5px !important;
11+
margin-bottom: 5px !important;
1512
}
1613
.container{
1714
}
15+
.tabs .tab a:hover, .tabs .tab a.active {
16+
background-color: transparent;
17+
color: #3f51b5;
18+
}
19+
.tabs {
20+
background-color: transparent;
21+
}
22+
.tabs .tab a {
23+
color: #3F51B5;
24+
}
25+
.tabs .indicator {
26+
background-color: #3F51B5;
27+
}
28+
.switch label input[type=checkbox]:checked+.lever {
29+
background-color: #3F51B5;
30+
}
31+
.switch label input[type=checkbox]:checked+.lever:after {
32+
background-color: #fcfcfc;
33+
left: 24px;
34+
}
35+
[type="checkbox"].filled-in:checked+label:after {
36+
border: 2px solid #3f51b5;
37+
background-color: #3f51b5;
38+
}
39+
.btn:hover, .btn-large:hover {
40+
background-color: #3f51b5;
41+
}
42+
a {
43+
color: #3F51B5;
44+
}
45+
.btn, .btn-large {
46+
background-color: #3f51b5;
47+
}
48+
li{
49+
list-style-type: disc !important;
50+
margin-left: 1rem;
51+
}

src/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"https://*/*",
2929
"storage",
3030
"activeTab",
31-
"<all_urls>"
31+
"<all_urls>",
32+
"notifications"
3233
]
3334

3435
}

src/popup.html

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<link href="materialize/css/materialize.min.css" type="text/css" rel="stylesheet">
88
<link rel="stylesheet" type="text/css" href="index.css">
99
<script src="https://use.fontawesome.com/73d6eff847.js"></script>
10+
<style type="text/css">
11+
html,body{
12+
width: 350px !important;
13+
height: 600px !important;
14+
max-height: 600px !important;
15+
overflow-y: scroll;
16+
}
17+
</style>
1018
</head>
1119
<body>
1220
<div class="container">
@@ -25,26 +33,33 @@ <h6 class="center">
2533
</label>
2634
</div>
2735
</div>
28-
<br />
2936
<div class="row">
30-
<div class="input-field col s12">
37+
<div class="col s12">
38+
<ul class="tabs">
39+
<li class="tab col s6" title="I am doing CodeHeat!"><a id="codeheatTab" href="#codeheatBox">CodeHeat</a></li>
40+
<li class="tab col s6" title="I am doing GSoC!"><a id="gsocTab" href="#gsocBox">GSoC</a></li>
41+
</ul>
42+
</div>
43+
</div>
44+
<div class="row">
45+
<div class="input-field col s12">
3146
<input placeholder="Required for getting data from github" id="githubUsername" type="text">
3247
<label for="githubUsername">Your Github Username</label>
3348
</div>
3449
<div class="col s12"><span>Fetch your contributions between:</span>
3550
<input type="checkbox" class="filled-in" id="lastWeekContribution"/>
36-
<label for="lastWeekContribution">Show past 7 days from today</label>
51+
<label for="lastWeekContribution">Show past <span id="noDays"></span> from today</label>
3752
</div>
3853

3954
<div class="input-field col s6">
40-
<input id="startingDate" type="text" class="datepicker" placeholder=" ">
41-
<label for="startingDate">Starting Date</label>
55+
<div>Starting Date:</div>
56+
<input id="startingDate" type="date" class="datepicker" placeholder=" ">
57+
4258
</div>
4359
<div class="input-field col s6">
44-
<input id="endingDate" type="text" class="datepicker" placeholder=" ">
45-
<label for="endingDate">Ending Date</label>
60+
<div>Ending Date</div>
61+
<input id="endingDate" type="date" class="datepicker" placeholder=" ">
4662
</div>
47-
<div class="col s12"><span>Date should be in YYYY-MM-DD format</span></div>
4863
<div class="col s12">
4964
<br />
5065
<input type="checkbox" class="filled-in" id="showOpenLabel"/>
@@ -58,10 +73,17 @@ <h6 class="center">
5873
<input placeholder="Reason" id="userReason" type="text">
5974
<label for="userReason">What is stopping you from doing your work?</label>
6075
</div>
61-
<div class="col center s12">
62-
<br /><br />
63-
<button id="refresh" class="waves-effect waves-light btn refresh"><i class="fa fa-refresh" aria-hidden="true"></i> Refresh this page to apply changes</button>
64-
<br />
76+
<div class="col s12">
77+
78+
<h5>Note:</h5>
79+
<h6>
80+
<ul>
81+
<li>The PRs fetched are according to the date last reviewed by anyone. So if you reviewed a PR 10 days back, and someone reviewed it 2 days back, it will appear in your last week's activity. See <a href="https://github.com/hkedia321/scrum_helper_extension/issues/20">this issue</a>.
82+
</li>
83+
<li>By using the extension you understand that there might be discrepancies in the SCRUM generated. You are advised to edit the SCRUM afterwards to remove any discrepancies.
84+
</li>
85+
</ul>
86+
</h6>
6587
</div>
6688
</div>
6789

@@ -74,7 +96,6 @@ <h6 class="center">
7496
</div>
7597
<script src="scripts/jquery-3.2.1.min.js"></script>
7698
<script type="text/javascript" type="text/javascript" src="materialize/js/materialize.min.js"></script>
77-
<script src="scripts/initialize.js"></script>
7899
<script src="scripts/main.js"></script>
79100
</body>
80101
</html>

src/scripts/initialize.js

Whitespace-only changes.

src/scripts/main.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ var endingDateElement = document.getElementById("endingDate");
77
var showOpenLabelElement = document.getElementById("showOpenLabel");
88
var showClosedLabelElement = document.getElementById("showClosedLabel");
99
var userReasonElement = document.getElementById("userReason");
10-
10+
var gsoc = 0;//0 means gsoc. 1 means gsoc
1111
function handleBodyOnLoad(){
1212
// prefill name
13-
chrome.storage.local.get(["githubUsername","enableToggle","startingDate","endingDate","showOpenLabel","showClosedLabel","userReason","lastWeekContribution"],function(items){
13+
chrome.storage.local.get(["githubUsername","enableToggle","startingDate","endingDate","showOpenLabel","showClosedLabel","userReason","lastWeekContribution","gsoc"],function(items){
1414
if(items.githubUsername){
1515
githubUsernameElement.value=items.githubUsername;
1616
}
@@ -52,6 +52,12 @@ function handleBodyOnLoad(){
5252
lastWeekContributionElement.checked=true;
5353
handleLastWeekContributionChange();
5454
}
55+
if(items.gsoc==1){
56+
handleGsocClick();
57+
}
58+
else{
59+
handleCodeheatClick();
60+
}
5561
});
5662
}
5763
function handleEnableChange(){
@@ -66,7 +72,7 @@ function handleEndingDateChange(){
6672
var value = endingDateElement.value;
6773
chrome.storage.local.set({"endingDate": value});
6874
}
69-
function handleLastWeekContributionChange(){
75+
function handleLastWeekContributionChange(keepPreviousValue=false){
7076
var value = lastWeekContributionElement.checked;
7177
if(value){
7278
startingDateElement.disabled=true;
@@ -84,7 +90,8 @@ function handleLastWeekContributionChange(){
8490
}
8591
function getLastWeek(){
8692
var today = new Date();
87-
var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
93+
var noDays_to_goback=gsoc==0?7:1;
94+
var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - noDays_to_goback);
8895
var lastWeekMonth = lastWeek.getMonth() + 1;
8996
var lastWeekDay = lastWeek.getDate();
9097
var lastWeekYear = lastWeek.getFullYear();
@@ -118,11 +125,21 @@ function handleUserReasonChange(){
118125
var value = userReasonElement.value;
119126
chrome.storage.local.set({"userReason": value});
120127
}
121-
function handleRefresh(){
122-
window.close();
123-
chrome.tabs.executeScript({
124-
code: "console.log('herrree');window.onbeforeunload = null;document.location.reload()"
125-
});
128+
function handleCodeheatClick(){
129+
gsoc=0;
130+
$("#codeheatTab").addClass("active");
131+
$('.tabs').tabs();
132+
$("#noDays").text("7 days");
133+
chrome.storage.local.set({"gsoc": 0});
134+
handleLastWeekContributionChange();
135+
}
136+
function handleGsocClick(){
137+
gsoc=1;
138+
$("#gsocTab").addClass("active");
139+
$('.tabs').tabs();
140+
$("#noDays").text("1 day");
141+
chrome.storage.local.set({"gsoc": 1});
142+
handleLastWeekContributionChange();
126143
}
127144
enableToggleElement.addEventListener("change", handleEnableChange);
128145
githubUsernameElement.addEventListener("keyup", handleGithubUsernameChange);
@@ -132,5 +149,10 @@ lastWeekContributionElement.addEventListener("change", handleLastWeekContributio
132149
showOpenLabelElement.addEventListener("change", handleOpenLabelChange);
133150
showClosedLabelElement.addEventListener("change", handleClosedLabelChange);
134151
userReasonElement.addEventListener("keyup", handleUserReasonChange);
135-
document.getElementById("refresh").addEventListener("click",handleRefresh);
136152
document.addEventListener("DOMContentLoaded", handleBodyOnLoad);
153+
document.getElementById("codeheatTab").addEventListener("click",handleCodeheatClick);
154+
document.getElementById("gsocTab").addEventListener("click",handleGsocClick);
155+
chrome.runtime.onMessage.addListener(
156+
function(request, sender, sendResponse) {
157+
chrome.notifications.create("Updated SCRUM!");
158+
});

0 commit comments

Comments
 (0)