misuzu/templates/profile/_layout/header.twig

132 lines
6.8 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% from 'macros.twig' import avatar %}
{% from '_layout/input.twig' import input_checkbox_raw %}
<div class="container profile__header"{% if profile_colour is defined %} style="--accent-colour: {{ profile_colour }}"{% endif %}>
2022-09-13 13:14:49 +00:00
<div class="profile__header__background"></div>
<div class="profile__header__details">
<div class="profile__header__avatar">
{% if profile_is_editing and perms.edit_avatar %}
<label class="profile__header__avatar__image profile__header__avatar__image--edit" for="avatar-selection">
{{ avatar(profile_user.id, 120, profile_user.name, {'id': 'avatar-preview'}) }}
2022-09-13 13:14:49 +00:00
</label>
<div class="profile__header__avatar__options">
<label class="input__button profile__header__avatar__option" for="avatar-selection">
Select
</label>
{{ input_checkbox_raw('avatar[delete]', false, 'profile__header__avatar__check', '', false, {'id':'avatar-delete'}) }}
<label class="input__button profile__header__avatar__option profile__header__avatar__option--delete"
for="avatar-delete">
Remove
</label>
</div>
{% else %}
<div class="profile__header__avatar__image">
{{ avatar(profile_user.id|default(0), 120, profile_user.name|default('')) }}
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
</div>
<div class="profile__header__details__content">
{% if profile_user is defined %}
<div class="profile__header__username">
{{ profile_user.name }}
2022-09-13 13:14:49 +00:00
</div>
{% if profile_user.hasTitle %}
<div class="profile__header__title">
{{ profile_user.title }}
</div>
{% endif %}
{% set hasCountryCode = profile_user.hasCountryCode %}
{% set age = profile_user.age %}
{% set hasAge = age > 0 %}
{% if hasCountryCode or hasAge %}
<div class="profile__header__country">
{% if hasCountryCode %}<div class="flag flag--{{ profile_user.countryCode|lower }}"></div>{% endif %}
<div class="profile__header__country__name">
{% if hasCountryCode %}{{ profile_user.countryCode|country_name }}{% endif %}{% if hasAge %}{% if hasCountryCode %}, {% endif %}{{ age }} year{{ age != 's' ? 's' : '' }} old{% endif %}
</div>
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
2022-09-13 13:14:49 +00:00
{% else %}
<div class="profile__header__username">
User not found!
</div>
<div class="profile__header__title">
Check the link and try again.
</div>
{% endif %}
</div>
</div>
<div class="profile__header__options">
{% if profile_user is defined %}
<div class="profile__header__actions">
{% if profile_mode is empty %}
{% if profile_is_editing %}
<button class="input__button input__button--save profile__header__action">Save</button>
<a href="{{ url('user-profile', {'user': profile_user.id}) }}" class="input__button input__button--destroy profile__header__action">Discard</a>
<a href="{{ url('settings-index') }}" class="input__button profile__header__action">Settings</a>
2024-01-30 23:47:02 +00:00
{% else %}
{% if profile_can_edit %}
<a href="{{ url('user-profile-edit', {'user': profile_user.id}) }}" class="input__button profile__header__action">Edit Profile</a>
{% endif %}
{% if profile_can_send_messages %}
<a href="{{ url('messages-compose', {'recipient': profile_user.name}) }}" class="input__button profile__header__action">Send Message</a>
{% endif %}
2022-09-13 13:14:49 +00:00
{% endif %}
{% else %}
<a href="{{ url('user-profile', {'user': profile_user.id}) }}" class="input__button profile__header__action">Return</a>
{% endif %}
</div>
{% endif %}
{% if stats is defined %}
<div class="profile__header__stats">
{% for stat in stats %}
{% if stat.value|default(0) > 0 %}
{% set is_date = stat.is_date|default(false) %}
{% set is_url = stat.url is defined %}
{% set active_class = stat.active|default(false) ? ' profile__header__stat--active' : '' %}
{% if is_url %}
<a class="profile__header__stat profile__header__stat--link{{ active_class }}" href="{{ stat.url }}">
{% else %}
<div class="profile__header__stat{{ active_class }}{% if is_date %} profile__header__stat--date" title="{{ stat.value|date('r') }}{% endif %}">
{% endif %}
<div class="profile__header__stat__name">
{{ stat.title }}
</div>
{% if is_date %}
<time class="profile__header__stat__value" datetime="{{ stat.value|date('c') }}">
2023-07-18 23:12:47 +00:00
{{ stat.value|time_format }}
2022-09-13 13:14:49 +00:00
</time>
{% else %}
<div class="profile__header__stat__value">
{{ stat.value|number_format }}
</div>
{% endif %}
{% if is_url %}</a>{% else %}</div>{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% if profile_is_banned %}
<div class="warning warning--red warning--bigger">
<div class="warning__content">
This user has been banned {% if profile_ban_info.isPermanent %}<strong>permanently</strong>{% else %}for <strong title="{{ profile_ban_info.expiresTime|date('r') }}">{{ profile_ban_info.remainingString }}</strong>{% endif %} since <strong><time datetime="{{ profile_ban_info.createdTime|date('c') }}" title="{{ profile_ban_info.createdTime|date('r') }}">{{ profile_ban_info.createdTime|time_format }}</time></strong>.
{% if not profile_is_guest and profile_ban_info.hasPublicReason %}
<p>Reason: {{ profile_ban_info.publicReason }}</p>
{% endif %}
</div>
</div>
{% endif %}