add: better visual separation between profile posts and normal posts

This commit is contained in:
trisua 2025-04-12 10:57:17 -04:00
parent e092d46586
commit 5e3c0f5588
4 changed files with 35 additions and 21 deletions

View file

@ -18,20 +18,15 @@
<div class="card tertiary">
<div class="card-nest">
<div class="card small flex flex-row gap-2 items-center">
{{ components::community_avatar(id=config.town_square,
community=false, size="32px") }}
{{ components::avatar(username=user.id, size="32px",
selector_type="id") }}
<select
id="community_to_post_to"
onchange="update_community_avatar(event)"
>
<option value="{{ config.town_square }}" selected>
<!-- prettier-ignore -->
{% if town_square.context.display_name %}
{{ town_square.context.display_name }}
{% else %}
{{ town_square.title }}
{% endif %}
{{ text "auth:link.my_profile" }}
</option>
{% for community in communities %}
@ -108,6 +103,9 @@
</main>
<script>
const town_square = "{{ config.town_square }}";
const user_id = "{{ user.id }}";
function update_community_avatar(e) {
const element = e.target.parentElement.querySelector(".avatar");
const id = e.target.selectedOptions[0].value;
@ -115,7 +113,11 @@
element.setAttribute("title", id);
element.setAttribute("alt", `${id}'s avatar`);
element.src = `/api/v1/communities/${id}/avatar`;
if (id === town_square) {
element.src = `/api/v1/auth/user/${user_id}/avatar?selector_type=id`;
} else {
element.src = `/api/v1/communities/${id}/avatar`;
}
}
async function cancel_create_post() {

View file

@ -145,7 +145,7 @@ community=false, show_community=true, can_manage_post=false) -%}
</div>
{%- endmacro %} {% macro post(post, owner, secondary=false, community=false,
show_community=true, can_manage_post=false) -%} {% if community and
show_community %}
show_community and community.id != config.town_square %}
<div class="card-nest">
<div class="card small">
<a
@ -208,6 +208,14 @@ show_community %}
>
{{ icon "repeat-2" }}
</span>
{% endif %} {% if post.community == config.town_square %}
<span
title="Posted to profile"
class="flex items-center"
style="color: var(--color-primary)"
>
{{ icon "user-round" }}
</span>
{% endif %}
</div>
@ -329,7 +337,7 @@ show_community %}
</div>
</div>
</div>
{% if community and show_community %}
{% if community and show_community and community.id != config.town_square %}
</div>
{% endif %} {%- endmacro %} {% macro notification(notification) -%}
<div class="w-full card-nest">
@ -418,7 +426,7 @@ show_community %}
{% endif %}
</div>
{%- endmacro %} {% macro online_indicator(user) -%} {% if not
user.settings.private_last_online or is_helper %}
user.settings.private_last_seen or is_helper %}
<div
class="online_indicator"
style="display: contents"
@ -458,6 +466,17 @@ user.settings.private_last_online or is_helper %}
</svg>
</div>
</div>
{% else %}
<div title="Offline" style="display: contents">
<svg
width="24"
height="24"
viewBox="0 0 24 24"
style="fill: hsl(0, 0%, 50%)"
>
<circle cx="12" cy="12" r="6"></circle>
</svg>
</div>
{% endif %} {%- endmacro %} {% macro theme(user, theme_preference) -%} {% if
user %} {% if user.settings.theme_hue %}
<style>

View file

@ -229,8 +229,8 @@
<span class="fade"
>Images must be less than 8 MB large. Animated images
such as GIFs or APNGs will not work to do all images
being formatted as AVIF.</span
such as GIFs or APNGs will not work because of all
images being formatted as AVIF.</span
>
</form>
</div>

View file

@ -219,11 +219,6 @@ pub async fn create_post_request(
}
};
let town_square = match data.0.get_community_by_id(data.0.0.town_square).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
};
let memberships = match data.0.get_memberships_by_owner(user.id).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
@ -246,8 +241,6 @@ pub async fn create_post_request(
let lang = get_lang!(jar, data.0);
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
context.insert("town_square", &town_square);
context.insert("communities", &communities);
// return