adding complete and undo-complete on click

This commit is contained in:
Will Baumbach
2026-04-17 12:09:32 -05:00
parent 349ac48fa2
commit 1eb77cd6b6
5 changed files with 38 additions and 4 deletions

View File

@@ -17,13 +17,13 @@
<div>Week {{planWeek.week}}</div>
</td>
@for (workout of planWeek.workouts; track $index) {
<td class="hoverOverWorkout">
<td class="incompleteWorkout" (click)="onCellClick($event)">
<div>{{workout.type}}</div>
<div>{{workout.totalDistance == 0 ? '' : workout.totalDistance + ' miles'}}</div>
<div>{{workout.description}}</div>
</td>
}
<td>43</td>
<td>{{planWeek.totalMilage}}</td>
</tr>
}
</table>

View File

@@ -33,7 +33,13 @@ td {
supported by Chrome, Edge, Opera and Firefox */
}
.hoverOverWorkout:hover {
background-color: rgb(211, 211, 211);
.incompleteWorkout:hover {
background-color: rgb(235, 235, 235);
}
.completedWorkout {
background-color: rgb(107, 194, 107);
}
.completedWorkout:hover {
background-color: rgb(89, 161, 89);
}

View File

@@ -15,4 +15,13 @@ export class CalendarComponent {
ngOnInit(): void {
}
onCellClick(event: Event) {
const target = event.currentTarget as HTMLElement;
if (target.classList.contains('incompleteWorkout')) {
target.classList.replace('incompleteWorkout', 'completedWorkout')
} else if (target.classList.contains('completedWorkout')) {
target.classList.replace('completedWorkout', 'incompleteWorkout')
}
}
}