@ -667,8 +667,8 @@ function viewToday() {
return h('div', null, dateNav(),
return h('div', null, dateNav(),
h('div', { class: 'card' },
h('div', { class: 'card' },
h('div', { class: 'rings' },
h('div', { class: 'rings' },
ring('Калории', t.kcal, s.kcal, 'ккал', 'var(--kcal)'), ring('Белки', t.protein, s.protein, 'г ', 'var(--prot)'),
ring('Калории', t.kcal, s.kcal, 'ккал', 'var(--kcal)'), ring('Белки', t.protein, s.protein, 'г белка ', 'var(--prot)'),
ring('Жиры', t.fat, s.fat, 'г ', 'var(--fat)'), ring('Углеводы', t.carbs, s.carbs, 'г ', 'var(--carb)'), ring('Вода', t.water, s.water, 'мл', 'var(--water)')),
ring('Жиры', t.fat, s.fat, 'г жиров ', 'var(--fat)'), ring('Углеводы', t.carbs, s.carbs, 'г углеводов ', 'var(--carb)'), ring('Вода', t.water, s.water, 'мл воды ', 'var(--water)')),
h('div', { class: 'row', style: 'justify-content:center;margin-top:10px' },
h('div', { class: 'row', style: 'justify-content:center;margin-top:10px' },
t.water > 0 ? h('button', { class: 'chip minus', 'aria-label': 'Убрать 250 мл воды', onclick: removeLastWater }, '− 250') : null,
t.water > 0 ? h('button', { class: 'chip minus', 'aria-label': 'Убрать 250 мл воды', onclick: removeLastWater }, '− 250') : null,
h('button', { class: 'chip on', onclick: () => addWater(250) }, '+250 мл воды')),
h('button', { class: 'chip on', onclick: () => addWater(250) }, '+250 мл воды')),
@ -1135,9 +1135,9 @@ function viewStats() {
function calcFields(pr, hints) {
function calcFields(pr, hints) {
hints = hints || {};
hints = hints || {};
const sex = selectField('Пол', [['m', 'Мужской'], ['f', 'Женский']], pr.sex);
const sex = selectField('Пол', [['m', 'Мужской'], ['f', 'Женский']], pr.sex);
const age = numField('Возраст, лет', { value: pr.age, placeholder: hints.age, required: true, int: true, min: 10, max: 100 });
const age = numField('Возраст, лет', { value: pr.age, placeholder: hints.age, required: true, int: true, min: 10, max: 100, hint: 'От 10 до 100 лет' });
const height = numField('Рост, см', { value: pr.height, placeholder: hints.height, required: true, min: 100, max: 250 });
const height = numField('Рост, см', { value: pr.height, placeholder: hints.height, required: true, min: 100, max: 250, hint: 'От 100 до 250 см' });
const weight = numField('В е с , кг', { value: pr.weight, placeholder: hints.weight, required: true, min: 25, max: 400 });
const weight = numField('В е с , кг', { value: pr.weight, placeholder: hints.weight, required: true, min: 25, max: 400, hint: 'От 25 до 400 кг' });
const act = selectField('Активность', ACTIVITY, pr.activity);
const act = selectField('Активность', ACTIVITY, pr.activity);
return {
return {
el: h('div', null, h('div', { class: 'grid2' }, sex, age), h('div', { class: 'grid2' }, height, weight), act),
el: h('div', null, h('div', { class: 'grid2' }, sex, age), h('div', { class: 'grid2' }, height, weight), act),
@ -1264,7 +1264,7 @@ function startWizard() {
const body = h('div');
const body = h('div');
let close;
let close;
const step1 = () => body.replaceChildren(
const step1 = () => body.replaceChildren(
h('p', { class: 'muted' }, 'Шаг 1 из 2. Выберите цель и укажите данные — мы посчитаем дневные нормы .'),
h('p', { class: 'muted' }, 'Шаг 1 из 2. Выберите цель и укажите данные. Н а втором шаге вы увидите свои дневные нормы и сможете их поправить .'),
goalChips(() => goal, k => { goal = k; }), h('div', { style: 'height:8px' }), calc.el,
goalChips(() => goal, k => { goal = k; }), h('div', { style: 'height:8px' }), calc.el,
h('div', { class: 'foot' }, h('button', { class: 'primary', onclick: () => { const p = calc.read(); if (!p) return; db.settings.goal = goal; db.settings.profile = p; step2(p); } }, 'Далее')));
h('div', { class: 'foot' }, h('button', { class: 'primary', onclick: () => { const p = calc.read(); if (!p) return; db.settings.goal = goal; db.settings.profile = p; step2(p); } }, 'Далее')));
const step2 = p => {
const step2 = p => {