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.

Appearance-Settings (Theme hell/dunkel + 8 Akzentfarben, synct mit Profil) und Desktop-Layout (2-Spalten-Dashboard, schwebende Tab-Bar, breite Listen)

Duarte Santos98b814f4f1a0
diff --git a/app/app.js b/app/app.js
index e53966d65..eb7368c98 100644
--- a/app/app.js
+++ b/app/app.js
@@ -13,6 +13,7 @@ const BODYPARTS = [...new Set(EXDB.map(e => e.bp))].sort();
const KEY = 'gym_state_v1';
const DEF = {
unit: 'kg', restSec: 90, sound: true,
+ theme: 'dark', accent: 'lime', // appearance — synced with the profile
bodyweight: [], // {d:'YYYY-MM-DD', w:Number, t:ms}
routines: [], // {id, name, emoji, ex:[{id, sets, reps, weight}]}
week: {}, // weekday(0-6, JS getDay) -> routineId
@@ -485,7 +486,15 @@ function bindCharts(root) {
============================================================ */
let elapsedInt = null;
function nav(hash) { location.hash = hash; }
-function route() { renderView(); updateTabbar(); }
+const ACCENTS = { lime: '#a3e635', sky: '#38bdf8', orange: '#fb923c', violet: '#a78bfa', pink: '#f472b6', red: '#f87171', teal: '#2dd4bf', gold: '#fbbf24' };
+function applyPrefs() {
+ const de = document.documentElement;
+ de.dataset.theme = S.theme === 'light' ? 'light' : 'dark';
+ de.dataset.accent = ACCENTS[S.accent] ? S.accent : 'lime';
+ const meta = document.querySelector('meta[name="theme-color"]');
+ if (meta) meta.content = de.dataset.theme === 'light' ? '#f2f4f7' : '#0c0e12';
+}
+function route() { applyPrefs(); renderView(); updateTabbar(); }
function renderView() {
const h = (location.hash || '#home').slice(1);
// re-rendering the same view (range chips, toggles, …) keeps the scroll position;
@@ -535,7 +544,7 @@ function updateTabbar() {
============================================================ */
function viewLogin(app) {
app.innerHTML = `
- <div style="display:flex;flex-direction:column;justify-content:center;min-height:78vh;text-align:center">
+ <div class="narrow" style="display:flex;flex-direction:column;justify-content:center;min-height:78vh;text-align:center">
<div style="font-size:4rem">🏋️</div>
<h1 style="font-size:2.2rem;font-weight:800;letter-spacing:-.02em;margin:8px 0 4px">GymLog</h1>
<div class="muted" style="margin-bottom:34px">Your workouts. Your weights. Your profile.</div>
@@ -647,6 +656,7 @@ function viewHome(app) {
<div class="small dim" style="margin-top:8px;text-align:center">Tap a day to plan or move a session</div>
</div>
+ <div class="cols"><div>
${S.active ? `
<div class="card" style="border-color:var(--orange)">
<h2 style="color:var(--orange)">Workout in progress</h2>
@@ -691,6 +701,7 @@ function viewHome(app) {
<div class="chart" style="margin-top:8px">${bwSpark}</div>`
: `<div class="muted small">No entries yet — log your weight to start the curve. It's also asked automatically before every workout.</div>`}
</div>
+ </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>
@@ -705,6 +716,7 @@ function viewHome(app) {
<button class="btn sm ghost accent" id="btn-history">See all ›</button>
</div>
<div class="list">${[...S.workouts].reverse().slice(0, 3).map(workoutItem).join('')}</div>` : ''}
+ </div></div>
`;
$('#btn-settings').onclick = () => nav('#settings');
@@ -817,8 +829,10 @@ function viewPlan(app) {
app.innerHTML = `
<div class="hdr"><div><h1>Plan</h1><div class="sub">Your weekly routine</div></div></div>
+ <div class="cols"><div>
<h4 class="sec">Week schedule</h4>
- <div class="list">${dayRows}</div>
+ <div class="list" style="display:flex;flex-direction:column">${dayRows}</div>
+ </div><div>
<div class="row between" style="margin-top:22px;margin-bottom:10px">
<h4 class="sec" style="margin:0">Routines</h4>
@@ -832,6 +846,7 @@ function viewPlan(app) {
<span class="chev">›</span></div>`).join('')}</div>`
: `<div class="empty"><div class="ico">📋</div>No routines yet.<br>Create one or load the starter plan.</div>
<button class="btn" id="btn-starter2">Load starter plan (Push / Pull / Legs)</button>`}
+ </div></div>
`;
app.querySelectorAll('[data-day]').forEach(el => el.addEventListener('click', () => dayAssignSheet(+el.dataset.day)));
@@ -863,6 +878,7 @@ function viewRoutineEdit(app, rid) {
const r = S.routines.find(x => x.id === rid);
if (!r) { nav('#plan'); return; }
app.innerHTML = `
+ <div class="narrow">
<div class="hdr">
<button class="iconbtn" id="btn-back">‹</button>
<div style="flex:1;margin:0 12px"><input class="input" id="r-name" value="${esc(r.name)}" style="font-weight:800;font-size:1.1rem"></div>
@@ -886,6 +902,7 @@ function viewRoutineEdit(app, rid) {
<button class="btn primary" id="btn-add-ex">+ Add exercise</button>
<div style="height:10px"></div>
<button class="btn danger" id="btn-del-r">Delete routine</button>
+ </div>
`;
$('#btn-back').onclick = () => nav('#plan');
@@ -1043,6 +1060,7 @@ function viewWorkout(app) {
const todayR = effectiveRoutine(todayISO());
const todayOvr = S.dayPlan[todayISO()] !== undefined;
app.innerHTML = `
+ <div class="narrow">
<div class="hdr"><div><h1>Start workout</h1><div class="sub">${DAYN[today]} — ${todayR ? 'today is ' + esc(todayR.name) : 'rest day, but no one’s stopping you'}</div></div></div>
${todayR ? `
<div class="card" style="border-color:var(--acc)">
@@ -1063,6 +1081,7 @@ function viewWorkout(app) {
<div style="height:14px"></div>
<button class="btn" id="btn-free">🎯 Freestyle workout (pick as you go)</button>
${!S.routines.length ? `<div style="height:10px"></div><button class="btn primary" id="btn-starter3">Load starter plan first</button>` : ''}
+ </div>
`;
app.querySelectorAll('[data-start]').forEach(el => el.addEventListener('click', () => startFlow(el.dataset.start)));
$('#btn-free').onclick = () => startFlow(null);
@@ -1094,6 +1113,7 @@ function renderActive(app) {
const entry = A.entries[cur];
app.innerHTML = `
+ <div class="narrow">
<div class="hdr">
<button class="iconbtn" id="wo-cancel">✕</button>
<div style="text-align:center"><div style="font-weight:800">${esc(A.name)}</div>
@@ -1112,6 +1132,7 @@ function renderActive(app) {
<button class="btn" id="wo-add">+ Add exercise</button>
<div style="height:10px"></div>
<button class="btn primary" id="wo-finish2">Finish workout 🏁</button>
+ </div>
`;
// elapsed ticker
@@ -1424,6 +1445,7 @@ function viewStats(app) {
${heatmapHTML()}
</div>
+ <div class="cols">
<div class="card">
<div class="row between" style="margin-bottom:8px">
<h2 style="margin:0">Body weight</h2>
@@ -1447,6 +1469,7 @@ function viewStats(app) {
<div class="small dim" style="margin-top:8px">Best set weight per workout · Best ever: <b class="accent">${fmtNum(bestWeightFor(statsEx))} ${S.unit}</b></div>`
: '<div class="muted small">Finish your first workout to see strength curves here. 📈</div>'}
</div>
+ </div>
${S.workouts.length ? `
<div class="row between" style="margin-bottom:10px">
@@ -1557,6 +1580,7 @@ function exerciseDetailSheet(ex) {
============================================================ */
function viewSettings(app) {
app.innerHTML = `
+ <div class="narrow">
<div class="hdr"><button class="iconbtn" id="btn-back">‹</button>
<div style="flex:1;margin-left:12px"><h1>Settings</h1></div></div>
@@ -1574,6 +1598,23 @@ function viewSettings(app) {
<button class="btn" id="acc-in">👤 Sign in with passkey</button>` : '<div class="small dim">Passkeys not supported in this browser.</div>'}`}
</div>
+ <div class="card">
+ <h2>Appearance <span class="dim" style="text-transform:none;letter-spacing:0">· synced with your profile</span></h2>
+ <div class="row between" style="padding:8px 0">
+ <span>Theme</span>
+ <div class="chips">
+ <button class="chip${S.theme !== 'light' ? ' on' : ''}" data-theme-set="dark">🌙 Dark</button>
+ <button class="chip${S.theme === 'light' ? ' on' : ''}" data-theme-set="light">☀️ Light</button>
+ </div>
+ </div>
+ <div style="padding:8px 0">
+ <div style="margin-bottom:10px">Accent color</div>
+ <div class="swatches">${Object.entries(ACCENTS).map(([k, c]) =>
+ `<button class="swatch${(S.accent || 'lime') === k ? ' on' : ''}" data-accent-set="${k}" style="background:${c}" aria-label="${k}"></button>`).join('')}
+ </div>
+ </div>
+ </div>
+
<div class="card">
<h2>Units & timer</h2>
<div class="row between" style="padding:8px 0">
@@ -1611,6 +1652,7 @@ function viewSettings(app) {
<div class="small muted" style="line-height:1.5">📱 In Safari: <b>Share → Add to Home Screen</b> to install GymLog as a full-screen app. All data stays on this device (localStorage) — export a backup now and then!</div>
</div>
<div class="dim small" style="text-align:center;margin-top:8px">GymLog · exercise data: hasaneyldrm/exercises-dataset (CC)</div>
+ </div>
`;
$('#btn-back').onclick = () => nav('#home');
@@ -1623,6 +1665,8 @@ function viewSettings(app) {
toast('Welcome back, ' + u.name + ' 💪');
} catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(e.message || 'Sign-in failed'); }
};
+ app.querySelectorAll('[data-theme-set]').forEach(c => c.addEventListener('click', () => { S.theme = c.dataset.themeSet; save(); route(); }));
+ app.querySelectorAll('[data-accent-set]').forEach(c => c.addEventListener('click', () => { S.accent = c.dataset.accentSet; save(); route(); }));
app.querySelectorAll('[data-unit]').forEach(c => c.addEventListener('click', () => { S.unit = c.dataset.unit; save(); route(); }));
$('#set-rest').addEventListener('change', ev => { S.restSec = +ev.target.value; save(); });
$('#set-sound').onclick = () => { S.sound = !S.sound; save(); route(); };
diff --git a/app/index.html b/app/index.html
index 41800efc8..36b522f1a 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=7">
+<link rel="stylesheet" href="style.css?v=8">
</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=7"></script>
-<script src="app.js?v=7"></script>
+<script src="data.js?v=8"></script>
+<script src="app.js?v=8"></script>
</body>
</html>
diff --git a/app/style.css b/app/style.css
index d5e8449e2..764a1b0a3 100644
--- a/app/style.css
+++ b/app/style.css
@@ -7,6 +7,21 @@
--r:16px; --pad:16px;
--sab:env(safe-area-inset-bottom,0px); --sat:env(safe-area-inset-top,0px);
}
+/* light theme (per-account setting, synced) */
+:root[data-theme="light"]{
+ --bg:#f2f4f7; --bg2:#e7eaef; --card:#ffffff; --card2:#eef0f4;
+ --line:#d9dee6; --txt:#171b22; --mut:#5b6474; --dim:#98a0af;
+}
+/* accent palettes (per-account setting) */
+:root[data-accent="sky"]{--acc:#38bdf8;--acc2:#0ea5e9}
+:root[data-accent="orange"]{--acc:#fb923c;--acc2:#f97316}
+:root[data-accent="violet"]{--acc:#a78bfa;--acc2:#8b5cf6}
+:root[data-accent="pink"]{--acc:#f472b6;--acc2:#ec4899}
+:root[data-accent="red"]{--acc:#f87171;--acc2:#ef4444}
+:root[data-accent="teal"]{--acc:#2dd4bf;--acc2:#14b8a6}
+:root[data-accent="gold"]{--acc:#fbbf24;--acc2:#f59e0b}
+:root{--accT:color-mix(in srgb, var(--acc) 16%, transparent)}
+
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{font-size:16px}
body{
@@ -55,6 +70,9 @@ a{color:var(--acc)}
#tabbar{position:fixed;left:0;right:0;bottom:0;z-index:50;
background:rgba(16,18,24,.88);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
border-top:1px solid var(--line);
+}
+:root[data-theme="light"] #tabbar{background:rgba(255,255,255,.86)}
+#tabbar{
display:flex;justify-content:space-around;align-items:flex-end;
padding:8px 6px calc(8px + var(--sab))}
#tabbar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;
@@ -195,9 +213,9 @@ a{color:var(--acc)}
.hm-grid{display:flex;gap:3px}
.hm-col{display:flex;flex-direction:column;gap:3px}
.hm-c{width:11px;height:11px;border-radius:3px;background:var(--bg2);flex:none}
-.hm-c.l1{background:#33451b}
-.hm-c.l2{background:#527221}
-.hm-c.l3{background:#7aa629}
+.hm-c.l1{background:#33451b;background:color-mix(in srgb, var(--acc) 28%, var(--bg2))}
+.hm-c.l2{background:#527221;background:color-mix(in srgb, var(--acc) 52%, var(--bg2))}
+.hm-c.l3{background:#7aa629;background:color-mix(in srgb, var(--acc) 76%, var(--bg2))}
.hm-c.l4{background:var(--acc)}
.hm-c.today{outline:1.5px solid var(--txt);outline-offset:-1.5px}
.hm-c.future{opacity:.28}
@@ -229,3 +247,30 @@ a{color:var(--acc)}
.capitalize{text-transform:capitalize}
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}
+
+/* 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}
+.swatch.on{border-color:var(--txt)}
+
+/* ---------- desktop (≥1000px): wide dashboard layout ---------- */
+.cols{display:block}
+@media (min-width:1000px){
+ #app{max-width:1080px;padding-top:28px}
+ .cols{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:start}
+ .cols>*{min-width:0}
+ #app .list{display:grid;grid-template-columns:1fr 1fr;gap:10px}
+ #modal-root .list,.narrow .list{display:flex;flex-direction:column}
+ .narrow{max-width:640px;margin:0 auto}
+ .tiles{grid-template-columns:repeat(4,1fr)}
+ .cols .tiles{grid-template-columns:1fr 1fr}
+ #tabbar{left:50%;right:auto;bottom:14px;transform:translateX(-50%);width:560px;
+ border:1px solid var(--line);border-radius:22px;padding:8px 10px 10px}
+ #tabbar button.start{margin-top:-30px}
+ /* margin centering (not transform) — JS drag animates transform:translateY */
+ .sheet{left:50%;right:auto;margin-left:-320px;width:640px;border-radius:22px 22px 0 0}
+ .center{width:360px}
+ #timer{left:50%;right:auto;margin-left:-260px;width:520px;bottom:110px}
+ .exmedia img{height:400px}
+ .hm-wrap{display:flex;flex-direction:column;align-items:center}
+}
diff --git a/app/sw.js b/app/sw.js
index 6f5c1aba4..008f3eb5f 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-v7';
-const SHELL = ['./', 'index.html', 'style.css?v=7', 'app.js?v=7', 'data.js?v=7', 'manifest.json'];
+const CACHE = 'gymlog-v8';
+const SHELL = ['./', 'index.html', 'style.css?v=8', 'app.js?v=8', 'data.js?v=8', 'manifest.json'];
self.addEventListener('install', e => {
e.waitUntil(caches.open(CACHE).then(c => c.addAll(SHELL)).then(() => self.skipWaiting()));