TPTIP-4: сохранить калькулятор после пропуска статического мастера
This commit is contained in:
parent
2ba7bb488c
commit
2156ed1b20
11
index.html
11
index.html
@ -1278,12 +1278,21 @@ function goalChips(get, set) {
|
||||
|
||||
function viewSettings() {
|
||||
const s = db.settings;
|
||||
let goal = s.goal;
|
||||
const calc = calcFields(s.profile), norms = normFields(s);
|
||||
const calcNote = h('div', { class: 'small muted' });
|
||||
const themeSel = selectField('Тема', [['auto', 'Как в системе'], ['light', 'Светлая'], ['dark', 'Тёмная']], s.theme, ev => { s.theme = ev.target.value; save(); applyTheme(); });
|
||||
const fileIn = h('input', { type: 'file', accept: 'application/json,.json', hidden: true, onchange: onImport });
|
||||
const catalog = (title, items, del) => h('div', { class: 'card' }, h('h3', null, title),
|
||||
items.length ? items.map(x => h('div', { class: 'item' }, h('div', { class: 'main' }, x.label), h('button', { class: 'ghost icon', 'aria-label': 'Удалить ' + x.label, onclick: () => confirmBox('Убрать «' + x.label + '» из справочника? Записи в дневнике останутся.', 'Убрать', () => { del(x); save(); render(); }) }, '🗑'))) : h('div', { class: 'empty' }, 'Справочник пуст'));
|
||||
return h('div', null,
|
||||
h('div', { class: 'card' }, h('a', { href: '/?lang=' + (new URLSearchParams(location.search).get('lang') || 'ru') }, window.TPTProfileText || '')),
|
||||
...(window.TPTProfile ? [h('div', { class: 'card' }, h('a', { href: '/?lang=' + (new URLSearchParams(location.search).get('lang') || 'ru') }, window.TPTProfileText))] : [
|
||||
h('div', { class: 'card' }, h('h3', null, 'Цель'), h('div', { style: 'margin-top:8px' }, goalChips(() => goal, k => { goal = k; }))),
|
||||
h('div', { class: 'card' }, h('h3', null, 'Калькулятор нормы'), h('p', { class: 'small muted' }, 'Формула Миффлина–Сан Жеора. Результат можно поправить вручную ниже.'), calc.el,
|
||||
h('button', { onclick: () => { const p = calc.read(); if (!p) return; const n = suggestNorms(goal, p); norms.fill(n); calcNote.textContent = 'Базовый обмен ' + mifflin(p).bmr + ' ккал, с активностью ' + mifflin(p).tdee + ' ккал. Нормы подставлены ниже — нажмите «Сохранить».'; } }, 'Рассчитать'), calcNote),
|
||||
h('div', { class: 'card' }, h('h3', null, 'Нормы в день'), norms.el,
|
||||
h('button', { class: 'primary', style: 'width:100%', onclick: () => { const n = norms.read(), p = calc.read(); if (!n || !p) return; Object.assign(s, n, { goal, profile: p }); save(); render(); toast('Настройки сохранены'); } }, 'Сохранить'))
|
||||
]),
|
||||
h('div', { class: 'card' }, themeSel),
|
||||
planCard(), remindersCard(), installCard(),
|
||||
h('div', { class: 'card stack' }, h('h3', null, 'Данные'),
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
// TPTIP-33: главный экран на телефоне 375 px сразу после мастера.
|
||||
const { test, expect } = require('@playwright/test');
|
||||
|
||||
test.use({ viewport: { width: 375, height: 740 }, locale: 'ru-RU' });
|
||||
test.use({ baseURL: 'http://127.0.0.1:3094', viewport: { width: 375, height: 740 }, locale: 'ru-RU' });
|
||||
|
||||
async function passWizard(page) {
|
||||
await page.goto('/');
|
||||
await page.locator('.sheet select').first().selectOption('m');
|
||||
await page.locator('.sheet select').last().selectOption('1.375');
|
||||
const fields = page.locator('.sheet input');
|
||||
for (const [i, value] of ['40', '170', '65'].entries()) await fields.nth(i).fill(value);
|
||||
await page.getByRole('button', { name: 'Далее', exact: true }).click();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user