-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kernelkind <[email protected]>
- Loading branch information
1 parent
2208e68
commit 6f5f090
Showing
9 changed files
with
193 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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 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,40 @@ | ||
use enostr::{NoteId, Pubkey}; | ||
use nostrdb::Note; | ||
|
||
#[derive(Clone)] | ||
#[allow(clippy::enum_variant_names)] | ||
pub enum NoteOptionSelection { | ||
CopyText, | ||
CopyPubkey, | ||
CopyNoteId, | ||
} | ||
|
||
pub fn process_note_selection( | ||
ui: &mut egui::Ui, | ||
selection: Option<NoteOptionSelection>, | ||
note: &Note<'_>, | ||
) { | ||
if let Some(option) = selection { | ||
match option { | ||
NoteOptionSelection::CopyText => { | ||
ui.output_mut(|w| { | ||
w.copied_text = note.content().to_string(); | ||
}); | ||
} | ||
NoteOptionSelection::CopyPubkey => { | ||
ui.output_mut(|w| { | ||
if let Some(bech) = Pubkey::new(*note.pubkey()).to_bech() { | ||
w.copied_text = bech; | ||
} | ||
}); | ||
} | ||
NoteOptionSelection::CopyNoteId => { | ||
ui.output_mut(|w| { | ||
if let Some(bech) = NoteId::new(*note.id()).to_bech() { | ||
w.copied_text = bech; | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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