Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ <h1>📚 Productivity Tracker</h1>

<!-- Progress -->
<h3 id="progress">Progress: 0% (0/0 tasks completed)</h3>
<div class="progress-container">
<div id="progressBar"></div>
</div>

<!-- Timer -->
<div class="timer">
Expand Down
21 changes: 21 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,25 @@ function updateTime() {

function pad(num) {
return num < 10 ? "0" + num : num;
}

const progressBar = document.getElementById("progressBar");

function updateProgress() {
const totalTasks = tasks.length;
const completedTasks = tasks.filter(task => task.completed).length;

const progressPercent =
totalTasks === 0 ? 0 : (completedTasks / totalTasks) * 100;

progressText.innerText =
`Progress: ${Math.round(progressPercent)}%`;

progressBar.style.width = `${progressPercent}%`;

if (progressPercent === 100) {
progressBar.style.background = "green";
} else {
progressBar.style.background = "#4caf50";
}
}
16 changes: 16 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,20 @@ li {
background: #eee;
padding: 5px;
border-radius: 5px;
}

.progress-container {
width: 100%;
height: 12px;
background: #ddd;
border-radius: 10px;
overflow: hidden;
margin-top: 10px;
}

#progressBar {
height: 100%;
width: 0%;
background: #4caf50;
transition: width 0.3s ease;
}