(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\") }}")) (span (text "{{ stack.name }}"))) (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 %}"))) (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' -%}") ; block button + user list for blocklist only (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 %}") ; user icons for circle stack (text "{% if stack.mode == 'Circle' -%}") (div ("class" "flex w-full gap-2 flex-wrap") (text "{% for user in stack.users %} {{ components::avatar(username=user, selector_type=\"id\", size=\"24px\") }} {% endfor %}")) (text "{%- endif %}") ; posts for all stacks except blocklist (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 %}")