add: better profile card ui

This commit is contained in:
trisua 2025-04-02 14:19:37 -04:00
parent e0a6072cc4
commit 41ee7e4125
5 changed files with 25 additions and 12 deletions

View file

@ -24,13 +24,15 @@
loading="lazy" loading="lazy"
style="--size: {{ size }}" style="--size: {{ size }}"
/> />
{% endif %} {%- endmacro %} {% macro banner(username) -%} {% endif %} {%- endmacro %} {% macro banner(username,
border_radius="var(--radius)") -%}
<img <img
title="{{ username }}'s banner" title="{{ username }}'s banner"
src="/api/v1/auth/profile/{{ username }}/banner" src="/api/v1/auth/profile/{{ username }}/banner"
alt="@{{ username }}'s banner" alt="@{{ username }}'s banner"
class="banner shadow" class="banner shadow"
loading="lazy" loading="lazy"
style="border-radius: {{ border_radius }};"
/> />
{%- endmacro %} {% macro community_banner(id, community=false) -%} {% if {%- endmacro %} {% macro community_banner(id, community=false) -%} {% if
community %} community %}
@ -252,14 +254,17 @@ show_community=true) -%} {% if community and show_community %}
</div> </div>
</div> </div>
{%- endmacro %} {% macro user_card(user) -%} {%- endmacro %} {% macro user_card(user) -%}
<a <a class="card-nest w-full" href="/@{{ user.username }}">
class="card secondary w-full flex items-center gap-4" <div class="card small" style="padding: 0">
href="/@{{ user.username }}" {{ components::banner(username=user.username, border_radius="0px") }}
> </div>
{{ components::avatar(username=user.username, size="48px") }}
<div class="flex flex-col"> <div class="card secondary flex items-center gap-4">
<h3>{{ components::username(user=user) }}</h3> {{ components::avatar(username=user.username, size="48px") }}
<span class="fade">{{ user.username }}</span> <div class="flex items-center">
<b>{{ components::username(user=user) }}</b>
{{ components::online_indicator(user=user) }}
</div>
</div> </div>
</a> </a>
{%- endmacro %} {% macro pagination(page=0, items=0) -%} {%- endmacro %} {% macro pagination(page=0, items=0) -%}

View file

@ -77,7 +77,13 @@
or is_helper %} or is_helper %}
<div class="w-full flex justify-between items-center"> <div class="w-full flex justify-between items-center">
<span class="notification chip">Last seen</span> <span class="notification chip">Last seen</span>
<span class="date">{{ profile.last_seen }}</span>
<div class="flex">
{{ components::online_indicator(user=profile) }}
<span class="date">
{{ profile.last_seen }}
</span>
</div>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View file

@ -16,7 +16,7 @@ content %}
{{ components::user_card(user=item[1]) }} {{ components::user_card(user=item[1]) }}
</div> </div>
{% endfor %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -16,7 +16,7 @@ content %}
{{ components::user_card(user=item[1]) }} {{ components::user_card(user=item[1]) }}
</div> </div>
{% endfor %} {% endfor %} {{ components::pagination(page=page, items=list|length) }}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -324,6 +324,7 @@ pub async fn following_request(
}; };
context.insert("list", &list); context.insert("list", &list);
context.insert("page", &props.page);
profile_context( profile_context(
&mut context, &mut context,
&other_user, &other_user,
@ -450,6 +451,7 @@ pub async fn followers_request(
}; };
context.insert("list", &list); context.insert("list", &list);
context.insert("page", &props.page);
profile_context( profile_context(
&mut context, &mut context,
&other_user, &other_user,