add: forges ui

TODO: forges tickets feed, posts open/closed state
This commit is contained in:
trisua 2025-06-09 16:45:36 -04:00
parent 5b1db42c51
commit a6140f7c8c
40 changed files with 1664 additions and 1270 deletions

View file

@ -0,0 +1,83 @@
; this is essentially the same as `communities/base.lisp`, but it has some minor
; changes to be more github-like instead of retrospring-like
(text "{% extends \"root.html\" %} {% block head %}")
(title
(text "{{ community.context.display_name }} - {{ config.name }}"))
(meta
("name" "og:title")
("content" "{{ community.title }}"))
(meta
("name" "description")
("content" "View the \\\"{{ community.title }}\\\" community on {{ config.name }}!"))
(meta
("name" "og:description")
("content" "View the \\\"{{ community.title }}\\\" community on {{ config.name }}!"))
(meta
("property" "og:type")
("content" "profile"))
(meta
("property" "profile:username")
("content" "{{ community.title }}"))
(meta
("name" "og:image")
("content" "{{ config.host|safe }}/api/v1/communities/{{ community.id }}/avatar"))
(meta
("name" "twitter:image")
("content" "{{ config.host|safe }}/api/v1/communities/{{ community.id }}/avatar"))
(meta
("name" "twitter:card")
("content" "summary"))
(meta
("name" "twitter:title")
("content" "{{ community.title }}"))
(meta
("name" "twitter:description")
("content" "View the \\\"{{ community.title }}\\\" community on {{ config.name }}!"))
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
(main
(div
("class" "content_container flex flex-col gap-4")
(div
("class" "card-nest")
(div
("class" "card flex gap-2")
("id" "community_avatar_and_name")
(text "{{ components::community_avatar(id=community.id, community=community, size=\"72px\") }}")
(div
("class" "flex flex-col")
(div
("class" "flex gap-2 items-center")
(h3
("id" "title")
("class" "title name shorter flex gap-2")
(text "{% if community.context.display_name -%} {{ community.context.display_name }} {% else %} {{ community.title }} {%- endif %} {% if community.context.is_nsfw -%}")
(span
("title" "NSFW community")
("class" "flex items-center")
("style" "color: var(--color-primary)")
(text "{{ icon \"square-asterisk\" }}"))
(text "{%- endif %}")))
(span
("class" "fade")
(text "{{ community.title }}"))))
(text "{{ components::community_actions(community=community) }}"))
(text "{% block content %}{% endblock %}")))
(text "{% if not community.is_forge %}")
(script
(text "window.location.pathname = window.location.pathname.replace(\"/forge\", \"/community\")"))
(text "{% endif %}")
(text "{% endblock %}")

View file

@ -0,0 +1,80 @@
(text "{% extends \"root.html\" %} {% block head %}")
(title
(text "Forge - {{ config.name }}"))
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"\") }}")
(main
("class" "flex flex-col gap-2")
; create new
(text "{% if user.permissions|has_supporter -%}")
(div
("class" "card-nest")
(div
("class" "card small")
(b
(text "{{ text \"forge:label.create_new\" }}")))
(form
("class" "card flex flex-col gap-2")
("onsubmit" "create_community_from_form(event)")
(div
("class" "flex flex-col gap-1")
(label
("for" "title")
(text "{{ text \"communities:label.name\" }}"))
(input
("type" "text")
("name" "title")
("id" "title")
("placeholder" "name")
("required" "")
("minlength" "2")
("maxlength" "32")))
(button
("class" "primary")
(text "{{ text \"communities:action.create\" }}"))))
(text "{% else %}")
(text "{{ components::supporter_ad(body=\"Become a supporter to create forges!\") }}")
(text "{%- endif %}")
; forge listing
(div
("class" "card-nest")
(div
("class" "card small flex items-center gap-2")
(icon (text "anvil"))
(str (text "forge:label.my_forges")))
(div
("class" "card flex flex-col gap-2")
(text "{% for item in list %} {{ components::community_listing_card(community=item) }} {% endfor %}"))))
(script
(text "async function create_community_from_form(e) {
e.preventDefault();
await trigger(\"atto::debounce\", [\"communities::create\"]);
fetch(\"/api/v1/communities\", {
method: \"POST\",
headers: {
\"Content-Type\": \"application/json\",
},
body: JSON.stringify({
title: e.target.title.value,
forge: true
}),
})
.then((res) => res.json())
.then((res) => {
trigger(\"atto::toast\", [
res.ok ? \"success\" : \"error\",
res.message,
]);
if (res.ok) {
setTimeout(() => {
window.location.href = `/forge/${res.payload}`;
}, 100);
}
});
}"))
(text "{% endblock %}")

View file

@ -0,0 +1,6 @@
(text "{% extends \"forge/base.html\" %} {% block content %}")
(div
("class" "flex flex-col gap-4 w-full")
(text "{{ macros::forge_nav(community=community, selected=\"info\") }}")
(text "{{ components::community_info(community=community) }}"))
(text "{% endblock %}")