Welcome to the Post Jam Activity! Now that you've built the basic Pomodoro Timer during the workshop, it's time to take it to the next level.
This folder contains the same Pomodoro Timer project, but with a new Task Management section that YOU will bring to life!
- Your Mission
- Getting Started
- Challenge 1: Task Management
- Bonus Challenges
- Helpful Resources
- Need Help?
You have two main goals:
- Required: Implement the Task Management functions (
addTask,deleteTask,updateTaskCount) - Bonus: Choose any additional feature from the challenge list and implement it!
Open pomodoro.html in your browser and js/main.js in your code editor.
In main.js, scroll down to Section 4: TASK FUNCTIONS. You'll see three empty functions waiting for your code:
function addTask() {
// YOUR CODE HERE
}
function deleteTask(taskElement) {
// YOUR CODE HERE
}
function updateTaskCount() {
// YOUR CODE HERE
}At the bottom of the file in Section 5, uncomment the task-related event listeners:
// Uncomment these when you're ready to test your functions!
addTaskBtn.addEventListener("click", addTask);
taskInput.addEventListener("keypress", (e) => {
if (e.key === "Enter") {
addTask();
}
});Now implement those functions and watch your tasks come to life!
The HTML already has a task section with:
- An input field (
#new-task-title) for typing task names - An "Add" button (
#add-task-btn) to add tasks - A task list (
#task-list) to display all tasks - A task counter (
#task-count-num) showing the number of tasks
This function should:
- Get the text from the input field
- Create a new task item and add it to the list
- Clear the input field after adding
- Handle empty input (don't add empty tasks!)
Example HTML structure for a task item:
<li class="task-item">
<div class="task-content">
<span class="task-title">Your task text here</span>
</div>
<button class="btn-delete" onclick="deleteTask(this.parentElement)">
<span class="material-symbols-rounded">delete</span>
</button>
</li>This function should:
- Remove the task element from the DOM
- Update the task counter
- Show "No active tasks" if the list is empty
This function should:
- Count the number of tasks in the list
- Update the
#task-count-numelement with the count
Here are some JavaScript methods that might help:
// Getting input value
const value = taskInput.value;
// Creating elements
const li = document.createElement("li");
li.className = "task-item";
li.innerHTML = `<your HTML here>`;
// Adding to a list
taskList.appendChild(li);
// Removing an element
element.remove();
// Counting elements
const count = taskList.querySelectorAll(".task-item").length;
// Clearing input
taskInput.value = "";Once you've completed the task management feature, pick any of these challenges to make your Pomodoro Timer even more awesome!
Make the background color change based on the timer mode!
Ideas:
- Blue background for Focus mode
- Green for Short Break
- Yellow/Orange for Long Break
- Or let users pick their own color!
Hint: Use document.body.style.backgroundColor = "your-color"
Play relaxing music or ambient sounds while the timer is running!
Ideas:
- Lo-fi beats for focus sessions
- Nature sounds for breaks
- Different music for different modes
Hint: Use the HTML5 <audio> element:
const audio = new Audio("your-music-file.mp3");
audio.play();
audio.pause();Play a sound or alarm when the timer finishes!
Ideas:
- Bell sound when focus ends
- Soft chime for break ends
- Let users choose their notification sound
Make tasks persist even after closing the browser!
Hint:
// Save
localStorage.setItem("tasks", JSON.stringify(tasksArray));
// Load
const tasks = JSON.parse(localStorage.getItem("tasks"));Add keyboard controls for faster interaction!
Ideas:
Spaceto start/pause timerRto reset timer1,2,3to switch modesEnterto add task (already provided!)
Hint:
document.addEventListener("keydown", (e) => {
if (e.code === "Space") {
startTimer();
}
});Track how many focus sessions you've completed!
Ideas:
- Count completed pomodoros
- Show total focus time today
- Weekly/monthly statistics
Hint: The #iteration-count element is already there, just update it!
Add a toggle switch to change between dark and light themes!
Ideas:
- Add a moon/sun icon button
- Switch CSS variables for colors
- Save preference to localStorage
Allow users to click on a task to edit its name!
Ideas:
- Double-click to enter edit mode
- Replace text with an input field
- Save on Enter or blur
Add checkboxes to mark tasks as done!
Ideas:
- Strike-through completed tasks
- Move completed tasks to the bottom
- Add a "Clear completed" button
Add priority levels to tasks!
Ideas:
- High, Medium, Low priority
- Color-coded indicators
- Sort by priority
Here are some resources to help you with your implementation:
If you get stuck:
- Check the browser console (
F12→ Console tab) for error messages - Use
console.log()to debug your code - Ask a mentor or workshop facilitator
- Search online - StackOverflow and MDN are your friends!
When you're done, share your enhanced Pomodoro Timer with us! We'd love to see what creative features you came up with.
Happy Coding! 🚀
Made with ❤️ by GDG PUP Web Dev Team