use leptos::*; use crate::prelude::*; use apb::{target::Addressed, Activity, Actor, Base, Object}; #[component] pub fn ActorBanner( object: serde_json::Value, #[prop(optional)] tiny: bool ) -> impl IntoView { match object { serde_json::Value::String(id) => view! {
?" "{Uri::pretty(&id)}
}, serde_json::Value::Object(_) => { let uid = object.id().unwrap_or_default().to_string(); let uri = Uri::web("users", &uid); let avatar_url = object.icon().get().map(|x| x.url().id().unwrap_or_default()).unwrap_or_default(); let display_name = object.name().unwrap_or_default().to_string(); let username = object.preferred_username().unwrap_or_default().to_string(); let domain = object.id().unwrap_or_default().replace("https://", "").split('/').next().unwrap_or_default().to_string(); view! {
{display_name}
{username}@{domain}
} }, _ => view! {
invalid actor
} } }