commit f38de8c

default  ·  2023-04-14 07:57:18 +0000 UTC
parent 995fd81
Show a top link to the (future) notifications area, including a count of new ones.
1 files changed,  +14, -1
M html.c
M html.c
+14, -1
 1@@ -282,14 +282,27 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
 2                 "<a href=\"%s/admin\" rel=\"nofollow\">%s</a></nav>\n",
 3                 snac->actor, L("RSS"),
 4                 snac->actor, L("private"));
 5-        else
 6+        else {
 7+            xs *n_list = notify_list(snac, 1);
 8+            int n_len  = xs_list_len(n_list);
 9+            xs *n_str  = NULL;
10+
11+            /* show the notification number, if there are any */
12+            if (n_len)
13+                n_str = xs_fmt("<sup style=\"background-color: red; color: white;\"> %d </sup> ", n_len);
14+            else
15+                n_str = xs_str_new("");
16+
17             s1 = xs_fmt(
18                 "<a href=\"%s\">%s</a> - "
19                 "<a href=\"%s/admin\">%s</a> - "
20+                "<a href=\"%s/admin\">%s</a>%s - "
21                 "<a href=\"%s/people\">%s</a></nav>\n",
22                 snac->actor, L("public"),
23                 snac->actor, L("private"),
24+                snac->actor, L("notifications"), n_str,
25                 snac->actor, L("people"));
26+        }
27 
28         s = xs_str_cat(s, s1);
29     }