From 09325c91de64d3bca545b456981d79a9eed6ee98 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 3 Jul 2024 05:58:29 +0200 Subject: [PATCH] feat(web): improved Document object view doesn't work retroactively but new lemmy posts should look more like lemmy posts --- web/index.html | 11 +++++++++- web/src/components/object.rs | 41 ++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/web/index.html b/web/index.html index 35e5a968..596e4386 100644 --- a/web/index.html +++ b/web/index.html @@ -203,6 +203,16 @@ min-width: 2em; max-width: 2em; } + div.flex-pic-container { + flex: 1; + border: solid 3px #bf616a; + margin-right: .5em; + } + div.flex-pic { + background-size: cover; + margin: 5px; + height: calc(100% - 10px); /* TODO can we avoid this calc() without having this overflow??? */ + } .box { border: 3px solid var(--accent); } @@ -215,7 +225,6 @@ img.attachment { cursor: pointer; height: 10em; - width: 100%; border: 3px solid var(--accent); padding: 5px; object-fit: cover; diff --git a/web/src/components/object.rs b/web/src/components/object.rs index d65fa971..3df22c4e 100644 --- a/web/src/components/object.rs +++ b/web/src/components/object.rs @@ -38,7 +38,7 @@ pub fn Attachment( view! {

view! { -

- {object.name().map(|name| { - view! { -

{name.to_string()}

- } - })} +

+ + + +

}.into_view(), _ => @@ -149,6 +142,15 @@ pub fn Object(object: crate::Object) -> impl IntoView { }); + let post_image = object.image().get().and_then(|x| x.url().id().str()).map(|x| view! { +
+ +
+
+
+
+ }); + let post_inner = view! {

@@ -163,11 +165,14 @@ pub fn Object(object: crate::Object) -> impl IntoView { }.into_view(), // lemmy with Page, peertube with Video Ok(apb::ObjectType::Document(t)) => view! { -
-

- {object.name().unwrap_or_default().to_string()} -

- {post_inner} +
+ {post_image} +
+

+ {object.name().unwrap_or_default().to_string()} +

+ {post_inner} +
}.into_view(), // wordpress, ... ?