53 lines
4.3 KiB
Plaintext
Executable File
53 lines
4.3 KiB
Plaintext
Executable File
<% if user_signed_in? %>
|
|
<!-- Authenticated User Dropdown -->
|
|
<div class="hidden sm:flex sm:items-center sm:ms-6">
|
|
<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
|
|
<div @click="open = ! open">
|
|
<button
|
|
class="bg-primary-700 text-white border border-primary-800 font-medium py-2 px-4 rounded-lg hover:bg-primary-800 transition-colors duration-200 focus-ring">
|
|
<div>
|
|
<%= current_user.email.length > 20 ? current_user.email[0,20] + "..." : current_user.email %>
|
|
</div>
|
|
<div class="ms-1">
|
|
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
|
</svg>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
<div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95" class="absolute z-50 mt-2 w-48 rounded-md shadow-lg origin-top-right right-0" style="display: none;" @click="open = false">
|
|
<div class="rounded-md ring-1 ring-primary-700 py-1 bg-primary-600">
|
|
<%= link_to t('header.profile'), edit_user_registration_path, class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
|
|
<%= link_to t('header.reservations'), "#", class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
|
|
<%= link_to t('header.logout'), destroy_user_session_path, data: { controller: "logout", action: "click->logout#signOut", logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false }, class: "block w-full px-4 py-2 text-start text-sm leading-5 text-neutral-100 hover:bg-primary-700" %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Responsive Auth Options -->
|
|
<div class="pt-4 pb-1 border-t border-primary-700 bg-primary-600">
|
|
<div class="px-4">
|
|
<% if current_user.first_name %>
|
|
<div class="font-medium text-base text-white"><%= current_user.first_name %></div>
|
|
<% else %>
|
|
<div class="font-medium text-base text-white"><%= current_user.email.length > 20 ? current_user.email[0,20] + "..." : current_user.email %></div>
|
|
<% end %>
|
|
</div>
|
|
<div class="mt-3 space-y-1">
|
|
<%= link_to t('header.profile'), edit_user_registration_path, class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700" %>
|
|
<%= link_to t('header.reservations'), "#", class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700" %>
|
|
<%= link_to t('header.logout'), destroy_user_session_path, data: { controller: "logout", action: "click->logout#signOut", logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false }, class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700" %>
|
|
</div>
|
|
</div>
|
|
<% else %>
|
|
<!-- Non-Authenticated Links -->
|
|
<div class="flex items-center space-x-4">
|
|
<%= link_to t('header.login'), new_user_session_path, class: "text-neutral-100 hover:text-primary-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
|
|
<%= link_to t('header.register'), new_user_registration_path, class: "bg-primary-50 text-primary-600 font-medium py-2 px-4 rounded-lg shadow-sm hover:bg-primary-100 transition-all duration-200" %>
|
|
</div>
|
|
<!-- Responsive Non-Auth Options -->
|
|
<div class="mt-3 space-y-1">
|
|
<%= link_to t('header.register'), new_user_registration_path, class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700" %>
|
|
<%= link_to t('header.login'), new_user_session_path, class: "block px-3 py-2 rounded-md text-base font-medium text-neutral-100 hover:text-primary-200 hover:bg-primary-700" %>
|
|
</div>
|
|
<% end %> |