integrated front and back
This commit is contained in:
+8
-7
@@ -16,6 +16,7 @@ import './modals/exercise-modal.js';
|
||||
import './modals/set-modal.js';
|
||||
import './modals/cardio-modal.js';
|
||||
import './modals/metrics-modal.js';
|
||||
import './modals/client-select-modal.js';
|
||||
import './modals/edit-exercise-modal.js';
|
||||
import './modals/edit-workout-date-modal.js';
|
||||
|
||||
@@ -23,12 +24,12 @@ function renderHeader() {
|
||||
const modeLabel = state.mode === 'trainer' ? '👨🏫 Тренер' : '👤 Личный';
|
||||
document.getElementById('app-header').innerHTML = `
|
||||
<div>
|
||||
<h2>Gym Tracker <span style="font-size:0.8rem; color:var(--text-secondary); font-weight:400;">(${modeLabel})</span></h2>
|
||||
<h2>Gym Bro <span style="font-size:0.8rem; color:var(--text-secondary); font-weight:400;">(${modeLabel})</span></h2>
|
||||
<div id="sync-status" class="sync-status">● Локально</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button class="icon-btn header-btn" onclick="App.toggleMode()" title="Сменить режим">🔄</button>
|
||||
<button class="icon-btn header-btn" onclick="ML.showBodyMetrics()" title="Замеры">📏</button>
|
||||
<button class="icon-btn header-btn" onclick="ML.showBodyMetrics()" title="Личные замеры">📏</button>
|
||||
<button class="icon-btn header-btn" onclick="SettingsLogic.show()" title="Настройки">⚙️</button>
|
||||
<button class="btn btn-small btn-secondary" onclick="AppSync.sync()" title="Синхронизация">🔄</button>
|
||||
</div>
|
||||
@@ -45,20 +46,20 @@ async function init() {
|
||||
await initAppData();
|
||||
}
|
||||
|
||||
// Глобальные хелперы
|
||||
window.App = {
|
||||
getWorkout: (id) => state.workouts.find(w => w.id === id),
|
||||
saveAndRender: () => { saveState(); },
|
||||
toggleMode: () => {
|
||||
state.mode = state.mode === 'personal' ? 'trainer' : 'personal';
|
||||
state.currentClientId = state.mode === 'personal' ? null : state.currentClientId;
|
||||
saveState();
|
||||
renderHeader();
|
||||
renderMainScreen();
|
||||
alert(`Режим изменён на: ${state.mode === 'trainer' ? 'Тренер' : 'Личный трекер'}`);
|
||||
}
|
||||
},
|
||||
backToMain: () => renderMainScreen(),
|
||||
};
|
||||
window.AppSync = { sync };
|
||||
window.App.backToMain = () => renderMainScreen();
|
||||
|
||||
// Делаем renderMainScreen доступным глобально
|
||||
window.renderMainScreen = renderMainScreen;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
|
||||
Reference in New Issue
Block a user