templates/layout/header/topbar-user.html.twig line 1

Open in your IDE?
  1. {% set userpages = build_property_nav(document, 'navigationUser').pages|filter(page => page.visible) %}
  2. <div class="relative flex items-center justify-end space-x-6"
  3.   id="topbar-user"
  4.   {% if app.user %}
  5.     data-controller="topbar-user"
  6.     data-action="click@window->topbar-user#cleanup"
  7.   {% endif %}
  8.   >
  9.   <div class="flex gap-4 text-sm text-white">
  10.     <ul class="flex text-sm uppercase">
  11.       {% if userpages %}
  12.         {% for page in userpages %}
  13.           <li>
  14.           <a href="{{ page.href }}" target="{{ page.target }}" class="flex gap-1 items-baseline px-2 text-white {{ page.active ? 'font-medium' : '' }}">
  15.             {# prettier-ignore #}
  16.             {% include "icons/" ~ page.document.property("icon") ~ ".svg.twig" ignore missing with {class: "w-5 h-5 text-primary"}  %}
  17.             <span>{{ page.label }}</span>
  18.           </a>
  19.           </li>
  20.         {% endfor %}
  21.       {% endif %}
  22.     </ul>
  23.     <div class="flex gap-5" {% if app.user %}{{ live_event_subscriber('user-' ~ app.user.id ~ '/messages') }}{% endif %}>
  24.     {% if app.user %}
  25.       <a href="#" data-action="click->topbar-user#toggleNotifications"  id="user-topbar-notifications-icon" class="{{check_if_unread_notifications(app.user) ? 'has-new' : '' }}" >
  26.         {% include 'icons/bell.svg.twig' with {
  27.           class: 'w-5 inline'
  28.         } %}
  29.       </a>
  30.       <a href="#" data-action="click->topbar-user#toggleMessages" id="user-topbar-messages-icon" class="{{ check_if_unread_messages(app.user.id) ? 'has-new' : '' }}">
  31.         {% include 'icons/chat.svg.twig' with {
  32.           class: 'w-4 inline'
  33.         } %}
  34.       </a>
  35.       <a href="#" data-action="click->topbar-user#toggleProfile" class="">
  36.         {% include 'icons/login.svg.twig' with {
  37.           class: 'w-5 inline'
  38.         } %}
  39.       </a>
  40.     {% else %}
  41.       <a href="{{ path('auth_login') }}" class="flex items-center">
  42.         {% include 'icons/login.svg.twig' with {
  43.           class: 'h-5 inline mr-2  text-primary'
  44.         } %}<span class="leading-none">{{ 'login'|trans }}</span>
  45.       </a>
  46.       <a href="{{ path('auth_register') }}" class="flex items-center text-primary">
  47.        <span class="leading-none">{{ 'sign.up'|trans }}</span>
  48.       </a>
  49.     {% endif %}
  50.     </div>
  51.   </div>
  52.   {% if app.user %}
  53.     <div data-topbar-user-target="notificationsMenu" class="absolute hidden mt-3 text-black shadow-lg z-1700 w-80 bg-neutral-50 overlay top-full">
  54.      <turbo-frame id="topbar-user-notifications" src="{{ path('topbar_notifications_frame') }}" loading="lazy">
  55.         <div class="grid items-center justify-center p-8">
  56.           {% include 'component/loader.html.twig' with { classes: 'w-8 h-8' } %}
  57.         </div>
  58.       </turbo-frame>
  59.     </div>
  60.     <div data-topbar-user-target="messagesMenu" class="absolute hidden mt-3 text-black shadow-lg z-1700 w-80 bg-neutral-50 overlay top-full">
  61.       <turbo-frame id="topbar-user-messages" src="{{ path('topbar_messages_frame') }}" loading="lazy">
  62.         <div class="grid items-center justify-center p-8">
  63.           {% include 'component/loader.html.twig' with { classes: 'w-8 h-8' } %}
  64.         </div>
  65.       </turbo-frame>
  66.       <ul>
  67.         <li>
  68.           <a href="{{ path('profile_messages_index') }}" class="grid justify-center p-4 text-sm hover:bg-neutral-100 text-neutral-700">
  69.             {{ 'show-all-messages'| trans }}
  70.           </a>
  71.         </li>
  72.       </ul>
  73.     </div>
  74.     <div data-topbar-user-target="profileMenu" class="absolute hidden mt-3 text-black border-l-4 shadow-lg z-1700 w-44 bg-neutral-50 overlay top-full border-primary-500">
  75.       <ul>
  76.         <li>
  77.           <a href="{{ path('network_activity') }}"
  78.           class="block px-4 py-2 mt-2 hover:bg-neutral-100">
  79.             {{ 'navigation.my-network'|trans }}
  80.           </a>
  81.         <li>
  82.           <a href="{{ pimcore_url({ object: app.user }) }}"
  83.             class="block px-4 py-2 hover:bg-neutral-100">
  84.             {{ 'navigation.my-profile'|trans }}
  85.           </a>
  86.         </li>
  87.         <li>
  88.           <a href="{{ path('profile_admin_index') }}"
  89.             class="block px-4 py-2 hover:bg-neutral-100">
  90.             {{ 'navigation.manage-profile'|trans }}
  91.           </a>
  92.         </li>
  93.         <li>
  94.           <a href="{{ path('auth_logout') }}" class="block px-4 py-2 mb-2 hover:bg-neutral-100">
  95.             {{ 'navigation.logout'|trans }}
  96.           </a>
  97.         </li>
  98.       </ul>
  99.     </div>
  100.   {% endif %}
  101. </div>