add: finish ui rewrite
This commit is contained in:
parent
e9846016e6
commit
5dec98d698
119 changed files with 8776 additions and 9350 deletions
163
crates/app/src/public/html/profile/private.lisp
Normal file
163
crates/app/src/public/html/profile/private.lisp
Normal file
|
@ -0,0 +1,163 @@
|
|||
(text "{% extends \"root.html\" %} {% block head %}")
|
||||
(title
|
||||
(text "{{ profile.username }} (private profile) - {{ config.name }}"))
|
||||
|
||||
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
|
||||
(main
|
||||
("class" "flex flex-col gap-2")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center justify-between gap-2")
|
||||
(div
|
||||
("class" "flex items-center gap-2")
|
||||
(text "{{ components::avatar(username=profile.username, size=\"24px\") }}")
|
||||
(span
|
||||
(text "{{ profile.username }}")))
|
||||
(b
|
||||
("class" "notification chip")
|
||||
(text "{{ text \"auth:label.private_profile\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(span
|
||||
(text "{{ text \"auth:label.private_profile_message\" }}"))
|
||||
(div
|
||||
("class" "card w-full secondary flex gap-2")
|
||||
(text "{% if user -%} {% if not is_following -%}")
|
||||
(button
|
||||
("onclick" "toggle_follow_user(event)")
|
||||
("class" "{% if follow_requested -%} hidden{%- endif %}")
|
||||
("atto_tag" "user.follow_request")
|
||||
(text "{{ icon \"user-plus\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.request_to_follow\" }}")))
|
||||
(button
|
||||
("onclick" "cancel_follow_user(event)")
|
||||
("class" "quaternary red{% if not follow_requested -%} hidden{%- endif %}")
|
||||
("atto_tag" "user.cancel_request")
|
||||
(text "{{ icon \"user-minus\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.cancel_follow_request\" }}")))
|
||||
(text "{% else %}")
|
||||
(button
|
||||
("onclick" "toggle_follow_user(event)")
|
||||
("class" "quaternary red")
|
||||
("atto_tag" "user.unfollow")
|
||||
(text "{{ icon \"user-minus\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.unfollow\" }}")))
|
||||
(text "{%- endif %} {% if not is_blocking -%}")
|
||||
(button
|
||||
("onclick" "toggle_block_user()")
|
||||
("class" "quaternary red")
|
||||
(text "{{ icon \"shield\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.block\" }}")))
|
||||
(text "{% else %}")
|
||||
(button
|
||||
("onclick" "toggle_block_user()")
|
||||
("class" "quaternary red")
|
||||
(text "{{ icon \"shield-off\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.unblock\" }}")))
|
||||
(text "{%- endif %}")
|
||||
(script
|
||||
(text "globalThis.toggle_follow_user = async (e) => {
|
||||
await trigger(\"atto::debounce\", [\"users::follow\"]);
|
||||
fetch(\"/api/v1/auth/user/{{ profile.id }}/follow\", {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (
|
||||
e.target.getAttribute(\"atto_tag\") ===
|
||||
\"user.follow_request\"
|
||||
) {
|
||||
document
|
||||
.querySelector(
|
||||
'[atto_tag=\"user.follow_request\"]',
|
||||
)
|
||||
.classList.add(\"hidden\");
|
||||
|
||||
document
|
||||
.querySelector(
|
||||
'[atto_tag=\"user.cancel_request\"]',
|
||||
)
|
||||
.classList.remove(\"hidden\");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.cancel_follow_user = async (e) => {
|
||||
await trigger(\"atto::debounce\", [\"users::follow\"]);
|
||||
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Are you sure you would like to do this?\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(
|
||||
\"/api/v1/auth/user/{{ profile.id }}/follow/cancel\",
|
||||
{
|
||||
method: \"POST\",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
document
|
||||
.querySelector(
|
||||
'[atto_tag=\"user.cancel_request\"]',
|
||||
)
|
||||
.classList.add(\"hidden\");
|
||||
document
|
||||
.querySelector(
|
||||
'[atto_tag=\"user.follow_request\"]',
|
||||
)
|
||||
.classList.remove(\"hidden\");
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.toggle_block_user = async () => {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Are you sure you would like to do this?\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(\"/api/v1/auth/user/{{ profile.id }}/block\", {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
});
|
||||
};"))
|
||||
(text "{%- endif %}")
|
||||
(a
|
||||
("href" "/")
|
||||
("class" "button red quaternary")
|
||||
(text "{{ icon \"x\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.back\" }}")))))))
|
||||
|
||||
(text "{% endblock %}")
|
Loading…
Add table
Add a link
Reference in a new issue