fix user avatar

This commit is contained in:
Swrup 2025-04-20 21:21:15 +02:00
parent 87a9806056
commit e6fe0ab5df
3 changed files with 10 additions and 26 deletions

View file

@ -208,17 +208,7 @@ module User = struct
match user.avatar_info with
| None -> []
| Some info ->
let alt_at =
if String.equal "" info.alt then []
else [ alt info.alt; name info.name; title info.alt ]
in
let at =
[ Fmt.kstr src "/user/%s/avatar" user.user_id
; class' "img-thumbnail"
]
@ alt_at
in
[ El.img ~at () ]
[ Html_util.mk_image ~is_small:true (Avatar (user.user_id, info)) ]
in
h1 user.user_nick :: bio :: img

View file

@ -26,11 +26,8 @@ let date post =
[ el_txt (print_date post.date) ]
(* TODO rm this since we can click the post_id? *)
let link_to_post ?(is_vignette = false) post =
let url =
if is_vignette then Fmt.str "/thread/%d#%d" post.parent_t_id post.id
else Fmt.str "#%d" post.id
in
let link_to_post post =
let url = Fmt.str "#%d" post.id in
El.a
~at:[ href url; title "Link to this post"; class' "post-link-to-self" ]
[ el_txt "#" ]
@ -154,21 +151,15 @@ let backlinks t_s post =
let l = List.map (post_id_quote t_s) post.backlinks in
El.div ~at:[ class' "post-replies" ] l
let image _t_s ?(is_vignette = false) post =
let image _t_s post =
match post.image_info with
| None -> None
| Some image -> (
| Some image ->
let img_small =
Html_util.mk_image ~is_small:true (Img_info.Post (post.id, image))
in
let el = El.div ~at:[ class' "post-image-div" ] [ img_small ] in
match is_vignette with
| true -> Some el
| false ->
hold_on el Ev.click (fun _ev ->
let v = Img_info.Post (post.id, image) in
Events.send_action (Image_change (Some v)) );
Some el )
Some el
let comment =
let open Comment in

View file

@ -133,4 +133,7 @@ let mk_image ~is_small img_info =
; mk_at "loading" "lazy"
]
in
El.img ~at ()
let el = El.img ~at () in
hold_on el Ev.click (fun _ev ->
Events.send_action (Image_change (Some img_info)) );
el