add: manage followers page

This commit is contained in:
trisua 2025-07-15 00:08:49 -04:00
parent 959a125992
commit 70ecc6f96e
8 changed files with 119 additions and 6 deletions

View file

@ -137,6 +137,12 @@
(text "{{ icon \"rss\" }}")
(span
(text "{{ text \"auth:label.following\" }}")))
(a
("data-tab-button" "account/followers")
("href" "#/account/followers")
(text "{{ icon \"rss\" }}")
(span
(text "{{ text \"auth:label.followers\" }}")))
(a
("data-tab-button" "account/blocks")
("href" "#/account/blocks")
@ -457,7 +463,7 @@
(text "{{ icon \"external-link\" }}")
(span
(text "{{ text \"requests:action.view_profile\" }}")))))
(text "{% endfor %}"))))
(text "{% endfor %} {{ components::pagination(page=page, items=following|length, key=\"#/account/following\") }}"))))
(script
(text "globalThis.toggle_follow_user = async (uid) => {
await trigger(\"atto::debounce\", [\"users::follow\"]);
@ -473,6 +479,62 @@
]);
});
};")))
(div
("class" "w-full flex flex-col gap-2 hidden")
("data-tab" "account/followers")
(div
("class" "card lowered flex flex-col gap-2")
(a
("href" "#/account")
("class" "button secondary")
(text "{{ icon \"arrow-left\" }}")
(span
(text "{{ text \"general:action.back\" }}")))
(div
("class" "card-nest")
(div
("class" "card flex items-center gap-2 small")
(text "{{ icon \"rss\" }}")
(span
(text "{{ text \"auth:label.followers\" }}")))
(div
("class" "card flex flex-col gap-2")
(text "{% for userfollow in followers %} {% set user = userfollow[1] %}")
(div
("class" "card secondary flex flex-wrap gap-2 items-center justify-between")
(div
("class" "flex gap-2")
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
(div
("class" "flex gap-2")
(button
("class" "lowered red small")
("onclick" "force_unfollow_me('{{ user.id }}')")
(text "{{ icon \"user-minus\" }}")
(span
(str (text "stacks:label.remove"))))
(a
("href" "/@{{ user.username }}")
("class" "button lowered small")
(text "{{ icon \"external-link\" }}")
(span
(text "{{ text \"requests:action.view_profile\" }}")))))
(text "{% endfor %} {{ components::pagination(page=page, items=following|length, key=\"#/account/followers\") }}"))))
(script
(text "globalThis.force_unfollow_me = async (uid) => {
await trigger(\"atto::debounce\", [\"users::follow\"]);
fetch(`/api/v1/auth/user/${uid}/force_unfollow_me`, {
method: \"POST\",
})
.then((res) => res.json())
.then((res) => {
trigger(\"atto::toast\", [
res.ok ? \"success\" : \"error\",
res.message,
]);
});
};")))
(div
("class" "w-full flex flex-col gap-2 hidden")
("data-tab" "account/blocks")