Added CSS classes to notification and people pages.

This commit is contained in:
default 2023-07-01 19:20:20 +02:00
parent 80cbabfcee
commit c423cc7425

26
html.c
View file

@ -1302,11 +1302,13 @@ xs_str *html_timeline(snac *snac, const xs_list *list, int local, int skip, int
d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *header, const char *t) d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *header, const char *t)
{ {
xs *s = xs_str_new(NULL); xs *s = xs_str_new(NULL);
xs *h = xs_fmt("<h2>%s</h2>\n", header); xs *h = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", header);
char *p, *actor_id; char *p, *actor_id;
s = xs_str_cat(s, h); s = xs_str_cat(s, h);
s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
p = list; p = list;
while (xs_list_iter(&p, &actor_id)) { while (xs_list_iter(&p, &actor_id)) {
xs *md5 = xs_md5_hex(actor_id, strlen(actor_id)); xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
@ -1394,6 +1396,8 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
} }
} }
s = xs_str_cat(s, "</div>\n");
return xs_str_cat(os, s); return xs_str_cat(os, s);
} }
@ -1464,24 +1468,29 @@ xs_str *html_notifications(snac *snac)
if (strcmp(v, n_time) > 0) { if (strcmp(v, n_time) > 0) {
/* unseen notification */ /* unseen notification */
if (stage == NHDR_NONE) { if (stage == NHDR_NONE) {
xs *s1 = xs_fmt("<h2>%s</h2>\n", L("New")); xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("New"));
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
stage = NHDR_NEW; stage = NHDR_NEW;
} }
} }
else { else {
/* already seen notification */ /* already seen notification */
if (stage != NHDR_OLD) { if (stage != NHDR_OLD) {
xs *s1 = xs_fmt("<h2>%s</h2>\n", L("Already seen")); if (stage == NHDR_NEW)
s = xs_str_cat(s, "</div>\n");
xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("Already seen"));
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
stage = NHDR_OLD; stage = NHDR_OLD;
} }
} }
s = xs_str_cat(s, "<div>\n");
const char *label = type; const char *label = type;
if (strcmp(type, "Create") == 0) if (strcmp(type, "Create") == 0)
@ -1490,7 +1499,8 @@ xs_str *html_notifications(snac *snac)
if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0) if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0)
label = L("Finished poll"); label = L("Finished poll");
xs *s1 = xs_fmt("<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n", xs *s1 = xs_fmt("<div class=\"snac-post-with-desc\">\n"
"<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n",
label, actor_id, a_name); label, actor_id, a_name);
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
@ -1511,9 +1521,11 @@ xs_str *html_notifications(snac *snac)
} }
if (stage == NHDR_NONE) { if (stage == NHDR_NONE) {
xs *s1 = xs_fmt("<h2>%s</h2>\n", L("None")); xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", L("None"));
s = xs_str_cat(s, s1); s = xs_str_cat(s, s1);
} }
else
s = xs_str_cat(s, "</div>\n");
s = html_user_footer(s); s = html_user_footer(s);