瀏覽代碼

Exercise list now shows which have been completed and the current exercise.

Lee Morgan 1 年之前
父節點
當前提交
d6db06c2d7
共有 2 個文件被更改,包括 12 次插入4 次删除
  1. 2 3
      views/css/session.css
  2. 10 1
      views/js/pages/session.js

+ 2 - 3
views/css/session.css

@@ -51,10 +51,9 @@
     background-clip: text;
     color: transparent;
     border: none;
-    font-size: 22px;
-    margin: 15px 0;
+    font-size: 25px;
+    margin: 10px 0;
     cursor: pointer;
-    text-decoration: underline;
 }
 
 #sessionNotesBtn{

+ 10 - 1
views/js/pages/session.js

@@ -43,7 +43,9 @@ export default {
 
         if(!this.rendered){
             nextSessionBtn.addEventListener("click", ()=>{
+                console.log(this.currentSession.exercises[this.exerciseIndex].done);
                 this.currentSession.exercises[this.exerciseIndex].done = true;
+                console.log(this.currentSession.exercises[this.exerciseIndex].done);
                 this.changeExercise(this.exerciseIndex + 1);
             });
             document.getElementById("finishSessionBtn").addEventListener("click", ()=>{this.finish()});
@@ -70,11 +72,18 @@ export default {
         for(let i = 0; i < this.workout.exercises.length; i++){
             const button = document.createElement("button");
             button.classList.add("exerciseListButton");
-            button.textContent = `${i+1}: ${this.workout.exercises[i].name}`;
+            if(this.exerciseIndex === i){
+                button.textContent = `*${this.workout.exercises[i].name}`;
+            }else{
+                button.textContent = this.workout.exercises[i].name;
+            }
             button.addEventListener("click", ()=>{
                 this.changeExercise(i);
                 list.style.display = "none";
             });
+            if(this.currentSession.exercises[i]?.done){
+                button.style.color = "white";
+            }
             list.appendChild(button);
         }
     },