Skip to content

Customize stats tabs and improve popover scrolling - #22

Merged
EClinick merged 2 commits into
masterfrom
task/ec/customize-stats-popover
Aug 9, 2026
Merged

Customize stats tabs and improve popover scrolling#22
EClinick merged 2 commits into
masterfrom
task/ec/customize-stats-popover

Conversation

@EClinick

@EClinick EClinick commented Aug 8, 2026

Copy link
Copy Markdown
Owner

What changed

Shared Stats tab customization

  • Added shared range-picker, customization-button, and visible-tab controls used by both battery and Mac mini Stats views.
  • Persisted battery and Mac mini tab choices separately.
  • Prevented users from hiding the final visible tab and recover safely when a stored selection is no longer valid.
  • Limited Mac mini choices to its supported Today, Week, and All ranges.

Scrollable menu-bar dashboards

  • Put both battery and Mac mini dashboards in the same bounded 600-point scroll viewport so tall content does not push the action footer off-screen.
  • Kept Refresh, Stats & Settings…, and Quit Juice fixed and reachable below the viewport.
  • Added a conditional Scroll/chevron cue that appears only while more content remains below.
  • Made the cue clickable to jump to the bottom, with hover, pressed, accessibility-label, and Reduce Motion behavior.
  • Kept signed-release updater controls inside the scrollable dashboard so they cannot displace the fixed footer.

Coverage

  • Added tests for shared picker alignment, persisted range filtering/fallbacks, and Mac mini supported-range enforcement.
  • Added AppKit layout tests for overflow detection, fixed footer placement, release-updater containment, and clicking the scroll cue to reach the bottom.

Scope

This PR is based directly on master and 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 suites
  • git diff --check
  • Two independent review rounds; the first found and fixed the signed-release updater overflow case, and the second reported no findings

Copilot AI lite review requested due to automatic review settings August 8, 2026 13:05
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
website Ignored Ignored Preview Aug 8, 2026 1:11pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 StatsRangeVisibility to support per-context available/fallback ranges and a dedicated Mac mini storage key with safe recovery behavior.
  • Adds PopoverDashboardViewport with 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.

Comment on lines +566 to +568
@Environment(\.accessibilityReduceMotion) private var reduceMotion
@State private var showsScrollHint = true
@State private var scrollHintHovered = false
@EClinick

EClinick commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 63a7c8c1fb

ℹ️ 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".

@EClinick
EClinick merged commit ac7d379 into master Aug 9, 2026
2 checks passed
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.

2 participants