Skip to content

feat: return to the current period from usage recaps - #367

Merged
chattymin merged 35 commits into
chattymin:mainfrom
heli-os:feature/recap-current-period-shortcut
Oct 5, 2026
Merged

chattymin merged 35 commits into
chattymin:mainfrom
heli-os:feature/recap-current-period-shortcut

Conversation

@heli-os

@heli-os heli-os commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a current-period shortcut between Previous and Next in Usage recap. Its label follows the selected scope: This week, This month, or This year. Clicking it resets the period offset without changing scope; it stays in place but is disabled when already showing the current period.

Week/month labels reuse the existing translations. The year label is localized in all seven supported languages through L.recapCurrentPeriod.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

UI changes

Before After
After browsing older periods, returning to the present requires repeated Next clicks or switching scope. A scope-specific shortcut returns directly to the current period and disables itself there.
Before: July After: July
recap-baseline-navigation-past recap-navigation-past

Clicking This month returns to September, keeps Month selected, and disables the current-period shortcut and Next:

recap-navigation-returned

Native SwiftUI/AppKit captures use isolated fixtures.

Validation

  • GitHub reports the workflow run as completed successfully and all build/test steps passed; the PR build-test check still displays pending as of this update.

  • GitHub CI passed: build, test + coverage gate, and secret scan. The suite ran 1,381 tests with 14 skipped and zero failures, including the new regression test.

  • swift build passed locally.

  • In a native SwiftUI/AppKit host with an isolated save and UserDefaults suite, navigated two periods back in Week, Month, and Year, pressed the actual shortcut, and verified the shortcut and Next were disabled again. The selected scope remains unchanged.

  • Native accessibility checks passed for all 21 language/scope combinations, including translated button labels, non-overlapping navigation controls, and the disabled current-period shortcut.

  • Added localization coverage for all three scopes in all seven supported languages.

  • ./scripts/test-gate.sh was attempted, but this Mac's Command Line Tools cannot import XCTest. The full test suite passed in GitHub CI.

  • git diff --check passed.

Checklist

  • swift build and swift test pass locally
  • PR title and description are written in English
  • UI changes are described above (before/after — images optional)
  • No copyrighted assets, secrets, or private tooling references are committed
  • Tests were added or updated for this change

heli-os and others added 30 commits September 27, 2026 19:46
The previous/next chevrons were plain-style buttons whose only hittable
area was the ~7x12pt glyph, so clicks often missed. Give each a 28pt
square hit target via contentShape while keeping the glyph position
unchanged, add a synthesized-click regression test, and record the
icon-only plain button class in the defect log.

Fixes chattymin#379

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GqeQ2gWkEa5Rdvki72naJF
Add a native tooltip ("X / Y · Z%") to the evolution/graduation and egg
hatch progress bars in CompanionHeader, backed by a pure
CompanionStore.progressDetail(used:total:) helper so both bars share
the same clamping/formatting logic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It is pure display formatting with no store state, so it belongs with the view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the tooltip. The bars rest at the original 6pt; hovering 300 ms springs them to 12pt
with a small overshoot and fades in "X / Y · Z%" centered inside. Leaving shrinks them back.
The 12pt height is always reserved, so hovering never shifts the layout or resizes the popover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sets

Official limits are an account property, but the popover reaches them
only through a provider snapshot. Week and month totals reset at their
calendar boundaries, so a provider used last Friday has week = month = 0
on Monday (or after the 1st) and lost its tab and its limits section
while the limits were being fetched fine (chattymin#336).

Track the newest positive-token entry (lastUsage) in the shared
ProviderEnrichment.local and keep the snapshot while it is within the
7-day weekly quota window. Zero-token synthetic records do not count.
Extend enrichmentScanStart to cover the window and keep snapshots in
provider registration order, since carriers arrive in task-completion
order.
# Conflicts:
#	Sources/PokeTokenBar/Core/UsageStore.swift
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
# Conflicts:
#	Sources/PokeTokenBar/UI/CompanionView.swift
# Conflicts:
#	Sources/PokeTokenBar/UI/CompanionView.swift
# Conflicts:
#	Tests/PokeTokenBarTests/UsageRecapTests.swift
# Conflicts:
#	Tests/PokeTokenBarTests/UsageStoreTests.swift
#	docs/reference/defect-log.md
# Conflicts:
#	docs/reference/defect-log.md
@chattymin
chattymin merged commit e21fb01 into chattymin:main Oct 5, 2026
2 checks passed
donky-ey pushed a commit to donky-ey/PokeDexBar that referenced this pull request Oct 15, 2026
…min#367)

Browsing back through recap history took the same number of clicks to
get home. A center button jumps to the current week/month/year and is
disabled while already there.
Strongorange added a commit to Strongorange/PokeTokenBar-windows that referenced this pull request Oct 19, 2026
Port macOS chattymin#332 core: UsageLedger keeps day-by-day totals across months
with monotonic-max merges (a rotated log cannot erase a day that really
happened) and covered-since semantics that separate a real zero from an
unrecorded day. RecapPeriod models whole calendar weeks/months/years —
weeks start on Sunday, the same rule as the week totals and the year
heatmap grid, exposed as one named culture so all three switch together.
UsageRecap.Make computes buckets (days, or months in the year view),
totals, the same-days comparison for running periods, best day, streaks,
active/counted days, in-period graduations and the canGoBack bound.
Recap strings ported for the seven app languages (chattymin#367/chattymin#368 included).
Strongorange added a commit to Strongorange/PokeTokenBar-windows that referenced this pull request Oct 19, 2026
The refresh background path merges the 365-day series into the ledger
(single-flight serialized, mutated under the service gate; the recap
reads a copy), prunes to this year plus last year for the year-over-year
comparison, and writes usage-ledger.json atomically only when the merge
changed anything. A corrupt ledger is moved to .corrupt and recording
starts fresh. RecapQuery turns a ledger snapshot into the window's view
model: period titles and bucket labels per scope and language, the chattymin#368
tooltips (exact tokens / a real zero / no data), the same-days compare
note, current-period label (chattymin#367), stats lines and in-period graduates.
Strongorange added a commit to Strongorange/PokeTokenBar-windows that referenced this pull request Oct 19, 2026
Opens from the usage tab's week/month row, which now stays visible on
quiet days too (a fresh install can open its recap before the first
token). Single-instance window with Fluent chrome: scope segments
(week/month/year), previous / current (chattymin#367) / next navigation where
offset never goes positive, Esc and arrow keys, live re-render on every
refresh, and a clipboard summary (PNG export deferred). The card itself
is the deliberate Pokédex readout from the original app — fixed explicit
palette (red shell, dark LCD, 8-block meters with exact-token tooltips
distinguishing used/zero/no-data), so the recap stays a device rather
than a third analytics chart; the graduate strip reuses the form-aware
sprites.
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.

5 participants