Skip to content

feat(ui): URL hash routing — share/bookmark/refresh restore (v1.19 A) - #55

Merged
argszero merged 1 commit into
mainfrom
feat/ui-ue-round4-hash-routing
Aug 17, 2026
Merged

argszero merged 1 commit into
mainfrom
feat/ui-ue-round4-hash-routing

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

UI/UE 4th-round deepening — item A: URL hash routing (rant 2026-08-17T20:39:30, v1.19).

Views now sync with the address-bar hash (#/marketplace, #/wallet, …), enabling bookmark / share / refresh-restore / back-forward navigation with zero external dependencies:

  • switchView syncs location.hash via history.pushState (skip when already equal → no duplicate entries; pushState never fires hashchange → no loop)
  • Back/forward (hashchange listener) follows the view
  • Illegal hash (#/xxx not in the 7 views) → falls back to dashboard without rewriting the URL (avoids polluting history / double-back)
  • Empty hash → no-op (default behavior preserved)
  • Refresh then login → restores the view from the pre-refresh hash (pendingHashView); guest-mode / not-logged-in states unaffected
  • Guest-restricted hash (e.g. #/settings) → intercepted by GUEST_VIEWS (toast), view + URL untouched, no new history entry

Docs: docs/user-stories.md v1.19 + ui/README.md「URL hash 路由约定」section. Verified by node --check, DOM-stub smoke test (13 assertions: refresh restore / pushState / back+forward / illegal hash / guest interception), cargo test, cargo fmt --check.

Rant (verbatim)

Rant: UI/UE 第四轮多角度深化 — 状态保持、信息密度、原生控件美化、帮助可达性(宿主 2026-08-17 第四轮指示:继续从多角度美化 UI、优化 UE)

A. URL hash 路由 — 刷新/前进后退保持视图

  • 视图切换时同步 location.hash(如 #/marketplace),刷新后恢复上次视图;支持浏览器前进/后退(hashchange 事件)
  • 游客模式登录页、未登录状态不冲突;hash 非法时回仪表盘

Related

  • Rant timestamp: 2026-08-17T20:39:30.507364 (project aitokenpool, status in_progress)
  • Branch: feat/ui-ue-round4-hash-routing (per rant: 分支 feat/ui-ue-round4; items B–G to follow in subsequent PRs)

Tests

  • node --check ui/js/app.js
  • DOM-stub smoke test — 13/13 assertions pass
  • cargo test — 1 passed
  • cargo fmt --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant