Repository navigation
feat(dashboard): add dark mode, pagination in recent requests, and management key persistence - #2
Conversation
…nagement key persistence
|
Thanks for the PR! Dark mode and pagination look good. I pushed one follow-up commit (30155cf) to this branch (maintainer edits) that changes two things: 1. Management key: reuse the host's key read-only instead of persisting our own copy
2. Pagination:
Optional follow-ups (not done): inline |
…ting it - Drop the localStorage copy of the management key and the remember checkbox. - Read the host Management Center key (cli-proxy-auth, enc::v1/v2) read-only, skipping it when rememberPassword is off or apiBase is another origin; a rejected host key is not retried during the page load. - Reset targetRecordsPage when a page load fails. - Update storage contract test and SECURITY.md accordingly.
48862ed to
30155cf
Compare
- Theme toggle (system -> light -> dark) next to the language button, on the toolbar and the auth gate. Default 'system' follows the host Management Center (parent data-theme, cli-proxy-theme, then the OS); the choice is the only thing stored (cpa_plugin_theme). The host entry is read, never written. - Keep the original light design; dark uses the same cool-slate identity with lower saturation. Hard-coded light surfaces moved to tokens so dark can override them without changing any light value. - Storage contract test and SECURITY.md updated accordingly.
|
Thank you so much @dohwi for the thorough review, guidance, and the follow-up commits ( I sincerely apologize for overlooking the security contract in All tests ( |
…verflowing - Prev/Next buttons: aria-label now follows the language (data-i18n-aria). - With the theme toggle added next to the language button the mobile footer reserved 124px of padding and squeezed the filter text to zero width at <=359px; stack the text above the buttons there and shift the reset button at <=767px so it no longer overlaps the new toggle.
- 'System' mapped the host's white theme to a pure-white page while the explicit Light mode is the original off-white, so switching System -> Light changed the background even though both are light. This page has no separate white look: host white now resolves to light. - Colour transitions on individual controls (tabs, buttons, selects, ...) ran on their own 0.15s clocks while cards switched instantly. Freeze them during the swap and crossfade the whole page once via the View Transitions API (falls back to an instant, transition-free swap; honours reduced motion).
The View Transitions crossfade made the page, cards and buttons switch instantly while selects and toggles (which carry their own 0.15s colour transitions) faded afterwards, so they changed at different times; the control under the pointer also lost :hover during the transition and tweened late. Drop the view transition and, for the duration of the swap, force one uniform colour transition on every element so everything fades together.
The selected tab's tint (#e8eef5) was only ~1.05:1 against the tab group's background, so the selected state was hard to see in light mode. Draw it as a white pill with a soft shadow and hairline ring (same idea as the selected period button); in dark mode add a hairline ring to the tinted pill.
Controls carry their own 0.15s colour transitions while cards and the page do not, so a theme change looked staggered. Switch every transition off for the swap and restore it once the new colours are painted; hover/focus transitions are unaffected.
|
Merging this with a few follow-up commits on top of the original change. Summary of what ended up in the PR: Original (thanks @ngnsusinn)
Follow-ups pushed to this branch
Verified with |
|
@ngnsusinn Thanks again for the contribution! 🎉 This PR is now fully merged into You can update from the CLIProxyAPI plugin store now: What's in v0.4.1 (your dark mode and pagination, plus the follow-ups on top):
Please don't push more commits to |
Summary
This PR adds three requested features to the Usage Audit dashboard:
prefers-color-scheme, persisted inlocalStorage(cpa_plugin_theme), with a full slate dark palette for KPI cards, tables, charts, and modals.< Prev, page numbers1, 2, ...,Next >) displaying 20 items per page with instant client-side switching across loaded pages and automatic cursor-based fetching for subsequent pages.localStorage(cpa_usage_audit_mgmt_key), eliminating the need to re-enter the key on every tab/session reload. Rejection (401/403) continues to clear both storage areas.Changes
internal/plugin/style.css: Added:root[data-theme='dark']tokens, dark mode component overrides, theme toggle button styles, and.ui-paginationbar layout.internal/plugin/dashboard.html: Added theme toggle buttons, auto-save checkbox in auth gate, and pagination controls in#loadMoreBar.internal/plugin/app.js: Added theme switching and persistence logic, paging state & page slicing inpaintRecords(), auto-save management key handling, and updated i18n catalogs (ko/en).internal/plugin/i18n_test.go: Updated storage contract test to account for the persisted theme and management key storage accessors.ui/build.mjs: Replaced hardcoded table backgrounds withvar(--bg-card)andvar(--surface-hover)for clean theme compatibility.Verification
go test -v ./internal/plugin/...passed completely (all tests passing including storage contract and i18n completions).go test -buildvcs=false ./...passed across all packages.go vet ./...passed with zero warnings.npm run buildinui/succeeds and keeps self-contained dashboard bundle in sync.