[PLUGINS][Actor][Profile] Current user profile in line with other users. Directory plugin actor template standardized.

This commit is contained in:
Eliseu Amaro 2021-09-20 14:38:39 +01:00
parent 8fe8687c5b
commit 543853c374
5 changed files with 109 additions and 90 deletions

View File

@ -4,23 +4,23 @@
{% set actor_bio = actor.getBio() %} {% set actor_bio = actor.getBio() %}
{% block body %} {% block body %}
<section class='section-widget section-widget-padded' title="{{ 'Your profile information.' | trans }}"> <section title="{{ actor_nickname }}'s {{ 'profile information.' | trans }}">
<a id="user" href="{{ path('actor_view_nickname', {'nickname' : actor_nickname}) }}"> <a class='profile' href="{{ path('actor_view_nickname', {'nickname' : actor_nickname}) }}">
<img src='{{ actor_avatar }}' class="icon icon-avatar" alt="{{ 'Your account\'s avatar.' | trans }}"> <img src='{{ actor_avatar }}' class="profile-avatar" alt="{{ 'Your account\'s avatar.' | trans }}">
<div class="user-info"> <div class="profile-info">
<strong id="user-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ actor_nickname }}</strong> <strong id="profile-info-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ actor_nickname }}</strong>
<nav class="user-tags"> <nav class="profile-info-tags">
{% if actor_tags %} {% if actor_tags %}
{% for tag in actor_tags %} {% for tag in actor_tags %}
<a href='#'><i> #{{ tag }} </i></a> <a href='#'><i> #{{ tag }} </i></a>
{% endfor %} {% endfor %}
{% else %} {% else %}
<i> {{ '(No tags)' | trans }} </i> {{ '(No tags)' | trans }}
{% endif %} {% endif %}
</nav> </nav>
<section class="user-bio"> <section class="profile-info-stats">
{% if actor_bio %} {% if actor_bio %}
<p>{{ actor_bio }}</p> <p>{{ actor_bio }}</p>
{% else %} {% else %}
@ -30,4 +30,6 @@
</div> </div>
</a> </a>
</section> </section>
<hr>
{% endblock body %} {% endblock body %}

View File

@ -41,6 +41,10 @@ html {
--fade-out: fadeOut 200ms cubic-bezier(0, 0.55, 0.45, 1); --fade-out: fadeOut 200ms cubic-bezier(0, 0.55, 0.45, 1);
} }
h1,h2,h3,h4,h5,h6 {
font-family: var(--display-font);
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
/* colours and shadows */ /* colours and shadows */
@ -125,7 +129,7 @@ figcaption a:link {
hr { hr {
all: unset; all: unset;
display: block; display: block;
height: 2px; height: 1px;
background: var(--bg2); background: var(--bg2);
} }
@ -297,7 +301,7 @@ hr {
.note-sidebar * { .note-sidebar * {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: auto; margin-left: auto;hr
margin-right: auto; margin-right: auto;
max-height: 100%; max-height: 100%;
} }
@ -632,8 +636,8 @@ textarea:hover,
textarea:focus, textarea:focus,
button:hover, button:hover,
button:focus, button:focus,
input:hover :not([type=checkbox], [type=radio]), input:hover,
input:focus :not([type=checkbox], [type=radio]), input:focus,
select:hover, select:hover,
select:focus { select:focus {
color: var(--white) !important; color: var(--white) !important;
@ -760,11 +764,53 @@ input[type=file] {
} }
} }
/* PROFILE */
.profile {
display: flex;
font-family: var(--main-font);
background-color: var(--translucent);
margin-bottom: var(--unit-size);
border-radius: var(--unit-size);
padding: var(--unit-size);
}
.profile > * {
flex: 1;
}
.profile-info {
display: flex;
flex-direction: column;
}
.profile-info-nickname {
font-size: var(--medium-size);
}
.profile-info-tags {
margin: unset;
}
.profile-info-stats strong {
margin-right: 5px;
}
.profile-info-stats {
margin-top: var(--unit-size);
}
.profile-avatar {
max-width: 4rem;
width: 100%;
height: auto;
margin-right: 5px;
}
/* MEDIA QUERIES */ /* MEDIA QUERIES */
/* sidepanels need to be shown by default on desktop, hidden on mobile */ /* sidepanels need to be shown by default on desktop, hidden on mobile */
.panel .panel-content { .panel .panel-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-family: var(--main-font);
font-size: var(--small-size); font-size: var(--small-size);
/* should remain in place for the user */ /* should remain in place for the user */

View File

@ -16,44 +16,6 @@
border: 2px solid transparent; border: 2px solid transparent;
} }
.panel-left nav {
padding-top: var(--unit-size);
font-size: var(--small-size);
}
/* PROFILE */
.profile {
display: flex;
flex-direction: column;
font-family: var(--display-font);
background-color: var(--translucent);
margin-bottom: var(--main-size);
border: solid 2px var(--bg2);
border-radius: var(--unit-size);
padding: var(--unit-size);
box-sizing: border-box;
}
.profile ~ * {
padding: var(--unit-size);
}
#user {
align-content: center;
}
#user img {
float: left;
width: 5rem;
height: auto;
margin-right: 5px;
}
#user-nickname {
font-size: var(--medium-size);
}
.profile-navigation { .profile-navigation {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -2,42 +2,43 @@
{% set id = actor.getId() %} {% set id = actor.getId() %}
{% set nickname = actor.getNickname() %} {% set nickname = actor.getNickname() %}
{% set actor_bio = actor.getBio() %}
{% set actor_tags = actor.getSelfTags() %}
{% set avatar = actor.getAvatarUrl() %} {% set avatar = actor.getAvatarUrl() %}
{% block title %}{{ nickname }}'s profile{% endblock %} {% block title %}{{ nickname }}'s profile{% endblock %}
{% block body %} {% block body %}
<section class="section-widget section-widget-padded"> <section title="{{ nickname }}'s {{ 'profile information.' | trans }}">
<div class="section-title"> <a class='profile' href="{{ path('actor_view_nickname', {'nickname' : nickname}) }}">
<img class="icon icon-avatar" src="{{ avatar }}" alt="{{ nickname }}'s avatar">{{ nickname }} <img src="{{ avatar }}" class="profile-avatar" alt="{{ nickname }}{{ '\'s avatar.' | trans }}">
</div> <div class="profile-info">
<strong id="profile-info-nickname" title="{{ nickname }}{{ '\'s nickname.' | trans }}">{{ nickname }}</strong>
<div class="actor-nickname-and-tags"> <nav class="profile-info-tags">
{% if actor_tags %}
{% for tag in actor_tags %}
<a href='#'><i> #{{ tag }} </i></a>
{% endfor %}
{% else %}
{{ '(no tags)' | trans }}
{% endif %}
</nav>
{% set actor_tags = actor.getSelfTags() %}
<div class="tags"> <section class="profile-info-stats">
{% if actor_tags %} {% if actor_bio %}
{% for tag in actor_tags %} <p>{{ actor_bio }}</p>
<a href='#'><i> #{{ tag }} </i></a> {% else %}
{% endfor %} <p>{{ '(no bio)' | trans }}</p>
{% else %} {% endif %}
<i> {{ '(No tags)' | trans }} </i> </section>
{% endif %}
</div> </div>
</div> </a>
{% set actor_bio = actor.getBio() %}
<div class="actor-bio">
{% if actor_bio %}
<p>{{ actor_bio }}</p>
{% else %}
<p>{{ '(No bio)' | trans }}</p>
{% endif %}
</div>
</section> </section>
<hr>
<main class="timeline" tabindex="0" role="feed"> <main class="timeline" tabindex="0" role="feed">
<div class="h-feed hfeed notes"> <div class="h-feed hfeed notes">
{% if notes is defined and notes is not empty %} {% if notes is defined and notes is not empty %}

View File

@ -6,29 +6,37 @@
<aside class="panel-content accessibility-target"> <aside class="panel-content accessibility-target">
{% if app.user %} {% if app.user %}
<section class='section-widget section-widget-padded' title="{{ 'Your profile information.' | trans }}"> <section class='section-widget section-widget-padded' title="{{ 'Your profile information.' | trans }}">
<a id="user" href="{{ path('actor_view_nickname', {'nickname' : current_actor.getNickname()}) }}"> <a class="profile" href="{{ path('actor_view_nickname', {'nickname' : current_actor.getNickname()}) }}">
<img src='{{ current_actor.getAvatarUrl() }}' class="icon icon-avatar" alt="{{ 'Your account\'s avatar.' | trans }}"> <img class="profile-avatar" src='{{ current_actor.getAvatarUrl() }}' class="icon icon-avatar" alt="{{ 'Your account\'s avatar.' | trans }}">
<div class="user-info"> <div class="profile-info">
<strong id="user-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ current_actor.getNickname() }}</strong> <strong class="profile-info-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ current_actor.getNickname() }}</strong>
<nav class="user-tags">
<nav class="profile-info-tags">
{% set user_tags = current_actor.getSelfTags() %} {% set user_tags = current_actor.getSelfTags() %}
{% if user_tags %}
{% for tag in user_tags %} <ul>
<a href='#'> #{{ tag }}</a> {% if user_tags %}
{% endfor %} {% for tag in user_tags %}
{% else %} <li><a href='#'> #{{ tag }}</a></li>
{{ '(No tags)' | trans }} {% endfor %}
{% endif %} {% else %}
{{ '(no tags)' | trans }}
{% endif %}
</ul>
</nav> </nav>
<section id="user-stats"> <section class="profile-info-stats">
<h2>{{ 'Subscriptions' | trans }} {{ current_actor.getSubscriptionsCount() }}</h2> <div><strong>{{ 'Subscriptions' | trans }}</strong>{{ current_actor.getSubscriptionsCount() }}</div>
<h2>{{ 'Subscribers' | trans }} {{ current_actor.getSubscribersCount() }}</h2> <div><strong>{{ 'Subscribers' | trans }}</strong>{{ current_actor.getSubscribersCount() }}</div>
</section> </section>
</div> </div>
</a> </a>
<hr>
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}"> <nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a title='{{ 'Your messages.' | trans }}' href='{{ path('settings') }}' class='{{ active("replies") }}'> <a title='{{ 'Your messages.' | trans }}' href='{{ path('settings') }}' class='{{ active("replies") }}'>
Messages Messages