commit 6f310af

default  ·  2025-03-19 16:07:29 +0000 UTC
parent 83c2888
Hide the first child container if it's empty.
1 files changed,  +6, -0
M html.c
M html.c
+6, -0
 1@@ -2609,6 +2609,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
 2             const char *cmd5;
 3             int cnt = 0;
 4             int o_cnt = 0;
 5+            int f_cnt = 0;
 6 
 7             /* get the first child */
 8             xs_list_next(children, &cmd5, &ctxt);
 9@@ -2632,6 +2633,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
10                         html_entry(user, f_chd, read_only, level + 1, cmd5, hide_children));
11 
12                     cnt++;
13+                    f_cnt++;
14                     left--;
15                 }
16                 else
17@@ -2680,6 +2682,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
18             if (o_cnt == 0 && ch_older)
19                 xs_html_add(ch_older,
20                     xs_html_attr("style", "display: none"));
21+
22+            if (f_cnt == 0)
23+                xs_html_add(fch_container,
24+                    xs_html_attr("style", "display: none"));
25         }
26     }
27