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

@ -1798,8 +1798,8 @@
(span ("class" "notification chip") (text "{{ total }} votes"))
(text "{% if not poll[2] -%}")
(span
("class" "notification chip")
(text "Expires in ")
("class" "notification chip flex items-center gap-1")
(text "Expires in")
(span
("class" "poll_date")
("data-created" "{{ poll[0].created }}")

View file

@ -62,12 +62,15 @@
("class" "card-nest")
(div
("class" "card small flex items-center gap-2")
(text "{{ icon \"user-plus\" }}")
(a
("href" "/api/v1/auth/user/find/{{ request.id }}")
(text "{{ components::avatar(username=request.id, selector_type=\"id\") }}"))
(span
(text "{{ text \"requests:label.user_follow_request\" }}")))
(div
("class" "card flex flex-col gap-2")
(span
("class" "flex items-center gap-2")
(text "{{ text \"requests:label.user_follow_request_message\" }}"))
(div
("class" "card flex flex-wrap w-full secondary gap-2")

View file

@ -35,6 +35,7 @@
(text "{{ icon \"user-plus\" }}")
(span
(text "{{ text \"auth:action.request_to_follow\" }}")))
(text "{% if follow_requested -%}")
(button
("onclick" "cancel_follow_user(event)")
("class" "lowered red{% if not follow_requested -%} hidden{%- endif %}")
@ -42,7 +43,7 @@
(text "{{ icon \"user-minus\" }}")
(span
(text "{{ text \"auth:action.cancel_follow_request\" }}")))
(text "{% else %}")
(text "{%- endif %} {% else %}")
(button
("onclick" "toggle_follow_user(event)")
("class" "lowered red")

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")