summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/mod.rs16
-rw-r--r--src/resp_types.rs1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/components/mod.rs b/src/components/mod.rs
index 545ab56..cd348ba 100644
--- a/src/components/mod.rs
+++ b/src/components/mod.rs
@@ -54,8 +54,7 @@ pub fn Comment<'comment, 'base_data>(
</div>
{
- match &comment.replies {
- Some(replies) => {
+ if let Some(replies) = &comment.replies {
Some(render::rsx! {
<ul>
{
@@ -68,8 +67,17 @@ pub fn Comment<'comment, 'base_data>(
}
</ul>
})
- },
- None => None,
+ } else {
+ None
+ }
+ }
+ {
+ if comment.replies.is_none() && comment.has_replies {
+ Some(render::rsx! {
+ <ul><li><a href={format!("/comments/{}", comment.id)}>{"-> View More Comments"}</a></li></ul>
+ })
+ } else {
+ None
}
}
</li>
diff --git a/src/resp_types.rs b/src/resp_types.rs
index 53e0935..dfe7619 100644
--- a/src/resp_types.rs
+++ b/src/resp_types.rs
@@ -34,6 +34,7 @@ pub struct RespPostCommentInfo<'a> {
pub your_vote: Option<Empty>,
#[serde(borrow)]
pub replies: Option<Vec<RespPostCommentInfo<'a>>>,
+ pub has_replies: bool,
}
#[derive(Deserialize, Debug)]