Files
TX/artifacts
riyadhafraa 8d90771409 Persist admin dashboard time range per user
Task #24: Remember the admin's last-used dashboard time range.

The admin dashboard's range selector (7d/30d/90d/custom) was resetting to
"Last 7 days" on every visit. Now the selected preset range is persisted in
localStorage under a per-user key (`admin.statsRange.<userId>`) so each admin
sees their last choice on return.

Implementation notes:
- Edited only artifacts/teaboy-os/src/pages/admin.tsx.
- Added two effects: one hydrates the stored value once `user.id` is
  available (auth loads asynchronously), the other writes to localStorage
  whenever the range changes after hydration.
- Only the preset values (7d/30d/90d) are persisted; "custom" is intentionally
  not stored since the custom dates are session-scoped and would feel stale on
  return. After hydration, switching to "custom" leaves the previously stored
  preset untouched so the next visit still restores the last preset.
- Used a hydration guard to avoid clobbering stored values with the default
  "7d" before the load effect runs.

Replit-Task-Id: a29d7e30-8111-4edd-9307-3262c4dbc236
2026-04-21 07:04:30 +00:00
..
2026-04-18 02:00:09 +00:00