mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-26 19:54:20 +01:00
The idea with these is that on notedeck you can just hover your cursor over a profile link to see the profile. I just have a stub for now, but full design coming soon after. Also simplify the preview system even further with a macro. In the future I imagine we can grep every preview in the codebase, and then include this as a string inside this macro. This is some kind of template metaprogramming insanity but in theory it could work. Signed-off-by: William Casarin <jb55@jb55.com>
18 lines
415 B
Rust
18 lines
415 B
Rust
use nostrdb::ProfileRecord;
|
|
|
|
pub fn get_profile_name<'a>(record: &'a ProfileRecord) -> Option<&'a str> {
|
|
let profile = record.record().profile()?;
|
|
let display_name = profile.display_name();
|
|
let name = profile.name();
|
|
|
|
if display_name.is_some() && display_name.unwrap() != "" {
|
|
return display_name;
|
|
}
|
|
|
|
if name.is_some() && name.unwrap() != "" {
|
|
return name;
|
|
}
|
|
|
|
None
|
|
}
|