Skip to content

Commit 4bdcb3d

Browse files
Click Project Button Functionality
- Will console display info needed - Will populate topic drop down to match the project div you clicked - Also will populate the project name input to match the project div you clicked - Need to add the subtopic select
1 parent fe8f9ef commit 4bdcb3d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/recentProjects.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ async function populateRecentProjects(){
2121
const projectTopicText_el = document.createElement('h5');
2222
const topicName = findTopicById(element.topicID);
2323
projectTopicText_el.textContent = topicName;
24-
2524

2625
const projectSubtopicText_el = document.createElement('h5');
2726
const subtopicName = findSubtopicById(element.subtopicID);
@@ -30,9 +29,21 @@ async function populateRecentProjects(){
3029
projectItem_el.append(projectName_el, projectTimeText_el, projectTopicText_el, projectSubtopicText_el);
3130

3231
projectListDiv_el.append(projectItem_el);
32+
33+
projectEventListener(projectItem_el, element.topicID, element.subtopicID, element.project);
3334
}
3435
}
3536

37+
function projectEventListener(div, topicID, subtopicID, project){
38+
div.addEventListener('click', () => {
39+
console.log(subtopicSelect_el);
40+
topicSelect_el.value = topicID;
41+
subtopicSelect_el.value = subtopicID;
42+
projectInput_el.value = project;
43+
console.log(topicID, subtopicID, project);
44+
});
45+
}
46+
3647
function findTopicById(id) {
3748
const foundObject = activeTopics.find(obj => obj.id === id);
3849
return foundObject ? foundObject.topic : null;

0 commit comments

Comments
 (0)