Repository navigation
Sortable columns, search filter, and collapsible live section for Stats tables - #26
Conversation
- Column headers cycle through three states on click: natural direction, flipped, then off (back to default order) - Hover preview arrows indicate the sort direction a click would apply - Add a search filter for the Stats app tables on both the battery and Mac mini dashboards - Introduce a shared juiceStandardEase animation constant - Add unit tests for the sorting and filtering behavior https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
Share the popover's CollapsibleLiveHeader and use it for DRAWING POWER NOW in the battery Today/Session tables and a new live/EARLIER split on the Mac mini table. Row assembly moves to a pure, tested MacMiniAppRows helper. Also widen the energy column to 88pt so ENERGY / COST stays on one line, with a shrink-instead-of-wrap guard on all column titles. Claude-Session: https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e78ece117
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func effectiveColumn(hasLiveWatts: Bool) -> Column { | ||
| column == .liveWatts && !hasLiveWatts ? .energy : column |
There was a problem hiding this comment.
Clear the live-watts sort when its column disappears
When a user selects LIVE W in Today and then switches to Week/All Time—or Session changes to historical mode on AC—appTableSort remains .liveWatts while the LIVE W header is removed. This fallback silently sorts the historical rows by energy, but no visible header shows an active sort and the user cannot complete the live column's click cycle to restore natural order. Clear or translate the live-watts sort whenever showsLivePower becomes false.
Useful? React with 👍 / 👎.
Reset the table sort to natural order when live power leaves the table, so a LIVE W sort cannot silently keep sorting by energy with its header gone. Quantize PEAK W to its displayed precision before comparing, the same guard LIVE W already has against same-value row swaps. Claude-Session: https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
String(format: %.1f) rounds ties to even, so displayedLiveWatts must do the same or an app hitting exactly 0.25 W keys as 0.3 while showing 0.2 W, letting rows move with no visible change. Claude-Session: https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
0.35 is above the true binary midpoint, so display and sort key both round up; only exactly representable midpoints like 0.25 round to even. Claude-Session: https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
Arithmetic rounding imitations double-round: 0.45 * 10 lands on exactly 4.5 and ties-to-even keys it 0.4 while %.1f displays 0.5. Format the value with the same %.1f/%.2f the row renders and parse it back, so key and display can never disagree. Keys are computed once per row, and the boundary tests are now verified against printf output. Claude-Session: https://claude.ai/code/session_018mkxULoejU6mi9V73xmFG2
What changed
Sortable column headers (APP, LIVE W, ENERGY / COST, CPU TIME / PEAK W) on both the battery and Mac mini Stats app tables:
Search filter in the pane title row: case/diacritic-insensitive, whitespace-trimmed, Esc or the clear button resets it; sections that filter out entirely are hidden and a no-match caption shows.
Collapsible DRAWING POWER NOW section on both Stats dashboards, reusing the popover's CollapsibleLiveHeader (with the collapsed 'N apps - X.X W' summary). The Mac mini table gains a proper live/EARLIER split, with row assembly extracted into a pure MacMiniAppRows helper.
Also: energy column widened to 88pt so ENERGY / COST renders on one line, and the standard 0.18s ease curve is consolidated into one shared juiceStandardEase constant (was duplicated at four sites).
Why
The Stats app tables were fixed-order only; sorting and filtering were requested for the circled column headers, with popover parity for collapsing the live section.
How it was verified