|
5 | 5 | import { fade } from 'svelte/transition'; |
6 | 6 | import { onMount, onDestroy } from 'svelte'; |
7 | 7 | import NotificationCenter from './NotificationCenter.svelte'; |
| 8 | + import { Sun, Moon, MonitorCog, Menu, X, LogIn, UserPlus, LogOut, User, ChevronDown, Settings } from '@lucide/svelte'; |
8 | 9 |
|
9 | 10 | let isMenuActive = $state(false); |
10 | 11 | let isMobile = $state(false); |
11 | 12 | let resizeListener: (() => void) | null = null; |
12 | 13 | let showUserDropdown = $state(false); |
13 | | -
|
14 | | - const sunIcon = `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>`; |
15 | | - const moonIcon = `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>`; |
16 | | - const autoIcon = `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"></path></svg>`; |
17 | | - const menuIcon = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg>`; |
18 | | - const closeIcon = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>`; |
19 | 14 | let logoImgClass = "h-8 max-h-8 w-auto transition-all duration-200 group-hover:scale-110"; |
20 | | - const loginIcon = `<svg class="w-5 h-5 mr-2 -ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"></path></svg>`; |
21 | | - const registerIcon = `<svg class="w-5 h-5 mr-2 -ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"></path></svg>`; |
22 | | - const logoutIcon = `<svg class="w-5 h-5 mr-2 -ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>`; |
23 | | - const userIcon = `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>`; |
24 | | - const chevronDownIcon = `<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>`; |
25 | | - const adminIcon = `<svg class="w-5 h-5 mr-2 -ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"></path></svg>`; |
26 | 15 |
|
27 | 16 |
|
28 | 17 | function toggleMenu() { |
|
107 | 96 | <div class="flex items-center space-x-3"> |
108 | 97 | <button onclick={toggleTheme} title="Toggle theme" class="btn btn-ghost btn-icon text-fg-muted dark:text-dark-fg-muted hover:text-fg-default dark:hover:text-dark-fg-default"> |
109 | 98 | {#if $theme === 'light'} |
110 | | - {@html sunIcon} |
| 99 | + <Sun class="w-5 h-5" /> |
111 | 100 | {:else if $theme === 'dark'} |
112 | | - {@html moonIcon} |
| 101 | + <Moon class="w-5 h-5" /> |
113 | 102 | {:else} |
114 | | - {@html autoIcon} |
| 103 | + <MonitorCog class="w-5 h-5" /> |
115 | 104 | {/if} |
116 | 105 | </button> |
117 | 106 |
|
|
125 | 114 | class="flex items-center space-x-2 btn btn-ghost btn-sm" |
126 | 115 | > |
127 | 116 | <div class="flex items-center space-x-2"> |
128 | | - {@html userIcon} |
| 117 | + <User class="w-5 h-5" /> |
129 | 118 | <span class="hidden xl:inline font-medium">{$username}</span> |
130 | 119 | <span class="transition-transform duration-200" class:rotate-180={showUserDropdown}> |
131 | | - {@html chevronDownIcon} |
| 120 | + <ChevronDown class="w-4 h-4" /> |
132 | 121 | </span> |
133 | 122 | </div> |
134 | 123 | </button> |
|
200 | 189 |
|
201 | 190 | <div class="block lg:hidden"> |
202 | 191 | <button onclick={toggleMenu} class="btn btn-ghost btn-icon text-fg-muted dark:text-dark-fg-muted hover:text-fg-default dark:hover:text-dark-fg-default"> |
203 | | - {@html isMenuActive ? closeIcon : menuIcon} |
| 192 | + {#if isMenuActive} |
| 193 | + <X class="h-5 w-5" /> |
| 194 | + {:else} |
| 195 | + <Menu class="h-5 w-5" /> |
| 196 | + {/if} |
204 | 197 | </button> |
205 | 198 | </div> |
206 | 199 | </div> |
|
226 | 219 | </div> |
227 | 220 | {#if $userRole === 'admin'} |
228 | 221 | <a href="/admin/events" use:route onclick={closeMenu} class="block px-3 py-2 rounded-md text-base font-medium text-fg-default dark:text-dark-fg-default hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center"> |
229 | | - {@html adminIcon} Admin Panel |
| 222 | + <Settings class="w-5 h-5 mr-2 -ml-1" /> Admin Panel |
230 | 223 | </a> |
231 | 224 | {/if} |
232 | 225 | <a href="/settings" use:route onclick={closeMenu} class="block px-3 py-2 rounded-md text-base font-medium text-fg-default dark:text-dark-fg-default hover:bg-neutral-100 dark:hover:bg-neutral-700"> |
233 | 226 | Settings |
234 | 227 | </a> |
235 | 228 | <button onclick={handleLogout} class="w-full text-left block px-3 py-2 rounded-md text-base font-medium text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-800 dark:hover:text-red-300 flex items-center"> |
236 | | - {@html logoutIcon} Logout |
| 229 | + <LogOut class="w-5 h-5 mr-2 -ml-1" /> Logout |
237 | 230 | </button> |
238 | 231 | {:else} |
239 | 232 | <a href="/login" use:route onclick={closeMenu} class="block px-3 py-2 rounded-md text-base font-medium text-fg-default dark:text-dark-fg-default hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center"> |
240 | | - {@html loginIcon} Login |
| 233 | + <LogIn class="w-5 h-5 mr-2 -ml-1" /> Login |
241 | 234 | </a> |
242 | 235 | <a href="/register" use:route onclick={closeMenu} class="block px-3 py-2 rounded-md text-base font-medium text-fg-default dark:text-dark-fg-default hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center"> |
243 | | - {@html registerIcon} Register |
| 236 | + <UserPlus class="w-5 h-5 mr-2 -ml-1" /> Register |
244 | 237 | </a> |
245 | 238 | {/if} |
246 | 239 | </div> |
|
0 commit comments