Skip to content

Commit

Permalink
Merge pull request #24 from Aoki-Dai/main
Browse files Browse the repository at this point in the history
feat: wip 円形プログレスバーの仕様を"完了済みToDo数/作成済ToDo数"にする
  • Loading branch information
leviosa42 authored Aug 4, 2024
2 parents 056b3fc + 6672461 commit 4042ec3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const countCompletedTodo = () => {
const progressCircle = document.getElementById("js-progress-circle");
const progressText = document.getElementById("js-progress-text");
const itemsJSON = todoStorage.loadTodoItems();
const totalTasks = 5; // 完了タスクの目標数
const totalTasks = itemsJSON.length; // totalTasksを設定

if (itemsJSON) {
itemsJSON.forEach((item) => {
Expand All @@ -140,7 +140,7 @@ const countCompletedTodo = () => {
}

if (progressCircle && progressText) {
const percentage = Math.min((countCompleted / totalTasks) * 100, 100);
const percentage = totalTasks > 0 ? Math.min((countCompleted / totalTasks) * 100, 100) : 0;
progressCircle.style.background = `conic-gradient(#4caf50 ${percentage}%, #bcd6bd ${percentage}%)`;
//progressText.textContent = `${Math.round(percentage)}%`;
progressText.textContent = `${countCompleted} / ${totalTasks}`;
Expand Down

0 comments on commit 4042ec3

Please # to comment.