Customize stats tabs and improve popover scrolling - #22
Conversation
|
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: 9f74896b44
ℹ️ 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".
| } | ||
| } | ||
| } | ||
| PopoverDashboardViewport(height: Self.dashboardViewportHeight) { |
There was a problem hiding this comment.
Let short battery dashboards retain their intrinsic height
When the battery dashboard is shorter than 600 points—for example on a fresh install with no app rows or timeline samples—this wrapper still reserves an exact 600-point viewport via its internal .frame(height:). Unlike the previous intrinsic layout, that leaves a large blank region and unnecessarily pushes the update and action controls toward the screen edge; on short displays or with larger accessibility text, those controls can be clipped even though no scrolling space is needed. Use the content height up to a screen-aware maximum rather than always forcing 600 points.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR centralizes stats range-tab UI and persistence so the battery Stats window and Mac mini Stats views share consistent “Customize Tabs” behavior, while also introducing a bounded, scrollable popover dashboard viewport with a scroll-to-bottom cue to keep footer actions reachable.
Changes:
- Introduces shared Stats range UI components (picker row, customization button, settings panel) and reuses them in both battery and Mac mini Stats views.
- Extends
StatsRangeVisibilityto support per-context available/fallback ranges and a dedicated Mac mini storage key with safe recovery behavior. - Adds
PopoverDashboardViewportwith scroll hint visibility tracking + scroll-to-bottom interaction, along with new layout/interaction tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/JuiceTests/StatsRangeVisibilityTests.swift | Adds Mac mini-specific visibility and fallback tests. |
| Tests/JuiceTests/StatsRangeControlsTests.swift | Adds an AppKit layout test to validate segmented control alignment/segment count. |
| Tests/JuiceTests/PopoverLayoutTests.swift | Adds tests for bounded popover scrolling and the scroll cue behavior. |
| Sources/Juice/Stats/StatsView.swift | Switches to shared range controls and settings UI. |
| Sources/Juice/Stats/StatsRangeVisibility.swift | Adds Mac mini storage key/defaults and makes visibility APIs context-aware via available/fallback ranges. |
| Sources/Juice/Stats/StatsRangeControls.swift | New shared views for range picking + customization. |
| Sources/Juice/Stats/MacMiniStatsView.swift | Adds persistent customization for Mac mini ranges with supported-range constraints. |
| Sources/Juice/PopoverView.swift | Wraps dashboards in a bounded viewport and adds scroll hint + observer implementation. |
| Sources/Juice/MacMiniPowerView.swift | Applies Mac mini range visibility customization to the popover server dashboard. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @Environment(\.accessibilityReduceMotion) private var reduceMotion | ||
| @State private var showsScrollHint = true | ||
| @State private var scrollHintHovered = false |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
What changed
Shared Stats tab customization
Today,Week, andAllranges.Scrollable menu-bar dashboards
Refresh,Stats & Settings…, andQuit Juicefixed and reachable below the viewport.Scroll/chevron cue that appears only while more content remains below.Coverage
Scope
This PR is based directly on
masterand is intentionally separate from #21. PR #21 owns the broader DRY refactor that unifies the battery and Mac mini dashboard structure, titled columns, and app-row rendering. This PR only shares the range controls and popover scrolling behavior needed by both existing views.Verification
make test— 313 tests passed across 41 suitesgit diff --check