Skip to content

Add menu-bar pin for Claude usage shortcut - #1

Merged
cris7ian merged 3 commits into
cris7ian:mainfrom
RicardoAveledo:pin-claude-usage
Oct 17, 2026
Merged

cris7ian merged 3 commits into
cris7ian:mainfrom
RicardoAveledo:pin-claude-usage

Conversation

@RicardoAveledo

Copy link
Copy Markdown
Contributor

Summary

Claude has no third-party usage API, so Mana currently links out to claude.ai/settings/usage from a Settings row. Reaching that link today takes two clicks every time: open the menu bar → open Settings → click "Check in browser".

This PR adds an opt-in "Show" toggle next to the existing Claude row in Settings. When enabled, a Claude section appears at the bottom of the menu-bar popover (styled like the other providers) with a one-click "Check usage" shortcut that opens the browser directly. Off by default, so nothing changes for users who don't want it.

Changes

  • UsageSettings: new claudeUsagePinned published property, persisted to UserDefaults under claudeUsagePinned. Mirrors the shape of antigravityEnabled.
  • SettingsView: adds a Toggle("Show", …) to the Claude row, matching the Antigravity row's control pattern.
  • UsagePopoverView: renders a claudeUsageSection after the provider ForEach when pinned, visually consistent with existing provider sections (icon + uppercased header + action on the right).
  • Localization: adds CLAUDE and Check usage entries to en/es/fr/de .strings files.
  • Tests: adds testClaudeUsagePinnedPersists to ManaTests, mirroring the existing antigravity persistence test.

Deliberately did not introduce a ProviderID.claude case — Claude has no fetchable usage, so a full provider would be dead weight. If a real API ever lands, swap claudeUsageSection for a proper provider and remove the toggle.

Test plan

  • xcodebuild -scheme Mana -configuration Debug build succeeds
  • testClaudeUsagePinnedPersists passes
  • Toggle off: popover looks unchanged
  • Toggle on: Claude section appears at the bottom of the popover
  • Clicking "Check usage" opens claude.ai/settings/usage and dismisses the popover
  • Toggle state persists across app restarts
  • Empty-state ("No providers configured") still shows when nothing is pinned/configured, and is suppressed when Claude is pinned

Claude has no third-party usage API, so reaching claude.ai/settings/usage
required opening Settings and clicking "Check in browser" every time.

Adds an opt-in "Show" toggle to the Claude row in Settings. When
enabled, a Claude section appears in the menu-bar popover (styled like
the other providers) with a one-click shortcut to the usage page. Off
by default; nothing changes for users who leave it off.

@cris7ian cris7ian left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please preserve access to Settings in the Claude-only configuration. All 23 macOS tests and localization checks pass locally; no GitHub CI checks are reported for this PR.

Comment thread Mana/UI/UsagePopoverView.swift Outdated
.padding(.bottom, 14)

if settings.visibleProviders.isEmpty {
if settings.visibleProviders.isEmpty && !settings.claudeUsagePinned {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

When Claude is pinned with no providers configured, this condition hides the empty-state “Open Settings” button, while the footer Settings button remains hidden because visibleProviders is empty. After closing Settings, users have no visible route back to unpin Claude or connect a provider. Keep the footer Settings button visible for Claude-only configurations and cover this state with a regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have not seen this sorry, fixing :)

Extract hasPopoverContent on UsageSettings so the popover's empty-state
guard and footer Settings button share one condition. Previously, pinning
Claude with no other providers hid both the empty-state Open Settings
button and the footer Settings button, leaving the user with no route
back. Adds a regression test covering the Claude-only configuration.
@RicardoAveledo

Copy link
Copy Markdown
Contributor Author

Good catch — fixed in 2345686.

Extracted hasPopoverContent on UsageSettings (!visibleProviders.isEmpty || claudeUsagePinned) and used it for both the empty-state guard and the footer Settings button, so there's one source of truth. Added testHasPopoverContentCoversClaudeOnlyConfiguration as a regression test for the Claude-only state.

@cris7ian cris7ian left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! 🙏

Previous fix suppressed the empty state in favor of showing only the
Claude section. Instead, keep the empty state intact (its Open Settings
button covers Settings access) and append the Claude section below it
with a divider. Drops the now-unused hasPopoverContent helper and its
test.

@cris7ian cris7ian left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! 🙏

@cris7ian
cris7ian merged commit e888b75 into cris7ian:main Oct 17, 2026
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