generated from nhcarrigan/template
fix: persist UI preferences across navigation and sessions (#48)
## Summary - **#35** — Adventure multiplier selection is now persisted in `localStorage` (`"elysium_batch_size"`). The chosen batch size is restored automatically on the next visit, with a graceful fallback to `1` for missing or unrecognisable values. - **#36** — Zone selection in the boss panel and quest panel is now persisted in `sessionStorage` (`"elysium_boss_zone"` / `"elysium_quest_zone"`). The selected zone survives navigation within a session and resets cleanly when the session ends, defaulting to Verdant Vale if no stored value exists. ## Test plan - [x] Lint — zero errors, zero warnings - [x] Build — all packages build cleanly - [x] Tests — 415 tests passing, 100% coverage across all packages - [ ] Manual: select a non-default batch size, refresh the page — multiplier should be restored - [ ] Manual: switch to a non-default zone in the boss panel, navigate away and back — zone should still be selected - [ ] Manual: repeat for the quest panel - [ ] Manual: log out and back in — zone selection should reset to Verdant Vale ✨ This PR was created with help from Hikari~ 🌸 Reviewed-on: #48 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #48.
This commit is contained in:
@@ -67,7 +67,9 @@ interface CollectResult {
|
||||
const ExplorationPanel = (): JSX.Element => {
|
||||
const { state, startExploration, collectExploration, formatNumber }
|
||||
= useGame();
|
||||
const [ activeZoneId, setActiveZoneId ] = useState("verdant_vale");
|
||||
const [ activeZoneId, setActiveZoneId ] = useState(() => {
|
||||
return sessionStorage.getItem("elysium_explore_zone") ?? "verdant_vale";
|
||||
});
|
||||
const [ pendingAreaId, setPendingAreaId ] = useState<string | null>(null);
|
||||
const [ lastResult, setLastResult ] = useState<CollectResult | null>(null);
|
||||
|
||||
@@ -116,6 +118,7 @@ const ExplorationPanel = (): JSX.Element => {
|
||||
function handleZoneSelect(id: string): void {
|
||||
setActiveZoneId(id);
|
||||
setLastResult(null);
|
||||
sessionStorage.setItem("elysium_explore_zone", id);
|
||||
}
|
||||
|
||||
const goldChange = lastResult?.response.event?.goldChange ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user