Skip to content

Commit 18d0a94

Browse files
Disable Buttons While Timer Active
- Recent projects, topic view, subtopic view, project view, options button, back button all don't do anything while timer active
1 parent 95eca6c commit 18d0a94

5 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/optionsHandler.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const optionsButton_el = document.getElementById('optionsButton');
33
let optionsValues;
44

55
optionsButton_el.addEventListener('click', () => {
6+
if (timerActive){
7+
return;
8+
}
69
overlayContainer_el.style.display = 'flex';
710
loadOverlayContent('overlays.html', '#optionsContainer', optionsListeners);
811
});

src/projectView.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ async function populateProjects(subtopicID, label){
2222

2323
// Add event listener using a closure to capture the current value of 'element'
2424
projectItemDiv_el.addEventListener('click', async () => {
25+
if (timerActive){
26+
return;
27+
}
2528
topicSelect_el.value = currentSelectedTopic.id;
2629
await populateSubtopicSelect(currentSelectedTopic.id);
2730
subtopicSelect_el.value = currentSelectedSubtopic;

src/recentProjects.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ async function populateRecentProjects(){
3535

3636
function projectEventListener(div, topicID, subtopicID, project){
3737
div.addEventListener('click', async () => {
38+
if (timerActive){
39+
return;
40+
}
3841
topicSelect_el.value = topicID;
3942
await populateSubtopicSelect(topicID);
4043
subtopicSelect_el.value = subtopicID;

src/subtopicView.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ async function populateSubtopics(topicID, topic) {
1919
noSubtopicTimeText_el.textContent = time;
2020

2121
noSubtopicItem_el.addEventListener('click', async () => {
22+
if (timerActive){
23+
return;
24+
}
2225
subjectViewLocation = 2;
2326
currentSelectedSubtopic = 'null';
2427
await populate30DayGraph('Subtopic', 'null');
@@ -50,6 +53,9 @@ async function populateSubtopics(topicID, topic) {
5053

5154
// Add event listener using a closure to capture the current value of 'element'
5255
subtopicItemDiv_el.addEventListener('click', async () => {
56+
if (timerActive){
57+
return;
58+
}
5359
subjectViewLocation = 2;
5460
currentSelectedSubtopic = element.id;
5561
await populate30DayGraph('Subtopic', element.id);
@@ -68,6 +74,9 @@ async function populateSubtopics(topicID, topic) {
6874
}
6975

7076
subtopicViewBackButton_el.addEventListener('click', async () => {
77+
if (timerActive){
78+
return;
79+
}
7180
subjectViewLocation -= 1;
7281
if (subjectViewLocation === 0){
7382
subtopicViewBackButton_el.style.display = 'none';

src/topicView.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ async function populateTopicView(){
2727
topicItemDiv_el.append(topicName_el, topicTime_el);
2828

2929
topicItemDiv_el.addEventListener('click', async () => {
30+
if (timerActive){
31+
return;
32+
}
3033
subjectViewLocation = 1;
3134
subtopicViewBackButton_el.style.display = 'block';
3235
currentSelectedTopic = ({id: element.id, topic: element.topic});

0 commit comments

Comments
 (0)