From d3e16c7ab5c692219843dc1b582ec194a6605260 Mon Sep 17 00:00:00 2001 From: programmingKyle <155344874+programmingKyle@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:43:47 -0400 Subject: [PATCH] Fixed Recording in Progress Info - Not sure when this happened. - Now working as intended. When you start clocking it will display all the information on which topic, subtopic and project you're recording on --- src/inputHandler.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/inputHandler.js b/src/inputHandler.js index 18579d8..81414d2 100644 --- a/src/inputHandler.js +++ b/src/inputHandler.js @@ -15,12 +15,11 @@ async function populateTopicSelect(){ return new Date(b.previousTime) - new Date(a.previousTime); }); - console.log(activeTopics); - activeTopics.forEach(element => { const topicOption_el = document.createElement('option'); topicOption_el.textContent = element.topic; topicOption_el.value = element.id; + topicOption_el.dataset.topicName = element.topic; topicSelect_el.append(topicOption_el); }); await populateSubtopicSelect(topicSelect_el.value); @@ -45,6 +44,7 @@ async function populateSubtopicSelect(topic){ const subtopicOption_el = document.createElement('option'); subtopicOption_el.textContent = element.subtopic; subtopicOption_el.value = element.id; + subtopicOption_el.dataset.subtopicName = element.subtopic; subtopicSelect_el.append(subtopicOption_el); } }); @@ -87,7 +87,10 @@ function populateDisplayInputs(){ const currentSubtopicText_el = document.getElementById('currentSubtopicText'); const currentProjectText_el = document.getElementById('currentProjectText'); - currentTimerTopicText_el.textContent = topicSelect_el.value; - currentSubtopicText_el.textContent = subtopicSelect_el.value === 'null' ? 'Not Selected' : subtopicSelect_el.value; + const selectedTopic = topicSelect_el.options[topicSelect_el.selectedIndex].dataset.topicName; + const selectedSubtopic = subtopicSelect_el.options[subtopicSelect_el.selectedIndex].dataset.subtopicName; + + currentTimerTopicText_el.textContent = selectedTopic; + currentSubtopicText_el.textContent = subtopicSelect_el.value === 'null' ? 'Not Selected' : selectedSubtopic; currentProjectText_el.textContent = projectInput_el.value; }