@@ -15,12 +15,11 @@ async function populateTopicSelect(){
1515 return new Date ( b . previousTime ) - new Date ( a . previousTime ) ;
1616 } ) ;
1717
18- console . log ( activeTopics ) ;
19-
2018 activeTopics . forEach ( element => {
2119 const topicOption_el = document . createElement ( 'option' ) ;
2220 topicOption_el . textContent = element . topic ;
2321 topicOption_el . value = element . id ;
22+ topicOption_el . dataset . topicName = element . topic ;
2423 topicSelect_el . append ( topicOption_el ) ;
2524 } ) ;
2625 await populateSubtopicSelect ( topicSelect_el . value ) ;
@@ -45,6 +44,7 @@ async function populateSubtopicSelect(topic){
4544 const subtopicOption_el = document . createElement ( 'option' ) ;
4645 subtopicOption_el . textContent = element . subtopic ;
4746 subtopicOption_el . value = element . id ;
47+ subtopicOption_el . dataset . subtopicName = element . subtopic ;
4848 subtopicSelect_el . append ( subtopicOption_el ) ;
4949 }
5050 } ) ;
@@ -87,7 +87,10 @@ function populateDisplayInputs(){
8787 const currentSubtopicText_el = document . getElementById ( 'currentSubtopicText' ) ;
8888 const currentProjectText_el = document . getElementById ( 'currentProjectText' ) ;
8989
90- currentTimerTopicText_el . textContent = topicSelect_el . value ;
91- currentSubtopicText_el . textContent = subtopicSelect_el . value === 'null' ? 'Not Selected' : subtopicSelect_el . value ;
90+ const selectedTopic = topicSelect_el . options [ topicSelect_el . selectedIndex ] . dataset . topicName ;
91+ const selectedSubtopic = subtopicSelect_el . options [ subtopicSelect_el . selectedIndex ] . dataset . subtopicName ;
92+
93+ currentTimerTopicText_el . textContent = selectedTopic ;
94+ currentSubtopicText_el . textContent = subtopicSelect_el . value === 'null' ? 'Not Selected' : selectedSubtopic ;
9295 currentProjectText_el . textContent = projectInput_el . value ;
9396}
0 commit comments