feat: Enter to save, Escape to discard, auto-save on unit/group selection

- selectUnit/selectGroup now async; call autoSaveCurrentForm before switching
- Enter in any form field (except textarea) triggers save
- Escape restores form to snapshot (discards unsaved changes)
- discardUnitForm/discardGroupForm helpers for snapshot restore
This commit is contained in:
Falkan
2026-03-18 19:42:56 -04:00
parent 554b5ba079
commit 1204ede140
2 changed files with 65 additions and 20 deletions

View File

@@ -2,68 +2,69 @@
"units": [
{
"id": "pound",
"label": "Pound",
"labelPlural": "Pounds",
"label": "pound",
"labelPlural": "pounds",
"symbol": "lb",
"group": "dickloads",
"toBase": 0.038
},
{
"id": "dickload",
"label": "Dickload",
"labelPlural": "Dickloads",
"label": "dickload",
"labelPlural": "dickloads",
"symbol": "dl",
"group": "dickloads",
"toBase": 1
},
{
"id": "barrel",
"label": "Barrel",
"labelPlural": "Barrels",
"label": "barrel",
"labelPlural": "barrels",
"symbol": "bbl",
"group": "dickloads",
"toBase": 19
},
{
"id": "hogshead",
"label": "Hogshead",
"labelPlural": "Hogsheads",
"label": "hogshead",
"labelPlural": "hogsheads",
"symbol": "hhd",
"group": "dickloads",
"toBase": 38
},
{
"id": "short-ton",
"label": "Short ton",
"labelPlural": "Short tons",
"label": "short ton",
"labelPlural": "short tons",
"symbol": "t",
"group": "dickloads",
"toBase": 76
},
{
"id": "fuckton",
"label": "Fuck ton",
"labelPlural": "Fucktons",
"label": "fuck ton",
"labelPlural": "fuck tons",
"symbol": "fcktn",
"group": "dickloads",
"toBase": 152
},
{
"id": "long-ton",
"label": "Long ton",
"labelPlural": "Long tons",
"label": "long ton",
"labelPlural": "long tons",
"symbol": "long tn",
"group": "dickloads",
"toBase": 85.1199999999
"toBase": 85.1199999999,
"hidden": false
},
{
"id": "metric-fuckton",
"label": "Metric fuckton",
"labelPlural": "Metric fucktons",
"label": "metric fuckton",
"labelPlural": "metric fucktons",
"symbol": "mfcktn",
"group": "dickloads",
"toBase": 170.2399999998,
"description": "Trivia: although the name is \"metric fuckton,\" it is actually equal to two long tons!",
"description": "Trivia: although the name is \"metric fuckton,\" it is actually equal to two {long-ton:plural}!",
"hidden": false
},
{