Getting A better Log Entry Experience, and history setup

This commit is contained in:
Brian McGonagill 2026-02-18 15:58:45 -06:00
parent 98a86ca6a8
commit 5d3396c333
15 changed files with 428 additions and 140 deletions

View file

@ -0,0 +1,34 @@
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
import { Workouts } from '../../../../imports/api/workouts';
import { WorkoutLog } from '../../../../imports/api/workoutLog';
import { LogEntry } from '../../../../imports/api/logEntry';
import { Chart } from 'chart.js';
import { dayjs } from 'dayjs';
Template.workoutData.onCreated(function() {
this.subscribe("myWorkoutRoutines");
this.subscribe("myWorkoutLog");
this.subscribe("myLogEntries");
});
Template.workoutData.onRendered(function() {
});
Template.workoutData.helpers({
workoutLog: function() {
return WorkoutLog.find({});
},
lastWorkout: async() => {
const mostRecentDate = await LogEntry.findOneAsync({}, { sort: { dateAdded: -1 } });
if (mostRecentDate) {
return LogEntry.find({ dateAdded: mostRecentDate.dateAdded });
} else {
return [];
}
},
});
Template.workoutData.events({
});

View file

@ -0,0 +1,45 @@
<template name="workoutData">
<h1>Workouts</h1>
<ul class="collection">
<li class="collection-header">Last Workout</li>
<li class="collection-item">
<table class="striped">
<thead>
<tr>
<th>Exercise</th>
<th>Weight</th>
<th>Sets</th>
</tr>
</thead>
<tbody>
{{#each lastWorkout}}
<tr>
<td>{{exerciseName}}</td>
<td>{{exerciseWeight}}</td>
<td>
<table>
<thead>
<tr>
<th>Sets</th>
<th>Reps</th>
</tr>
</thead>
<tbody>
{{#each sets}}
<tr>
<td>{{setNumber}}</td>
<td>{{repCount}}</td>
</tr>
{{/each}}
</tbody>
</table>
</td>
</tr>
{{/each}}
</tbody>
</table>
</li>
</ul>
</template>