diff --git a/frontend/js/render/dashboard-screen.js b/frontend/js/render/dashboard-screen.js index 38de9b2..b667450 100644 --- a/frontend/js/render/dashboard-screen.js +++ b/frontend/js/render/dashboard-screen.js @@ -2,8 +2,9 @@ import { state } from '../state.js'; import { escapeHtml } from '../utils.js'; -import { drawExerciseProgress, drawBodyMetricsGraph } from './dashboard.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'; @@ -22,16 +23,16 @@ export function renderDashboard() {

💪 Прогресс упражнения

- ${getUniqueExercises().map(ex => ``).join('')}
- -
- +
+ +
-

Главное — рабочий максимум «вес × повторы»: зелёный — прогресс (вес выше или тот же вес и больше повторов), красный — откат. Тусклые точки — остальные подходы, «×N» — их число. Последние 10 тренировок.

+

Главное — рабочий максимум «вес × повторы»: зелёный — прогресс (вес выше или тот же вес и больше повторов), красный — откат. Тусклые точки — остальные подходы, «×N» — их число.

@@ -57,20 +58,15 @@ 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) { alert('Сначала выберите упражнение'); return; } localStorage.setItem(CHART_EX_KEY, select.value); - 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); - } + showChartDialog(select.value); }, showExSummary: () => { const select = document.getElementById('dash-ex-select');