-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add subtle Cloud badges to sidebar workspaces #12294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
austinywang
wants to merge
4
commits into
main
Choose a base branch
from
issue-12291-cloud-badge-sidebar
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b72a7a9
test: cover Cloud workspace sidebar identity and badge
austinywang 9857fc7
Show persistent Cloud identity in sidebar row accessories
austinywang da19d21
Extract Cloud badge helpers and focused behavior suite
austinywang 2475be7
Cover Cloud badge updates during sidebar context menus
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import AppKit | ||
| import SwiftUI | ||
|
|
||
| extension NSImageView { | ||
| /// Applies the shared secondary treatment for workspace identity accessories. | ||
| func configureSidebarWorkspaceAccessory( | ||
| symbol: String, | ||
| label: String?, | ||
| pointSize: CGFloat, | ||
| tint: NSColor, | ||
| weight: Font.Weight = .semibold | ||
| ) { | ||
| isHidden = label == nil | ||
| toolTip = label | ||
| guard label != nil else { return } | ||
| image = RenderableSystemSymbol.configuredAppKitImage( | ||
| systemName: symbol, pointSize: pointSize, weight: weight | ||
| ) | ||
| contentTintColor = tint | ||
| } | ||
|
|
||
| /// Reserves one fixed accessory slot without changing the row's vertical layout. | ||
| func layoutSidebarWorkspaceAccessory( | ||
| maxX: CGFloat, centerY: CGFloat, side: CGFloat, spacing: CGFloat, apply: Bool | ||
| ) -> CGFloat { | ||
| guard !isHidden else { return maxX } | ||
| if apply { | ||
| frame = NSRect(x: maxX - side, y: centerY - side / 2, width: side, height: side) | ||
| } | ||
| return maxX - side - spacing | ||
| } | ||
|
|
||
| } | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import SwiftUI | ||
|
|
||
| /// An immutable, fixed-width Cloud accessory; the row owns its accessibility label. | ||
| struct SidebarCloudWorkspaceBadgeView: View { | ||
| let label: String? | ||
| let pointSize: CGFloat | ||
| let tint: Color | ||
|
|
||
| var body: some View { | ||
| if let label { | ||
| CmuxSystemSymbolImage(magnified: "cloud", pointSize: pointSize, weight: .regular, tint: tint) | ||
| .fixedSize() | ||
| .safeHelp(label) | ||
| .accessibilityHidden(true) | ||
| } | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Hide the accessory when image materialization fails.
configuredAppKitImagecan returnnilafter renderability or bitmap materialization fails, including while its retry cache suppresses another attempt. This helper derivesisHiddenfromlabel, so the cloud, pin, and mute views can remain visible without an image whilelayoutSidebarWorkspaceAccessoryreserves space. The image assignment already clears a failed image; the stale-image case is not visible whenlabelisnil.Materialize first, clear
imagewhen no label exists, and derive visibility from the rendered image:Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents