diff --git a/web/index.html b/web/index.html
index 44893437..92cd86fc 100644
--- a/web/index.html
+++ b/web/index.html
@@ -25,6 +25,9 @@
a.upub-title:hover {
text-decoration: underline;
}
+ a.hover:hover {
+ text-decoration: underline;
+ }
img.avatar-circle {
display: inline;
max-height: 2em;
@@ -38,6 +41,15 @@
background-color: #bf616a55;
color: #bf616a;
}
+ table.post-table {
+ border-collapse: collapse;
+ }
+ tr.post-table {
+ border: 1px dashed #bf616a;
+ }
+ td.post-table {
+ border: 1px dashed #bf616a;
+ }
@media screen and (max-width: 786px) {
div.boxscroll {
max-height: 100%;
diff --git a/web/src/context.rs b/web/src/context.rs
index 1d594227..d414e288 100644
--- a/web/src/context.rs
+++ b/web/src/context.rs
@@ -35,6 +35,14 @@ impl Uri {
}
}
+ pub fn pretty(url: &str) -> String {
+ if url.len() < 50 {
+ url.replace("https://", "")
+ } else {
+ format!("{}..", url.replace("https://", "").get(..50).unwrap_or_default().to_string())
+ }.replace('/', "/")
+ }
+
pub fn short(url: &str) -> String {
if url.starts_with(URL_BASE) {
url.split('/').last().unwrap_or_default().to_string()
diff --git a/web/src/lib.rs b/web/src/lib.rs
index f06dccdc..80dd022b 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -213,6 +213,7 @@ pub fn UserPage() -> impl IntoView {
}
});
view! {
+
{move || match actor.get() {
None => view! { loading...
}.into_view(),
Some(None) => view! { error loading
}.into_view(),
@@ -257,47 +258,55 @@ pub fn ObjectPage() -> impl IntoView {
}
});
view! {
- {move || match object.get() {
- Some(Some(o)) => view!{ }.into_view(),
- Some(None) => view! { loading failed
}.into_view(),
- None => view! { loading ...
}.into_view(),
- }}
+
+
+ {move || match object.get() {
+ Some(Some(o)) => view!{
}.into_view(),
+ Some(None) => view! {
loading failed
}.into_view(),
+ None => view! {
loading ...
}.into_view(),
+ }}
+
}
}
#[component]
pub fn Object(object: serde_json::Value) -> impl IntoView {
let summary = object.summary().unwrap_or_default().to_string();
- let content = object.content().unwrap_or_default().to_string();
- let date = object.published().map(|x| x.to_rfc3339()).unwrap_or_default();
+ let content = dissolve::strip_html_tags(object.content().unwrap_or_default());
+ let date = object.published().map(|x| x.to_rfc2822()).unwrap_or_default();
let author_id = object.attributed_to().id().unwrap_or_default();
- let author = CACHE.get(&author_id).map(|x| view! { });
+ let author = CACHE.get(&author_id).unwrap_or(serde_json::Value::String(author_id.clone()));
view! {
- {author}
-
-
- {summary} |
-
-
- {content} |
-
-
- {date} |
-
-
+
+
+
+ {summary} |
+
+
+ {
+ content.into_iter().map(|x| view! { {x} }).collect_view()
+ } |
+
+
+ |
+ {date} |
+
+
+
}
}
#[component]
pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
- let object = activity.clone().object().extract().unwrap_or_else(||
- serde_json::Value::String(activity.object().id().unwrap_or_default())
- );
- let object_id = object.id().unwrap_or_default().to_string();
- let object_uri = Uri::web("objects", &object_id);
- let content = dissolve::strip_html_tags(object.content().unwrap_or_default());
+ let object_id = activity.object().id().unwrap_or_default();
+ let object = CACHE.get(&object_id).unwrap_or(serde_json::Value::String(object_id.clone()));
let addressed = activity.addressed();
let audience = format!("[ {} ]", addressed.join(", "));
+ let actor_id = activity.actor().id().unwrap_or_default();
+ let actor = match CACHE.get(&actor_id) {
+ Some(a) => a,
+ None => serde_json::Value::String(actor_id.clone()),
+ };
let privacy = if addressed.iter().any(|x| x == apb::target::PUBLIC) {
"[public]"
} else if addressed.iter().any(|x| x.ends_with("/followers")) {
@@ -305,32 +314,36 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
} else {
"[private]"
};
- let title = object.summary().unwrap_or_default().to_string();
- let date = object.published().map(|x| x.to_rfc3339()).unwrap_or_else(||
- activity.published().map(|x| x.to_rfc3339()).unwrap_or_default()
+ let date = object.published().map(|x| x.to_rfc2822()).unwrap_or_else(||
+ activity.published().map(|x| x.to_rfc2822()).unwrap_or_default()
);
let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity);
view! {
+
{match kind {
// post
- apb::ActivityType::Create => view! {
-
-
{title}
- {
- content
- .into_iter()
- .map(|x| view! {
{x}
}.into_view())
- .collect::
>()
- }
-
- },
- kind => view! {
-
- },
+ apb::ActivityType::Create => view! { }.into_view(),
+ _ => view! {}.into_view(),
}}
- {privacy}" "{date}
+ {date}" "{privacy}
}
}
@@ -358,15 +371,9 @@ pub fn TimelineFeed(name: &'static str, tl: Timeline) -> impl IntoView {
children=move |id: String| {
match CACHE.get(&id) {
Some(object) => {
- let actor_id = object.actor().id().unwrap_or_default();
- let actor = match CACHE.get(&actor_id) {
- Some(a) => a,
- None => serde_json::Value::String(id),
- };
view! {
}.into_view()