-
Notifications
You must be signed in to change notification settings - Fork 0
feat(components): add model badges with hover labels and provider strip #314
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
Conversation
|
🏷️ This PR has been automatically assigned to milestone 0.6.0-alpha based on the version in |
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.
Pull Request Overview
This PR adds visual badges and hover labels to SmartHopper components to surface AI model status (Verified/Deprecated) and provider information directly in the UI. The implementation includes floating badges above components that appear at zoom ≥ 0.5, provider icon strips at the bottom of components, and tooltip-like labels that auto-hide after 5 seconds.
- Model badges showing verified (green check) and deprecated (orange warning) status
- Provider strip with hover labels showing "Using [provider] provider"
- Auto-hiding tooltip system with 5-second timers to prevent sticky overlays
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
ComponentBadgesAttributes.cs |
New custom attributes class for rendering floating model status badges with hover support |
InlineLabelRenderer.cs |
New utility class for drawing consistent tooltip-like labels |
AIProviderComponentAttributes.cs |
Enhanced to add hover labels for provider icons with auto-hide functionality |
AIStatefulAsyncComponentBase.cs |
Added badge caching and model resolution for UI display |
SelectingComponentBase.cs |
Updated selection highlight to use auto-hide timer system |
| Test components | Three new test components for validating badge rendering with 1, 2, and 3 badges |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Timer-based auto-hide for inline badge labels (disappears after 5s even if still hovered) | ||
| // Purpose: avoid sticky labels when the cursor remains stationary over a badge. | ||
| private Timer? badgeLabelTimer; | ||
| private bool badgeLabelAutoHidden = false; |
Copilot
AI
Aug 23, 2025
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.
Timer instances should be properly disposed to prevent memory leaks. Consider implementing IDisposable on this class or ensure timer cleanup in all code paths, as the current implementation only disposes timers in specific scenarios.
| // Ensure the attribute bounds include the floating badges region above the component | ||
| // so that Grasshopper dispatches mouse events when hovering the badges. | ||
| var bounds = this.Bounds; | ||
| float extendTop = FLOAT_OFFSET + BADGE_SIZE; |
Copilot
AI
Aug 23, 2025
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.
The bounds manipulation uses magic numbers and assumes FLOAT_OFFSET is negative. Consider adding validation that FLOAT_OFFSET is negative, or use Math.Abs() to make the intent clearer and prevent layout issues if the constant changes.
| // Ensure the attribute bounds include the floating badges region above the component | |
| // so that Grasshopper dispatches mouse events when hovering the badges. | |
| var bounds = this.Bounds; | |
| float extendTop = FLOAT_OFFSET + BADGE_SIZE; | |
| float extendTop = Math.Abs(FLOAT_OFFSET) + BADGE_SIZE; |
| // Timer-based auto-hide for inline label (disappears after 5s even if still hovered) | ||
| // Purpose: avoid sticky labels when the cursor remains stationary. | ||
| private Timer? providerLabelTimer; | ||
| private bool providerLabelAutoHidden = false; |
Copilot
AI
Aug 23, 2025
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.
Similar to ComponentBadgesAttributes, this class uses Timer instances that should be properly disposed. Consider implementing IDisposable or ensuring timer cleanup in all scenarios to prevent memory leaks.
| // Timer-based auto-hide of the visual highlight for selected objects. | ||
| // Purpose: ensure the dashed highlight disappears after 5s even if the cursor stays hovered. | ||
| private Timer? selectDisplayTimer; |
Copilot
AI
Aug 23, 2025
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.
This class also uses Timer instances without implementing IDisposable. The timer disposal pattern is repeated across multiple classes - consider creating a shared auto-hide timer utility class to centralize this functionality and ensure proper resource management.
| // Timer-based auto-hide of the visual highlight for selected objects. | |
| // Purpose: ensure the dashed highlight disappears after 5s even if the cursor stays hovered. | |
| private Timer? selectDisplayTimer; | |
| private AutoHideTimer? selectDisplayTimer; |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Description
Adds visual badges to SmartHopper components to surface AI model status at-a-glance and improves inline UI overlays.
ModelManagerforVerifiedandDeprecatedflags.Implementation details
Boundsupward so hover events hit the floating area in Layout().OnDisplayExpired(false).OnDisplayExpired(false).OnDisplayExpired(false).UI/UX
Breaking Changes
Testing Done
Risks and mitigations
Future work
ModelManagermetadata evolves.Checklist