|
10 | 10 | > |
11 | 11 | <BaseIcon name="menu" /> |
12 | 12 | </button> |
13 | | - <div class="relative max-w-md w-full transition-all "> |
| 13 | + <div class="relative max-w-md w-full transition-all"> |
14 | 14 | <BaseIcon name="search" /> |
15 | 15 | <input |
16 | 16 | placeholder="Search subscribers, campaigns..." |
|
22 | 22 |
|
23 | 23 | <div class="flex items-center gap-4"> |
24 | 24 | <button class="hidden sm:flex items-center gap-2 px-4 py-2 bg-ext-wf1 text-white text-xs font-bold rounded-lg hover:bg-ext-wf3 transition-shadow shadow-sm shadow-indigo-500/20"> |
25 | | - <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus" aria-hidden="true"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg> |
| 25 | + <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" |
| 26 | + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> |
| 27 | + <path d="M5 12h14"></path> |
| 28 | + <path d="M12 5v14"></path> |
| 29 | + </svg> |
26 | 30 | Create Campaign |
27 | 31 | </button> |
28 | 32 |
|
29 | 33 | <!-- User dropdown --> |
30 | | - <div class="flex items-center gap-3 pl-2 group cursor-pointer"> |
31 | | - <div class="flex flex-col items-end hidden sm:flex"> |
32 | | - <span class="text-sm font-bold text-slate-800 leading-none">{{ adminData.login_name || 'Admin User' }}</span> |
33 | | - <span class="text-[10px] text-slate-500 mt-0.5">{{ adminData.super_user ? 'Super Admin' : 'Administrator' }}</span> |
| 34 | + <div class="relative"> |
| 35 | + <div |
| 36 | + class="flex items-center gap-3 pl-2 cursor-pointer" |
| 37 | + @click="toggleDropdown" |
| 38 | + > |
| 39 | + <div class="flex flex-col items-end hidden sm:flex"> |
| 40 | + <span class="text-sm font-bold text-slate-800 leading-none"> |
| 41 | + {{ adminData.login_name || 'Admin User' }} |
| 42 | + </span> |
| 43 | + <span class="text-[10px] text-slate-500 mt-0.5"> |
| 44 | + {{ adminData.super_user ? 'Super Admin' : 'Administrator' }} |
| 45 | + </span> |
| 46 | + </div> |
| 47 | + |
| 48 | + <BaseIcon name="chevronDown" /> |
34 | 49 | </div> |
35 | 50 |
|
36 | | - <BaseIcon name="chevronDown" /> |
| 51 | + <!-- Dropdown --> |
| 52 | + <div |
| 53 | + v-if="dropdownOpen" |
| 54 | + class="absolute right-0 mt-2 w-40 bg-white border border-slate-200 rounded-lg shadow-lg py-1 z-50" |
| 55 | + > |
| 56 | + <a |
| 57 | + href="/logout" |
| 58 | + class="block px-4 py-2 text-sm text-slate-700 hover:bg-slate-100" |
| 59 | + > |
| 60 | + Logout |
| 61 | + </a> |
| 62 | + </div> |
37 | 63 | </div> |
38 | 64 | </div> |
39 | 65 | </header> |
|
46 | 72 | </template> |
47 | 73 |
|
48 | 74 | <script setup> |
49 | | -/* No imports required */ |
50 | 75 | import BaseIcon from "../components/base/BaseIcon.vue"; |
51 | 76 | import { useSidebar } from "../composables/useSidebar"; |
52 | 77 | import { onMounted, ref } from "vue"; |
53 | 78 |
|
54 | 79 | const { openSidebar } = useSidebar(); |
| 80 | +
|
55 | 81 | const adminData = ref({}); |
| 82 | +const dropdownOpen = ref(false); |
| 83 | +
|
| 84 | +const toggleDropdown = () => { |
| 85 | + dropdownOpen.value = !dropdownOpen.value; |
| 86 | +}; |
56 | 87 |
|
57 | 88 | onMounted(async () => { |
58 | 89 | try { |
59 | 90 | const response = await fetch('/admin-about', { |
60 | 91 | headers: { |
61 | | - 'Accept': 'application/json', |
| 92 | + Accept: 'application/json', |
62 | 93 | 'X-Requested-With': 'XMLHttpRequest' |
63 | 94 | } |
64 | 95 | }); |
| 96 | +
|
65 | 97 | if (response.ok) { |
66 | 98 | adminData.value = await response.json(); |
67 | 99 | } |
|
0 commit comments