Minor members list redesign.

This commit is contained in:
flash 2023-07-19 18:14:04 +00:00
parent 239b0bae61
commit e678efedf4
7 changed files with 139 additions and 309 deletions

View file

@ -190,7 +190,6 @@ html {
@include profile/guidelines.css; @include profile/guidelines.css;
@include profile/header.css; @include profile/header.css;
@include profile/profile.css; @include profile/profile.css;
@include profile/relations.css;
@include profile/signature.css; @include profile/signature.css;
@include profile/warning.css; @include profile/warning.css;

View file

@ -1,10 +0,0 @@
.profile__relations {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.profile__relations__user {
margin: 2px;
width: 300px;
display: flex;
}

View file

@ -1,22 +1,16 @@
.usercard { .usercard {
display: flex; display: flex;
flex-direction: column;
transition: box-shadow .5s; transition: box-shadow .5s;
z-index: 1; z-index: 1;
color: #fff; color: #fff;
background-color: var(--background-colour); background-color: var(--background-colour);
box-shadow: 0 1px 2px #000A; box-shadow: 0 1px 2px var(--background-colour-translucent-6);
text-shadow: 0 1px 4px #000;
overflow: hidden;
flex: 1 1 auto;
--usercard-header-overlay-start: transparent;
--usercard-header-overlay-stop: var(--background-colour-translucent-9);
} }
.usercard:hover { .usercard:hover {
box-shadow: 0 1px 4px #000; box-shadow: 0 1px 4px var(--background-colour-translucent-6);
z-index: 2; z-index: 2;
} }
.usercard__background { .usercard__background {
position: absolute; position: absolute;
top: 0; top: 0;
@ -27,10 +21,7 @@
background-blend-mode: multiply; background-blend-mode: multiply;
} }
.usercard__header { .usercard__link {
flex: 0 0 auto;
}
.usercard__header__link {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@ -38,133 +29,132 @@
height: 100%; height: 100%;
} }
.usercard__header__avatar { .usercard__avatar {
width: 60px; box-sizing: content-box;
height: 60px; width: 50px;
height: 50px;
z-index: 20; z-index: 20;
} padding: 8px;
.usercard__header__container {
display: flex;
align-items: center;
padding: 10px;
background-image: linear-gradient(0deg, var(--usercard-header-overlay-stop), var(--usercard-header-overlay-start));
pointer-events: none; pointer-events: none;
flex-grow: 0;
flex-shrink: 0;
} }
.usercard__header__details { .usercard__details {
margin: 0 10px; pointer-events: none;
flex: 1 1 auto; display: flex;
flex-direction: column;
justify-content: center;
overflow: hidden;
flex-grow: 1;
flex-shrink: 1;
} }
.usercard__header__relation { .usercard__details__username {
font-variant: all-small-caps; font-size: 1.4em;
background: var(--usercard-header-overlay-stop); line-height: 1.4em;
border-radius: 2px; white-space: nowrap;
line-height: 1.2em; overflow: hidden;
padding: 1px 5px 4px; text-overflow: ellipsis;
cursor: default;
} }
.usercard__header__username { .usercard__details__title {
font-size: 1.5em;
line-height: 1.3em;
}
.usercard__header__title {
font-size: .9em; font-size: .9em;
line-height: 1.2em; line-height: 1.2em;
} }
.usercard__header__country { .usercard__details__country {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
} }
.usercard__header__country__name { .usercard__details__country__name {
font-size: .9em; font-size: .9em;
margin-left: 4px; margin-left: 4px;
line-height: 1.2em; line-height: 1.2em;
} }
.usercard__container {
flex: 1 1 auto;
background-color: var(--usercard-header-overlay-stop);
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.usercard__dates {
font-size: .9em;
line-height: 1em;
display: flex;
justify-content: space-evenly;
align-items: center;
flex: 0 0 auto;
margin-bottom: 4px;
}
.usercard__date {
padding: 4px;
}
.usercard__stats { .usercard__stats {
display: flex; display: flex;
flex-wrap: wrap;
justify-content: flex-end; justify-content: flex-end;
flex: 0 0 auto; align-items: center;
pointer-events: none;
flex-grow: 1;
flex-shrink: 0;
gap: 6px;
padding: 0 6px;
} }
.usercard__stat { .usercard__stat {
display: flex; padding: 4px 8px;
flex-direction: column-reverse; min-width: 80px;
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
padding: 5px 10px;
cursor: default; cursor: default;
flex: 0 0 auto;
text-align: right; text-align: right;
background-color: var(--background-colour-translucent-8);
backdrop-filter: blur(10px);
border: 1px solid var(--background-colour-translucent-6);
border-radius: 5px;
pointer-events: initial;
display: flex;
flex-direction: column-reverse;
}
.usercard__stat--wide {
min-width: 140px;
} }
.usercard__stat[href] { .usercard__stat[href] {
cursor: pointer; cursor: pointer;
transition: border-color .2s;
} }
.usercard__stat[href]:hover, .usercard__stat[href]:hover,
.usercard__stat[href]:focus { .usercard__stat[href]:focus {
border-bottom: 2px solid var(--accent-colour); border-color: var(--accent-colour);
padding-bottom: 3px;
} }
.usercard__stat__name { .usercard__stat__name {
display: block;
font-size: .9em; font-size: .9em;
line-height: 1.5em;
font-variant: small-caps; font-variant: small-caps;
cursor: inherit; cursor: inherit;
} }
.usercard__stat__value { .usercard__stat__value {
font-size: 1.3em;
cursor: inherit;
display: block; display: block;
font-size: 1.2em;
line-height: 1.5em;
cursor: inherit;
} }
.usercard__actions {
flex: 0 0 auto;
display: flex;
height: 38px;
}
.usercard__action {
flex: 1 1 auto;
display: flex;
justify-content: center;
align-items: center;
color: inherit;
text-decoration: none;
font-size: 1.5em;
transition: background-color .2s;
text-align: center;
cursor: pointer;
}
.usercard__action:hover,
.usercard__action:focus { background-color: rgba(255, 255, 255, .2); }
.usercard__action:active { background-color: rgba(255, 255, 255, .1); }
@media (max-width: 800px) { @media (max-width: 800px) {
.usercard__header__details { .usercard {
text-align: center; flex-wrap: wrap;
}
.usercard__details {
/* i swear to god man */
width: calc(100% - 66px);
}
.usercard__stats {
width: 100%;
justify-content: flex-start;
padding: 0 8px 4px;
}
.usercard__stat,
.usercard__stat--wide {
min-width: auto;
flex-direction: row-reverse;
gap: 5px;
}
.usercard__stat--wide {
flex-direction: row;
}
.usercard__stat__name,
.usercard__stat__value {
display: inline-block;
font-size: .9em;
line-height: 1.2em;
font-variant: initial;
} }
} }

View file

@ -1,14 +1,10 @@
.userlist { .userlist--search {
display: flex; margin: 0 2px;
flex-wrap: wrap;
justify-content: center;
overflow: hidden;
padding: 2px;
} }
.userlist__item { .userlist__item {
margin: 2px; margin: 2px 0;
width: 300px; flex-grow: 0;
display: flex; flex-shrink: 0;
} }
.userlist__empty { .userlist__empty {
text-align: center; text-align: center;
@ -63,4 +59,4 @@
.userlist__select:not(:first-child) { .userlist__select:not(:first-child) {
margin-top: 5px; margin-top: 5px;
} }
} }

View file

@ -96,7 +96,7 @@
<div class="container search__container"> <div class="container search__container">
{{ container_title('<i class="fas fa-users fa-fw"></i> Users (%s)'|format(users|length|number_format)) }} {{ container_title('<i class="fas fa-users fa-fw"></i> Users (%s)'|format(users|length|number_format)) }}
<div class="userlist"> <div class="userlist userlist--search">
{% for user in users %} {% for user in users %}
<div class="userlist__item"> <div class="userlist__item">
{{ user_card(user) }} {{ user_card(user) }}

View file

@ -1,23 +0,0 @@
{% extends 'profile/master.twig' %}
{% from 'macros.twig' import pagination %}
{% from 'user/macros.twig' import user_card %}
{% block content %}
<div class="profile">
{% include 'profile/_layout/header.twig' %}
<div class="profile__relations">
{% for user in profile_users %}
<div class="profile__relations__user">
{{ user_card(attribute(user, relation_prop), profile_viewer) }}
</div>
{% endfor %}
</div>
{% if profile_relation_pagination.pages > 1 %}
<div class="container profile__pagination">
{{ pagination(profile_relation_pagination, canonical_url) }}
</div>
{% endif %}
</div>
{% endblock %}

View file

@ -1,187 +1,65 @@
{% macro user_card(user, current_user) %} {% macro user_card(user) %}
{% if user.getId is defined %}
{% from _self import user_card_new %}
{{ user_card_new(user, current_user) }}
{% else %}
{% from _self import user_card_old %}
{{ user_card_old(user) }}
{% endif %}
{% endmacro %}
{% macro user_card_new(user, current_user) %}
{% from 'macros.twig' import avatar %}
<div class="usercard" style="--accent-colour: {{ user.colour }}">
<div class="usercard__background"></div>
<div class="usercard__header">
<a class="usercard__header__link" href="{{ url('user-profile', {'user': user.id}) }}"></a>
<div class="usercard__header__container">
<div class="usercard__header__avatar">
{{ avatar(user.id, 60, user.username) }}
</div>
<div class="usercard__header__details">
<div class="usercard__header__username">
{{ user.username }}
</div>
{% if user.hasTitle %}
<div class="usercard__header__title">
{{ user.title }}
</div>
{% endif %}
{% if user.hasCountry %}
<div class="usercard__header__country">
<div class="flag flag--{{ user.country|lower }}"></div>
<div class="usercard__header__country__name">
{{ user.countryName }}
</div>
</div>
{% endif %}
</div>
</div>
</div>
<div class="usercard__container">
<div class="usercard__stats">
{% if user.forumTopicCount > 0 %}
<a class="usercard__stat" href="{{ url('user-profile-forum-topics', {'user': user.id}) }}">
<div class="usercard__stat__name">
Topics
</div>
<div class="usercard__stat__value">
{{ user.forumTopicCount|number_format }}
</div>
</a>
{% endif %}
{% if user.forumPostCount > 0 %}
<a class="usercard__stat" href="{{ url('user-profile-forum-posts', {'user': user.id}) }}">
<div class="usercard__stat__name">
Posts
</div>
<div class="usercard__stat__value">
{{ user.forumPostCount|number_format }}
</div>
</a>
{% endif %}
</div>
<div class="usercard__dates">
<div class="usercard__date" title="{{ user.createdTime|date('r') }}">
Joined <time datetime="{{ user.createdTime|date('c') }}">{{ user.createdTime|time_format }}</time>
</div>
{% if user.hasBeenActive %}
<div class="usercard__date" title="{{ user.activeTime|date('r') }}">
Last seen <time datetime="{{ user.activeTime|date('c') }}">{{ user.activeTime|time_format }}</time>
</div>
{% else %}
<div class="usercard__date">
Never logged in
</div>
{% endif %}
</div>
<div class="usercard__actions">
<a class="usercard__action" href="{{ url('user-profile', {'user': user.id}) }}" title="View Profile">
<i class="fas fa-user"></i>
</a>
</div>
</div>
</div>
{% endmacro %}
{% macro user_card_old(user) %}
{% from 'macros.twig' import avatar %} {% from 'macros.twig' import avatar %}
<div class="usercard"{% if user.user_colour is defined %} style="{{ user.user_colour|html_colour('--accent-colour') }}"{% endif %}> <div class="usercard"{% if user.user_colour is defined %} style="{{ user.user_colour|html_colour('--accent-colour') }}"{% endif %}>
<div class="usercard__background"></div> <div class="usercard__background"></div>
<a class="usercard__link" href="{{ url('user-profile', {'user': user.user_id}) }}" title="Visit {{ user.username }}'{{ user.username|last|lower == 's' ? '' : 's' }} profile"></a>
<div class="usercard__header"> <div class="usercard__avatar">
<a class="usercard__header__link" href="{{ url('user-profile', {'user': user.user_id}) }}"></a> {{ avatar(user.user_id, 50, user.username) }}
</div>
<div class="usercard__header__container"> <div class="usercard__details">
<div class="usercard__header__avatar"> <div class="usercard__details_inner">
{{ avatar(user.user_id, 60, user.username) }} <div class="usercard__details__username"{% if user.user_colour is defined %} style="{{ user.user_colour|html_colour }}"{% endif %}>
{{ user.username }}
</div> </div>
<div class="usercard__header__details"> {% if user.user_title is defined and user.user_title is not empty %}
<div class="usercard__header__username"{% if user.user_colour is defined %} style="{{ user.user_colour|html_colour }}"{% endif %}> <div class="usercard__details__title">
{{ user.username }} {{ user.user_title }}
</div> </div>
{% endif %}
{% if user.user_title is defined and user.user_title is not empty %} {% if user.user_country|default('XX') != 'XX' %}
<div class="usercard__header__title"> <div class="usercard__details__country">
{{ user.user_title }} <div class="flag flag--{{ user.user_country|lower }}"></div>
<div class="usercard__details__country__name">
{{ user.user_country|country_name }}
</div> </div>
{% endif %} </div>
{% endif %}
{% if user.user_country|default('XX') != 'XX' %}
<div class="usercard__header__country">
<div class="flag flag--{{ user.user_country|lower }}"></div>
<div class="usercard__header__country__name">
{{ user.user_country|country_name }}
</div>
</div>
{% endif %}
</div>
</div> </div>
</div> </div>
<div class="usercard__container"> <div class="usercard__stats">
<div class="usercard__stats"> {% if user.user_count_topics|default(0) > 0 %}
{% if user.user_count_topics|default(0) > 0 %} <a class="usercard__stat" href="{{ url('user-profile-forum-topics', {'user': user.user_id}) }}">
<a class="usercard__stat" href="{{ url('user-profile-forum-topics', {'user': user.user_id}) }}"> <div class="usercard__stat__name">Topics</div>
<div class="usercard__stat__name"> <div class="usercard__stat__value">{{ user.user_count_topics|number_format }}</div>
Topics
</div>
<div class="usercard__stat__value">
{{ user.user_count_topics|number_format }}
</div>
</a>
{% endif %}
{% if user.user_count_posts|default(0) > 0 %}
<a class="usercard__stat" href="{{ url('user-profile-forum-posts', {'user': user.user_id}) }}">
<div class="usercard__stat__name">
Posts
</div>
<div class="usercard__stat__value">
{{ user.user_count_posts|number_format }}
</div>
</a>
{% endif %}
</div>
<div class="usercard__dates">
{% if user.user_created is defined %}
<div class="usercard__date" title="{{ user.user_created|date('r') }}">
Joined <time datetime="{{ user.user_created|date('c') }}">{{ user.user_created|time_format }}</time>
</div>
{% endif %}
{% if user.user_active is defined %}
{% if user.user_active is null %}
<div class="usercard__date">
Never logged in
</div>
{% else %}
<div class="usercard__date" title="{{ user.user_active|date('r') }}">
Last seen <time datetime="{{ user.user_active|date('c') }}">{{ user.user_active|time_format }}</time>
</div>
{% endif %}
{% endif %}
</div>
<div class="usercard__actions">
<a class="usercard__action" href="{{ url('user-profile', {'user': user.user_id}) }}" title="View Profile">
<i class="fas fa-user"></i>
</a> </a>
</div> {% endif %}
{% if user.user_count_posts|default(0) > 0 %}
<a class="usercard__stat" href="{{ url('user-profile-forum-posts', {'user': user.user_id}) }}">
<div class="usercard__stat__name">Posts</div>
<div class="usercard__stat__value">{{ user.user_count_posts|number_format }}</div>
</a>
{% endif %}
{% if user.user_active is defined and user.user_active is not null %}
<div class="usercard__stat usercard__stat--wide">
<div class="usercard__stat__name">Last seen</div>
<div class="usercard__stat__value"><time datetime="{{ user.user_active|date('c') }}">{{ user.user_active|time_format }}</time></div>
</div>
{% endif %}
{% if user.user_created is defined %}
<div class="usercard__stat usercard__stat--wide">
<div class="usercard__stat__name">Joined</div>
<div class="usercard__stat__value"><time datetime="{{ user.user_created|date('c') }}">{{ user.user_created|time_format }}</time></div>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endmacro %} {% endmacro %}