Skip to content

Commit d964ed2

Browse files
authored
tab bug fixed (#78)
Signed-off-by: Vedansh Saini <[email protected]>
1 parent 24fb851 commit d964ed2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/scripts/main.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function handleBodyOnLoad() {
2222
'userReason',
2323
'lastWeekContribution',
2424
'gsoc',
25+
'selectedTab',
2526
],
2627
(items) => {
2728
if (items.githubUsername) {
@@ -65,6 +66,15 @@ function handleBodyOnLoad() {
6566
} else {
6667
handleCodeheatClick();
6768
}
69+
if (items.selectedTab === 'gsoc') {
70+
handleGsocClick();
71+
}
72+
else {
73+
handleCodeheatClick();
74+
}
75+
76+
// initialize materialize tabs
77+
$('.tabs').tabs('select_tab', items.selectedTab === 'gsoc' ? 'gsocBox' : 'codeheatBox' );
6878
},
6979
);
7080
}
@@ -147,15 +157,15 @@ function handleCodeheatClick() {
147157
$('#codeheatTab').addClass('active');
148158
$('.tabs').tabs();
149159
$('#noDays').text('7 days');
150-
chrome.storage.local.set({ gsoc: 0 });
160+
chrome.storage.local.set({ gsoc: 0, selectedTab: 'codeheat' });
151161
handleLastWeekContributionChange();
152162
}
153163
function handleGsocClick() {
154164
gsoc = 1;
155165
$('#gsocTab').addClass('active');
156166
$('.tabs').tabs();
157167
$('#noDays').text('1 day');
158-
chrome.storage.local.set({ gsoc: 1 });
168+
chrome.storage.local.set({ gsoc: 1, selectedTab: 'gsoc' });
159169
handleLastWeekContributionChange();
160170
}
161171
enableToggleElement.addEventListener('change', handleEnableChange);

0 commit comments

Comments
 (0)