use crate::types::*; use yew::{html, Component, Context, Html, Properties}; pub struct CommentComponent {} #[derive(Properties, PartialEq)] pub struct CommentProps { pub root_id: String, // TODO maybe opti pub comment: FullComment, } pub enum Msg { } impl Component for CommentComponent { type Message = Msg; type Properties = CommentProps; fn create(_ctx: &Context) -> Self { Self {} } fn update(&mut self, _ctx: &Context, _msg: Self::Message) -> bool { false } fn view(&self, ctx: &Context) -> Html { let props = ctx.props(); let comment_id = props.comment.id.to_base64(); let elem_id = format!("{}-{}", props.root_id, comment_id); html! {

{ props.comment.post_time } { if let Some(email) = &props.comment.email { html! { { email } } } else { html! {} } } { "Remove" }

{ &props.comment.text }

} } }