ui crate and chrome sidebar
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
17
crates/notedeck_ui/src/profile/mod.rs
Normal file
17
crates/notedeck_ui/src/profile/mod.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use nostrdb::ProfileRecord;
|
||||
|
||||
pub mod picture;
|
||||
|
||||
pub use picture::ProfilePic;
|
||||
|
||||
pub fn get_profile_url<'a>(profile: Option<&ProfileRecord<'a>>) -> &'a str {
|
||||
unwrap_profile_url(profile.and_then(|pr| pr.record().profile().and_then(|p| p.picture())))
|
||||
}
|
||||
|
||||
pub fn unwrap_profile_url(maybe_url: Option<&str>) -> &str {
|
||||
if let Some(url) = maybe_url {
|
||||
url
|
||||
} else {
|
||||
ProfilePic::no_pfp_url()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user