Chart zoom 2x faster, chart padding, clearer food cost format

Charts:
- Zoom speed: 0.02 -> 0.04 (all 5 chart instances)
- stats-chart-block: added padding 0 14px to match content margins

Food cost of workout:
- Was: "1.8 x Хлеб (102г, 273 кк)" — ambiguous "1.8 x"
- Now: "1.8 порц. Хлеб (по 102г, 273 кк/порц.)" — clear units
- Header: "485 ккал — это как:" instead of "485 ккал ="
- Math: 485/273 = 1.78 portions of 102g each

Duplicates: seed DB has none (verified). Device dupes from pre-dedup
imports — JS migration handles them on next launch.
This commit is contained in:
4aiman 2026-06-01 13:51:47 +03:00
commit 45d3736a99
2 changed files with 8 additions and 7 deletions

View file

@ -1642,6 +1642,7 @@ select {
/* Stats charts */
.stats-chart-block {
margin-bottom: 16px;
padding: 0 14px;
}
.stats-period {
display: flex;

View file

@ -511,7 +511,7 @@ async function renderStatsCharts(container, days, foodTotals, bmr) {
legend: { display: false },
zoom: {
zoom: {
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.02 },
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.04 },
pinch: { enabled: true },
mode: "x",
onZoomStart: ({chart, event}) => {
@ -642,7 +642,7 @@ async function renderStatsCharts(container, days, foodTotals, bmr) {
},
zoom: {
zoom: {
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.02 },
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.04 },
pinch: { enabled: true },
mode: "x",
onZoomStart: ({chart, event}) => {
@ -760,7 +760,7 @@ async function renderStatsCharts(container, days, foodTotals, bmr) {
},
zoom: {
zoom: {
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.02 },
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.04 },
pinch: { enabled: true },
mode: "x",
onZoomStart: ({chart, event}) => {
@ -2959,7 +2959,7 @@ async function showSessionDetail(sessionId) {
legend: { display: false },
zoom: {
zoom: {
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.02 },
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.04 },
pinch: { enabled: true },
mode: "x",
limits: { x: { minRange: 0.5 } },
@ -3009,7 +3009,7 @@ async function showSessionDetail(sessionId) {
legend: { display: false },
zoom: {
zoom: {
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.02 },
wheel: { enabled: true, modifierKey: "ctrl", speed: 0.04 },
pinch: { enabled: true },
mode: "x",
limits: { x: { minRange: 0.5 } },
@ -3223,11 +3223,11 @@ async function showSessionDetail(sessionId) {
// Take first 3, build readable string
const display = parts.slice(0, 3);
const lines = display.map(p =>
`${p.portions} x ${esc(p.name)}${p.amountStr ? " (" + p.amountStr + ", " + p.servingKcal + " кк)" : ""}`
`${p.portions} порц. ${esc(p.name)} (по ${p.amountStr || "?"}, ${p.servingKcal} кк/порц.)`
);
costSection.style.display = "";
costEl.innerHTML = `<div class="food-cost-total">${Math.round(sessionKcal)} ккал =</div>
costEl.innerHTML = `<div class="food-cost-total">${Math.round(sessionKcal)} ккал — это как:</div>
<div class="food-cost-items">${lines.map(l => `<div class="food-cost-line">${l}</div>`).join('<div class="food-cost-or">или</div>')}</div>`;
} catch (e) { console.error("[food-cost]", e); }
}, 600);