feat(web): user fields

not ultra pretty but at least they show now
This commit is contained in:
əlemi 2024-07-21 15:06:22 +02:00
parent 972b109ac0
commit 4b9f9ba0b4
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 19 additions and 1 deletions

View file

@ -28,7 +28,7 @@ leptos = { version = "0.6", features = ["csr", "tracing"] }
leptos_router = { version = "0.6", features = ["csr"] }
leptos-use = { version = "0.10", features = ["serde"] }
reqwest = { version = "0.12", features = ["json"] }
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters", "litepub"] }
apb = { path = "../apb", features = ["unstructured", "activitypub-fe", "activitypub-counters", "litepub", "did-core"] }
uriproxy = { path = "../utils/uriproxy/" }
mdhtml = { path = "../utils/mdhtml/" }
futures = "0.3.30"

View file

@ -103,6 +103,13 @@
table.align {
max-width: 100%;
}
table.fields,
table.fields tr,
table.fields td
{
border: 1px solid var(--background-dim);
word-wrap: break-word;
}
span.footer {
padding: .1em;
font-size: .6em;

View file

@ -46,6 +46,14 @@ pub fn ActorHeader() -> impl IntoView {
let actor_type_tag = if actor_type == apb::ActorType::Person { None } else {
Some(view! { <sup class="ml-s"><small>"["{actor_type.as_ref().to_lowercase()}"]"</small></sup> } )
};
let fields = actor.attachment()
.map(|x| view! {
<tr>
<td class="w-25"><b class="color">{x.name().str().unwrap_or_default()}</b></td>
<td class="w-75" inner_html={mdhtml::safe_html(x.value().unwrap_or_default())}></td>
</tr>
})
.collect_view();
let uid = actor.id().unwrap_or_default().to_string();
let web_path = Uri::web(U::Actor, &uid);
let _uid = uid.clone();
@ -105,6 +113,9 @@ pub fn ActorHeader() -> impl IntoView {
</div>
</div>
<p class="mb-2 mt-0 center bio" inner_html={mdhtml::safe_html(actor.summary().unwrap_or_default())}></p>
<p class="center">
<table class="fields center w-100 pa-s" style="margin: auto; table-layout: fixed;">{fields}</table>
</p>
</div>
<Outlet />
}.into_view()