feat: group the sidebar, add a settings hub and move account actions to a header user menu
This commit is contained in:
1 parent
acd8e78e55
commit
7095456d36
16 files changed
+487
-477
No files matched your search
@@ -0,0 +1,5 @@
|
||||
{# The E&P logo with the app name beside it, as in the header of the apps portal (EP/apps) and epbms. #}
|
||||
<span class="flex items-center gap-3">
|
||||
<img class="h-9 w-auto" src="{{ asset('build/images/ep-logo.svg') }}" alt="E&P Reisen & Events" width="157" height="48">
|
||||
<span class="pl-3 border-l border-line text-sm font-bold uppercase tracking-wide text-brand">Team</span>
|
||||
</span>
|
||||
@@ -3,7 +3,7 @@
|
||||
{% block list %}
|
||||
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
|
||||
{% if item.level == 0 %}
|
||||
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
|
||||
<div class="min-h-full flex grow flex-col gap-y-5">
|
||||
<nav class="flex flex-1 flex-col">
|
||||
<ul role="list" class="space-y-1">
|
||||
{{ block('children') }}
|
||||
@@ -19,7 +19,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block item %}
|
||||
{% if item.displayed %}
|
||||
{% if item.displayed and item.extras.heading is defined %}
|
||||
{# the heading of a group of items, see AbstractMenuBuilder::addHeading() #}
|
||||
<li class="px-2 pt-5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted">{{ item.label|raw }}</li>
|
||||
{% elseif item.displayed %}
|
||||
<li>
|
||||
{%- if item.hasChildren and item.displayChildren %}
|
||||
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
|
||||
@@ -41,9 +44,10 @@
|
||||
{% import _self as knp_menu %}
|
||||
<a href="{{ item.uri }}"
|
||||
class="{{ html_classes('', {
|
||||
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold text-gray-700 hover:bg-gray-50': item.level == 1,
|
||||
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700 hover:bg-gray-50': item.level > 1,
|
||||
'bg-gray-50': matcher.isCurrent(item) or matcher.isAncestor(item)
|
||||
'group flex gap-x-3 p-2 text-sm leading-6 font-semibold': item.level == 1,
|
||||
'block py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
|
||||
'text-ink hover:bg-white/60 hover:text-brand': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
|
||||
'bg-white text-brand': matcher.isCurrent(item) or matcher.isAncestor(item)
|
||||
}) }}"
|
||||
{{ knp_menu.attributes(item.linkAttributes) }}>
|
||||
{{ block('label') }}
|
||||
@@ -57,14 +61,14 @@
|
||||
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
|
||||
{{ stimulus_target('sidebar-menu', 'button') }}
|
||||
{{ knp_menu.attributes(item.linkAttributes) }}
|
||||
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
|
||||
class="{{ html_classes('hover:bg-white/60 hover:text-brand flex items-center w-full text-left p-2 gap-x-3 text-sm leading-6 font-semibold', { 'text-brand': matcher.isAncestor(item), 'text-ink': not matcher.isAncestor(item) }) }}"
|
||||
aria-expanded="false">
|
||||
{{ block('label') }}
|
||||
</button>
|
||||
{% elseif item.extras.divider is defined %}
|
||||
<hr class="my-4 h-px bg-gray-200">
|
||||
<hr class="my-4 h-px border-line">
|
||||
{% else %}
|
||||
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
|
||||
<div class="hover:bg-white/60 group flex gap-x-3 p-2 text-sm leading-5 font-semibold text-ink"
|
||||
role="button">
|
||||
{{ block('label') }}
|
||||
</div>
|
||||
@@ -73,7 +77,7 @@
|
||||
|
||||
{% block label -%}
|
||||
{% if item.extras.icon is defined -%}
|
||||
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 text-gray-400') -}}
|
||||
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-brand' : 'text-muted')) -}}
|
||||
<span class="flex-1">{{ item.label|raw }}</span>
|
||||
{%- else -%}
|
||||
{{ item.label|raw }}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{#
|
||||
The account menu behind the user's picture: own profile, the other areas (MenuBuilder::createUserMenu)
|
||||
and logout. Opens on click, closes on a click elsewhere and on Escape.
|
||||
#}
|
||||
{% set user_menu = knp_menu_get('default_user') %}
|
||||
<div class="relative"
|
||||
{{ stimulus_controller('toggle', { open: false }, { closed: 'hidden' }) }}
|
||||
{{ stimulus_action('toggle', 'closeOutside', 'click@window')|stimulus_action('toggle', 'close', 'keydown.esc@window') }}>
|
||||
<button type="button"
|
||||
class="flex items-center gap-x-2 text-sm text-ink hover:text-brand"
|
||||
aria-haspopup="true"
|
||||
{{ stimulus_action('toggle', 'toggle') }}>
|
||||
{% if app.user.teamer and app.user.teamer.photo %}
|
||||
<img src="{{ asset(app.user.teamer.photo | upload_filename_full | imagine_filter('profile')) }}"
|
||||
class="h-8 w-8 rounded-full object-cover"
|
||||
alt="">
|
||||
{% else %}
|
||||
{{ icon('user', 'w-8 h-8 text-brand') }}
|
||||
{% endif %}
|
||||
<span class="hidden sm:inline">{{ app.user.firstName }}</span>
|
||||
</button>
|
||||
<div class="hidden absolute right-0 top-full mt-2 z-40 min-w-56 border border-line bg-white py-1 text-sm shadow-lg"
|
||||
role="menu"
|
||||
{{ stimulus_target('toggle', 'toggle') }}>
|
||||
{% if app.user.teamer %}
|
||||
<a href="{{ path('app_teamer_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
|
||||
{% elseif is_granted('ROLE_ADMINISTRATIVE') %}
|
||||
<a href="{{ path('app_administrative_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
|
||||
{% endif %}
|
||||
{% for item in user_menu.children %}
|
||||
{% if loop.last %}<hr class="my-1 border-line">{% endif %}
|
||||
<a href="{{ item.uri }}" class="user-menu-item" role="menuitem">{{ icon(item.extras.icon, 'w-5 h-5 text-muted') }}{{ item.label }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user