Weights can show two decimals, for quarter plates and microplates (#139)

A per-side figure off kg plates lands on .25 and .75, and one decimal reported those as .3 and
.8 — close enough to be wrong, and no use at all to anyone loading microplates.

Settings carries the choice and lib/format.js reads it the way it already reads the date
locale, so all sixty-odd places that print a weight follow without being touched. It only ever
shows precision that is already in the number: a whole number still prints whole, 62.5 is 62.5
either way, and nothing about what is stored or how it rounds changes.
This commit is contained in:
Duarte Santos committed 2026-09-20 21:04:56 +02:00
1 parent 22c2ff9d2c
commit ae1c8fe8b2
5 files changed
+64 -2

No files matched your search

+3 -1
View File
@@ -3,7 +3,7 @@ import { HashRouter, Routes, Route, Navigate, useNavigate, useLocation, useNavig
import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { bindUI } from './components/ui.jsx'
import { ACCENTS } from './lib/format.js'
import { ACCENTS, setWeightDecimals } from './lib/format.js'
import { setLang, useLang } from './lib/i18n.js'
import { setPlayOnSilent } from './lib/sound.js'
import { setNav } from './lib/nav.js'
@@ -81,6 +81,8 @@ function Shell() {
return () => mql.removeEventListener('change', onChange)
}, [S.theme, S.accent])
useEffect(() => { setLang(S.lang || 'en') }, [S.lang])
// Same shape as the language: a module-level display setting, pushed when it changes (#139).
useEffect(() => { setWeightDecimals(S.wdec) }, [S.wdec])
useEffect(() => { document.documentElement.lang = S.lang || 'en' }, [langV, S.lang])
// Forward navigation starts at the top; going back lands where you left off.
// The position is recorded from scroll events rather than read at route