about summary refs log tree commit diff
path: root/templates/src
diff options
context:
space:
mode:
Diffstat (limited to 'templates/src')
-rw-r--r--templates/src/templates.rs45
1 files changed, 29 insertions, 16 deletions
diff --git a/templates/src/templates.rs b/templates/src/templates.rs
index 66edc9a..0054c91 100644
--- a/templates/src/templates.rs
+++ b/templates/src/templates.rs
@@ -329,22 +329,35 @@ markup::define! {
                     span.counter { @post["properties"]["bookmark"].as_array().map(|a| a.len()).unwrap_or(0) }
                 }
             }
-            // Needs rich webmention support which may or may not depend on an MF2 parser
-            // Might circumvent with an external parser with CORS support
-            // why write this stuff in rust then tho
-            /*details {
-                summary { "Show comments and reactions" }
-                @if post["properties"]["like"].as_array().map(|a| a.len()).unwrap_or(0) > 0 {
-                    // Show a facepile of likes for a post
-                }
-                @if post["properties"]["bookmark"].as_array().map(|a| a.len()).unwrap_or(0) > 0 {
-                    // Show a facepile of bookmarks for a post
-                }
-                @if post["properties"]["repost"].as_array().map(|a| a.len()).unwrap_or(0) > 0 {
-                    // Show a facepile of reposts for a post
-                }
-                @if post["properties"]["comment"].as_array().map(|a| a.len()).unwrap_or(0) > 0 {
-                    // Show all the comments recursively (so we could do Salmention with them)
+            /*@if (
+                post["properties"]["like"].as_array().map(|a| a.len()).unwrap_or(0)
+                    + post["properties"]["bookmark"].as_array().map(|a| a.len()).unwrap_or(0)
+                    + post["properties"]["repost"].as_array().map(|a| a.len()).unwrap_or(0)
+                    + post["properties"]["comment"].as_array().map(|a| a.len()).unwrap_or(0)
+            ) > 0 {
+                details {
+                    summary { "Show comments and reactions" }
+                    // TODO actually render facepiles and comments
+                    @if let Some(likes) = post["properties"]["like"].as_array() {
+                        @if !likes.is_empty() {
+                            // Show a facepile of likes for a post
+                        }
+                    }
+                    @if let Some(bookmarks) = post["properties"]["bookmark"].as_array() {
+                        @if !bookmarks.is_empty() {
+                            // Show a facepile of bookmarks for a post
+                        }
+                    }
+                    @if let Some(reposts) = post["properties"]["repost"].as_array() {
+                        @if !reposts.is_empty() {
+                            // Show a facepile of reposts for a post
+                        }
+                    }
+                    @if let Some(comments) = post["properties"]["comment"].as_array() {
+                        @for comment in comments.iter() {
+                            // Show all the comments recursively (so we could do Salmention with them)
+                        }
+                    }
                 }
             }*/
         }