Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Home-Gewichts-Chart mit Achsen, Monats-Kalender hinter den Streak-/Wochen-Tiles (Tag antippen → Workout-Details bzw. Session planen), Start-Button-Glow folgt der Akzentfarbe

Duarte Santosde2439c8debc
diff --git a/app/app.js b/app/app.js
index eb7368c98..aa5a24090 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 = `
<div class="hdr">
@@ -704,9 +704,9 @@ function viewHome(app) {
</div><div>
<div class="tiles">
- <div class="tile"><div class="l">This week</div><div class="v">${wThisWeek}<span class="muted" style="font-size:1rem">${plannedPerWeek ? ' / ' + plannedPerWeek : ''}</span></div></div>
- <div class="tile"><div class="l">Week streak</div><div class="v">${streakWeeks()} 🔥</div></div>
- <div class="tile"><div class="l">Total workouts</div><div class="v">${S.workouts.length}</div></div>
+ <div class="tile tappable" data-open-cal><div class="l">This week 📅</div><div class="v">${wThisWeek}<span class="muted" style="font-size:1rem">${plannedPerWeek ? ' / ' + plannedPerWeek : ''}</span></div></div>
+ <div class="tile tappable" data-open-cal><div class="l">Week streak 📅</div><div class="v">${streakWeeks()} 🔥</div></div>
+ <div class="tile tappable" data-open-cal><div class="l">Total workouts</div><div class="v">${S.workouts.length}</div></div>
<div class="tile"><div class="l">Last volume</div><div class="v" style="font-size:1.15rem">${lastW ? fmtVol(lastW.vol) : '—'}</div></div>
</div>
@@ -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('<div id="cal-wrap"></div>');
+ 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 += '<div></div>';
+ 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 += `<button class="cal-d${ws ? ' has' : ''}${iso === todayISO() ? ' today' : ''}" data-cal="${iso}">
+ <span>${d}</span><i class="${ws ? 'done' : ovr && eff ? 'ovr' : eff ? 'plan' : ''}"></i></button>`;
+ }
+ 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 = `
+ <div class="row between" style="margin-bottom:2px">
+ <button class="iconbtn" id="cal-prev">‹</button>
+ <h3 style="margin:0">${MONTHS_LONG[mo]} ${y}</h3>
+ <button class="iconbtn" id="cal-next">›</button>
+ </div>
+ <div class="small muted" style="text-align:center">${monthWs.length ? monthWs.length + ' workout' + (monthWs.length > 1 ? 's' : '') + ' · ' + fmtVol(monthVol) : 'No workouts this month'}</div>
+ <div class="cal-grid">${['Mo','Tu','We','Th','Fr','Sa','Su'].map(l => `<div class="cal-h">${l}</div>`).join('')}${cells}</div>
+ <div class="cal-legend">
+ <span><i style="background:var(--acc)"></i>Trained</span>
+ <span><i style="background:var(--blue)"></i>Planned</span>
+ <span><i style="background:var(--orange)"></i>Rescheduled</span>
+ </div>
+ <div class="small dim" style="text-align:center;margin-top:10px">Tap a trained day for details · tap any other day to plan a session</div>`;
+ 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(`<h3>${fmtDate(iso, true)}</h3><div class="list">${ws.map(workoutItem).join('')}</div>`);
+ 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 36b522f1a..cd7f89266 100644
--- a/app/index.html
+++ b/app/index.html
@@ -13,7 +13,7 @@
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icon-180.png">
<link rel="icon" type="image/png" href="icon-180.png">
-<link rel="stylesheet" href="style.css?v=8">
+<link rel="stylesheet" href="style.css?v=9">
</head>
<body>
<div id="app"><div style="padding-top:42vh;text-align:center;font-size:2.2rem">🏋️</div></div>
@@ -45,7 +45,7 @@
<div id="modal-root"></div>
<div id="toast"></div>
-<script src="data.js?v=8"></script>
-<script src="app.js?v=8"></script>
+<script src="data.js?v=9"></script>
+<script src="app.js?v=9"></script>
</body>
</html>
diff --git a/app/style.css b/app/style.css
index 764a1b0a3..959258654 100644
--- a/app/style.css
+++ b/app/style.css
@@ -81,7 +81,8 @@ a{color:var(--acc)}
#tabbar button.on{color:var(--txt)}
#tabbar button.start{margin-top:-26px}
#tabbar button.start .cir{width:58px;height:58px;border-radius:50%;background:var(--acc);
- display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px rgba(163,230,53,.35)}
+ display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px rgba(163,230,53,.35);
+ box-shadow:0 6px 20px color-mix(in srgb, var(--acc) 45%, transparent)}
#tabbar button.start .cir svg{width:26px;height:26px;stroke:#111;stroke-width:2.2}
#tabbar button.start span{color:var(--acc)}
#tabbar button.start.rec .cir{background:var(--orange);box-shadow:0 6px 20px rgba(251,146,60,.4);animation:pulse 1.6s infinite}
@@ -248,6 +249,23 @@ a{color:var(--acc)}
h4.sec{font-size:.8rem;text-transform:uppercase;letter-spacing:.08em;color:var(--mut);margin:20px 0 10px;font-weight:700}
.steps-list{padding-left:20px;color:var(--mut);font-size:.9rem;line-height:1.55;display:flex;flex-direction:column;gap:8px}
+/* month calendar sheet */
+.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin-top:12px}
+.cal-h{text-align:center;font-size:.64rem;color:var(--dim);font-weight:700;text-transform:uppercase;padding:2px 0}
+.cal-d{aspect-ratio:1;border-radius:12px;background:var(--card);border:1px solid var(--line);
+ display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
+ font-weight:600;font-size:.88rem;color:var(--txt)}
+.cal-d:active{background:var(--card2)}
+.cal-d.has{background:var(--accT);border-color:var(--acc)}
+.cal-d.today{border-color:var(--txt);border-width:2px}
+.cal-d i{width:6px;height:6px;border-radius:50%;background:transparent}
+.cal-d i.done{background:var(--acc)}
+.cal-d i.plan{background:var(--blue)}
+.cal-d i.ovr{background:var(--orange)}
+.cal-legend{display:flex;gap:14px;justify-content:center;margin-top:12px;font-size:.7rem;color:var(--dim)}
+.cal-legend i{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:5px}
+.tile.tappable:active{background:var(--card2)}
+
/* accent swatches (settings) */
.swatches{display:flex;gap:10px;flex-wrap:wrap}
.swatch{width:36px;height:36px;border-radius:50%;border:3px solid transparent;flex:none}
diff --git a/app/sw.js b/app/sw.js
index 008f3eb5f..852fecd00 100644
--- a/app/sw.js
+++ b/app/sw.js
@@ -1,6 +1,6 @@
/* GymLog service worker — network-first for app shell, cache-first for media */
-const CACHE = 'gymlog-v8';
-const SHELL = ['./', 'index.html', 'style.css?v=8', 'app.js?v=8', 'data.js?v=8', 'manifest.json'];
+const CACHE = 'gymlog-v9';
+const SHELL = ['./', 'index.html', 'style.css?v=9', 'app.js?v=9', 'data.js?v=9', 'manifest.json'];
self.addEventListener('install', e => {
e.waitUntil(caches.open(CACHE).then(c => c.addAll(SHELL)).then(() => self.skipWaiting()));