tetratto/crates/app/src/public/html/macros.lisp

325 lines
11 KiB
Common Lisp

(text "{% macro nav(selected=\"\", show_lhs=true, hide_user_menu=false) -%}")
(nav
(div
("class" "content_container flex justify-between")
(div
("class" "flex nav_side")
(a
("href" "/")
("class" "button desktop title")
(b (text "{{ config.name }}")))
(text "{% if show_lhs -%}")
(a
("href" "{{ home }}")
("class" "button {% if selected == 'home' -%}active{%- endif %}")
("title" "Home")
(icon (text "house"))
(span
("class" "desktop")
(str (text "general:link.home"))))
(text "{% if user -%}")
(a
("href" "/communities")
("class" "button {% if selected == 'communities' -%}active{%- endif %}")
(icon (text "book-heart"))
(span
("class" "desktop")
(str (text "general:link.communities"))))
(text "{%- endif %} {%- endif %}"))
(div
("class" "flex nav_side")
(text "{% if user -%}")
(a
("href" "/communities/intents/post")
("class" "button")
("title" "Create post")
(icon (text "square-pen")))
(a
("href" "/chats/0/0")
("class" "button {% if selected == 'chats' -%}active{%- endif %}")
("title" "Chats")
(icon (text "message-circle")))
(a
("href" "/requests")
("class" "button {% if selected == 'requests' -%}active{%- endif %}")
("title" "Chats")
(icon (text "inbox"))
(span
("class" "notification tr {% if user.request_count <= 0 -%}hidden{%- endif %}")
("id" "requests_span")
(text "{{ user.request_count }}")))
(a
("href" "/notifs")
("class" "button {% if selected == 'notifications' -%}active{%- endif %}")
("title" "Chats")
(icon (text "bell"))
(span
("class" "notification tr {% if user.notification_count <= 0 -%}hidden{%- endif %}")
("id" "notifications_span")
(text "{{ user.notification_count }}")))
(text "{% if not hide_user_menu -%}")
(div
("class" "dropdown")
(button
("class" "flex-row title")
("onclick" "trigger('atto::hooks::dropdown', [event])")
("exlude" "dropdown")
("style" "gap: var(--pad-1) !important")
(text "{{ components::avatar(username=user.username, size=\"24px\") }}")
(icon_class (text "chevron-down") (text "dropdown-arrow")))
(text "{{ components::user_menu() }}"))
(text "{%- endif %} {% else %}")
(div
("class" "dropdown")
(button
("class" "title")
("onclick" "trigger('atto::hooks::dropdown', [event])")
("exclude" "dropdown")
(icon_class (text "chevron-down") (text "dropdown-arrow")))
(div
("class" "inner")
(a
("href" "/auth/login")
("class" "button")
(icon (text "log-in"))
(str (text "auth:action.login")))
(a
("href" "/auth/register")
("class" "button")
(icon (text "user-plus"))
(str (text "auth:action.register")))
(b ("class" "title") (text "{{ config.name }}"))
(a
("href" "https://trisua.com/t/tetratto")
("class" "button")
(icon (text "code"))
(str (text "general:link.source_code")))
(a
("href" "/reference/tetratto/index.html")
("class" "button")
("data-turbo" "false")
(icon (text "rabbit"))
(str (text "general:link.reference")))
(a
("href" "{{ config.policies.terms_of_service }}")
("class" "button")
(icon (text "heart-handshake"))
(text "Terms of service"))
(a
("href" "{{ config.policies.privacy }}")
("class" "button")
(icon (text "cookie"))
(text "Privacy policy")))))
(text "{%- endif %}")))
(text "{%- endmacro %}")
(text "{% macro timelines_nav(selected=\"\", posts=\"\", questions=\"\", secondary_selected=\"posts\") -%}")
(div
("class" "mobile_nav mobile")
; primary nav
(div
("class" "dropdown")
("style" "width: max-content")
(button
("class" "camo raised small")
("onclick" "trigger('atto::hooks::dropdown', [event])")
("exclude" "dropdown")
(icon (text "sliders-horizontal"))
(text "{{ selected }}"))
(div
("class" "inner left")
(text "{{ macros::timelines_nav_options(selected=selected) }}")))
(text "{% if posts and questions -%}")
; secondary nav
(text "{{ macros::timelines_secondary_nav(posts=posts, questions=questions, selected=secondary_selected) }}")
(text "{%- endif %}"))
(div
("class" "desktop flex flex-col gap-2")
; primary nav desktop only
(text "{{ macros::timelines_nav_options(selected=selected) }}")
; secondary nav desktop only
(text "{% if posts and questions -%}")
(text "{{ macros::timelines_secondary_nav(posts=posts, questions=questions, selected=secondary_selected) }}")
(text "{%- endif %}"))
(text "{%- endmacro %}")
(text "{% macro timelines_nav_options(selected=\"\") -%}")
(div
("class" "pillmenu {% if user -%}rows{% endif %} w-full")
(div
("class" "row")
(text "{% if user -%}")
(a
("href" "/")
("class" "{% if selected == 'home' -%}active{%- endif %}")
(icon (text "newspaper"))
(str (text "general:link.home")))
(a
("href" "/stacks")
("class" "{% if selected == 'stacks' -%}active{%- endif %}")
(icon (text "layers"))
(str (text "stacks:link.stacks")))
(text "{% else %}")
(a
("href" "/")
("class" "{% if selected == 'all' -%}active{%- endif %}")
(icon (text "earth"))
(str (text "general:link.all")))
(text "{%- endif %}")
(a
("href" "/popular")
("class" "{% if selected == 'popular' -%}active{%- endif %}")
(icon (text "trending-up"))
(str (text "general:link.popular"))))
(div
("class" "row")
(text "{% if user -%}")
(a
("href" "/following")
("class" "{% if selected == 'following' -%}active{%- endif %}")
(icon (text "rss"))
(str (text "general:link.following")))
(a
("href" "/search")
("class" "{% if selected == 'search' -%}active{%- endif %}")
(icon (text "search"))
(str (text "general:link.search")))
(a
("href" "/all")
("class" "{% if selected == 'all' -%}active{%- endif %}")
(icon (text "earth"))
(str (text "general:link.all")))
(text "{%- endif %}")))
(text "{%- endmacro %}")
(text "{% macro timelines_secondary_nav(posts=\"\", questions=\"\", selected=\"posts\") -%} {% if user -%}")
(div
("class" "pillmenu w-full")
(a
("href" "{{ posts }}")
("class" "{% if selected == 'posts' -%}active{%- endif %}")
(icon (text "newspaper"))
(span (str (text "communities:label.posts"))))
(a
("href" "{{ questions }}")
("class" "{% if selected == 'questions' -%}active{%- endif %}")
(icon (text "message-circle-heart"))
(span (str (text "communities:label.questions")))))
(text "{%- endif %} {%- endmacro %}")
(text "{% macro community_nav(community, selected=\"\") -%} {% if community.context.enable_questions -%}")
(div
("class" "pillmenu")
(a
("href" "/community/{{ community.title }}")
("class" "{% if selected == 'posts' -%}active{%- endif %}")
(icon (text "newspaper"))
(str (text "communities:tab.posts")))
(a
("href" "/community/{{ community.title }}/questions")
("class" "{% if selected == 'questions' -%}active{%- endif %}")
(icon (text "message-circle-heart"))
(str (text "communities:tab.questions"))))
(text "{%- endif %} {%- endmacro %}")
(text "{% macro profile_nav(selected=\"\") -%}")
(div
("class" "pillmenu")
(text "{% if is_self or is_helper or not profile.settings.hide_extra_post_tabs -%}")
(a
("href" "/@{{ profile.username }}")
("class" "{% if selected == 'posts' -%}active{%- endif %}")
(str (text "auth:label.posts")))
(a
("href" "/@{{ profile.username }}/replies")
("class" "{% if selected == 'replies' -%}active{%- endif %}")
(str (text "auth:label.replies")))
(a
("href" "/@{{ profile.username }}/media")
("class" "{% if selected == 'media' -%}active{%- endif %}")
(str (text "auth:label.media")))
(text "{% if is_self or is_helper -%}")
(a
("href" "/@{{ profile.username }}/outbox")
("class" "{% if selected == 'outbox' -%}active{%- endif %}")
(str (text "auth:label.outbox")))
(text "{%- endif %} {%- endif %}"))
(text "{%- endmacro %}")
(text "{% macro forge_nav(community, selected=\"\") -%}")
(div
("class" "pillmenu")
(a
("href" "/forge/{{ community.title }}")
("class" "{% if selected == 'info' -%}active{%- endif %}")
(icon (text "info"))
(str (text "forge:tab.info")))
(a
("href" "/forge/{{ community.title }}/tickets")
("class" "{% if selected == 'tickets' -%}active{%- endif %}")
(icon (text "circle-dot"))
(str (text "forge:tab.tickets"))))
(text "{%- endmacro %}")
(text "{% macro profile_settings_nav_options() -%}")
(a
("data-tab-button" "account")
("class" "active")
("href" "#/account")
(text "{{ icon \"smile\" }}")
(span
(text "{{ text \"settings:tab.account\" }}")))
(a
("data-tab-button" "profile")
("href" "#/profile")
(text "{{ icon \"user-round\" }}")
(span
(text "{{ text \"settings:tab.profile\" }}")))
(a
("data-tab-button" "theme")
("href" "#/theme")
(text "{{ icon \"paint-bucket\" }}")
(span
(text "{{ text \"settings:tab.theme\" }}")))
(a
("data-tab-button" "sessions")
("href" "#/sessions")
(text "{{ icon \"cookie\" }}")
(span
(text "{{ text \"settings:tab.sessions\" }}")))
(a
("data-tab-button" "connections")
("href" "#/connections")
(text "{{ icon \"cable\" }}")
(span
(text "{{ text \"settings:tab.connections\" }}")))
(text "{%- endmacro %}")