misuzu/templates/_layout/header.twig
flashwave 383e2ed0e0 Rewrote the user information class.
This one took multiple days and it pretty invasive into the core of Misuzu so issue might (will) arise, there's also some features that have gone temporarily missing in the mean time and some inefficiencies introduced that will be fixed again at a later time.
The old class isn't gone entirely because I still have to figure out what I'm gonna do about validation, but for the most part this knocks out one of the "layers of backwards compatibility", as I've been referring to it, and is moving us closer to a future where Flashii actually gets real updates.
If you run into anything that's broken and you're inhibited from reporting it through the forum, do it through chat or mail me at flashii-issues@flash.moe.
2023-08-02 22:12:47 +00:00

106 lines
4.7 KiB
Twig

{% from 'macros.twig' import avatar %}
{% from '_layout/input.twig' import input_checkbox_raw %}
{% if current_user_real is defined %}
<div class="impersonate">
<div class="impersonate-content">
<div class="impersonate-user" style="--user-colour: {{ current_user_real_colour }}">
You are <a href="{{ url('user-profile', {'user': current_user_real.id}) }}" class="impersonate-user-link">
<div class="avatar impersonate-user-avatar">{{ avatar(current_user_real.id, 20, current_user_real.name) }}</div>
{{ current_user_real.name }}
</a>
</div>
<div class="impersonate-options">
<a href="{{ url('auth-revert') }}" class="impersonate-options-link" title="Revert"><i class="fas fa-backward"></i></a>
</div>
</div>
</div>
{% endif %}
<nav class="header">
<div class="header__background"></div>
<div class="header__desktop">
<a class="header__desktop__logo" href="{{ url('index') }}" title="{{ globals.site_name }}">
{{ globals.site_name }}
</a>
<div class="header__desktop__menus">
{% for item in header_menu %}
<div class="header__desktop__menu">
<a href="{{ item.url }}" class="header__desktop__link header__desktop__menu__link">{{ item.title }}</a>
{% if item.menu is defined and item.menu is iterable %}
<div class="header__desktop__submenu">
<div class="header__desktop__submenu__background"></div>
<div class="header__desktop__submenu__content">
{% for subitem in item.menu %}
<a href="{{ subitem.url }}" class="header__desktop__link header__desktop__submenu__link">{{ subitem.title }}</a>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
<div class="header__desktop__user">
{% for item in user_menu %}
<a href="{{ item.url }}" title="{{ item.title }}" class="header__desktop__user__button {{ item.class|default('') }}">
<i class="{{ item.icon }}"></i>
</a>
{% endfor %}
{% if current_user is defined %}
<a href="{{ url('user-profile', {'user': current_user.id}) }}" class="avatar header__desktop__user__avatar" title="{{ current_user.name }}">
{{ avatar(current_user.id, 60, current_user.name) }}
</a>
{% else %}
<a href="{{ url('auth-login') }}" class="avatar header__desktop__user__avatar">
{{ avatar(0, 60, 'Log in') }}
</a>
{% endif %}
</div>
</div>
<div class="header__mobile">
<div class="header__mobile__icons">
<label class="header__mobile__icon" for="toggle-mobile-header">
<i class="fas fa-bars"></i>
</label>
<a class="header__mobile__logo header__mobile__icon" href="{{ url('index') }}">
{{ globals.site_name }}
</a>
<label class="header__mobile__icon header__mobile__avatar" for="toggle-mobile-header">
{{ avatar(current_user.id|default(0), 40, current_user.name|default('Log in')) }}
</label>
</div>
{{ input_checkbox_raw('', false, 'header__mobile__toggle', '', false, {'id':'toggle-mobile-header'}) }}
<div class="header__mobile__menu">
<div class="header__mobile__menu__spacer"></div>
<div class="header__mobile__user">
{% for item in user_menu %}
<a href="{{ item.url }}" class="header__mobile__link header__mobile__link--user {{ item.class|default('') }}">
<i class="{{ item.icon }}"></i> {{ item.title }}
</a>
{% endfor %}
</div>
<div class="header__mobile__navigation">
{% for item in header_menu %}
<a href="{{ item.url }}" class="header__mobile__link header__mobile__link--primary">{{ item.title }}</a>
{% if item.menu is defined and item.menu is iterable %}
{% for subitem in item.menu %}
<a href="{{ subitem.url }}" class="header__mobile__link">{{ subitem.title }}</a>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
</nav>