Simplify: token-ify hardcoded colors, remove redundant Big ternary, guard no-op shift-click

- Replace 5 hardcoded #2C2C2C/#555550/#888880 literals with var(--pico-color),
  var(--color-label), var(--pico-muted-color); add --color-label token to :root
- Remove inline Big(inputValue) ternary in results derived — convert.ts already
  handles same-unit identity via its own from.id === to.id guard
- Drop now-unused Big import from +page.svelte
- Guard onshiftclick in ConversionResult: no-op when tile is already the from-unit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Falkan
2026-03-16 22:07:37 -04:00
parent d22885b708
commit d9489a5db2
3 changed files with 13 additions and 12 deletions

View File

@@ -2,7 +2,6 @@
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { Big } from 'big.js';
import { florpUnits } from '$lib/units/definitions';
import { convertById } from '$lib/convert';
import { FRACTIONAL_DIGITS } from '$lib/config';
@@ -43,13 +42,12 @@
}
// ── Derived: results for ALL units in definition order ─────────────────────
// convert.ts already handles the same-unit identity (from.id === to.id → return value),
// so no special-casing needed here for the from-unit.
let results = $derived<ResultItem[]>(
units.map((u) => ({
unit: u,
convertedValue:
u.id === fromUnitId
? Big(inputValue) // from-unit always equals inputValue
: convertById(inputValue, fromUnitId, u.id, units)
convertedValue: convertById(inputValue, fromUnitId, u.id, units)
}))
);