diff --git a/app/app.js b/app/app.js
index eb7368c..aa5a240 100644
--- a/app/app.js
+++ b/app/app.js
@@ -638,7 +638,7 @@ function viewHome(app) {
const plannedPerWeek = Object.keys(S.week).filter(k => S.week[k]).length;
const lastW = S.workouts[S.workouts.length-1];
- const bwSpark = lineChart(S.bodyweight.slice(-30).map(b => ({t: b.t || new Date(b.d).getTime(), y: b.w, d: b.d})), {h: 90, axes: false, unit: S.unit});
+ const bwSpark = lineChart(S.bodyweight.slice(-30).map(b => ({t: b.t || new Date(b.d).getTime(), y: b.w, d: b.d})), {h: 130, unit: S.unit});
app.innerHTML = `
-
This week
${wThisWeek}${plannedPerWeek ? ' / ' + plannedPerWeek : ''}
-
Week streak
${streakWeeks()} ๐ฅ
-
Total workouts
${S.workouts.length}
+
This week ๐
${wThisWeek}${plannedPerWeek ? ' / ' + plannedPerWeek : ''}
+
Week streak ๐
${streakWeeks()} ๐ฅ
+
Total workouts
${S.workouts.length}
Last volume
${lastW ? fmtVol(lastW.vol) : 'โ'}
@@ -724,6 +724,7 @@ function viewHome(app) {
$('#wk-prev').onclick = () => { weekOffset--; route(); };
$('#wk-next').onclick = () => { weekOffset++; route(); };
app.querySelectorAll('[data-date]').forEach(el => el.addEventListener('click', () => dayOverrideSheet(el.dataset.date)));
+ app.querySelectorAll('[data-open-cal]').forEach(el => el.addEventListener('click', () => calendarSheet()));
const bs = $('#btn-start-today'); if (bs) bs.onclick = () => startFlow(routine.id);
const ba = $('#btn-start-any'); if (ba) ba.onclick = () => nav('#workout');
const br = $('#btn-resume'); if (br) br.onclick = () => nav('#workout');
@@ -752,6 +753,63 @@ function bindWorkoutItems(root) {
}));
}
+/* ---------- full month calendar (from streak/week tiles) ---------- */
+const MONTHS_LONG = ['January','February','March','April','May','June','July','August','September','October','November','December'];
+function calendarSheet(startDate) {
+ const cur = startDate ? new Date(startDate) : new Date();
+ cur.setDate(1);
+ const m = openModal('
');
+ const wrap = m.el.querySelector('#cal-wrap');
+ const draw = () => {
+ const y = cur.getFullYear(), mo = cur.getMonth();
+ const byDay = {};
+ S.workouts.forEach(w => (byDay[w.d] = byDay[w.d] || []).push(w));
+ const startOffset = (new Date(y, mo, 1).getDay() + 6) % 7; // Mon-start
+ const daysIn = new Date(y, mo + 1, 0).getDate();
+ let cells = '';
+ for (let i = 0; i < startOffset; i++) cells += '
';
+ for (let d = 1; d <= daysIn; d++) {
+ const iso = y + '-' + String(mo + 1).padStart(2, '0') + '-' + String(d).padStart(2, '0');
+ const ws = byDay[iso];
+ const eff = effectiveRoutineId(iso);
+ const ovr = S.dayPlan[iso] !== undefined;
+ cells += `
`;
+ }
+ const monthWs = S.workouts.filter(w => w.d.startsWith(y + '-' + String(mo + 1).padStart(2, '0')));
+ const monthVol = monthWs.reduce((a, w) => a + (w.vol || 0), 0);
+ wrap.innerHTML = `
+
+
+
${MONTHS_LONG[mo]} ${y}
+
+
+
${monthWs.length ? monthWs.length + ' workout' + (monthWs.length > 1 ? 's' : '') + ' ยท ' + fmtVol(monthVol) : 'No workouts this month'}
+
${['Mo','Tu','We','Th','Fr','Sa','Su'].map(l => `
${l}
`).join('')}${cells}
+
+ Trained
+ Planned
+ Rescheduled
+
+
Tap a trained day for details ยท tap any other day to plan a session
`;
+ wrap.querySelector('#cal-prev').onclick = () => { cur.setMonth(cur.getMonth() - 1); draw(); };
+ wrap.querySelector('#cal-next').onclick = () => { cur.setMonth(cur.getMonth() + 1); draw(); };
+ wrap.querySelectorAll('[data-cal]').forEach(b => b.addEventListener('click', () => {
+ const iso = b.dataset.cal;
+ const ws = byDay[iso];
+ if (!ws) { m.close(); dayOverrideSheet(iso); return; }
+ if (ws.length === 1) { m.close(); workoutDetailSheet(ws[0]); return; }
+ m.close();
+ const lm = openModal(`
${fmtDate(iso, true)}
${ws.map(workoutItem).join('')}
`);
+ lm.el.querySelectorAll('[data-wid]').forEach(el => el.addEventListener('click', () => {
+ const w = S.workouts.find(x => x.id === el.dataset.wid);
+ if (w) { lm.close(); workoutDetailSheet(w); }
+ }));
+ }));
+ };
+ draw();
+}
+
/* ---------- per-date session override ---------- */
function dayOverrideSheet(iso) {
const wd = new Date(iso + 'T12:00:00').getDay();
diff --git a/app/index.html b/app/index.html
index 36b522f..cd7f892 100644
--- a/app/index.html
+++ b/app/index.html
@@ -13,7 +13,7 @@
-
+
@@ -45,7 +45,7 @@
-
-
+
+