tetratto/crates/app/src/public/html/stacks/feed.lisp

115 lines
4.6 KiB
Common Lisp
Raw Normal View History

2025-06-15 11:52:44 -04:00
(text "{% extends \"root.html\" %} {% block head %}")
(title
(text "{{ stack.name }} - {{ config.name }}"))
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
(main
("class" "flex flex-col gap-2")
(text "{{ macros::timelines_nav(selected=\"stacks\") }}")
(div
("class" "card-nest w-full")
(div
("class" "card small flex items-center justify-between gap-2")
(div
("class" "flex items-center gap-2")
(a
("href" "/api/v1/auth/user/find/{{ stack.owner }}")
(text "{{ components::avatar(username=stack.owner, selector_type=\"id\") }}"))
2025-06-15 11:52:44 -04:00
(span
(text "{{ stack.name }}")))
2025-06-15 16:09:02 -04:00
(div
("class" "flex gap-2")
(text "{% if stack.mode == 'Circle' -%}")
; post button for circle stacks
(a
("href" "/communities/intents/post?stack={{ stack.id }}")
("class" "button lowered small")
(text "{{ icon \"plus\" }}")
(span
(text "{{ text \"general:action.post\" }}")))
(text "{%- endif %}")
(text "{% if user and user.id == stack.owner -%}")
; manage button for stack owner only
(a
("href" "/stacks/{{ stack.id }}/manage")
("class" "button lowered small")
(text "{{ icon \"pencil\" }}")
(span
(text "{{ text \"general:action.manage\" }}")))
(text "{%- endif %}")))
2025-06-15 11:52:44 -04:00
(div
("class" "card w-full flex flex-col gap-2")
(text "{% if list|length == 0 -%}")
(p
(text "No items yet! Maybe ")
(a
("href" "/stacks/{{ stack.id }}/manage#/users")
(text "add a user to this stack"))
(text "!"))
(text "{%- endif %}")
(text "{% if stack.mode == 'BlockList' -%}")
2025-06-15 16:09:02 -04:00
; block button + user list for blocklist only
2025-06-15 11:52:44 -04:00
(text "{% if not is_blocked -%}")
(button
("onclick" "block_all()")
(str (text "stacks:label.block_all")))
(text "{% else %}")
(button
("onclick" "block_all(false)")
(str (text "stacks:label.unblock_all")))
(text "{%- endif %}")
(div
("class" "flex gap-2 flex-wrap w-full")
(text "{% for user in list %} {{ components::user_plate(user=user, secondary=true) }} {% endfor %}"))
(text "{% else %}")
2025-06-15 16:09:02 -04:00
; user icons for circle stack
2025-06-15 19:04:56 -04:00
(text "{% if stack.mode == 'Circle' -%}")
(div
("class" "flex w-full gap-2 flex-wrap")
2025-06-15 19:19:41 -04:00
(text "{% for user in stack.users %}")
(a
("href" "/api/v1/auth/user/find/{{ user }}")
("class" "flush")
(text "{{ components::avatar(username=user, selector_type=\"id\", size=\"24px\") }}"))
(text "{% endfor %}"))
2025-06-15 19:04:56 -04:00
(text "{%- endif %}")
2025-06-15 16:09:02 -04:00
; posts for all stacks except blocklist
2025-06-15 11:52:44 -04:00
(text "{% for post in list %}
{% if post[2].read_access == \"Everybody\" -%}
{% if post[0].context.repost and post[0].context.repost.reposting -%}
{{ components::repost(repost=post[3], post=post[0], owner=post[1], secondary=true, community=post[2], show_community=true) }}
{% else %}
{{ components::post(post=post[0], owner=post[1], question=post[4], secondary=true, community=post[2], poll=post[5]) }}
{%- endif %} {%- endif %} {% endfor %}")
(text "{%- endif %} {{ components::pagination(page=page, items=list|length) }}"))))
(script
(text "async function block_all(block = true) {
if (
!(await trigger(\"atto::confirm\", [
\"Are you sure you would like to do this?\",
]))
) {
return;
}
fetch(\"/api/v1/stacks/{{ stack.id }}/block\", {
method: block ? \"POST\" : \"DELETE\",
})
.then((res) => res.json())
.then((res) => {
trigger(\"atto::toast\", [
res.ok ? \"success\" : \"error\",
res.message,
]);
if (res.ok) {
window.location.href = \"/settings#/account/blocks\";
}
});
}"))
(text "{% endblock %}")