{% macro avatar(username, size="24px", selector_type="username") -%} @{{ username }} {%- endmacro %} {% macro community_avatar(id, community=false, size="24px") -%} {% if community -%} {{ community.title }}'s avatar {% else %} {{ id }}'s avatar {%- endif %} {%- endmacro %} {% macro banner(username, border_radius="var(--radius)") -%} {%- endmacro %} {% macro community_banner(id, community=false) -%} {% if community %} {% else %} {%- endif %} {%- endmacro %} {% macro community_listing_card(community) -%} {{ self::community_avatar(id=community.id, community=community, size="48px") }}

{{ community.context.display_name }}

{{ community.member_count }} members
{%- endmacro %} {% macro username(user) -%}
{% if user.settings.display_name -%} {{ user.settings.display_name }} {% else %} {{ user.username }} {%- endif %}
{%- endmacro %} {% macro likes(id, asset_type, likes=0, dislikes=0, secondary=false) -%} {% if not user or not user.settings.hide_dislikes -%} {%- endif %} {%- endmacro %} {% macro full_username(user) -%}
{{ self::username(user=user) }} {{ self::online_indicator(user=user) }} {% if user.is_verified -%} {{ icon "badge-check" }} {%- endif %}
{%- endmacro %} {% macro repost(repost, post, owner, secondary=false, community=false, show_community=true, can_manage_post=false) -%}
{{ self::post(post=post, owner=owner, secondary=secondary, community=community, show_community=show_community, can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}
{%- endmacro %} {% macro post(post, owner, question=false, secondary=false, community=false, show_community=true, can_manage_post=false, repost=false, expect_repost=false) -%} {% if community and show_community and community.id != config.town_square or question %}
{% if question -%} {{ self::question(question=question[0], owner=question[1], profile=owner) }} {% else %}
{{ self::community_avatar(id=post.community, community=community) }} {% if community.context.display_name -%} {{ community.context.display_name }} {% else %} {{ community.title }} {%- endif %} {% if post.context.is_pinned or post.context.is_profile_pinned -%} {{ icon "pin" }} {%- endif %}
{%- endif %} {%- endif %}
{% if not expect_repost -%} {{ self::avatar(username=owner.username, size="52px", selector_type="username") }} {%- endif %}
{% if expect_repost -%} {{ self::avatar(username=owner.username, size="24px", selector_type="username") }} {%- endif %} {{ self::full_username(user=owner) }} {% if post.context.edited != 0 -%}
{{ post.context.edited }} *
{% else %} {{ post.created }} {%- endif %} {% if post.context.is_nsfw -%} {{ icon "square-asterisk" }} {%- endif %} {% if post.context.repost and post.context.repost.reposting %} {{ icon "repeat-2" }} {%- endif %} {% if post.community == config.town_square -%} {{ icon "user-round" }} {%- endif %} {% if post.is_deleted -%} {{ icon "trash-2" }} {%- endif %}
{% if not post.context.content_warning -%} {{ post.content|markdown|safe }} {% if expect_repost -%} {% if repost -%} {{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }} {% else %}
{{ icon "frown" }} Could not find original post...
{%- endif %} {%- endif %}
{{ self::post_media(upload_ids=post.uploads) }} {% else %}
{{ icon "triangle-alert" }} {{ post.context.content_warning }}
{{ post.content|markdown|safe }} {% if expect_repost -%} {% if repost -%} {{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }} {% else %}
{{ icon "frown" }} Could not find original post...
{%- endif %} {%- endif %}
{{ self::post_media(upload_ids=post.uploads) }}
{%- endif %}
{% for tag in post.context.tags %} #{{ tag }} {% endfor %}
{% if user -%}
{% if post.context.reactions_enabled -%} {% if post.content|length > 0 -%} {{ self::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }} {%- endif %} {%- endif %} {% if post.context.repost and post.context.repost.reposting -%} {{ icon "expand" }} {%- endif %}
{% else %}
{%- endif %}
{{ icon "message-circle" }} {{ post.comment_count }} {{ icon "external-link" }} {% if user -%} {%- endif %}
{% if community and show_community and community.id != config.town_square or question %}
{%- endif %} {%- endmacro %} {% macro post_media(upload_ids) -%} {% if upload_ids|length > 0%} {%- endif %} {%- endmacro %} {% macro notification(notification) -%}
{% if not notification.read -%} {%- endif %} {{ notification.title|markdown|safe }}
{{ notification.content|markdown|safe }}
{% if notification.read -%} {% else %} {%- endif %}
{%- endmacro %} {% macro user_card(user) -%}
{{ self::banner(username=user.username, border_radius="0px") }}
{{ self::avatar(username=user.username, size="48px") }}
{{ self::username(user=user) }} {{ self::online_indicator(user=user) }}
{%- endmacro %} {% macro pagination(page=0, items=0, key="", value="") -%}
{% if page > 0 -%} {{ icon "arrow-left" }} {{ text "general:link.previous" }} {% else %}
{%- endif %} {% if items != 0 -%} {{ text "general:link.next" }} {{ icon "arrow-right"}} {%- endif %}
{%- endmacro %} {% macro online_indicator(user) -%} {% if not user.settings.private_last_seen or is_helper %}
{% else %}
{%- endif %} {%- endmacro %} {% macro theme(user, theme_preference) -%} {% if user %} {% if user.settings.theme_hue -%} {%- endif %} {% if user.settings.theme_sat -%} {%- endif %} {% if user.settings.theme_lit -%} {%- endif %} {% if theme_preference -%} {%- endif %}
{{ self::theme_color(color=user.settings.theme_color_surface, css="color-surface") }} {{ self::theme_color(color=user.settings.theme_color_text, css="color-text") }} {{ self::theme_color(color=user.settings.theme_color_text_link, css="color-link") }} {{ self::theme_color(color=user.settings.theme_color_lowered, css="color-lowered") }} {{ self::theme_color(color=user.settings.theme_color_text_lowered, css="color-text-lowered") }} {{ self::theme_color(color=user.settings.theme_color_super_lowered, css="color-super-lowered") }} {{ self::theme_color(color=user.settings.theme_color_raised, css="color-raised") }} {{ self::theme_color(color=user.settings.theme_color_text_raised, css="color-text-raised") }} {{ self::theme_color(color=user.settings.theme_color_super_raised, css="color-super-raised") }} {{ self::theme_color(color=user.settings.theme_color_primary, css="color-primary") }} {{ self::theme_color(color=user.settings.theme_color_text_primary, css="color-text-primary") }} {{ self::theme_color(color=user.settings.theme_color_primary_lowered, css="color-primary-lowered") }} {{ self::theme_color(color=user.settings.theme_color_secondary, css="color-secondary") }} {{ self::theme_color(color=user.settings.theme_color_text_secondary, css="color-text-secondary") }} {{ self::theme_color(color=user.settings.theme_color_secondary_lowered, css="color-secondary-lowered") }} {% if user.permissions|has_supporter -%} {%- endif %}
{%- endif %} {%- endmacro %} {% macro theme_color(color, css) -%} {% if color -%} {%- endif %} {%- endmacro %} {% macro question(question, owner, show_community=true, secondary=false, profile=false) -%}
{% if owner.id == 0 -%} {% if profile and profile.settings.anonymous_avatar_url -%} anonymous' avatar {% else %} {{ self::avatar(username=owner.username, selector_type="username", size="52px") }} {%- endif %} {% else %} {{ self::avatar(username=owner.username, selector_type="username", size="52px") }} {%- endif %}
{% if owner.id == 0 -%} {% if profile and profile.settings.anonymous_username -%} {{ profile.settings.anonymous_username }} {{ icon "drama" }} {% else %} anonymous {%- endif %} {% else %} {{ self::full_username(user=owner) }} {%- endif %} {{ question.created }} {{ icon "message-circle-heart" }} {% if question.context.is_nsfw -%} {{ icon "square-asterisk" }} {%- endif %} {% if question.community > 0 and show_community -%} {{ self::community_avatar(id=question.community, size="24px") }} {%- endif %} {% if question.is_global -%} {{ question.answer_count }} answers {%- endif %}
{{ question.content|markdown|safe }}
{%- endmacro %} {% macro create_question_form(receiver="0", community="", header="", is_global=false) -%}
{{ icon "message-circle-heart" }} {% if header -%} {{ header|markdown|safe }} {% else %} {{ text "requests:label.ask_question" }} {%- endif %}
{%- endmacro %} {% macro global_question(question, can_manage_questions=false, secondary=false, show_community=true) -%}
{{ self::question(question=question[0], owner=question[1], show_community=show_community) }}
{{ self::likes(id=question[0].id, asset_type="Question", likes=question[0].likes, dislikes=question[0].dislikes, secondary=false) }}
{{ icon "external-link" }} {% if user -%} {{ text "requests:label.answer" }} {% else %} {{ text "general:action.open" }} {%- endif %} {% if user -%} {% if can_manage_questions or is_helper or question[1].id == user.id %} {%- endif %} {%- endif %}
{%- endmacro %} {% macro spotify_playing(state, size="60px") -%} {% if state and state.data %}
Listening on {{ icon "spotify" }}
{{ state.data.timestamp }}
Album cover
{%- endif %} {%- endmacro %} {% macro last_fm_playing(state, size="60px") -%} {% if state and state.data %}
Listening on {{ icon "last_fm" }}
{{ state.data.timestamp }}
Track cover
{{ state.data.track }}
{{ state.data.artist }} {% if state.data.duration_ms and state.data.duration_ms != "0" -%} {%- endif %}
{%- endif %} {%- endmacro %} {% macro connection_icon(key) -%}
{% if key == "Spotify" -%} {{ icon "spotify" }} {% elif key == "LastFm" %} {{ icon "last_fm" }} {%- endif %}
{%- endmacro %} {% macro connection_url(key, value) -%} {% if value[0].data.url %} {{ value[0].data.url }} {% elif key == "LastFm" %} https://last.fm/user/{{ value[0].data.name }} {%- endif %} {%- endmacro %} {% macro message_actions(can_manage_message, owner, message, owner) -%} {%- endmacro %} {% macro message(user, message, can_manage_message=false, grouped=false) -%}
{% if not grouped -%} {{ self::avatar(username=user.username, size="42px") }} {%- endif %}
{% if not grouped -%}
{{ self::full_username(user=user) }} {% if message.edited != message.created %} {{ message.edited }}* {% else %} {{ message.created }} {%- endif %}
{%- endif %}
{{ message.content|markdown|safe }} {% if grouped -%} {%- endif %}
{%- endmacro %} {% macro user_menu() -%}
{{ user.username }} {{ icon "circle-user-round" }} {{ text "auth:link.my_profile" }} {{ icon "settings" }} {{ text "auth:link.settings" }} {% if is_helper -%} {{ text "general:label.mod" }} {{ icon "scroll-text" }} {{ text "general:link.audit_log" }} {{ icon "flag" }} {{ text "general:link.reports" }} {{ icon "ban" }} {{ text "general:link.ip_bans" }} {{ icon "chart-line" }} {{ text "general:link.stats" }} {%- endif %} {{ config.name }} {{ icon "code" }} {{ text "general:link.source_code" }}
{%- endmacro %} {% macro user_status(other_user) -%} {% if other_user.settings.status %}
{{ other_user.settings.status }} {% if (other_user.connections.LastFm[1].data and other_user.connections.LastFm[1].data.track) or (other_user.connections.Spotify[1].data and other_user.connections.Spotify[1].data.track) %} {{ icon "music" }} {% endif %}
{% elif other_user.connections.LastFm[0].data.name and other_user.connections.LastFm[1].data and other_user.connections.LastFm[1].data.track %}
{{ icon "music" }} Listening to {{ other_user.connections.LastFm[1].data.artist }}
{% elif other_user.connections.Spotify[0].data.name and other_user.connections.Spotify[1].data and other_user.connections.Spotify[1].data.track %}
{{ icon "music" }} Listening to {{ other_user.connections.Spotify[1].data.artist }}
{%- endif %} {%- endmacro %} {% macro user_plate(user, show_menu=false, show_kick=false, secondary=false) -%}
{{ self::avatar(username=user.username, size="42px", selector_type="username") }}
{{ self::full_username(user=user) }}
{{ self::user_status(other_user=user) }}
{% if show_menu -%} {% elif show_kick %} {%- endif %}
{%- endmacro %} {% macro emoji_picker(element_id, render_dialog=false) -%} {% if render_dialog -%}
{%- endif %} {%- endmacro %} {% macro file_picker(files_list_id) -%} {%- endmacro %} {% macro supporter_ad(body="") -%} {% if config.stripe and not is_supporter %}
{% if body -%} {{ body }} {% else %} {{ text "general:label.supporter_motivation" }} {%- endif %} {{ icon "heart" }} {{ text "general:action.become_supporter" }}
{%- endif %} {%- endmacro %} {% macro create_post_options() -%}
{{ components::emoji_picker(element_id="content", render_dialog=true) }} {% if not quoting -%} {% if is_supporter -%} {{ components::file_picker(files_list_id="files_list") }} {%- endif %} {%- endif %}

{%- endmacro %}