50 lines
1.1 KiB
Rust
50 lines
1.1 KiB
Rust
use crate::{types::*, components::comment::*, api::*};
|
|
|
|
use webcomment_common::types::*;
|
|
use yew::{html, Component, Context, Html, Properties};
|
|
|
|
pub struct CommentsComponent {}
|
|
|
|
#[derive(Properties, PartialEq)]
|
|
pub struct CommentsProps {
|
|
pub root_id: String, // TODO maybe opti
|
|
pub api: Api,
|
|
}
|
|
|
|
pub enum Msg {
|
|
}
|
|
|
|
impl Component for CommentsComponent {
|
|
type Message = Msg;
|
|
type Properties = CommentsProps;
|
|
|
|
fn create(_ctx: &Context<Self>) -> Self {
|
|
Self {}
|
|
}
|
|
|
|
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
|
|
false
|
|
}
|
|
|
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
let props = ctx.props();
|
|
let comment_props = CommentProps {
|
|
root_id: String::from("comments"),
|
|
comment: FullComment {
|
|
author: String::from("Toto"),
|
|
email: Some(String::from("toto@fai.tld")),
|
|
id: CommentId::new(),
|
|
last_edit_time: Some(123),
|
|
post_time: 42,
|
|
text: String::from("Bonjour"),
|
|
},
|
|
};
|
|
let element_id = format!("{}-comments", props.root_id);
|
|
html! {
|
|
<div id={ element_id }>
|
|
<CommentComponent ..comment_props />
|
|
</div>
|
|
}
|
|
}
|
|
}
|