diff --git a/web/src/components/activity.rs b/web/src/components/activity.rs index 0f9da67d..e3524396 100644 --- a/web/src/components/activity.rs +++ b/web/src/components/activity.rs @@ -1,9 +1,7 @@ -use std::sync::Arc; - use leptos::*; use crate::prelude::*; -use apb::{target::Addressed, Activity, Actor, Base, Object}; +use apb::{target::Addressed, Activity, Object}; #[component] @@ -11,15 +9,12 @@ pub fn ActivityLine(activity: crate::Object) -> impl IntoView { let object_id = activity.object().id().unwrap_or_default(); let actor_id = activity.actor().id().unwrap_or_default(); let actor = CACHE.get_or(&actor_id, serde_json::Value::String(actor_id.clone()).into()); - let avatar = actor.icon().get().map(|x| x.url().id().unwrap_or_default()).unwrap_or_default(); - let username = actor.preferred_username().unwrap_or_default().to_string(); - let domain = actor.id().unwrap_or_default().replace("https://", "").split('/').next().unwrap_or_default().to_string(); let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity); view! {
diff --git a/web/src/components/user.rs b/web/src/components/user.rs
index 57916566..f4191f09 100644
--- a/web/src/components/user.rs
+++ b/web/src/components/user.rs
@@ -3,6 +3,18 @@ use crate::prelude::*;
use apb::{Actor, Base, Object};
+#[component]
+pub fn ActorStrip(object: crate::Object) -> impl IntoView {
+ let actor_id = object.id().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();
+ let avatar = object.icon().get().map(|x| x.url().id().unwrap_or_default()).unwrap_or_default();
+ view! {
+
+ {username}@{domain}
+
+ }
+}
#[component]
pub fn ActorBanner(object: crate::Object) -> impl IntoView {