add: ability to add user to stack through block list ui
This commit is contained in:
parent
8c969cd56f
commit
2a77c61bf2
10 changed files with 130 additions and 20 deletions
|
@ -312,22 +312,11 @@
|
|||
|
||||
if (playing.error) {
|
||||
// refresh token
|
||||
const [new_token, new_refresh_token, expires_in] =
|
||||
await trigger(\"spotify::refresh_token\", [
|
||||
client_id,
|
||||
const [new_token, new_refresh_token] =
|
||||
await trigger(\"spotify::refresh\", [
|
||||
refresh_token,
|
||||
]);
|
||||
|
||||
await trigger(\"connections::push_con_data\", [
|
||||
\"Spotify\",
|
||||
{
|
||||
token: new_token,
|
||||
refresh_token: new_refresh_token,
|
||||
expires_in: expires_in.toString(),
|
||||
name: profile.display_name,
|
||||
},
|
||||
]);
|
||||
|
||||
token = new_token;
|
||||
refresh_token = new_refresh_token;
|
||||
return;
|
||||
|
|
|
@ -433,12 +433,19 @@
|
|||
(div
|
||||
("class" "flex gap-2")
|
||||
(text "{{ components::avatar(username=user.username) }} {{ components::full_username(user=user) }}"))
|
||||
(a
|
||||
("href" "/@{{ user.username }}")
|
||||
("class" "button lowered small")
|
||||
(text "{{ icon \"external-link\" }}")
|
||||
(span
|
||||
(text "{{ text \"requests:action.view_profile\" }}"))))
|
||||
(div
|
||||
("class" "flex gap-2")
|
||||
(a
|
||||
("href" "/stacks/add_user/{{ user.id }}")
|
||||
("target" "_blank")
|
||||
("class" "button lowered small")
|
||||
(icon (text "plus"))
|
||||
(span (str (text "settings:label.add_to_stack"))))
|
||||
(a
|
||||
("href" "/@{{ user.username }}")
|
||||
("class" "button lowered small")
|
||||
(icon (text "external-link"))
|
||||
(span (str (text "requests:action.view_profile"))))))
|
||||
(text "{% endfor %}")))))
|
||||
(div
|
||||
("class" "w-full flex flex-col gap-2 hidden")
|
||||
|
|
49
crates/app/src/public/html/stacks/add_user.lisp
Normal file
49
crates/app/src/public/html/stacks/add_user.lisp
Normal file
|
@ -0,0 +1,49 @@
|
|||
(text "{% extends \"root.html\" %} {% block head %}")
|
||||
(title
|
||||
(text "Add user to stack - {{ config.name }}"))
|
||||
|
||||
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"\") }}")
|
||||
(main
|
||||
("class" "flex flex-col gap-2")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center gap-2")
|
||||
(text "{{ components::avatar(username=add_user.username, size=\"24px\") }}")
|
||||
(text "{{ components::full_username(user=add_user) }}"))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(span (text "Select a stack to add this user to:"))
|
||||
(text "{% for stack in stacks %}")
|
||||
(button
|
||||
("class" "justify-start lowered w-full")
|
||||
("onclick" "choose_stack('{{ stack.id }}')")
|
||||
(icon (text "layers"))
|
||||
(text "{{ stack.name }}"))
|
||||
(text "{% endfor %}"))))
|
||||
|
||||
(script
|
||||
(text "function choose_stack(id) {
|
||||
fetch(`/api/v1/stacks/${id}/users`, {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: \"{{ add_user.username }}\",
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
}"))
|
||||
|
||||
(text "{% endblock %}")
|
|
@ -173,7 +173,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
fetch(`/api/v1/stacks/{{ stack.id }}/users`, {
|
||||
fetch(\"/api/v1/stacks/{{ stack.id }}/users\", {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue