commit c423cc7

default  ·  2023-07-01 17:20:20 +0000 UTC
parent 80cbabf
Added CSS classes to notification and people pages.
1 files changed,  +20, -8
M html.c
M html.c
+20, -8
 1@@ -1302,11 +1302,13 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int
 2 d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *header, const char *t)
 3 {
 4     xs *s = xs_str_new(NULL);
 5-    xs *h = xs_fmt("<h2>%s</h2>\n", header);
 6+    xs *h = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", header);
 7     char *p, *actor_id;
 8 
 9     s = xs_str_cat(s, h);
10 
11+    s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
12+
13     p = list;
14     while (xs_list_iter(&p, &actor_id)) {
15         xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
16@@ -1394,6 +1396,8 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
17         }
18     }
19 
20+    s = xs_str_cat(s, "</div>\n");
21+
22     return xs_str_cat(os, s);
23 }
24 
25@@ -1464,24 +1468,29 @@ xs_str *html_notifications(snac *snac)
26         if (strcmp(v, n_time) > 0) {
27             /* unseen notification */
28             if (stage == NHDR_NONE) {
29-                xs *s1 = xs_fmt("<h2>%s</h2>\n", L("New"));
30+                xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("New"));
31                 s = xs_str_cat(s, s1);
32 
33+                s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
34+
35                 stage = NHDR_NEW;
36             }
37         }
38         else {
39             /* already seen notification */
40             if (stage != NHDR_OLD) {
41-                xs *s1 = xs_fmt("<h2>%s</h2>\n", L("Already seen"));
42+                if (stage == NHDR_NEW)
43+                    s = xs_str_cat(s, "</div>\n");
44+
45+                xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("Already seen"));
46                 s = xs_str_cat(s, s1);
47 
48+                s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
49+
50                 stage = NHDR_OLD;
51             }
52         }
53 
54-        s = xs_str_cat(s, "<div>\n");
55-
56         const char *label = type;
57 
58         if (strcmp(type, "Create") == 0)
59@@ -1490,7 +1499,8 @@ xs_str *html_notifications(snac *snac)
60         if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0)
61             label = L("Finished poll");
62 
63-        xs *s1 = xs_fmt("<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n",
64+        xs *s1 = xs_fmt("<div class=\"snac-post-with-desc\">\n"
65+                        "<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n",
66             label, actor_id, a_name);
67         s = xs_str_cat(s, s1);
68 
69@@ -1511,9 +1521,11 @@ xs_str *html_notifications(snac *snac)
70     }
71 
72     if (stage == NHDR_NONE) {
73-        xs *s1 = xs_fmt("<h2>%s</h2>\n", L("None"));
74-         s = xs_str_cat(s, s1);
75+        xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("None"));
76+        s = xs_str_cat(s, s1);
77     }
78+    else
79+        s = xs_str_cat(s, "</div>\n");
80 
81     s = html_user_footer(s);
82