Commit Graph

38 Commits

Author SHA1 Message Date
yaroslav k
1f3184baf6 undo: header buttons, shortcuts, wiring
- App provides HistoryHandle as context (both build modes; stacks stay
  empty on the server) and passes it to persist::init_hydrated
- persist: init_hydrated starts undo tracking after the localStorage
  load (first captured state = saved state, not mock); clear_all and
  apply_import call undo::before_replace so they are undoable
- header: Отменить/Вернуть buttons with disabled states driven by the
  reactive stack depths; Ctrl+Z / Ctrl+Shift+Z / Ctrl+Y via a window
  keydown listener that skips editable targets (browser owns those)
- SCSS: disabled control buttons dim out
2026-08-16 12:31:22 +03:00
yaroslav k
99ccb0cdc7 undo: snapshot history engine (state::undo)
- History: capped undo/redo stacks of whole Dashboard clones; a pending
  pre-burst snapshot becomes a real undo step when the tracking effect's
  settle timer fires (1 s of quiet) — one undo step per edit burst
- undo/redo consume the pending burst first, so a fresh edit is
  undoable before it settles; a new edit clears the redo branch
- suppress flag: wholesale replacements (Clear, import) flush the
  pending burst, push the current state, and mark their own write as
  non-capturable — Clear and import are undoable themselves
- HistoryHandle is Copy (RwSignal fields): context-friendly (Send+Sync)
  and safe to capture in view closures under edition-2024 rules
- no std::time::Instant: it panics on wasm32-unknown-unknown; the
  browser timer is the only clock
- 9 unit tests: burst coalescing, redo, cap, flush order, suppress
2026-08-16 12:31:17 +03:00
yaroslav k
b9a399be64 header: Save/Load/Clear buttons wired to persistence
Save downloads dashboard.json, Load opens a file picker and imports
through apply_import with errors reported in the modal, Clear asks for
confirmation then wipes to Dashboard::blank(). App provides the store
and ModalState and mounts the modal; init_hydrated starts autosave.
2026-08-16 11:28:19 +03:00
yaroslav k
0c2eda7621 modal: in-app dialog for confirms and import errors
ModalState carries title/message/action as RwSignals; the action is
read at click time so a late confirm wins. Overlay click and Cancel
close; the confirm button runs the stored action. Edition-2024 note:
method calls on non-Copy captures move by value inside nested move
closures, so handlers touch state.open/state.action fields directly.
2026-08-16 11:28:19 +03:00
yaroslav k
043977cc1f persist: localStorage autosave + JSON export/import engine
- STORAGE_KEY aex.dashboard, 500 ms debounced autosave via store.track()
- deferred load after hydration keeps SSR markup authoritative
- parse_dashboard version-checks the file (the migration hook), errors
  are RU messages via ImportError (thiserror)
- clear writes the blank dashboard back so a reload stays blank
- export_download builds a Blob URL and revokes it after the click
- 5 unit tests: round trip, blank, garbage, newer and older versions
2026-08-16 11:28:19 +03:00
yaroslav k
f3b0ceb3e7 derive serde on all persisted entities; add Settings.version and Dashboard::blank
Store and serde derives coexist on all 23 dashboard types (prototype
confirmed). Settings carries the saved-format version (1) as the
migration hook anchor; Dashboard::blank() is the post-Clear empty
campaign. mock() now builds Settings via Default.
2026-08-15 15:14:43 +03:00
yaroslav k
6a07bd668d clear all compiler warnings
Remove unused imports (nav, sidebar, state, mock, inventory, item,
numput), the unused qty closure, the unused #![feature] gate, and a
module-scoped allow(dead_code) for the unmounted search stubs.
2026-08-15 14:56:57 +03:00
yaroslav k
444f046990 replace lazy_static with std::sync::LazyLock; commit Cargo.lock
lazy_static removed from Cargo.toml (the only dependency removal for
now, per decision). ITEMS_REFS/ITEMS_NAMES are now LazyLock statics; the
duplicate foundry.json load is dropped and the no-op HashMap roundtrip
is gone. Cargo.lock is now tracked: the app is a binary and builds
should be reproducible.
2026-08-15 14:56:54 +03:00
yaroslav k
257f254b13 document every function, trait and struct in src/
Doc comments on all modules, components, entities, helpers and type
aliases; larger comments on the important entities (Dashboard, PlayerData,
Context, App, Numput, item data). No behavior changes.
2026-08-04 09:21:25 +03:00
YK
6c7ba86018 item rendering, custom numput components 2025-09-23 15:44:06 +03:00
YK
38c6c7bb78 <Inventory/> component, basic markup + styles, balance (with <Numput>) 2025-09-20 11:08:03 +03:00
YK
0620207877 basic routing, <Nav> component 2025-09-20 11:06:39 +03:00
YK
ae1193e6ce proper import spacing 2025-09-20 11:04:51 +03:00
YK
c54ca148f5 Numput component: custom number <input /> with relative value changes 2025-09-20 11:02:11 +03:00
YK
94befe3cd1 feature flag 2025-09-20 11:00:16 +03:00
YK
63da2898e1 reorder services 2025-09-20 11:00:10 +03:00
YK
2e742629dd InventoryKind entity definition and Display impl 2025-09-20 10:59:52 +03:00
YK
ce0365963a add missing component 2025-09-13 17:02:00 +03:00
YK
4b45e33cea refactor: extract all sidebar blocks into separate modules/components 2025-09-13 16:54:10 +03:00
YK
17fba36476 chore: add entities generated fields to prelude, fix imports / # 2025-09-13 16:53:48 +03:00
YK
05563c18ec sidebar part 4: spell slot block 2025-09-13 16:28:44 +03:00
YK
8f1ec42e48 dst reset button functionality 2025-09-13 12:58:15 +03:00
YK
809e13ce06 fix heading 2025-09-13 12:48:40 +03:00
YK
4e232e97e0 sidebar part 3: death save throws block 2025-09-13 12:48:01 +03:00
YK
697e7db055 make return type for closure explicit 2025-09-13 12:47:16 +03:00
YK
1c0c0a2b5f sidebar part 2: hit dice block 2025-09-13 11:53:59 +03:00
YK
9a820583a7 set min field on number inputs 2025-09-13 10:09:42 +03:00
YK
f13db5cd9f update entities defs 2025-09-13 10:09:20 +03:00
YK
37f2232af1 sidebar part 1: character image, name, class, level, xp, hp 2025-09-12 11:44:55 +03:00
YK
9c211d46de remove debug code, fix <input> tag 2025-09-12 10:21:25 +03:00
YK
58879c7463 update entity defs, Name struct, mock data updated 2025-09-12 10:20:59 +03:00
YK
ec1bc78fdf update entities defs 2025-09-12 08:08:03 +03:00
YK
b8e9ddcdaf feat: header with campaign image, name, session #, current date and (not yet functional nor properly styled) buttons 2025-09-12 07:23:09 +03:00
YK
57f0b29d5c update entities defs 2025-09-12 07:22:18 +03:00
YK
73963f5b2e component structure changes 2025-09-12 00:44:46 +03:00
YK
6d6956592d update Note entity; re-generate mock data 2025-09-12 00:44:31 +03:00
YK
b09dcb5fc1 csr version imported 2025-09-11 10:27:57 +03:00
YK
2a1fb81567 initial commit: ssr 2025-09-11 08:43:59 +03:00