add user menu on header

This commit is contained in:
SvyatoslavArtymovych 2023-05-01 17:05:41 +03:00
parent ce8bada1a7
commit 4b10ac99f6
2 changed files with 28 additions and 0 deletions

View File

@ -95,6 +95,32 @@
</div>
{% endif %}
</div>
{% if current_user.is_authenticated %}
<!-- <p class="text-base dark:text-white">{{ current_user.username }}</p> -->
{% endif %}
{% if current_user.is_authenticated %}
<div class="flex items-center ml-3">
<div>
<!-- prettier-ignore -->
<button type="button" class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 mr-2 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5" aria-expanded="false" data-dropdown-toggle="dropdown-user" >
<span class="sr-only">Open user menu</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" /> </svg>
<!-- prettier-ignore -->
</button>
</div>
<!-- prettier-ignore -->
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:bg-gray-700 dark:divide-gray-600" id="dropdown-user" >
<div class="px-4 py-3" role="none">
<p class="text-center text-sm text-gray-900 dark:text-white" role="none"> {{current_user.username}} </p>
</div>
<ul class="py-1" role="none">
<li>
<a href="{{ url_for('auth.logout') }}" class="block px-4 py-2 text-sm dark:hover:bg-gray-600 dark:text-white" role="menuitem" >Sign out</a >
</li>
</ul>
</div>
</div>
{% endif %}
</div>
</div>
</div>

View File

@ -67,6 +67,7 @@
</a>
</li>
{% if current_user.is_authenticated %}
<li>
<a
href="{{ url_for('auth.logout') }}"
@ -85,6 +86,7 @@
<span class="flex-1 ml-3 whitespace-nowrap">Sign Out</span>
</a>
</li>
{% endif %}
</ul>
</div>
</aside>