feat: add empty state to some elements

This commit is contained in:
2025-02-06 14:38:05 +07:00
parent 193aaa646e
commit cb8a348945
4 changed files with 139 additions and 82 deletions

View File

@@ -29,10 +29,14 @@ impl NostrProfile {
/// Get contact's avatar
pub fn avatar(&self) -> String {
if let Some(picture) = &self.metadata.picture {
format!(
"{}/?url={}&w=100&h=100&fit=cover&mask=circle&n=-1",
IMAGE_SERVICE, picture
)
if picture.len() > 1 {
format!(
"{}/?url={}&w=100&h=100&fit=cover&mask=circle&n=-1",
IMAGE_SERVICE, picture
)
} else {
"brand/avatar.png".into()
}
} else {
"brand/avatar.png".into()
}