Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0968e2a86d | |||
| e6cc7eda0a | |||
| ec476f5ce6 | |||
| b72f5f8e36 | |||
| d7b9d0fa2d | |||
| 569b94f799 | |||
| 5d2ed76e29 | |||
| 7343a950f8 | |||
| 97176ed90e | |||
| e77aa6df17 | |||
| baa0f57536 | |||
| 4da4fd9365 | |||
| 35fabb1610 | |||
| 50eba83266 | |||
| 9fe1b41c2c | |||
| 7c42744d10 | |||
| 9979859b76 |
@@ -3,3 +3,5 @@ __pycache__/
|
||||
|
||||
*.db
|
||||
.venv/
|
||||
data/
|
||||
node_modules/
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.db
|
||||
*.sqlite*
|
||||
.env
|
||||
.env.*
|
||||
venv/
|
||||
.venv/
|
||||
data/
|
||||
.dockerignore
|
||||
@@ -24,6 +24,20 @@ os.makedirs(os.path.dirname(os.getenv("GYM_DB_PATH", "./gym.db")), exist_ok=True
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
# Лёгкая миграция: create_all не трогает уже существующие таблицы, а колонки,
|
||||
# добавленные после релиза, заводить надо (SQLite, без alembic)
|
||||
def _ensure_columns():
|
||||
from sqlalchemy import inspect, text
|
||||
insp = inspect(engine)
|
||||
if "workouts" not in insp.get_table_names():
|
||||
return
|
||||
cols = {c["name"] for c in insp.get_columns("workouts")}
|
||||
if "set_groups" not in cols:
|
||||
with engine.begin() as conn:
|
||||
conn.execute(text("ALTER TABLE workouts ADD COLUMN set_groups TEXT DEFAULT '[]'"))
|
||||
|
||||
_ensure_columns()
|
||||
|
||||
app = FastAPI(
|
||||
title="Gym Bro API",
|
||||
description="API для трекера тренировок с офлайн-синхронизацией и авторизацией",
|
||||
|
||||
@@ -95,6 +95,9 @@ class Workout(Base):
|
||||
start_time = Column(String, nullable=False)
|
||||
end_time = Column(String)
|
||||
notes = Column(String, default="")
|
||||
# Состав сетов (JSON: [{"sync_id","name","exercise_sync_ids":[...]}]) —
|
||||
# плоским полем, т.к. структура целиком принадлежит клиенту
|
||||
set_groups = Column(String, default="[]")
|
||||
synced = Column(Integer, default=0)
|
||||
|
||||
created_at = Column(String)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# backend/routers/bootstrap.py
|
||||
|
||||
import json
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from sqlalchemy.orm import Session, joinedload
|
||||
from sqlalchemy import or_
|
||||
@@ -65,6 +67,12 @@ def get_bootstrap_data(
|
||||
def serialize_workout(w):
|
||||
wt_name = w.workout_type.name if w.workout_type else ""
|
||||
client_name = w.client.full_name if w.client else None
|
||||
try:
|
||||
set_groups = json.loads(w.set_groups or "[]")
|
||||
if not isinstance(set_groups, list):
|
||||
set_groups = []
|
||||
except Exception:
|
||||
set_groups = []
|
||||
|
||||
return {
|
||||
"id": w.id,
|
||||
@@ -75,6 +83,7 @@ def get_bootstrap_data(
|
||||
"start_time": w.start_time,
|
||||
"end_time": w.end_time,
|
||||
"notes": w.notes,
|
||||
"set_groups": set_groups,
|
||||
"synced": w.synced,
|
||||
"created_at": w.created_at,
|
||||
"updated_at": w.updated_at,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Dict, Optional, Tuple
|
||||
@@ -322,6 +323,47 @@ def sync_data(
|
||||
client_map: Dict[str, int] = {}
|
||||
exercise_map: Dict[str, int] = {}
|
||||
|
||||
deleted = {"workouts": 0}
|
||||
|
||||
# ========================================================
|
||||
# 0. Удаления (надгробия с клиента): снимаем тренировки по sync_id
|
||||
# вместе с упражнениями, сетами, дроп-сетами и кардио.
|
||||
# ========================================================
|
||||
for sid in payload.deleted_sync_ids or []:
|
||||
target = (
|
||||
db.query(models.Workout)
|
||||
.filter(
|
||||
models.Workout.sync_id == sid,
|
||||
models.Workout.owner_id == current_user.id,
|
||||
)
|
||||
.first()
|
||||
)
|
||||
if not target:
|
||||
continue
|
||||
we_ids = [e.id for e in target.workout_exercises]
|
||||
if we_ids:
|
||||
set_ids = [
|
||||
s.id
|
||||
for s in db.query(models.Set)
|
||||
.filter(models.Set.workout_exercise_id.in_(we_ids))
|
||||
.all()
|
||||
]
|
||||
if set_ids:
|
||||
db.query(models.DropsetItem).filter(
|
||||
models.DropsetItem.set_id.in_(set_ids)
|
||||
).delete(synchronize_session=False)
|
||||
db.query(models.Set).filter(
|
||||
models.Set.workout_exercise_id.in_(we_ids)
|
||||
).delete(synchronize_session=False)
|
||||
db.query(models.WorkoutExercise).filter(
|
||||
models.WorkoutExercise.id.in_(we_ids)
|
||||
).delete(synchronize_session=False)
|
||||
db.query(models.Cardio).filter(
|
||||
models.Cardio.workout_id == target.id
|
||||
).delete(synchronize_session=False)
|
||||
db.delete(target)
|
||||
deleted["workouts"] += 1
|
||||
|
||||
# ========================================================
|
||||
# 1. Clients
|
||||
# ========================================================
|
||||
@@ -361,6 +403,10 @@ def sync_data(
|
||||
existing.end_time = workout_data.end_time if workout_data.end_time is not None else existing.end_time
|
||||
existing.notes = workout_data.notes if workout_data.notes is not None else existing.notes
|
||||
existing.workout_type_id = resolve_workout_type_id(db, workout_data.workout_type_id)
|
||||
if workout_data.set_groups is not None:
|
||||
existing.set_groups = json.dumps(
|
||||
[g.model_dump() for g in workout_data.set_groups], ensure_ascii=False
|
||||
)
|
||||
existing.synced = 1
|
||||
existing.updated_at = timestamp
|
||||
|
||||
@@ -398,6 +444,9 @@ def sync_data(
|
||||
start_time=workout_data.start_time,
|
||||
end_time=workout_data.end_time,
|
||||
notes=workout_data.notes or "",
|
||||
set_groups=json.dumps(
|
||||
[g.model_dump() for g in workout_data.set_groups or []], ensure_ascii=False
|
||||
),
|
||||
synced=1,
|
||||
created_at=timestamp,
|
||||
updated_at=timestamp,
|
||||
@@ -557,5 +606,6 @@ def sync_data(
|
||||
status="success",
|
||||
created=created,
|
||||
updated=updated,
|
||||
deleted=deleted,
|
||||
warnings=warnings,
|
||||
)
|
||||
|
||||
@@ -252,10 +252,17 @@ class WorkoutBase(BaseModel):
|
||||
workout_type_id: Optional[int] = None
|
||||
|
||||
|
||||
class SetGroupData(BaseModel):
|
||||
sync_id: Optional[str] = None
|
||||
name: str = "Сет"
|
||||
exercise_sync_ids: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class WorkoutCreate(WorkoutBase):
|
||||
sync_id: Optional[str] = None
|
||||
client_id: Optional[int] = None
|
||||
client_sync_id: Optional[str] = None
|
||||
set_groups: Optional[List[SetGroupData]] = None
|
||||
workout_exercises: List[WorkoutExerciseCreate] = Field(default_factory=list)
|
||||
cardio_sessions: List[CardioCreate] = Field(default_factory=list)
|
||||
|
||||
@@ -337,10 +344,13 @@ class SyncPayload(BaseModel):
|
||||
exercises: List[ExerciseCreate] = Field(default_factory=list)
|
||||
workouts: List[WorkoutCreate] = Field(default_factory=list)
|
||||
body_metrics: List[BodyMetricCreate] = Field(default_factory=list)
|
||||
# Удалённые на клиенте тренировки (sync_id) — иначе bootstrap возвращает их обратно
|
||||
deleted_sync_ids: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SyncResponse(BaseModel):
|
||||
status: str
|
||||
created: Dict[str, int]
|
||||
updated: Dict[str, int]
|
||||
deleted: Dict[str, int] = Field(default_factory=dict)
|
||||
warnings: List[str] = Field(default_factory=list)
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ services:
|
||||
build: ./frontend
|
||||
container_name: gym-bro-frontend
|
||||
ports:
|
||||
- "80:80"
|
||||
# 80 занят другим nginx на сервере — поднимите на другом порту: APP_PORT=8080 docker compose up -d
|
||||
- "${APP_PORT:-80}:80"
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
demo.html
|
||||
.env
|
||||
.env.*
|
||||
.dockerignore
|
||||
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>График прогрессии (просмотр)</title>
|
||||
<link rel="stylesheet" href="styles/main.css">
|
||||
<link rel="stylesheet" href="styles/components.css">
|
||||
<link rel="stylesheet" href="styles/workout.css">
|
||||
<link rel="stylesheet" href="styles/modal.css">
|
||||
<style>
|
||||
.chart-page { max-width: 760px; margin: 0 auto; padding: 16px; }
|
||||
.chart-page h2 { margin: 14px 0 2px; }
|
||||
.chart-page .hint { font-size: 0.75rem; color: var(--text-secondary, #888); margin: 4px 0 8px; }
|
||||
.chart-page canvas { width: 100%; background: #1e1e1e; border-radius: 10px; }
|
||||
.chart-open { margin: 8px 0 4px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="chart-page">
|
||||
<h2>📈 Жим штанги лёжа — рабочий максимум важнее числа подходов</h2>
|
||||
<p class="hint">Вершина линии — главный вес дня «вес × повторы». 12.11: <b>100×1</b> (шесть подходов), 19.11: <b>100×2</b> (пять подходов, разминочных меньше) — вершина зелёная: вес тот же, повторов больше, это прогресс, хотя подходов меньше. Тусклые точки — разминочные и остальные подходы.</p>
|
||||
<canvas id="chart-barbell" width="680" height="320"></canvas>
|
||||
<button class="btn btn-small btn-secondary chart-open" onclick="window.CM.showChartDialog('Жим штанги лёжа')">Открыть карточку графика (как в приложении) 📈</button>
|
||||
<button class="btn btn-small btn-secondary chart-open" onclick="window.EM.showSummaryDialog('Жим штанги лёжа')">Сводка по упражнению 📋</button>
|
||||
|
||||
<h2>📈 Жим гантелей на лавке (30/45 — одна группа вариантов)</h2>
|
||||
<p class="hint">Прогрессия 20→28 кг; 17.11 после паузы — красный откат, это тоже видно.</p>
|
||||
<canvas id="chart-dumbbell" width="680" height="320"></canvas>
|
||||
<button class="btn btn-small btn-secondary chart-open" onclick="window.CM.showChartDialog('Жим гантелей на лавке 30')">Карточка графика 📈</button>
|
||||
<button class="btn btn-small btn-secondary chart-open" onclick="window.EM.showSummaryDialog('Жим гантелей на лавке 30')">Сводка по упражнению 📋</button>
|
||||
</div>
|
||||
<div id="modal-container"></div>
|
||||
<script src="demo-seed.js"></script>
|
||||
<script>
|
||||
// Превью всегда работает в гостевом режиме на свежем датасете:
|
||||
// если в этом браузере есть сохранённый вход, данные читались бы из пустого
|
||||
// пользовательского ключа и график показал бы «нет завершённых тренировок».
|
||||
localStorage.removeItem('gym_auth_token');
|
||||
localStorage.removeItem('gym_auth_user');
|
||||
localStorage.setItem('gym_tracker_v7_guest', JSON.stringify(window.GYM_DEMO_SEED));
|
||||
</script>
|
||||
<script type="module">
|
||||
import { loadState } from './js/state.js';
|
||||
import { drawExerciseProgress } from './js/render/dashboard.js';
|
||||
import './js/modals/chart-modal.js';
|
||||
import './js/modals/exercise-summary.js';
|
||||
|
||||
loadState(); // state наполняется из localStorage только этим вызовом (как в app.js)
|
||||
drawExerciseProgress(document.getElementById('chart-barbell'), 'Жим штанги лёжа');
|
||||
drawExerciseProgress(document.getElementById('chart-dumbbell'), 'Жим гантелей на лавке 30');
|
||||
// ?modal=1 — сразу открыть полноэкранный график (для проверки модалки без клика)
|
||||
if (location.search.includes('modal=1')) window.CM.showChartDialog('Жим штанги лёжа');
|
||||
if (location.search.includes('summary=1')) window.EM.showSummaryDialog('Жим штанги лёжа');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,975 @@
|
||||
// автосгенерировано (gym_seed + пиратка жима) — демо-датасет (не коммитить)
|
||||
window.GYM_DEMO_SEED = {
|
||||
"workouts": [
|
||||
{
|
||||
"id": "w1",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-16T18:30:00+03:00",
|
||||
"endTime": "2026-10-16T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e2",
|
||||
"name": "Жим гантелей на лавке 30",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s3",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-16T18:40:00+03:00",
|
||||
"weight": 20,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s4",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-16T18:50:00+03:00",
|
||||
"weight": 20,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s5",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-16T19:00:00+03:00",
|
||||
"weight": 20,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e6",
|
||||
"name": "Разводка",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s7",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-16T19:10:00+03:00",
|
||||
"weight": 8,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s8",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-16T19:18:00+03:00",
|
||||
"weight": 8,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w9",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-20T18:30:00+03:00",
|
||||
"endTime": "2026-10-20T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e10",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s11",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T18:40:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s12",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T18:52:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s13",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T19:04:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 8,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e14",
|
||||
"name": "Молотки",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s15",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T19:14:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s16",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T19:20:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s17",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-20T19:26:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w900",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-22T18:30:00+03:00",
|
||||
"endTime": "2026-10-22T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e901",
|
||||
"name": "Жим штанги лёжа",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s902",
|
||||
"weight": 20,
|
||||
"reps": 20,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-22T18:30:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s903",
|
||||
"weight": 50,
|
||||
"reps": 15,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-22T18:37:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s904",
|
||||
"weight": 70,
|
||||
"reps": 12,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-22T18:44:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s905",
|
||||
"weight": 80,
|
||||
"reps": 4,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-22T18:51:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s906",
|
||||
"weight": 90,
|
||||
"reps": 1,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-22T18:58:00+03:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w18",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-24T18:30:00+03:00",
|
||||
"endTime": "2026-10-24T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e19",
|
||||
"name": "Жим гантелей на лавке 30",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s20",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-24T18:40:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s21",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-24T18:52:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s22",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-24T19:04:00+03:00",
|
||||
"weight": 22,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w23",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-29T18:30:00+03:00",
|
||||
"endTime": "2026-10-29T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e24",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s25",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-29T18:40:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s26",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-29T18:52:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s27",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-29T19:04:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 8,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s28",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-10-29T19:16:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 6,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w907",
|
||||
"client_id": null,
|
||||
"startTime": "2026-10-29T18:30:00+03:00",
|
||||
"endTime": "2026-10-29T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e908",
|
||||
"name": "Жим штанги лёжа",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s909",
|
||||
"weight": 20,
|
||||
"reps": 20,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:30:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s910",
|
||||
"weight": 50,
|
||||
"reps": 15,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:37:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s911",
|
||||
"weight": 70,
|
||||
"reps": 12,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:44:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s912",
|
||||
"weight": 80,
|
||||
"reps": 4,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:51:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s913",
|
||||
"weight": 90,
|
||||
"reps": 2,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:58:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s914",
|
||||
"weight": 100,
|
||||
"reps": 1,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-10-29T18:65:00+03:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "новый максимум",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w29",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-03T18:30:00+03:00",
|
||||
"endTime": "2026-11-03T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e30",
|
||||
"name": "Жим гантелей на лавке 30",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s31",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-03T18:40:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s32",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-03T18:52:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e33",
|
||||
"name": "Разводка",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s34",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-03T19:02:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s35",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-03T19:10:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s36",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-03T19:18:00+03:00",
|
||||
"weight": 10,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w915",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-05T18:30:00+03:00",
|
||||
"endTime": "2026-11-05T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e916",
|
||||
"name": "Жим штанги лёжа",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s917",
|
||||
"weight": 20,
|
||||
"reps": 20,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:30:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s918",
|
||||
"weight": 50,
|
||||
"reps": 15,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:37:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s919",
|
||||
"weight": 70,
|
||||
"reps": 12,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:44:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s920",
|
||||
"weight": 80,
|
||||
"reps": 4,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:51:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s921",
|
||||
"weight": 90,
|
||||
"reps": 2,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:58:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s922",
|
||||
"weight": 100,
|
||||
"reps": 1,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-05T18:65:00+03:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w37",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-08T18:30:00+03:00",
|
||||
"endTime": "2026-11-08T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e38",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s39",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-08T18:40:00+03:00",
|
||||
"weight": 26,
|
||||
"reps": 8,
|
||||
"isDropset": true,
|
||||
"subSets": [
|
||||
{
|
||||
"weight": 26,
|
||||
"reps": 8
|
||||
},
|
||||
{
|
||||
"weight": 20,
|
||||
"reps": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "s40",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-08T19:00:00+03:00",
|
||||
"weight": 26,
|
||||
"reps": 8,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w923",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-12T18:30:00+03:00",
|
||||
"endTime": "2026-11-12T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e924",
|
||||
"name": "Жим штанги лёжа",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s925",
|
||||
"weight": 20,
|
||||
"reps": 20,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:30:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s926",
|
||||
"weight": 50,
|
||||
"reps": 15,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:37:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s927",
|
||||
"weight": 70,
|
||||
"reps": 12,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:44:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s928",
|
||||
"weight": 80,
|
||||
"reps": 4,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:51:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s929",
|
||||
"weight": 90,
|
||||
"reps": 2,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:58:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s930",
|
||||
"weight": 100,
|
||||
"reps": 1,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-12T18:65:00+03:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w41",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-13T18:30:00+03:00",
|
||||
"endTime": "2026-11-13T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e43",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s44",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-13T18:40:00+03:00",
|
||||
"weight": 28,
|
||||
"reps": 8,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s45",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-13T18:52:00+03:00",
|
||||
"weight": 28,
|
||||
"reps": 6,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s46",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-13T19:04:00+03:00",
|
||||
"weight": 26,
|
||||
"reps": 8,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [
|
||||
{
|
||||
"id": "c42",
|
||||
"type": "бег",
|
||||
"purpose": "warmup",
|
||||
"duration": 10
|
||||
}
|
||||
],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w47",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-17T18:30:00+03:00",
|
||||
"endTime": "2026-11-17T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e48",
|
||||
"name": "Жим гантелей на лавке 30",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s49",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-17T18:40:00+03:00",
|
||||
"weight": 26,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s50",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-17T18:52:00+03:00",
|
||||
"weight": 26,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s51",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-17T19:04:00+03:00",
|
||||
"weight": 24,
|
||||
"reps": 12,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "после паузы",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w52",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-19T18:30:00+03:00",
|
||||
"endTime": "2026-11-19T19:30:00+03:00",
|
||||
"type": "спина-плечи",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e53",
|
||||
"name": "Косичка",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s54",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-19T18:40:00+03:00",
|
||||
"weight": 32,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s55",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-19T18:50:00+03:00",
|
||||
"weight": 32,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e56",
|
||||
"name": "Разгибание на блоке",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s57",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-19T18:42:00+03:00",
|
||||
"weight": 27,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
},
|
||||
{
|
||||
"id": "s58",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-19T18:52:00+03:00",
|
||||
"weight": 27,
|
||||
"reps": 15,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [
|
||||
{
|
||||
"id": "g59",
|
||||
"name": "суперсет на спину",
|
||||
"exerciseIds": [
|
||||
"e53",
|
||||
"e56"
|
||||
]
|
||||
}
|
||||
],
|
||||
"notes": "",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w931",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-19T18:30:00+03:00",
|
||||
"endTime": "2026-11-19T19:30:00+03:00",
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e932",
|
||||
"name": "Жим штанги лёжа",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s933",
|
||||
"weight": 20,
|
||||
"reps": 20,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-19T18:30:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s934",
|
||||
"weight": 50,
|
||||
"reps": 15,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-19T18:37:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s935",
|
||||
"weight": 70,
|
||||
"reps": 12,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-19T18:44:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s936",
|
||||
"weight": 90,
|
||||
"reps": 3,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-19T18:51:00+03:00"
|
||||
},
|
||||
{
|
||||
"id": "s937",
|
||||
"weight": 100,
|
||||
"reps": 2,
|
||||
"rating": 5,
|
||||
"isDropset": false,
|
||||
"timestamp": "2026-11-19T18:58:00+03:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "меньше подходов — больше вес",
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"id": "w60",
|
||||
"client_id": null,
|
||||
"startTime": "2026-11-20T18:30:00+03:00",
|
||||
"endTime": null,
|
||||
"type": "грудь-руки",
|
||||
"exercises": [
|
||||
{
|
||||
"id": "e61",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"sets": [
|
||||
{
|
||||
"id": "s62",
|
||||
"rating": 5,
|
||||
"timestamp": "2026-11-20T09:10:00+03:00",
|
||||
"weight": 28,
|
||||
"reps": 10,
|
||||
"isDropset": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"cardio": [],
|
||||
"setGroups": [],
|
||||
"notes": "",
|
||||
"synced": false
|
||||
}
|
||||
],
|
||||
"exerciseRef": [
|
||||
{
|
||||
"id": "r63",
|
||||
"name": "Косичка",
|
||||
"workoutType": "спина-плечи",
|
||||
"group": ""
|
||||
},
|
||||
{
|
||||
"id": "r64",
|
||||
"name": "Разгибание на блоке",
|
||||
"workoutType": "спина-плечи",
|
||||
"group": ""
|
||||
},
|
||||
{
|
||||
"id": "r65",
|
||||
"name": "Жим гантелей на лавке 30",
|
||||
"workoutType": "грудь-руки",
|
||||
"group": "жим гантелей на лавке"
|
||||
},
|
||||
{
|
||||
"id": "r66",
|
||||
"name": "Жим гантелей на лавке 45",
|
||||
"workoutType": "грудь-руки",
|
||||
"group": "жим гантелей на лавке"
|
||||
},
|
||||
{
|
||||
"id": "r67",
|
||||
"name": "Молотки",
|
||||
"workoutType": "грудь-руки",
|
||||
"group": ""
|
||||
},
|
||||
{
|
||||
"id": "r68",
|
||||
"name": "Разводка",
|
||||
"workoutType": "грудь-руки",
|
||||
"group": ""
|
||||
},
|
||||
{
|
||||
"id": "r938",
|
||||
"name": "Жим штанги лёжа",
|
||||
"workoutType": "грудь-руки",
|
||||
"group": "жим лёжа"
|
||||
}
|
||||
],
|
||||
"bodyMetrics": [
|
||||
{
|
||||
"id": "b69",
|
||||
"client_id": null,
|
||||
"date": "2026-10-16",
|
||||
"values": [
|
||||
{
|
||||
"metric_type_id": 1,
|
||||
"value": 78.5
|
||||
},
|
||||
{
|
||||
"metric_type_id": 2,
|
||||
"value": 100
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "b70",
|
||||
"client_id": null,
|
||||
"date": "2026-11-01",
|
||||
"values": [
|
||||
{
|
||||
"metric_type_id": 1,
|
||||
"value": 77.8
|
||||
},
|
||||
{
|
||||
"metric_type_id": 2,
|
||||
"value": 101
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "b71",
|
||||
"client_id": null,
|
||||
"date": "2026-11-18",
|
||||
"values": [
|
||||
{
|
||||
"metric_type_id": 1,
|
||||
"value": 77.1
|
||||
},
|
||||
{
|
||||
"metric_type_id": 2,
|
||||
"value": 102
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"workoutTypes": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "грудь-руки"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "спина-плечи"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "ноги"
|
||||
}
|
||||
],
|
||||
"metricTypes": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Вес",
|
||||
"unit": "кг"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Грудь",
|
||||
"unit": "см"
|
||||
}
|
||||
],
|
||||
"clients": [],
|
||||
"expandedWorkoutId": "w60",
|
||||
"expandedExerciseId": null,
|
||||
"nextId": 1000,
|
||||
"mode": "personal",
|
||||
"currentClientId": null
|
||||
};
|
||||
+14
-68
@@ -15,74 +15,20 @@
|
||||
<main id="app" class="container"></main>
|
||||
<div id="modal-container"></div>
|
||||
<script>
|
||||
// Демо-данные для просмотра (ключ v6 = текущая версия хранилища)
|
||||
if (!localStorage.getItem('gym_tracker_v6')) {
|
||||
localStorage.setItem('gym_tracker_v6', JSON.stringify({
|
||||
workouts: [
|
||||
{
|
||||
id: '1', client_id: null, startTime: new Date().toISOString(), endTime: null,
|
||||
type: 'спина-плечи',
|
||||
exercises: [
|
||||
{ id: 'e1', name: 'Косичка', sets: [
|
||||
{ id: 's1', weight: 30, reps: 15, rating: 5, isDropset: false, timestamp: '2026-11-20T00:10:00+03:00' },
|
||||
{ id: 's2', weight: 30, reps: 15, rating: 5, isDropset: false, timestamp: '2026-11-20T00:14:00+03:00' },
|
||||
]},
|
||||
{ id: 'e2', name: 'Разгибание на блоке', sets: [
|
||||
{ id: 's3', weight: 25, reps: 15, rating: 4, isDropset: false, timestamp: '2026-11-20T00:12:00+03:00' },
|
||||
{ id: 's4', weight: 25, reps: 15, rating: 5, isDropset: false, timestamp: '2026-11-20T00:16:00+03:00' },
|
||||
]},
|
||||
{ id: 'e3', name: 'Жим гантелей на лавке 30', sets: [
|
||||
{ id: 's5', weight: 22, reps: 12, rating: 5, isDropset: false, timestamp: '2026-11-20T00:20:00+03:00' },
|
||||
]},
|
||||
{ id: 'e4', name: 'Молотки', sets: [] },
|
||||
],
|
||||
cardio: [{ id: 'c1', type: 'бег', purpose: 'warmup', duration: 10 }],
|
||||
setGroups: [{ id: 'g1', name: 'суперсет на спину', exerciseIds: ['e1', 'e2'] }],
|
||||
notes: '', synced: false,
|
||||
},
|
||||
{
|
||||
id: '2', client_id: null, startTime: '2026-11-17T18:00:00+03:00', endTime: '2026-11-17T19:10:00+03:00',
|
||||
type: 'грудь-руки',
|
||||
exercises: [
|
||||
{ id: 'e5', name: 'Жим гантелей на лавке 45', sets: [
|
||||
{ id: 's6', weight: 24, reps: 10, rating: 5, isDropset: false, timestamp: '2026-11-17T18:30:00+03:00' },
|
||||
{ id: 's7', weight: 24, reps: 10, rating: 4, isDropset: true, subSets: [{ weight: 24, reps: 6 }, { weight: 18, reps: 8 }], timestamp: '2026-11-17T18:40:00+03:00' },
|
||||
]},
|
||||
{ id: 'e6', name: 'Разводка', sets: [
|
||||
{ id: 's8', weight: 10, reps: 15, rating: 5, isDropset: false, timestamp: '2026-11-17T18:50:00+03:00' },
|
||||
]},
|
||||
],
|
||||
cardio: [], setGroups: [], notes: 'после паузы', synced: false,
|
||||
},
|
||||
{
|
||||
id: '3', client_id: null, startTime: '2026-11-14T18:00:00+03:00', endTime: '2026-11-14T19:00:00+03:00',
|
||||
type: 'грудь-руки',
|
||||
exercises: [
|
||||
{ id: 'e7', name: 'Жим гантелей на лавке 30', sets: [
|
||||
{ id: 's9', weight: 20, reps: 12, rating: 5, isDropset: false, timestamp: '2026-11-14T18:30:00+03:00' },
|
||||
]},
|
||||
],
|
||||
cardio: [], setGroups: [], notes: '', synced: true,
|
||||
},
|
||||
],
|
||||
exerciseRef: [
|
||||
{ id: 'r1', name: 'Косичка', workoutType: 'спина-плечи', group: '' },
|
||||
{ id: 'r2', name: 'Разгибание на блоке', workoutType: 'спина-плечи', group: '' },
|
||||
{ id: 'r3', name: 'Жим гантелей на лавке 30', workoutType: 'грудь-руки', group: 'жим гантелей на лавке' },
|
||||
{ id: 'r4', name: 'Жим гантелей на лавке 45', workoutType: 'грудь-руки', group: 'жим гантелей на лавке' },
|
||||
{ id: 'r5', name: 'Молотки', workoutType: 'грудь-руки', group: '' },
|
||||
{ id: 'r6', name: 'Разводка', workoutType: 'грудь-руки', group: '' },
|
||||
],
|
||||
bodyMetrics: [],
|
||||
workoutTypes: [{ id: 1, name: 'грудь-руки' }, { id: 2, name: 'ноги' }, { id: 3, name: 'спина-плечи' }],
|
||||
metricTypes: [],
|
||||
clients: [],
|
||||
expandedWorkoutId: '1',
|
||||
expandedExerciseId: null,
|
||||
nextId: 100,
|
||||
mode: 'personal',
|
||||
currentClientId: null,
|
||||
}));
|
||||
// Локальный тест: API указывает на локальный бэкенд (иначе относительный /api упрётся в статику)
|
||||
localStorage.setItem('gym_api_base', 'http://127.0.0.1:8000');
|
||||
</script>
|
||||
<script src="demo-seed.js"></script>
|
||||
<script>
|
||||
// Демо-датасет v4 (прогрессия жима, пиратка штанги, суперсет, дропсет): пересев при смене версии
|
||||
if (localStorage.getItem('gym_demo_seed') !== 'v4') {
|
||||
localStorage.setItem('gym_tracker_v7_guest', JSON.stringify(window.GYM_DEMO_SEED));
|
||||
// если уже выполнен вход — обновить и пользовательский ключ (в него мигрировали старые данные)
|
||||
try {
|
||||
const u = JSON.parse(localStorage.getItem('gym_auth_user'));
|
||||
if (u && u.id) localStorage.setItem('gym_tracker_v7_user_' + u.id, JSON.stringify(window.GYM_DEMO_SEED));
|
||||
} catch (e) { /* гостевой режим */ }
|
||||
localStorage.setItem('gym_demo_seed', 'v4');
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="js/app.js"></script>
|
||||
|
||||
@@ -40,6 +40,7 @@ import "./modals/edit-workout-date-modal.js";
|
||||
import "./modals/client-select-modal.js";
|
||||
import "./modals/group-modal.js";
|
||||
import "./modals/chart-modal.js";
|
||||
import "./modals/exercise-summary.js";
|
||||
|
||||
function renderHeader() {
|
||||
const user = getActiveUser();
|
||||
|
||||
@@ -167,17 +167,26 @@ export function getExerciseChart(exerciseName, clientId = null) {
|
||||
for (const ex of w.exercises || []) {
|
||||
if (!variantNames.has(normalizeName(ex.name))) continue;
|
||||
let maxWeight = 0, totalReps = 0;
|
||||
const sets = []; // каждый подход отдельно: точка на графике
|
||||
for (const s of ex.sets || []) {
|
||||
const wgt = s.isDropset && s.subSets?.length
|
||||
? Math.max(...s.subSets.map(x => parseFloat(x.weight) || 0))
|
||||
: (parseFloat(s.weight) || 0);
|
||||
if (wgt > maxWeight) maxWeight = wgt;
|
||||
totalReps += s.isDropset && s.subSets?.length
|
||||
? s.subSets.reduce((a, x) => a + (parseInt(x.reps) || 0), 0)
|
||||
: (parseInt(s.reps) || 0);
|
||||
const parts = s.isDropset && s.subSets?.length
|
||||
? s.subSets
|
||||
: [s];
|
||||
for (const p of parts) {
|
||||
const wgt = parseFloat(p.weight) || 0;
|
||||
const rps = parseInt(p.reps) || 0;
|
||||
if (wgt > 0 || rps > 0) sets.push({ weight: wgt, reps: rps });
|
||||
if (wgt > maxWeight) maxWeight = wgt;
|
||||
totalReps += rps;
|
||||
}
|
||||
}
|
||||
// повторы, взятые на максимальном весе — по ним видно прогресс при том же весе
|
||||
let topReps = 0;
|
||||
for (const st of sets) {
|
||||
if (st.weight === maxWeight && st.reps > topReps) topReps = st.reps;
|
||||
}
|
||||
if (maxWeight > 0 || totalReps > 0) {
|
||||
points.push({ date: w.startTime, name: ex.name, maxWeight, totalReps });
|
||||
points.push({ date: w.startTime, name: ex.name, maxWeight, topReps, totalReps, sets });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,6 +195,105 @@ export function getExerciseChart(exerciseName, clientId = null) {
|
||||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Сводка по упражнению (все завершённые тренировки): рекорды, средние за
|
||||
* тренировку и за всё время, синергичные упражнения (делались в тот же день)
|
||||
* и максимальный вес среди них. Варианты из одной группы считаются вместе.
|
||||
*/
|
||||
export function getExerciseSummary(exerciseName, clientId = null) {
|
||||
const variantNames = refVariantNames(exerciseName);
|
||||
const targetClient = normalizeClientId(clientId);
|
||||
|
||||
let best = null; // {weight, reps, date, variant}
|
||||
let maxSetsDay = null; // {count, date}
|
||||
let totalSets = 0, totalVolume = 0, totalReps = 0, totalRating = 0;
|
||||
let sumTopWeight = 0, days = 0;
|
||||
let from = null, to = null;
|
||||
const variantsSeen = new Set();
|
||||
const synergic = new Map(); // нормализованное имя -> {name, count, best}
|
||||
|
||||
for (const w of state.workouts) {
|
||||
if (!isSameClient(w.client_id, targetClient)) continue;
|
||||
if (!w.endTime) continue;
|
||||
const hits = (w.exercises || []).filter(ex => variantNames.has(normalizeName(ex.name)));
|
||||
if (!hits.length) continue;
|
||||
|
||||
days++;
|
||||
if (!from || new Date(w.startTime) < new Date(from)) from = w.startTime;
|
||||
if (!to || new Date(w.startTime) > new Date(to)) to = w.startTime;
|
||||
|
||||
let daySets = 0, dayVolume = 0, dayTop = 0;
|
||||
for (const ex of hits) {
|
||||
variantsSeen.add(ex.name);
|
||||
for (const s of ex.sets || []) {
|
||||
const parts = s.isDropset && s.subSets?.length ? s.subSets : [s];
|
||||
for (const p of parts) {
|
||||
const wgt = parseFloat(p.weight) || 0;
|
||||
const rps = parseInt(p.reps) || 0;
|
||||
if (!wgt && !rps) continue;
|
||||
daySets++; totalSets++;
|
||||
dayVolume += wgt * rps; totalVolume += wgt * rps;
|
||||
totalReps += rps;
|
||||
if ((parseFloat(s.rating) || 5) > 0) totalRating += (parseFloat(s.rating) || 5);
|
||||
if (wgt > dayTop) dayTop = wgt;
|
||||
if (!best || wgt > best.weight || (wgt === best.weight && rps > best.reps)) {
|
||||
best = { weight: wgt, reps: rps, date: w.startTime, variant: ex.name };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sumTopWeight += dayTop;
|
||||
if (!maxSetsDay || daySets > maxSetsDay.count) maxSetsDay = { count: daySets, date: w.startTime };
|
||||
|
||||
// Синергичные: другие упражнения этих же тренировок
|
||||
for (const ex of w.exercises || []) {
|
||||
if (variantNames.has(normalizeName(ex.name))) continue;
|
||||
const key = normalizeName(ex.name);
|
||||
const rec = synergic.get(key) || { name: ex.name, count: 0, best: null };
|
||||
rec.count++;
|
||||
for (const s of ex.sets || []) {
|
||||
const parts = s.isDropset && s.subSets?.length ? s.subSets : [s];
|
||||
for (const p of parts) {
|
||||
const wgt = parseFloat(p.weight) || 0;
|
||||
const rps = parseInt(p.reps) || 0;
|
||||
if (!wgt) continue;
|
||||
if (!rec.best || wgt > rec.best.weight || (wgt === rec.best.weight && rps > rec.best.reps)) {
|
||||
rec.best = { weight: wgt, reps: rps, date: w.startTime };
|
||||
}
|
||||
}
|
||||
}
|
||||
synergic.set(key, rec);
|
||||
}
|
||||
}
|
||||
|
||||
const synergicList = Array.from(synergic.values())
|
||||
.sort((a, b) => b.count - a.count || (b.best?.weight || 0) - (a.best?.weight || 0));
|
||||
let synergicBest = null;
|
||||
for (const s of synergicList) {
|
||||
if (s.best && (!synergicBest || s.best.weight > synergicBest.weight)) {
|
||||
synergicBest = { ...s.best, name: s.name };
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
days,
|
||||
variants: Array.from(variantsSeen),
|
||||
period: from ? { from, to } : null,
|
||||
best,
|
||||
maxSetsDay,
|
||||
totals: { sets: totalSets, volume: totalVolume, reps: totalReps },
|
||||
avg: days ? {
|
||||
topWeight: Math.round(sumTopWeight / days * 10) / 10,
|
||||
sets: Math.round(totalSets / days * 10) / 10,
|
||||
volume: Math.round(totalVolume / days),
|
||||
reps: Math.round(totalReps / days),
|
||||
rating: Math.round(totalRating / totalSets * 10) / 10 || 0,
|
||||
} : null,
|
||||
synergic: synergicList,
|
||||
synergicBest,
|
||||
};
|
||||
}
|
||||
|
||||
window.EL = {
|
||||
addExercise,
|
||||
toggleExercise,
|
||||
|
||||
@@ -27,6 +27,9 @@ export function showGroupDialogFor(workoutId, groupId = null) {
|
||||
w.setGroups.push({ id: genId(), name: data.name, exerciseIds: data.exerciseIds });
|
||||
}
|
||||
|
||||
// Состав сета меняет саму тренировку — пусть уедет на сервер заново
|
||||
if (w.endTime) w.synced = false;
|
||||
|
||||
saveState();
|
||||
renderMainScreen();
|
||||
});
|
||||
@@ -40,6 +43,7 @@ export function removeGroup(workoutId, groupId) {
|
||||
const w = state.workouts.find(x => x.id === workoutId);
|
||||
if (!w) return;
|
||||
w.setGroups = (w.setGroups || []).filter(g => g.id !== groupId);
|
||||
if (w.endTime) w.synced = false;
|
||||
saveState();
|
||||
renderMainScreen();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,15 @@ export function finishWorkout(workoutId) {
|
||||
|
||||
export function deleteWorkout(workoutId) {
|
||||
if (!confirm('Удалить тренировку полностью?')) return;
|
||||
|
||||
// Надгробие: без него bootstrap вернёт удалённую тренировку с сервера
|
||||
const w = state.workouts.find(x => x.id === workoutId);
|
||||
const sid = w && (w.sync_id || w.id);
|
||||
if (sid) {
|
||||
if (!Array.isArray(state.deletedWorkouts)) state.deletedWorkouts = [];
|
||||
if (!state.deletedWorkouts.includes(sid)) state.deletedWorkouts.push(sid);
|
||||
}
|
||||
|
||||
state.workouts = state.workouts.filter(w => w.id !== workoutId);
|
||||
saveState();
|
||||
renderMainScreen();
|
||||
|
||||
@@ -4,60 +4,125 @@ import { showModal, closeModal } from './modal-base.js';
|
||||
import { getExerciseChart } from '../logic/exercise.js';
|
||||
|
||||
/**
|
||||
* График прогрессии упражнения: максимальный вес (или повторения, если вес
|
||||
* не используется) по завершённым тренировкам. Варианты из одной группы
|
||||
* справочника складываются в одну линию.
|
||||
* График прогрессии упражнения. Главный элемент — рабочий максимум тренировки:
|
||||
* вершина «вес × повторения» (например 100×2). Зелёный — лучше прошлого раза
|
||||
* (вес больше, или тот же вес и больше повторов), красный — откат, фиолетовый —
|
||||
* так же. Остальные подходы — тусклые точки (размер = повторения). Варианты из
|
||||
* одной группы справочника — на одной линии.
|
||||
*/
|
||||
export function showChartDialog(exerciseName, clientId = null) {
|
||||
const points = getExerciseChart(exerciseName, clientId);
|
||||
|
||||
if (points.length === 0) {
|
||||
showModal(`
|
||||
<div class="modal-content">
|
||||
<div class="modal-header"><span class="modal-title">${escapeHtml(exerciseName)}</span><button class="btn-icon" onclick="closeModal()">✕</button></div>
|
||||
<div class="history-hint" style="margin:8px 0">Нет завершённых тренировок с этим упражнением — график появится после первых результатов.</div>
|
||||
</div>
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
||||
const byWeight = points.some(p => p.maxWeight > 0);
|
||||
const values = points.map(p => byWeight ? p.maxWeight : p.totalReps);
|
||||
const label = byWeight ? 'вес, кг' : 'повторы';
|
||||
const val = s => byWeight ? s.weight : s.reps; // что откладывать по вертикали
|
||||
const dayTop = p => byWeight ? p.maxWeight : Math.max(...p.sets.map(val), 0);
|
||||
const dayTopReps = p => byWeight ? p.topReps : 0;
|
||||
|
||||
const W = 320, H = 170, padL = 30, padR = 12, padT = 14, padB = 24;
|
||||
const t0 = new Date(points[0].date).getTime();
|
||||
const t1 = new Date(points[points.length - 1].date).getTime();
|
||||
const span = Math.max(1, t1 - t0);
|
||||
const vMax = Math.max(...values), vMin = Math.min(...values);
|
||||
const vSpan = Math.max(1e-6, vMax - vMin);
|
||||
const x = t => padL + (W - padL - padR) * (new Date(t).getTime() - t0) / span;
|
||||
const y = v => padT + (H - padT - padB) * (1 - (v - vMin) / vSpan);
|
||||
// Прогресс вершины относительно предыдущей тренировки
|
||||
const cls = i => {
|
||||
if (i === 0) return 'chart-flat';
|
||||
const cur = dayTop(points[i]), prev = dayTop(points[i - 1]);
|
||||
if (cur > prev) return 'chart-up';
|
||||
if (cur < prev) return 'chart-down';
|
||||
if (byWeight && dayTopReps(points[i]) > dayTopReps(points[i - 1])) return 'chart-up';
|
||||
if (byWeight && dayTopReps(points[i]) < dayTopReps(points[i - 1])) return 'chart-down';
|
||||
return 'chart-flat';
|
||||
};
|
||||
const classes = points.map((_, i) => cls(i));
|
||||
const topLabel = p => byWeight ? `${dayTop(p)}×${dayTopReps(p)}` : `${dayTop(p)}`;
|
||||
|
||||
const pts = points.map(p => `${x(p.date).toFixed(1)},${y(byWeight ? p.maxWeight : p.totalReps).toFixed(1)}`);
|
||||
const circles = points.map((p, i) =>
|
||||
`<circle cx="${x(p.date).toFixed(1)}" cy="${y(values[i]).toFixed(1)}" r="3.5"><title>${new Date(p.date).toLocaleDateString('ru-RU')} — ${escapeHtml(p.name)}: ${values[i]} ${label === 'вес, кг' ? 'кг' : 'повт.'}</title></circle>`
|
||||
// Полноэкранный график: размер под текущий вьюпорт, а не фиксированные 320px
|
||||
const W = Math.max(320, (window.innerWidth || 900) - 12);
|
||||
const H = Math.min(640, Math.max(300, Math.round((window.innerHeight || 700) * 0.52)));
|
||||
const padL = 46, padR = 34, padT = 36, padB = 58;
|
||||
const n = points.length;
|
||||
const x = i => n === 1 ? (padL + W - padR) / 2
|
||||
: padL + (W - padL - padR) * i / (n - 1);
|
||||
|
||||
const allVals = points.flatMap(p => p.sets.map(val)).concat(points.map(dayTop));
|
||||
const vMax = Math.max(...allVals), vMin = Math.min(0, ...allVals);
|
||||
const vTop = vMax + (vMax - vMin) * 0.1 || vMax + 1;
|
||||
const y = v => padT + (H - padT - padB) * (1 - (v - vMin) / (vTop - vMin || 1));
|
||||
|
||||
const maxReps = Math.max(1, ...points.flatMap(p => p.sets.map(s => s.reps || 0)));
|
||||
const rOf = s => 2.6 + 3.6 * Math.min(1, (s.reps || 0) / maxReps);
|
||||
|
||||
// Все подходы — тусклые фоновые точки, слегка раскиданные вокруг дня
|
||||
const dots = [];
|
||||
points.forEach((p, i) => {
|
||||
const spread = p.sets.length > 1 ? Math.min(20, (W - padL - padR) / (2 * n)) : 0;
|
||||
p.sets.forEach((s, k) => {
|
||||
if (byWeight && s.weight === p.maxWeight) return; // максимум покажет вершина линии
|
||||
const dx = p.sets.length > 1 ? -spread + 2 * spread * k / (p.sets.length - 1) : 0;
|
||||
dots.push(
|
||||
`<circle class="chart-set" cx="${(x(i) + dx).toFixed(1)}" cy="${y(val(s)).toFixed(1)}" r="${rOf(s).toFixed(1)}">` +
|
||||
`<title>${new Date(p.date).toLocaleDateString('ru-RU')} · подход: ` +
|
||||
(byWeight ? `${s.weight} кг × ${s.reps}` : `${s.reps} повт.`) + `</title></circle>`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Линия рабочего максимума: каждый отрезок окрашен по прогрессу конца отрезка
|
||||
const segs = [];
|
||||
for (let i = 1; i < n; i++) {
|
||||
segs.push(`<line x1="${x(i - 1).toFixed(1)}" y1="${y(dayTop(points[i - 1])).toFixed(1)}" ` +
|
||||
`x2="${x(i).toFixed(1)}" y2="${y(dayTop(points[i])).toFixed(1)}" class="chart-seg ${classes[i]}"/>`);
|
||||
}
|
||||
// Вершины: крупная точка + подпись «вес×повт.» с цветом прогресса
|
||||
const showLabel = i => n <= 12 || i >= n - 6 || classes[i] !== 'chart-flat';
|
||||
const verts = points.map((p, i) =>
|
||||
`<circle class="chart-vert ${classes[i]}" cx="${x(i).toFixed(1)}" cy="${y(dayTop(p)).toFixed(1)}" r="6.5"></circle>` +
|
||||
(showLabel(i)
|
||||
? `<text x="${x(i).toFixed(1)}" y="${(y(dayTop(p)) - 11).toFixed(1)}" text-anchor="middle" class="chart-label chart-vert-label ${classes[i]}">${topLabel(p)}</text>`
|
||||
: '')
|
||||
).join('');
|
||||
|
||||
const fmt = d => new Date(d).toLocaleDateString('ru-RU', { day: '2-digit', month: '2-digit' });
|
||||
const maxIdx = values.indexOf(vMax);
|
||||
|
||||
const counts = points.map((p, i) =>
|
||||
(n <= 16 || i % 2 === 0)
|
||||
? `<text x="${x(i).toFixed(1)}" y="${H - 20}" text-anchor="middle" class="chart-label chart-count">×${p.sets.length}</text>` +
|
||||
`<text x="${x(i).toFixed(1)}" y="${H - 4}" text-anchor="middle" class="chart-label chart-date-lab">${fmt(p.date)}</text>`
|
||||
: ''
|
||||
).join('');
|
||||
|
||||
showModal(`
|
||||
<div class="modal-header"><span class="modal-title">📈 ${escapeHtml(exerciseName)}</span><button class="btn-icon" onclick="closeModal()">✕</button></div>
|
||||
<div class="chart-sub">${points.length} трен. · ${label} · варианты одной группы сложены вместе</div>
|
||||
<div class="modal-content modal-fullscreen">
|
||||
<div class="modal-header"><span class="modal-title">📈 ${escapeHtml(exerciseName)}</span></div>
|
||||
<div class="chart-sub chart-legend-top">линия — рабочий максимум «вес × повторы»: <b class="chart-up">зелёный — прогресс</b> (вес выше или тот же вес и больше повторов), <b class="chart-down">красный — откат</b>; тусклые точки — остальные подходы, ×N — их число</div>
|
||||
<svg class="chart-svg" viewBox="0 0 ${W} ${H}">
|
||||
<line x1="${padL}" y1="${y(vMin).toFixed(1)}" x2="${W - padR}" y2="${y(vMin).toFixed(1)}" class="chart-axis"/>
|
||||
<line x1="${padL}" y1="${y(vMax).toFixed(1)}" x2="${W - padR}" y2="${y(vMax).toFixed(1)}" class="chart-axis"/>
|
||||
<text x="4" y="${(y(vMax) + 4).toFixed(1)}" class="chart-label">${vMax}</text>
|
||||
<text x="4" y="${(y(vMin) + 4).toFixed(1)}" class="chart-label">${vMin}</text>
|
||||
${points.length > 1 ? `<polyline points="${pts.join(' ')}" class="chart-line"/>` : ''}
|
||||
${circles}
|
||||
<text x="${padL}" y="${H - 8}" class="chart-label">${fmt(points[0].date)}</text>
|
||||
${points.length > 1 && new Date(points[points.length - 1].date) - new Date(points[0].date) > 864e5
|
||||
? `<text x="${W - padR}" y="${H - 8}" text-anchor="end" class="chart-label">${fmt(points[points.length - 1].date)}</text>` : ''}
|
||||
${points.length > 0 ? `<text x="${x(points[maxIdx].date).toFixed(1)}" y="${(y(values[maxIdx]) - 8).toFixed(1)}" text-anchor="middle" class="chart-label chart-max">макс ${values[maxIdx]}</text>` : ''}
|
||||
<text x="${padL - 6}" y="${(y(vMax) + 4).toFixed(1)}" text-anchor="end" class="chart-label">${vMax}</text>
|
||||
<text x="${padL - 6}" y="${(y(vMin) + 4).toFixed(1)}" text-anchor="end" class="chart-label">${vMin}</text>
|
||||
${dots.join('')}
|
||||
${segs.join('')}
|
||||
${verts}
|
||||
${counts}
|
||||
</svg>
|
||||
<div class="chart-list">${points.slice(-5).reverse().map(p =>
|
||||
`<div class="chart-row"><span class="chart-date">${new Date(p.date).toLocaleDateString('ru-RU')}</span><span class="chart-name">${escapeHtml(p.name)}</span><span class="chart-val">${byWeight ? p.maxWeight + ' кг' : p.totalReps + ' повт.'}</span></div>`
|
||||
).join('')}</div>
|
||||
<div class="chart-list">${points.slice(-5).reverse().map((p, k) => {
|
||||
const i = points.length - 1 - k;
|
||||
return `<div class="chart-row"><span class="chart-date">${new Date(p.date).toLocaleDateString('ru-RU')}</span>` +
|
||||
`<span class="chart-val ${classes[i]}"><b>${topLabel(p)}</b></span>` +
|
||||
`<span class="chart-sets">${p.sets.map(s => byWeight ? s.weight + '×' + s.reps : s.reps).join(' ')}` +
|
||||
` · <span class="chart-count-num">${p.sets.length}</span> подх.</span></div>`;
|
||||
}).join('')}</div>
|
||||
<div class="modal-actions-row">
|
||||
<button class="btn btn-secondary big-touch" data-ex="${escapeHtml(exerciseName)}"
|
||||
onclick="EM.showSummaryFromBtn(this)">📋 Сводка</button>
|
||||
<button class="btn btn-primary big-touch" onclick="ModalBase.closeModal()">✕ Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { state } from '../state.js';
|
||||
import { escapeHtml } from '../utils.js';
|
||||
import { showModal, closeModal } from './modal-base.js';
|
||||
import { getExerciseSummary } from '../logic/exercise.js';
|
||||
import { showChartDialog } from './chart-modal.js';
|
||||
|
||||
const fmtDate = d => new Date(d).toLocaleDateString('ru-RU');
|
||||
|
||||
/**
|
||||
* Страница-сводка по упражнению: рекорды, средние за тренировку и за всё
|
||||
* время, синергичные упражнения и максимальный вес среди них.
|
||||
*/
|
||||
export function showExerciseSummary(exerciseName, clientId = null) {
|
||||
const s = getExerciseSummary(exerciseName, clientId);
|
||||
|
||||
if (!s.days) {
|
||||
showModal(`
|
||||
<div class="modal-content">
|
||||
<div class="modal-header"><span class="modal-title">${escapeHtml(exerciseName)}</span><button class="btn-icon" onclick="closeModal()">✕</button></div>
|
||||
<div class="history-hint" style="margin:8px 0">Нет завершённых тренировок с этим упражнением.</div>
|
||||
</div>
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
||||
const card = (label, value, sub = '') =>
|
||||
`<div class="sum-card"><div class="sum-value">${value}</div><div class="sum-label">${label}</div>` +
|
||||
(sub ? `<div class="sum-sub">${sub}</div>` : '') + `</div>`;
|
||||
|
||||
const synergRows = s.synergic.slice(0, 8).map(x =>
|
||||
`<div class="chart-row"><span class="chart-date">${x.count} трен.</span>` +
|
||||
`<span class="chart-name">${escapeHtml(x.name)}</span>` +
|
||||
`<span class="chart-val">${x.best ? x.best.weight + '×' + x.best.reps : '—'}</span></div>`
|
||||
).join('') || '<div class="history-hint">Пока нет данных по соседним упражнениям.</div>';
|
||||
|
||||
showModal(`
|
||||
<div class="modal-content modal-fullscreen">
|
||||
<div class="modal-header">
|
||||
<span class="modal-title">📋 ${escapeHtml(exerciseName)}</span>
|
||||
</div>
|
||||
<div class="chart-sub">
|
||||
${s.days} тренир.` +
|
||||
(s.period ? ` · ${fmtDate(s.period.from)} — ${fmtDate(s.period.to)}` : '') +
|
||||
(s.variants.length > 1 ? ` · варианты: ${s.variants.map(escapeHtml).join(', ')}` : '') + `
|
||||
</div>
|
||||
|
||||
<div class="sum-grid">
|
||||
${card('рабочий максимум', s.best ? `${s.best.weight}×${s.best.reps}` : '—',
|
||||
s.best ? `${fmtDate(s.best.date)} · ${escapeHtml(s.best.variant)}` : '')}
|
||||
${card('максимум подходов за тренировку', s.maxSetsDay ? `×${s.maxSetsDay.count}` : '—',
|
||||
s.maxSetsDay ? fmtDate(s.maxSetsDay.date) : '')}
|
||||
${card('средний рабочий вес', s.avg ? `${s.avg.topWeight} кг` : '—', 'за тренировку')}
|
||||
${card('средне подходов', s.avg ? `×${s.avg.sets}` : '—', `и ${s.avg ? s.avg.reps : 0} повт. за тренировку`)}
|
||||
${card('средний объём', s.avg ? `${s.avg.volume} кг` : '—', 'за тренировку')}
|
||||
${card('за всё время', `${s.totals.volume} кг`, `${s.totals.sets} подх. · ${s.totals.reps} повт.` +
|
||||
(s.avg && s.avg.rating ? ` · средняя оценка ${s.avg.rating}` : ''))}
|
||||
</div>
|
||||
|
||||
<h4 style="margin:12px 0 4px">🤝 Синергичные упражнения <span class="text-muted text-small">(делались в тот же день)</span></h4>
|
||||
<div class="chart-list">${synergRows}</div>
|
||||
${s.synergicBest ? `<div class="chart-sub" style="margin-top:6px">Максимум среди синергичных: <b>${escapeHtml(s.synergicBest.name)} ${s.synergicBest.weight}×${s.synergicBest.reps}</b> (${fmtDate(s.synergicBest.date)})</div>` : ''}
|
||||
|
||||
<div class="modal-actions-row">
|
||||
<button class="btn btn-secondary big-touch" data-ex="${escapeHtml(exerciseName)}"
|
||||
onclick="EM.showChartFrom(this)">📈 График</button>
|
||||
<button class="btn btn-primary big-touch" onclick="ModalBase.closeModal()">✕ Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
|
||||
// Кнопка «📋 Сводка» в графике: имя из data-атрибута
|
||||
export function showSummaryFromBtn(btn) {
|
||||
const name = btn.dataset.ex;
|
||||
const w = state.workouts.find(w => (w.exercises || []).some(e => e.name === name));
|
||||
showExerciseSummary(name, w ? w.client_id : null);
|
||||
}
|
||||
|
||||
window.EM = {
|
||||
showSummaryDialog: (name) => showExerciseSummary(name),
|
||||
showSummaryFromBtn,
|
||||
showChartFrom: (btn) => showChartDialog(btn.dataset.ex),
|
||||
};
|
||||
@@ -74,6 +74,13 @@ export function stepValue(id, delta, adaptive = false) {
|
||||
input.dispatchEvent(new Event('change'));
|
||||
}
|
||||
|
||||
// Подложка модалки: закрытие по фону и по Esc; глобальный closeModal —
|
||||
// на него ссылаются onclick в разметке графиков и сводки
|
||||
window.closeModal = closeModal;
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape" && container() && container().innerHTML) closeModal();
|
||||
});
|
||||
|
||||
window.ModalBase = {
|
||||
showModal,
|
||||
closeModal,
|
||||
|
||||
@@ -14,7 +14,8 @@ export function renderCircuit(w, group, members, isReadOnly) {
|
||||
<div class="circuit-members"></div>
|
||||
</div>
|
||||
`;
|
||||
if (!isReadOnly) {
|
||||
// Состав сета можно править и в архивной тренировке — подходы не меняются
|
||||
if (!isReadOnly || w.endTime) {
|
||||
const controls = document.createElement('div');
|
||||
controls.className = 'circuit-controls';
|
||||
const editBtn = document.createElement('button');
|
||||
@@ -79,7 +80,7 @@ export function renderCircuit(w, group, members, isReadOnly) {
|
||||
}
|
||||
card.appendChild(roundsWrap);
|
||||
|
||||
if (!isReadOnly) {
|
||||
if (!isReadOnly || w.endTime) {
|
||||
const footRow = document.createElement('div');
|
||||
footRow.className = 'circuit-add';
|
||||
if (!w.endTime) {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// frontend/js/render/dashboard-screen.js
|
||||
|
||||
import { state } from '../state.js';
|
||||
import { drawExerciseProgress, drawBodyMetricsGraph } from './dashboard.js';
|
||||
import { escapeHtml } from '../utils.js';
|
||||
import { drawBodyMetricsGraph } from './dashboard.js';
|
||||
import { showExerciseSummary } from '../modals/exercise-summary.js';
|
||||
import { showChartDialog } from '../modals/chart-modal.js';
|
||||
|
||||
const CHART_EX_KEY = 'gym_dash_char…ise';
|
||||
|
||||
export function renderDashboard() {
|
||||
const app = document.getElementById('app');
|
||||
@@ -18,13 +23,16 @@ export function renderDashboard() {
|
||||
<h3>💪 Прогресс упражнения</h3>
|
||||
<div class="field-group">
|
||||
<label>Выберите упражнение</label>
|
||||
<select id="dash-ex-select" onchange="DashboardLogic.updateExerciseChart()">
|
||||
<select id="dash-ex-select" onchange="DashboardLogic.rememberExercise()">
|
||||
<option value="">— Выберите —</option>
|
||||
${getUniqueExercises().map(ex => `<option value="${ex}">${ex}</option>`).join('')}
|
||||
${getUniqueExercises().map(ex => `<option value="${escapeHtml(ex)}">${escapeHtml(ex)}</option>`).join('')}
|
||||
</select>
|
||||
</div>
|
||||
<canvas id="chart-exercise" width="400" height="200" style="width:100%; background:#1e1e1e; border-radius:8px;"></canvas>
|
||||
<p class="text-muted text-small mt-10">Показаны макс. вес и повторения за последние 10 тренировок.</p>
|
||||
<div style="display:flex; gap:8px; flex-wrap:wrap">
|
||||
<button class="btn btn-primary" style="flex:1" onclick="DashboardLogic.openChart()">📈 Открыть график</button>
|
||||
<button class="btn btn-secondary" onclick="DashboardLogic.showExSummary()">📋 Сводка</button>
|
||||
</div>
|
||||
<p class="text-muted text-small mt-10">Главное — рабочий максимум «вес × повторы»: зелёный — прогресс (вес выше или тот же вес и больше повторов), красный — откат. Тусклые точки — остальные подходы, «×N» — их число.</p>
|
||||
</div>
|
||||
|
||||
<!-- Секция 2: Динамика тела -->
|
||||
@@ -50,18 +58,20 @@ export function renderDashboard() {
|
||||
`;
|
||||
|
||||
window.DashboardLogic = {
|
||||
updateExerciseChart: () => {
|
||||
// Выбор упражнения запоминается и восстанавливается при следующем открытии
|
||||
rememberExercise: () => {
|
||||
localStorage.setItem(CHART_EX_KEY, document.getElementById('dash-ex-select').value);
|
||||
},
|
||||
openChart: () => {
|
||||
const select = document.getElementById('dash-ex-select');
|
||||
const canvas = document.getElementById('chart-exercise');
|
||||
if (select.value) {
|
||||
drawExerciseProgress(canvas, select.value);
|
||||
} else {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.clearRect(0,0,canvas.width,canvas.height);
|
||||
ctx.fillStyle='#666';
|
||||
ctx.textAlign='center';
|
||||
ctx.fillText('Выберите упражнение выше', canvas.width/2, canvas.height/2);
|
||||
}
|
||||
if (!select.value) { alert('Сначала выберите упражнение'); return; }
|
||||
localStorage.setItem(CHART_EX_KEY, select.value);
|
||||
showChartDialog(select.value);
|
||||
},
|
||||
showExSummary: () => {
|
||||
const select = document.getElementById('dash-ex-select');
|
||||
if (!select.value) { alert('Сначала выберите упражнение'); return; }
|
||||
showExerciseSummary(select.value);
|
||||
},
|
||||
updateBodyChart: () => {
|
||||
const clientSel = document.getElementById('dash-client-select');
|
||||
@@ -77,7 +87,10 @@ export function renderDashboard() {
|
||||
}
|
||||
};
|
||||
|
||||
// Первичная отрисовка (пустые состояния)
|
||||
// Первичная отрисовка: восстанавливаем закреплённый выбор упражнения
|
||||
const saved = localStorage.getItem(CHART_EX_KEY);
|
||||
const exSelect = document.getElementById('dash-ex-select');
|
||||
if (saved && Array.from(exSelect.options).some(o => o.value === saved)) exSelect.value = saved;
|
||||
DashboardLogic.updateExerciseChart();
|
||||
if(state.metricTypes.length > 0) {
|
||||
document.getElementById('dash-metric-select').value = state.metricTypes[0].id;
|
||||
|
||||
+104
-123
@@ -2,9 +2,12 @@
|
||||
|
||||
import { state } from '../state.js';
|
||||
import { formatDate } from '../utils.js';
|
||||
import { getExerciseChart } from '../logic/exercise.js';
|
||||
|
||||
/**
|
||||
* Рисует линейный график прогресса упражнения
|
||||
* Рисует график прогресса упражнения: каждая точка — подход (вес по вертикали,
|
||||
* размер — повторения), фиолетовая линия — максимальный вес за тренировку
|
||||
* (силовая прогрессия), «×N» под осью — количество подходов (выносливость).
|
||||
* @param {HTMLCanvasElement} canvas
|
||||
* @param {string} exerciseName
|
||||
*/
|
||||
@@ -15,31 +18,110 @@ export function drawExerciseProgress(canvas, exerciseName) {
|
||||
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
const history = getCumulativeExerciseHistory(exerciseName);
|
||||
const days = getExerciseProgressData(exerciseName);
|
||||
|
||||
if (history.length < 2) {
|
||||
drawEmptyState(ctx, width, height, "Недостаточно данных\nНужно минимум 2 тренировки");
|
||||
if (days.length === 0) {
|
||||
drawEmptyState(ctx, width, height, "Нет завершённых тренировок\nс этим упражнением");
|
||||
return;
|
||||
}
|
||||
|
||||
// Находим максимальный ИТОГОВЫЙ объем для масштабирования оси Y
|
||||
const maxVolume = Math.max(...history.map(h => h.totalVolume));
|
||||
const maxWeight = Math.max(...days.map(d => d.max), 1);
|
||||
|
||||
const padding = { top: 20, right: 20, bottom: 30, left: 40 };
|
||||
const padding = { top: 14, right: 14, bottom: 58, left: 44 };
|
||||
const chartW = width - padding.left - padding.right;
|
||||
const chartH = height - padding.top - padding.bottom;
|
||||
|
||||
// Рисуем сетку (используем maxVolume для оси Y)
|
||||
drawGridAndAxes(ctx, padding, chartW, chartH, maxVolume, 'Дата', 'Общий вес (кг)');
|
||||
drawGridAndAxes(ctx, padding, chartW, chartH, maxWeight, 'Дата', 'Вес (кг)');
|
||||
|
||||
// Рисуем новый график со стеком
|
||||
drawCumulativeVolumeChart(ctx, history, padding, chartW, chartH, maxVolume);
|
||||
const n = days.length;
|
||||
const x = i => n === 1 ? padding.left + chartW / 2
|
||||
: padding.left + (chartW * i) / (n - 1);
|
||||
const y = v => padding.top + chartH - (v / maxWeight) * chartH;
|
||||
const maxReps = Math.max(1, ...days.flatMap(d => d.sets.map(s => s.reps)));
|
||||
|
||||
// Легенда (обновленная)
|
||||
// Прогресс вершины относительно прошлой тренировки: вес выше — или тот же
|
||||
// вес и больше повторов => зелёный; меньше => красный; ровно => фиолетовый.
|
||||
const COLORS = { up: '#3ddc55', down: '#ff5a5a', flat: '#c792ff' };
|
||||
const cls = i => {
|
||||
if (i === 0) return 'flat';
|
||||
const a = days[i - 1], b = days[i];
|
||||
if (b.max > a.max) return 'up';
|
||||
if (b.max < a.max) return 'down';
|
||||
if ((b.topReps || 0) > (a.topReps || 0)) return 'up';
|
||||
if ((b.topReps || 0) < (a.topReps || 0)) return 'down';
|
||||
return 'flat';
|
||||
};
|
||||
const classes = days.map((_, i) => cls(i));
|
||||
|
||||
// Линия рабочего максимума: отрезки окрашены по прогрессу конца отрезка
|
||||
for (let i = 1; i < n; i++) {
|
||||
ctx.strokeStyle = COLORS[classes[i]];
|
||||
ctx.lineWidth = 4;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x(i - 1), y(days[i - 1].max));
|
||||
ctx.lineTo(x(i), y(days[i].max));
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
days.forEach((d, i) => {
|
||||
const px = x(i);
|
||||
|
||||
// Подходы дня ниже максимума — тусклые фоновые точки
|
||||
const below = d.sets.filter(s => s.weight !== d.max);
|
||||
const spread = below.length > 1 ? Math.min(11, chartW / (3 * n)) : 0;
|
||||
below.forEach((s, k) => {
|
||||
const dx = below.length > 1 ? -spread + (2 * spread * k) / (below.length - 1) : 0;
|
||||
const r = 2.2 + 2.8 * Math.min(1, s.reps / maxReps);
|
||||
ctx.beginPath();
|
||||
ctx.fillStyle = 'rgba(199, 146, 255, 0.55)';
|
||||
ctx.arc(px + dx, y(s.weight), r, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
});
|
||||
|
||||
// Вершина: рабочий максимум «вес × повторы» с цветом прогресса
|
||||
ctx.beginPath();
|
||||
ctx.fillStyle = COLORS[classes[i]];
|
||||
ctx.arc(px, y(d.max), 5.5, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = '#ffffff';
|
||||
ctx.lineWidth = 1.2;
|
||||
ctx.stroke();
|
||||
if (n <= 10 || i >= n - 4 || classes[i] !== 'flat') {
|
||||
ctx.fillStyle = COLORS[classes[i]];
|
||||
ctx.font = 'bold 12px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(`${d.max}×${d.topReps || ''}`, px, y(d.max) - 8);
|
||||
}
|
||||
|
||||
// Дата под каждой точкой оси X и количество подходов (выносливость)
|
||||
if (n <= 10 || i % 2 === 0) {
|
||||
ctx.fillStyle = '#d5d5d5';
|
||||
ctx.font = '10px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(formatShortDate(d.date.toISOString()), px, height - padding.bottom + 15);
|
||||
ctx.fillStyle = '#b0b0b0';
|
||||
ctx.font = '10px sans-serif';
|
||||
ctx.fillText('×' + d.sets.length, px, height - padding.bottom + 29);
|
||||
}
|
||||
});
|
||||
|
||||
// Легенда — внизу, под датами
|
||||
drawLegend(ctx, width, [
|
||||
{ color: '#bb86fc', label: 'Итоговый объем' },
|
||||
{ color: 'rgba(187, 134, 252, 0.4)', label: 'Накопление по подходам' }
|
||||
]);
|
||||
{ color: '#3ddc55', label: 'рабочий максимум: зелёный — прогресс, красный — откат' },
|
||||
{ color: 'rgba(199, 146, 255, 0.55)', label: 'тусклая точка = подход (размер = повторы)' },
|
||||
], height - 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Данные графика: по каждой завершённой тренировке — список подходов
|
||||
* (дроп-сеты развёрнуты) и максимальный вес. Варианты упражнения из одной
|
||||
* группы справочника объединяются в одну линию (общий источник —
|
||||
* getExerciseChart из logic/exercise.js).
|
||||
*/
|
||||
export function getExerciseProgressData(exerciseName, clientId = null) {
|
||||
return getExerciseChart(exerciseName, clientId)
|
||||
.map(p => ({ date: new Date(p.date), sets: p.sets, max: p.maxWeight, topReps: p.topReps }))
|
||||
.slice(-10);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,46 +219,6 @@ export function drawBodyMetricsGraph(canvas, clientId, metricTypeId) {
|
||||
ctx.fillText(formatShortDate(dataPoints[dataPoints.length-1].date.toISOString()), width - padding.right, height - 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Собирает историю с накопительным весом по каждому подходу
|
||||
*/
|
||||
function getCumulativeExerciseHistory(name) {
|
||||
const normalized = name.trim().toLowerCase();
|
||||
const history = [];
|
||||
|
||||
state.workouts.forEach(w => {
|
||||
w.exercises.forEach(ex => {
|
||||
if (ex.name.trim().toLowerCase() === normalized && ex.sets.length > 0) {
|
||||
let currentCumulativeWeight = 0;
|
||||
const cumulativePoints = [];
|
||||
|
||||
ex.sets.forEach(s => {
|
||||
// Учитываем вес подхода (для дроп-сетов можно брать средний или максимальный, здесь берем основной)
|
||||
const setWeight = s.isDropset && s.subSets
|
||||
? Math.max(...s.subSets.map(ss => ss.weight))
|
||||
: s.weight;
|
||||
|
||||
// Объем подхода = вес * повторения (или просто вес, если вы считаете тоннаж)
|
||||
// В вашем примере (15, 30, 45, 60) вы суммируете именно вес подходов.
|
||||
// Если нужно суммировать тоннаж (вес * повторы), замените на: setWeight * s.reps
|
||||
const volume = setWeight * s.reps;
|
||||
|
||||
currentCumulativeWeight += volume;
|
||||
cumulativePoints.push(currentCumulativeWeight);
|
||||
});
|
||||
|
||||
history.push({
|
||||
date: new Date(w.startTime),
|
||||
cumulativePoints: cumulativePoints, // [15, 30, 45, 60]
|
||||
totalVolume: currentCumulativeWeight // 60
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
history.sort((a, b) => a.date - b.date);
|
||||
return history.slice(-10); // Последние 10 тренировок
|
||||
}
|
||||
|
||||
// --- Вспомогательные функции ---
|
||||
|
||||
@@ -243,8 +285,8 @@ function drawGridAndAxes(ctx, pad, cw, ch, maxY, maxXAxisLabel, yAxisLabel) {
|
||||
ctx.stroke();
|
||||
|
||||
// Подписи Y
|
||||
ctx.fillStyle = '#b0b0b0';
|
||||
ctx.font = '10px sans-serif';
|
||||
ctx.fillStyle = '#c9c9c9';
|
||||
ctx.font = '11px sans-serif';
|
||||
ctx.textAlign = 'right';
|
||||
for(let i=0; i<=4; i++) {
|
||||
const val = (maxY * i / 4).toFixed(0);
|
||||
@@ -290,78 +332,17 @@ function drawLineChart(ctx, data, pad, cw, ch, maxY, getValueFn, color, lineWidt
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
/**
|
||||
* Рисует график прогресса с вертикальным стеком накопительного веса
|
||||
*/
|
||||
function drawCumulativeVolumeChart(ctx, data, pad, cw, ch, maxY) {
|
||||
if (!data.length) return;
|
||||
|
||||
// 1. Сначала рисуем соединительную линию для ОБЩИХ итогов (тренд)
|
||||
ctx.strokeStyle = '#bb86fc'; // Основной цвет (например, фиолетовый)
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
|
||||
data.forEach((item, index) => {
|
||||
const x = pad.left + (index / (data.length - 1 || 1)) * cw;
|
||||
const y = pad.top + ch - (item.totalVolume / maxY) * ch;
|
||||
|
||||
if (index === 0) ctx.moveTo(x, y);
|
||||
else ctx.lineTo(x, y);
|
||||
});
|
||||
ctx.stroke();
|
||||
|
||||
// 2. Рисуем вертикальные стеки точек для каждой даты
|
||||
data.forEach((item, index) => {
|
||||
const x = pad.left + (index / (data.length - 1 || 1)) * cw;
|
||||
|
||||
item.cumulativePoints.forEach((cumWeight, pointIndex) => {
|
||||
const isLast = pointIndex === item.cumulativePoints.length - 1;
|
||||
const y = pad.top + ch - (cumWeight / maxY) * ch;
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
if (isLast) {
|
||||
// Финальная точка: крупная, непрозрачная, с белой обводкой для контраста
|
||||
ctx.fillStyle = '#bb86fc';
|
||||
ctx.arc(x, y, 5, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
|
||||
ctx.strokeStyle = '#ffffff';
|
||||
ctx.lineWidth = 1.5;
|
||||
ctx.stroke();
|
||||
} else {
|
||||
// Промежуточные точки: полупрозрачные, поменьше
|
||||
ctx.fillStyle = 'rgba(187, 134, 252, 0.4)'; // Тот же цвет, но 40% непрозрачности
|
||||
ctx.arc(x, y, 3, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
});
|
||||
|
||||
// Опционально: провести бледную вертикальную линию от 0 до итоговой точки,
|
||||
// чтобы визуально связать подходы в один "столбик"
|
||||
if (item.cumulativePoints.length > 1) {
|
||||
const bottomY = pad.top + ch; // Ось X
|
||||
const topY = pad.top + ch - (item.totalVolume / maxY) * ch;
|
||||
|
||||
ctx.strokeStyle = 'rgba(187, 134, 252, 0.15)';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, bottomY);
|
||||
ctx.lineTo(x, topY);
|
||||
ctx.stroke();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function drawLegend(ctx, width, items) {
|
||||
ctx.font = '10px sans-serif';
|
||||
function drawLegend(ctx, width, items, y) {
|
||||
// y — базовая линия текста (легенда внизу); квадрат чуть выше текста
|
||||
ctx.font = '11px sans-serif';
|
||||
ctx.textAlign = 'left';
|
||||
let xOffset = 10;
|
||||
items.forEach(item => {
|
||||
ctx.fillStyle = item.color;
|
||||
ctx.fillRect(xOffset, 10, 10, 10);
|
||||
ctx.fillRect(xOffset, y - 9, 10, 10);
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillText(item.label, xOffset + 15, 19);
|
||||
ctx.fillText(item.label, xOffset + 15, y);
|
||||
xOffset += ctx.measureText(item.label).width + 30;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -160,8 +160,10 @@ export function renderWorkoutDetails(w) {
|
||||
}
|
||||
});
|
||||
|
||||
if (!isReadOnly && w.endTime && w.exercises.length >= 2) {
|
||||
// Тренировка завершена, но ещё не в архиве — сеты можно собрать задним числом
|
||||
if (w.endTime && w.exercises.length >= 2) {
|
||||
// Тренировка завершена (в т.ч. уже в архиве) — сеты можно собрать
|
||||
// задним числом: состав сета не меняет подходы, а после правки
|
||||
// тренировка пометится «не сохранено» и уйдёт на сервер при синке
|
||||
const groupBtn = document.createElement('button');
|
||||
groupBtn.className = 'btn btn-ghost mt-10';
|
||||
groupBtn.style.width = '100%';
|
||||
|
||||
+53
-6
@@ -263,6 +263,31 @@ function convertBackendWorkoutToFrontend(w) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Серверный состав сетов → локальные setGroups. Участники приходят как
|
||||
* sync_id упражнений тренировки; локальные id конвертируются из тех же
|
||||
* sync_id, поэтому ссылка восстанавливается по месту.
|
||||
*/
|
||||
function serverSetGroupsToLocal(w) {
|
||||
let sg = w.set_groups || [];
|
||||
if (typeof sg === "string") {
|
||||
try { sg = JSON.parse(sg); } catch { sg = []; }
|
||||
}
|
||||
if (!Array.isArray(sg)) return [];
|
||||
|
||||
const known = new Set(
|
||||
(w.workout_exercises || []).map((ex) => ex.sync_id).filter(Boolean)
|
||||
);
|
||||
|
||||
return sg
|
||||
.map((g) => ({
|
||||
id: g.sync_id || generateUUID(),
|
||||
name: g.name || "Сет",
|
||||
exerciseIds: (g.exercise_sync_ids || []).filter((sid) => known.has(sid)),
|
||||
}))
|
||||
.filter((g) => g.exerciseIds.length >= 2);
|
||||
}
|
||||
|
||||
function convertBackendWorkout(w, workoutTypeNameById) {
|
||||
const workoutSyncId = w.sync_id || generateUUID();
|
||||
|
||||
@@ -278,6 +303,7 @@ function convertBackendWorkout(w, workoutTypeNameById) {
|
||||
: "",
|
||||
notes: w.notes || "",
|
||||
synced: true,
|
||||
setGroups: serverSetGroupsToLocal(w),
|
||||
|
||||
exercises: (w.workout_exercises || []).map((ex) => {
|
||||
const exSyncId = ex.sync_id || generateUUID();
|
||||
@@ -521,10 +547,11 @@ export async function initAppData() {
|
||||
serverExercises
|
||||
);
|
||||
|
||||
// Тренировки
|
||||
const serverWorkouts = (data.workouts || []).map((w) =>
|
||||
convertBackendWorkout(w, workoutTypeNameById)
|
||||
);
|
||||
// Тренировки: серверные, которых нет в списке удалённых этим устройством
|
||||
const tombstones = new Set(Array.isArray(state.deletedWorkouts) ? state.deletedWorkouts : []);
|
||||
const serverWorkouts = (data.workouts || [])
|
||||
.map((w) => convertBackendWorkout(w, workoutTypeNameById))
|
||||
.filter((w) => !tombstones.has(w.sync_id));
|
||||
|
||||
state.workouts = mergeBySyncId(
|
||||
state.workouts || [],
|
||||
@@ -723,6 +750,18 @@ function buildWorkoutsPayload(dirty) {
|
||||
end_time: w.endTime || null,
|
||||
notes: w.notes || "",
|
||||
|
||||
// Состав сетов: участники ссылками на sync_id упражнений этой тренировки
|
||||
set_groups: (w.setGroups || []).map((g) => ({
|
||||
sync_id: g.id || null,
|
||||
name: g.name || "Сет",
|
||||
exercise_sync_ids: (g.exerciseIds || [])
|
||||
.map((id) => {
|
||||
const ex = (w.exercises || []).find((e) => e.id === id);
|
||||
return ex ? ensureSyncId(ex) : null;
|
||||
})
|
||||
.filter(Boolean),
|
||||
})),
|
||||
|
||||
workout_exercises: buildWorkoutExercisesPayload(w.exercises),
|
||||
cardio_sessions: buildCardioPayload(w.cardio),
|
||||
};
|
||||
@@ -736,8 +775,9 @@ export async function sync() {
|
||||
// тоже должны уходить на сервер (upsert по sync_id идемпотентен)
|
||||
const dirtyWorkouts = state.workouts;
|
||||
const dirtyMetrics = getDirtyMetrics(); // Новая функция
|
||||
const tombstones = Array.isArray(state.deletedWorkouts) ? state.deletedWorkouts : [];
|
||||
|
||||
if (dirtyWorkouts.length === 0 && dirtyMetrics.length === 0) {
|
||||
if (dirtyWorkouts.length === 0 && dirtyMetrics.length === 0 && tombstones.length === 0) {
|
||||
alert("Нет данных для синхронизации");
|
||||
return;
|
||||
}
|
||||
@@ -757,6 +797,7 @@ export async function sync() {
|
||||
exercises: buildExercisesPayload(),
|
||||
workouts: buildWorkoutsPayload(dirtyWorkouts),
|
||||
body_metrics: buildMetricsPayload(dirtyMetrics), // Отправляем замеры
|
||||
deleted_sync_ids: tombstones.slice(), // удалённые тренировки
|
||||
};
|
||||
|
||||
console.log("📤 Sending sync payload:", payload);
|
||||
@@ -767,6 +808,7 @@ export async function sync() {
|
||||
// Помечаем все как синхронизированные
|
||||
dirtyWorkouts.forEach(w => w.synced = true);
|
||||
dirtyMetrics.forEach(m => m.synced = true);
|
||||
state.deletedWorkouts = []; // сервер подтвердил удаления
|
||||
|
||||
saveState();
|
||||
|
||||
@@ -775,9 +817,14 @@ export async function sync() {
|
||||
}
|
||||
|
||||
const createdW = response.created?.workouts || 0;
|
||||
const updatedW = response.updated?.workouts || 0;
|
||||
const deletedW = response.deleted?.workouts || 0;
|
||||
const createdM = response.created?.body_metrics || 0;
|
||||
|
||||
let message = `Синхронизировано:\nТренировок: ${createdW}\nЗамеров: ${createdM}`;
|
||||
let message = `Синхронизировано:\nТренировок: ${createdW + updatedW}` +
|
||||
(updatedW ? ` (новых ${createdW}, обновлено ${updatedW})` : "") +
|
||||
(deletedW ? `\nУдалено: ${deletedW}` : "") +
|
||||
`\nЗамеров: ${createdM}`;
|
||||
|
||||
if (response.warnings?.length) {
|
||||
message += `\n\nПредупреждения:\n${response.warnings.join("\n")}`;
|
||||
|
||||
@@ -7,6 +7,17 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
# no-cache: браузер каждый раз сверяется по ETag — после деплоя
|
||||
# сразу видно свежие файлы, а не прогретый кэш
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
|
||||
# JS и CSS: отсутствующий файл — 404, а не index.html (иначе браузер
|
||||
# получает HTML под видом модуля и падает с непонятной ошибкой), + no-cache
|
||||
location ~* \.(js|css)$ {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri =404;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
|
||||
# Проксирование API на бэкенд
|
||||
|
||||
@@ -134,14 +134,65 @@ textarea { resize: vertical; min-height: 60px; }
|
||||
/* === Progress chart === */
|
||||
.chart-btn { flex: 0 0 auto; font-size: 0.95rem; opacity: 0.75; }
|
||||
.chart-svg { width: 100%; height: auto; display: block; margin: 8px 0 4px; }
|
||||
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
|
||||
.chart-svg circle { fill: var(--accent); stroke: var(--card-bg, #fff); stroke-width: 1.5; }
|
||||
.chart-svg circle.chart-set { fill: var(--accent); fill-opacity: 0.38; stroke: none; }
|
||||
.chart-axis { stroke: var(--border); stroke-width: 1; }
|
||||
.chart-label { font-size: 9px; fill: var(--text-secondary, #888); }
|
||||
.chart-max { fill: var(--accent); font-weight: 700; }
|
||||
.chart-label { font-size: 12px; fill: var(--text-secondary, #888); }
|
||||
/* Линия рабочего максимума и её вершины: цвет = прогресс относительно прошлого раза */
|
||||
.chart-seg { stroke-width: 4; stroke-linecap: round; }
|
||||
.chart-svg circle.chart-vert { stroke: #fff; stroke-width: 2; }
|
||||
.chart-seg.chart-up, .chart-svg circle.chart-vert.chart-up { stroke: #3ddc55; }
|
||||
.chart-seg.chart-down, .chart-svg circle.chart-vert.chart-down { stroke: #ff5a5a; }
|
||||
.chart-seg.chart-flat, .chart-svg circle.chart-vert.chart-flat { stroke: #c792ff; }
|
||||
.chart-svg circle.chart-vert.chart-up { fill: #3ddc55; }
|
||||
.chart-svg circle.chart-vert.chart-down { fill: #ff5a5a; }
|
||||
.chart-svg circle.chart-vert.chart-flat { fill: #c792ff; }
|
||||
.chart-vert-label { font-weight: 700; font-size: 15px; }
|
||||
.chart-vert-label.chart-up { fill: #3ddc55; }
|
||||
.chart-vert-label.chart-down { fill: #ff5a5a; }
|
||||
.chart-vert-label.chart-flat { fill: #c792ff; }
|
||||
.chart-up { color: #3ddc55; }
|
||||
.chart-down { color: #ff5a5a; }
|
||||
.chart-sub { font-size: 0.72rem; color: var(--text-secondary, #888); }
|
||||
.chart-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
|
||||
.chart-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.78rem; }
|
||||
.chart-date { color: var(--text-secondary, #888); flex: 0 0 auto; }
|
||||
.chart-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.chart-sets { flex: 1; min-width: 0; text-align: right; color: var(--text-secondary, #888); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.chart-val { font-weight: 600; flex: 0 0 auto; }
|
||||
.chart-count { fill: #c9c9c9; font-size: 12px; }
|
||||
.chart-date-lab { fill: #d5d5d5; font-size: 12.5px; font-weight: 600; }
|
||||
.chart-count-num { color: var(--accent); }
|
||||
/* Сводка по упражнению */
|
||||
.sum-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
|
||||
@media (min-width: 480px) { .sum-grid { grid-template-columns: repeat(3, 1fr); } }
|
||||
.sum-card { background: var(--card-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
|
||||
.sum-value { font-size: 1.05rem; font-weight: 700; }
|
||||
.sum-label { font-size: 0.72rem; color: var(--text-secondary, #888); margin-top: 2px; }
|
||||
.sum-sub { font-size: 0.68rem; color: var(--text-secondary, #888); margin-top: 2px; }
|
||||
.chart-legend-bottom { margin-top: 2px; }
|
||||
|
||||
/* Крупные кнопки под графиками и сводками — попадание в зале после подхода */
|
||||
.modal-actions-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
.big-touch {
|
||||
flex: 1;
|
||||
min-height: 56px;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.modal-fullscreen .btn-icon {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
min-width: 52px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
/* Легенда графика — крупная, над графиком (статистика записей остаётся внизу) */
|
||||
.chart-legend-top {
|
||||
font-size: 15px;
|
||||
line-height: 1.45;
|
||||
margin: 2px 2px 10px;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@ body.modal-open { overflow: hidden; }
|
||||
background: var(--surface); padding: 20px; border-radius: 16px 16px 0 0;
|
||||
width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto; animation: slideUp 0.25s;
|
||||
}
|
||||
/* График на весь экран — крупно, как в демо */
|
||||
.modal-content.modal-fullscreen {
|
||||
max-width: 100%; width: 100%; height: 100%; max-height: 100%;
|
||||
border-radius: 0; padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
|
||||
animation: fadeIn 0.2s;
|
||||
}
|
||||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||||
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
|
||||
|
||||
|
||||
@@ -2,97 +2,111 @@
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
**Gym Bro** — это легковесный, self-hosted трекер тренировок с поддержкой офлайн-режима, синхронизации и режима тренера. Без лишнего веса, только мышцы. 💪
|
||||
**Gym Bro** — легковесный self-hosted трекер тренировок с офлайн-режимом, синхронизацией и режимом тренера. Без лишнего веса, только мышцы. 💪
|
||||
|
||||
## Особенности
|
||||
## Особенности
|
||||
|
||||
* **Offline First:** Работает без интернета. Данные сохраняются локально (`localStorage`) и синхронизируются при появлении связи.
|
||||
* **Multi-user Support:** Разделение данных между пользователями (JWT Auth). Каждый видит только свои тренировки.
|
||||
* **Trainer Mode:** Режим для тренеров. Ведите несколько клиентов одновременно, присваивайте им уникальные цвета для визуального разделения.
|
||||
* **Dropsets & History:** Поддержка дроп-сетов и мгновенная подсказка истории упражнений прямо во время подхода.
|
||||
* **Body Metrics:** Гибкая система замеров тела (вес, объёмы, % жира) с историей изменений.
|
||||
* **No Build Step for Frontend:** Чистый HTML/CSS/JS. Не нужен Webpack/Vite. Просто открой файл или залей на любой static host.
|
||||
* **Single Binary Deployment:** Весь стек упакован в Docker Compose. Один командой поднимается БД, API и Веб-сервер.
|
||||
* **Offline First:** работает без интернета. Данные живут в `localStorage`, при появлении связи синхронизируются с сервером (уходят все тренировки, правки после синхронизации тоже).
|
||||
* **Multi-user:** разделение данных по пользователям (JWT + bcrypt). Каждый видит только своё.
|
||||
* **Trainer Mode:** ведение нескольких клиентов с цветовым разделением.
|
||||
* **Сеты и суперсеты:** объединение упражнений в круговые тренировки по раундам, расформирование без потери подходов.
|
||||
* **Группы вариантов упражнения:** «Жим гантелей 30» и «Жим гантелей 45» — один справочник, общая история и общий график прогрессии.
|
||||
* **История в момент подхода:** в модалке веса видны последние тренировки с датами, номерами подходов и дроп-сетами; шаг степпера подстраивается под рабочий вес.
|
||||
* **Дашборд и графики:** статистика по объёму, подходу за тренировку, 📈 график прогрессии по каждому упражнению.
|
||||
* **Body Metrics:** замеры тела (вес, объёмы) с типами и историей.
|
||||
* **Без сборки фронтенда:** чистый HTML/CSS/JS (ES-модули). Никакого Webpack/Vite.
|
||||
* **Docker Compose:** весь стек — API, статика и nginx-прокси — одной командой.
|
||||
|
||||
## 🛠 Технологии
|
||||
## Технологии
|
||||
|
||||
* **Backend:** Python 3.11, FastAPI, SQLAlchemy, SQLite, PyJWT, Bcrypt.
|
||||
* **Frontend:** Vanilla JavaScript (ES Modules), CSS Variables, No Frameworks.
|
||||
* **Infrastructure:** Docker, Nginx (as reverse proxy & static server).
|
||||
* **Backend:** Python 3.11+, FastAPI, SQLAlchemy, SQLite, PyJWT, bcrypt.
|
||||
* **Frontend:** Vanilla JavaScript (ES Modules), CSS Variables.
|
||||
* **Инфраструктура:** Docker, nginx (статика + реверс-прокси `/api` → backend).
|
||||
|
||||
## 🚀 Быстрый старт (Docker)
|
||||
## Быстрый старт (Docker)
|
||||
|
||||
### Требования
|
||||
* Docker Engine
|
||||
* Docker Compose Plugin
|
||||
Требования: Docker Engine + Compose plugin.
|
||||
|
||||
### Установка
|
||||
|
||||
1. Клонируйте репозиторий:
|
||||
```bash
|
||||
git clone https://github.com/your-username/gym-bro.git
|
||||
cd gym-bro
|
||||
```
|
||||
|
||||
2. Настройте секреты (опционально, для продакшена обязательно):
|
||||
``` bash
|
||||
cp .env.example .env
|
||||
# Отредактируйте .env, замените JWT_SECRET на длинную случайную строку
|
||||
```
|
||||
|
||||
3. Соберите и запустите:
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
4. Откройте браузер:
|
||||
```text
|
||||
http://localhost
|
||||
```
|
||||
|
||||
5. Зарегистрируйтесь и начинайте качаться!
|
||||
|
||||
### 📂 Структура проекта
|
||||
|
||||
``` text
|
||||
gym-bro/
|
||||
├── backend/ # FastAPI приложение
|
||||
│ ├── routers/ # API эндпоинты
|
||||
│ ├── models.py # SQLAlchemy модели
|
||||
│ ├── schemas.py # Pydantic схемы
|
||||
│ ├── auth.py # Логика JWT/Bcrypt
|
||||
│ └── Dockerfile
|
||||
├── frontend/ # Статические файлы
|
||||
│ ├── js/ # ES модули логики
|
||||
│ ├── styles/ # CSS
|
||||
│ ├── index.html # Точка входа
|
||||
│ ├── nginx.conf # Конфиг прокси
|
||||
│ └── Dockerfile
|
||||
├── data/ # Volume для SQLite (не коммитится!)
|
||||
├── docker-compose.yml
|
||||
└── README.md
|
||||
```bash
|
||||
git clone https://git.iovchinnikov.ru/ivan-igorevich/gym-bro.git
|
||||
cd gym-bro
|
||||
cp .env.example .env # заменить JWT_SECRET на длинную случайную строку (обязательно для прода)
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
### 🔐 Безопасность
|
||||
- Пароли хэшируются с помощью bcrypt.
|
||||
- Сессии управляются через JWT токены (HttpOnly cookie опция планируется).
|
||||
- Все данные изолированы по owner_id на уровне БД.
|
||||
- Внимание: Для продакшена обязательно измените JWT_SECRET в .env файле.
|
||||
Открыть `http://localhost` (или `http://<IP сервера>`), зарегистрироваться — и качаться.
|
||||
|
||||
### 🤝 Вклад
|
||||
Pull requests приветствуются!
|
||||
1. Форкните проект.
|
||||
2. Создайте ветку feature/amazing-feature.
|
||||
3. Коммитьте изменения.
|
||||
4. Пушьте в GitHub.
|
||||
5. Открывайте Pull Request.
|
||||
* Если порт 80 на сервере занят существующим nginx: `APP_PORT=8080 docker compose up -d`.
|
||||
* База SQLite лежит в `./data/gym.db` (bind-mount, переживает пересоздание контейнеров). Есть рабочая база с другой установки — положить её в `data/gym.db` до первого запуска.
|
||||
* Фронтенд обращается к API относительно себя (`/api`), поэтому браузерная часть работает с любым хостом без правок. Для мобильного клиента адрес можно переопределить: `localStorage.setItem('gym_api_base', 'http://<сервер>/api')`.
|
||||
|
||||
### 📄 Лицензия
|
||||
MIT License.
|
||||
## Локальная разработка (без Docker)
|
||||
|
||||
----
|
||||
```bash
|
||||
python3 -m venv .venv && .venv/bin/pip install -r backend/requirements.txt
|
||||
cd backend && ../.venv/bin/uvicorn main:app --reload --port 8000
|
||||
```
|
||||
|
||||
Фронтенд — любой статический сервер:
|
||||
|
||||
```bash
|
||||
python3 -m http.server 8777 -d frontend
|
||||
```
|
||||
|
||||
Открыть `http://127.0.0.1:8777/demo.html` (готовый стенд с демо-данными и локальным адресом API) или `index.html`, предварительно указав API:
|
||||
|
||||
```js
|
||||
localStorage.setItem('gym_api_base', 'http://127.0.0.1:8000');
|
||||
```
|
||||
|
||||
Смоук-тест логики: `node smoke.test.mjs`.
|
||||
|
||||
## Структура проекта
|
||||
|
||||
```text
|
||||
gym-bro/
|
||||
├── backend/ # FastAPI приложение
|
||||
│ ├── routers/ # auth, workouts, exercises, metrics, sync, clients…
|
||||
│ ├── models.py # SQLAlchemy-модели
|
||||
│ ├── schemas.py # Pydantic-схемы
|
||||
│ ├── auth.py # JWT + bcrypt
|
||||
│ ├── requirements.txt
|
||||
│ └── Dockerfile
|
||||
├── frontend/ # статика (ES-модули, без сборки)
|
||||
│ ├── js/ # app.js, state.js, sync.js, logic/, modals/, render/
|
||||
│ ├── styles/
|
||||
│ ├── index.html # точка входа
|
||||
│ ├── demo.html # демо-страница для локального тестирования
|
||||
│ ├── nginx.conf # раздача статики + прокси /api
|
||||
│ └── Dockerfile
|
||||
├── sql/ # схема БД
|
||||
├── data/ # SQLite (не коммитится)
|
||||
├── docker-compose.yml
|
||||
└── .env.example # JWT_SECRET
|
||||
```
|
||||
|
||||
## Переменные окружения backend
|
||||
|
||||
| Переменная | По умолчанию | Назначение |
|
||||
|---|---|---|
|
||||
| `GYM_DB_PATH` | `./gym.db` | путь к SQLite; в compose — `/data/gym.db` |
|
||||
| `GYM_JWT_SECRET` | dev-заглушка | секрет подписи JWT, **обязательно сменить в проде** |
|
||||
| `GYM_JWT_EXPIRE_DAYS` | 30 | срок жизни токена |
|
||||
|
||||
## Безопасность
|
||||
|
||||
* Пароли — bcrypt-хэши, в БД только они.
|
||||
* Сессии — JWT (`Authorization: Bearer …`), изоляция данных по `owner_id` на уровне запросов.
|
||||
* Для продакшена обязательно задать длинный случайный `JWT_SECRET` (менее 32 байт — предупреждение от PyJWT) и закрыть HTTPS на внешнем nginx.
|
||||
|
||||
## Репозитории
|
||||
|
||||
* `iovi` — основной: <https://git.iovchinnikov.ru/ivan-igorevich/gym-bro>
|
||||
* `origin` — зеркало: <https://gitlab.com/ivan-igorevich/gym-bro>
|
||||
|
||||
---
|
||||
Made with ❤️ and heavy weights by ivan-igorevich
|
||||
|
||||
Reference in New Issue
Block a user