add: mail ui

This commit is contained in:
trisua 2025-08-02 16:04:50 -04:00
parent 2e60cbc464
commit b2a73d286b
24 changed files with 993 additions and 259 deletions

View file

@ -113,6 +113,12 @@
("style" "color: var(--color-primary)")
("class" "flex items-center")
(text "{{ icon \"badge-check\" }}"))
(text "{%- endif %} {% if user.permissions|has_supporter -%}")
(span
("title" "Supporter")
("style" "color: var(--color-primary);")
("class" "flex items-center")
(text "{{ icon \"star\" }}"))
(text "{%- endif %} {% if user.permissions|has_staff_badge -%}")
(span
("title" "Staff")
@ -456,21 +462,25 @@
(div
("class" "w-full card-nest")
(div
("class" "card small notif_title flex items-center")
(text "{% if not notification.read -%}")
(svg
("width" "24")
("height" "24")
("viewBox" "0 0 24 24")
("style" "fill: var(--color-link)")
(circle
("cx" "12")
("cy" "12")
("r" "6")))
(text "{%- endif %}")
(b
("class" "no_p_margin")
(text "{{ notification.title|markdown|safe }}")))
("class" "card small notif_title flex gap-2 justify-between items-center")
(div
("class" "flex items-center")
(text "{% if not notification.read -%}")
(svg
("width" "24")
("height" "24")
("viewBox" "0 0 24 24")
("style" "fill: var(--color-link)")
(circle
("cx" "12")
("cy" "12")
("r" "6")))
(text "{%- endif %}")
(b
("class" "no_p_margin")
(text "{{ notification.title|markdown|safe }}")))
(span ("class" "date") (text "{{ notification.created }}")))
(div
("class" "card notif_content flex flex-col gap-2")
(span
@ -2451,3 +2461,85 @@
(span
(str (text "dialog:action.continue"))))))
(text "{%- endif %} {%- endmacro %}")
(text "{% macro letter_listing(letter, owner) -%}")
(div
("class" "card lowered flex gap-2 flex-row")
(a
("href" "/@{{ owner.username }}")
(text "{{ self::avatar(username=owner.username, size=\"32px\") }}"))
(div
("class" "flex flex-col")
(text "{{ self::full_username(user=owner) }}")
(div
("class" "flex items-center gap-2")
; read status
(text "{% if user.id in letter.read_by -%}")
(div ("class" "flex items-center green") (icon (text "mail-check")))
(text "{% else %}")
(div ("class" "flex items-center") (icon (text "mail")))
(text "{%- endif %}")
; subject
(a ("class" "flush") ("href" "/mail/letter/{{ letter.id }}") (b (text "{{ letter.subject }}"))))))
(text "{%- endmacro %}")
(text "{% macro letter(letter, owner, show_subject=true) -%}")
(div
("class" "card-nest")
(text "{% if show_subject -%}")
(div
("class" "card flex gap-2 flex-row")
(a
("href" "/@{{ owner.username }}")
(text "{{ self::avatar(username=owner.username, size=\"32px\") }}"))
(div
("class" "flex flex-col")
(text "{{ self::full_username(user=owner) }}")
(span
(b (text "{{ letter.subject }}"))
(text "{% if letter.replying_to -%}")
(a
("href" "/mail/letter/{{ letter.replying_to }}")
(text " (up)"))
(text "{%- endif %}"))
(div
("class" "flex flex-wrap gap-2")
(text "{% for receiver in letter.receivers %}")
(a
("href" "/api/v1/auth/user/find/{{ receiver }}")
(text "{{ components::avatar(username=receiver, selector_type=\"id\", size=\"18px\") }}"))
(text "{%- endfor %}"))))
(text "{% else %}")
(div
("class" "card small flex gap-2 flex-row")
(a
("href" "/@{{ owner.username }}")
(text "{{ self::avatar(username=owner.username, size=\"24px\") }}"))
(text "{{ self::full_username(user=owner) }}"))
(text "{%- endif %}")
(div
("class" "card flex flex-col gap-2")
(text "{{ letter.content|markdown|safe }}")
(hr)
(div
("class" "flex gap-2 items-center")
(a
("class" "button small lowered")
("href" "/mail/compose?receivers={{ owner.username }}&subject=Re%3A%20{{ letter.subject }}&replying_to={{ letter.id }}")
("title" "Reply")
(icon (text "reply")))
(a
("class" "button small lowered")
("href" "/mail/compose?receivers={% for receiver in letter.receivers %},id%3A{{ receiver }}{% endfor %}&subject=Re%3A%20{{ letter.subject }}&replying_to={{ letter.id }}")
("title" "Reply all")
(icon (text "reply-all")))
(text "{% if user and letter.owner == user.id -%}")
(button
("class" "small lowered red")
("onclick" "delete_letter('{{ letter.id }}')")
("title" "Delete")
(icon (text "trash")))
(text "{%- endif %}"))))
(text "{%- endmacro %}")