Show accepted word count badge in menu bar icon#203
Merged
Conversation
Displays the total accepted word count as a compact number to the right of the paw icon in the menu bar. Hidden when the count is zero. Uses WordCountFormatter for compact display (42, 1.5K, 10K, 1.0M). MenuBarStatusLabelView now observes SuggestionCoordinator to update the badge as words are accepted.
944f6d7 to
9d2cc8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Surfaces the total accepted word count as a compact number to the right of the paw icon in the menu bar. The badge is hidden when the count is zero, so new users see a clean icon until they start accepting suggestions.
Validation
Screenshot not included — requires manual testing to verify menu bar rendering since the label only updates after accepting a suggestion in a live text field.
Linked issues
N/A — new feature request.
Risk / rollout notes
tabby.xcodeproj/project.pbxprojupdated to registerWordCountFormatterTests.swiftin the test target.MenuBarStatusLabelViewnow takesSuggestionCoordinatoras an@ObservedObjectparameter. The coordinator was already public onAppDelegate.WordCountFormatteris a pure helper inSupport/with 9 test cases covering all formatting tiers (raw, K, M).Greptile Summary
This PR surfaces the total accepted word count as a compact badge to the right of the paw icon in the menu bar, hidden when the count is zero so new users see a clean icon until they start accepting suggestions.
WordCountFormatteris a new pureSupport/helper that maps integer word counts to compact strings (\"999\",\"1.5K\",\"10K\",\"1.0M\") with 9 unit tests covering all tiers, including the%.1frounding boundary at 9,999.MenuBarStatusLabelViewis updated to acceptSuggestionCoordinatoras an@ObservedObjectand conditionally render the formatted label next to the icon; the coordinator was already a public property onAppDelegate, so the wiring inCotabbyApp.swiftis a one-line change.project.pbxprojregistersWordCountFormatterTests.swiftin the test target's file-reference and build-sources sections following the existing GUID naming convention.Confidence Score: 5/5
Safe to merge; the change adds a read-only display layer on top of an already-maintained counter without touching any acceptance, insertion, or state-machine logic.
The new WordCountFormatter is pure and thoroughly tested. The coordinator wiring is a one-line pass-through of an already-public object. The word-count property is @published on @mainactor so SwiftUI observation is safe. No data flow, persistence, or acceptance logic is altered by this PR.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant SuggestionCoordinator participant MenuBarStatusLabelView participant WordCountFormatter User->>SuggestionCoordinator: Tab accepted (acceptSuggestion) SuggestionCoordinator->>SuggestionCoordinator: recordAcceptedWords(from: chunk) SuggestionCoordinator->>SuggestionCoordinator: "totalTabAcceptedWordCount += n" SuggestionCoordinator->>SuggestionCoordinator: userDefaults.set(count) SuggestionCoordinator-->>MenuBarStatusLabelView: "objectWillChange fires (@Published)" MenuBarStatusLabelView->>WordCountFormatter: compactLabel(for: totalTabAcceptedWordCount) WordCountFormatter-->>MenuBarStatusLabelView: "42" / "1.5K" / nil MenuBarStatusLabelView-->>User: Menu bar badge updated (or hidden if nil)Reviews (3): Last reviewed commit: "Fix docstring: document rounding at 9,95..." | Re-trigger Greptile