-
Notifications
You must be signed in to change notification settings - Fork 49
add relay note UI/badge #1184
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
base: master
Are you sure you want to change the base?
add relay note UI/badge #1184
Conversation
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 a relay indicator to the note action bar that displays which relays a note has been seen on. The indicator appears as a badge showing the count of relays and provides a context menu to view the full list.
- Added relay indicator badge that displays relay count and provides relay details on interaction
- Refactored action bar layout to use right-to-left layout with relay indicator on the right side
- Extended
render_note_actionbarsignature to acceptnoteandtxnparameters needed for relay metadata
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if bar_action.is_some() { | ||
| action = bar_action; | ||
| } |
Copilot
AI
Oct 30, 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 conditional assignment if bar_action.is_some() { action = bar_action; } is redundant. Since bar_action is Option<NoteAction>, you can directly assign it with action = bar_action; or use action = bar_action.or(action); to preserve any previous action if bar_action is None.
| if bar_action.is_some() { | |
| action = bar_action; | |
| } | |
| action = bar_action; |
| let tooltip_relays = relays.clone(); | ||
| response = response.on_hover_ui(move |ui| { | ||
| ui.spacing_mut().item_spacing.y = 2.0; | ||
| for relay in tooltip_relays { |
Copilot
AI
Oct 30, 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 clone of relays (a Vec<&str>) is unnecessary here. Since the hover_ui closure is not 'move' and runs synchronously within the same frame, you can capture &relays by reference instead. Remove the clone and change the closure to use &relays directly.
| let tooltip_relays = relays.clone(); | |
| response = response.on_hover_ui(move |ui| { | |
| ui.spacing_mut().item_spacing.y = 2.0; | |
| for relay in tooltip_relays { | |
| response = response.on_hover_ui(|ui| { | |
| ui.spacing_mut().item_spacing.y = 2.0; | |
| for relay in &relays { |
|
@kernelkind I ran puffin, and I don't see major jumps in the puffin graphs when I interact with the relay badge UI element relaybadgenote.mp4 |
|
Relay Badge Ready
glyph only when idle.
the popover contents.
collect_note_relays.
File touched: crates/notedeck_ui/src/note/mod.rs
Tests