add: better visual separation between profile posts and normal posts
This commit is contained in:
parent
e092d46586
commit
5e3c0f5588
4 changed files with 35 additions and 21 deletions
|
@ -18,20 +18,15 @@
|
||||||
<div class="card tertiary">
|
<div class="card tertiary">
|
||||||
<div class="card-nest">
|
<div class="card-nest">
|
||||||
<div class="card small flex flex-row gap-2 items-center">
|
<div class="card small flex flex-row gap-2 items-center">
|
||||||
{{ components::community_avatar(id=config.town_square,
|
{{ components::avatar(username=user.id, size="32px",
|
||||||
community=false, size="32px") }}
|
selector_type="id") }}
|
||||||
|
|
||||||
<select
|
<select
|
||||||
id="community_to_post_to"
|
id="community_to_post_to"
|
||||||
onchange="update_community_avatar(event)"
|
onchange="update_community_avatar(event)"
|
||||||
>
|
>
|
||||||
<option value="{{ config.town_square }}" selected>
|
<option value="{{ config.town_square }}" selected>
|
||||||
<!-- prettier-ignore -->
|
{{ text "auth:link.my_profile" }}
|
||||||
{% if town_square.context.display_name %}
|
|
||||||
{{ town_square.context.display_name }}
|
|
||||||
{% else %}
|
|
||||||
{{ town_square.title }}
|
|
||||||
{% endif %}
|
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
{% for community in communities %}
|
{% for community in communities %}
|
||||||
|
@ -108,6 +103,9 @@
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const town_square = "{{ config.town_square }}";
|
||||||
|
const user_id = "{{ user.id }}";
|
||||||
|
|
||||||
function update_community_avatar(e) {
|
function update_community_avatar(e) {
|
||||||
const element = e.target.parentElement.querySelector(".avatar");
|
const element = e.target.parentElement.querySelector(".avatar");
|
||||||
const id = e.target.selectedOptions[0].value;
|
const id = e.target.selectedOptions[0].value;
|
||||||
|
@ -115,7 +113,11 @@
|
||||||
element.setAttribute("title", id);
|
element.setAttribute("title", id);
|
||||||
element.setAttribute("alt", `${id}'s avatar`);
|
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() {
|
async function cancel_create_post() {
|
||||||
|
|
|
@ -145,7 +145,7 @@ community=false, show_community=true, can_manage_post=false) -%}
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro %} {% macro post(post, owner, secondary=false, community=false,
|
{%- endmacro %} {% macro post(post, owner, secondary=false, community=false,
|
||||||
show_community=true, can_manage_post=false) -%} {% if community and
|
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-nest">
|
||||||
<div class="card small">
|
<div class="card small">
|
||||||
<a
|
<a
|
||||||
|
@ -208,6 +208,14 @@ show_community %}
|
||||||
>
|
>
|
||||||
{{ icon "repeat-2" }}
|
{{ icon "repeat-2" }}
|
||||||
</span>
|
</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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -329,7 +337,7 @@ show_community %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if community and show_community %}
|
{% if community and show_community and community.id != config.town_square %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %} {%- endmacro %} {% macro notification(notification) -%}
|
{% endif %} {%- endmacro %} {% macro notification(notification) -%}
|
||||||
<div class="w-full card-nest">
|
<div class="w-full card-nest">
|
||||||
|
@ -418,7 +426,7 @@ show_community %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro %} {% macro online_indicator(user) -%} {% if not
|
{%- endmacro %} {% macro online_indicator(user) -%} {% if not
|
||||||
user.settings.private_last_online or is_helper %}
|
user.settings.private_last_seen or is_helper %}
|
||||||
<div
|
<div
|
||||||
class="online_indicator"
|
class="online_indicator"
|
||||||
style="display: contents"
|
style="display: contents"
|
||||||
|
@ -458,6 +466,17 @@ user.settings.private_last_online or is_helper %}
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</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
|
{% endif %} {%- endmacro %} {% macro theme(user, theme_preference) -%} {% if
|
||||||
user %} {% if user.settings.theme_hue %}
|
user %} {% if user.settings.theme_hue %}
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -229,8 +229,8 @@
|
||||||
|
|
||||||
<span class="fade"
|
<span class="fade"
|
||||||
>Images must be less than 8 MB large. Animated images
|
>Images must be less than 8 MB large. Animated images
|
||||||
such as GIFs or APNGs will not work to do all images
|
such as GIFs or APNGs will not work because of all
|
||||||
being formatted as AVIF.</span
|
images being formatted as AVIF.</span
|
||||||
>
|
>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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 {
|
let memberships = match data.0.get_memberships_by_owner(user.id).await {
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
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 lang = get_lang!(jar, data.0);
|
||||||
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
|
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
|
||||||
|
|
||||||
context.insert("town_square", &town_square);
|
|
||||||
context.insert("communities", &communities);
|
context.insert("communities", &communities);
|
||||||
|
|
||||||
// return
|
// return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue