commit a84e74e

grunfink  ·  2026-01-12 05:14:58 +0000 UTC
parent de9d546
Move the pronouns closer to the account name.
1 files changed,  +16, -15
M html.c
M html.c
+16, -15
 1@@ -222,9 +222,6 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
 2 
 3     xs *name = actor_name(actor, proxy);
 4     xs *pronouns = actor_pronouns(actor);
 5-    char pronouns_c = 0;
 6-    if (*pronouns != '\0')
 7-        pronouns_c = 1;
 8 
 9     /* get the avatar */
10     if ((v = xs_dict_get(actor, "icon")) != NULL) {
11@@ -259,16 +256,28 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
12     if (href == NULL)
13         href = xs_dup(actor_id);
14 
15+    xs_html *name_link = xs_html_tag("a",
16+            xs_html_attr("href",    href),
17+            xs_html_attr("class",   "p-author h-card snac-author"),
18+            xs_html_raw(name)); /* name is already html-escaped */
19+
20+    if (*pronouns) {
21+        xs_html_add(name_link,
22+            xs_html_text(" ["),
23+            xs_html_tag("span",
24+                xs_html_attr("class",   "snac-pronouns"),
25+                xs_html_attr("title",   "user's pronouns"),
26+                xs_html_raw(pronouns)),
27+            xs_html_text("]"));
28+    }
29+
30     xs_html_add(actor_icon,
31         xs_html_sctag("img",
32             xs_html_attr("loading", "lazy"),
33             xs_html_attr("class",   "snac-avatar"),
34             xs_html_attr("src",     avatar),
35             xs_html_attr("alt",     "[?]")),
36-        xs_html_tag("a",
37-            xs_html_attr("href",    href),
38-            xs_html_attr("class",   "p-author h-card snac-author"),
39-            xs_html_raw(name))); /* name is already html-escaped */
40+        name_link);
41 
42     if (!xs_is_null(url)) {
43         xs *md5 = xs_md5_hex(url, strlen(url));
44@@ -281,14 +290,6 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
45                 xs_html_text("ยป")));
46     }
47 
48-    if (pronouns_c > 0)
49-        xs_html_add(actor_icon,
50-            xs_html_text(" "),
51-            xs_html_tag("span",
52-                xs_html_attr("class",   "snac-pronouns"),
53-                xs_html_attr("title",   "user's pronouns"),
54-                xs_html_raw(pronouns)));
55-
56 
57     if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) {
58         xs_html_add(actor_icon,