|
1 | 1 | <template> |
2 | | - <header class="app-header"> |
3 | | - <div class="app-header__container"> |
4 | | - <div class="app-header__logo-section"> |
5 | | - <img src="/logo.svg" alt="Logo" class="app-header__logo-image"> |
| 2 | + <header class="app-header"> |
| 3 | + <div class="app-header__container"> |
| 4 | + <div class="app-header__logo-section"> |
| 5 | + <img src="/logo.svg" alt="Logo" class="app-header__logo-image" /> |
| 6 | + </div> |
| 7 | + |
| 8 | + <div class="app-header__right-section"> |
| 9 | + <!-- Dark Mode Toggle Button --> |
| 10 | + <button @click="toggleDarkMode" class="app-header__toggle-theme-button"> |
| 11 | + <font-awesome-icon :icon="darkMode ? 'moon' : 'sun'" /> |
| 12 | + <span>{{ darkMode ? 'Dark Mode' : 'Light Mode' }}</span> |
| 13 | + </button> |
| 14 | + |
| 15 | + <!-- Add Widget Button --> |
| 16 | + <!-- <div v-if="showAddWidget" class="app-header__button-container"> |
| 17 | + <fwb-button pill class="app-header__add-widget-button" @click="openSidebar"> |
| 18 | + <template #prefix> |
| 19 | + <font-awesome-icon icon="circle-plus" class="mr-2" /> |
| 20 | + </template> |
| 21 | + Add Widget |
| 22 | + </fwb-button> |
| 23 | + </div> --> |
| 24 | + |
| 25 | + <!-- Database Info Icon with Tooltip --> |
| 26 | + <fwb-tooltip placement="bottom" class="cursor-pointer"> |
| 27 | + <template #trigger> |
| 28 | + <font-awesome-layers class="fa-lg app-header__db-icon"> |
| 29 | + <font-awesome-icon |
| 30 | + icon="fa-solid fa-circle" |
| 31 | + class="app-header__circle-icon" |
| 32 | + transform="grow-13" |
| 33 | + /> |
| 34 | + <font-awesome-icon icon="fa-solid fa-database" class="app-header__database-icon" /> |
| 35 | + </font-awesome-layers> |
| 36 | + </template> |
| 37 | + <template #content> |
| 38 | + <div class="app-header__tooltip-content"> |
| 39 | + <span class="tooltip-content__label">Database Endpoint: </span> |
| 40 | + <span class="tooltip-content__info">{{ databaseEndpoint }}</span> |
6 | 41 | </div> |
7 | | - |
8 | | - <div class="app-header__right-section"> |
9 | | - <!-- Dark Mode Toggle Button --> |
10 | | - <button @click="toggleDarkMode" class="app-header__toggle-theme-button"> |
11 | | - <font-awesome-icon :icon="darkMode ? 'moon' : 'sun'" /> |
12 | | - <span>{{ darkMode ? 'Dark Mode' : 'Light Mode' }}</span> |
13 | | - </button> |
14 | | - |
15 | | - <!-- Add Widget Button --> |
16 | | - <div class="app-header__button-container"> |
17 | | - <fwb-button pill class="app-header__add-widget-button" @click="openSidebar"> |
18 | | - <template #prefix> |
19 | | - <font-awesome-icon icon="circle-plus" class="mr-2" /> |
20 | | - </template> |
21 | | - Add Widget |
22 | | - </fwb-button> |
23 | | - </div> |
24 | | - |
25 | | - <!-- Database Info Icon with Tooltip --> |
26 | | - <fwb-tooltip placement="bottom"> |
27 | | - <template #trigger> |
28 | | - <font-awesome-layers class="fa-lg app-header__db-icon"> |
29 | | - <font-awesome-icon icon="fa-solid fa-circle" class="app-header__circle-icon" transform="grow-13" /> |
30 | | - <font-awesome-icon icon="fa-solid fa-database" class="app-header__database-icon" /> |
31 | | - </font-awesome-layers> |
32 | | - </template> |
33 | | - <template #content> |
34 | | - <div class="app-header__tooltip-content"> |
35 | | - <span class="tooltip-content__label">Database Endpoint: </span> |
36 | | - <span class="tooltip-content__info">Database URL info</span> |
37 | | - </div> |
38 | | - </template> |
39 | | - </fwb-tooltip> |
40 | | - </div> |
41 | | - </div> |
42 | | - </header> |
| 42 | + </template> |
| 43 | + </fwb-tooltip> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + </header> |
43 | 47 | </template> |
44 | 48 |
|
45 | 49 | <script setup lang="ts"> |
46 | | -import { FwbButton, FwbTooltip } from 'flowbite-vue'; |
47 | | -import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome'; |
48 | | -import { useWidgetStore } from '@/stores/widgets'; |
49 | | -import { useThemeStore } from '@/stores/theme'; |
50 | | -import { computed } from 'vue'; |
51 | | -
|
52 | | -const widgetStore = useWidgetStore(); |
| 50 | +import { FwbTooltip } from 'flowbite-vue' |
| 51 | +import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome' |
| 52 | +import { useThemeStore } from '@/stores/theme' |
| 53 | +import { computed, onMounted } from 'vue' |
| 54 | +import { useDatabaseStore } from '@/stores/database-endpoint' |
53 | 55 |
|
54 | | -const openSidebar = () => { |
55 | | - widgetStore.setSidebarVisible(true); |
56 | | -}; |
| 56 | +const databaseStore = useDatabaseStore() |
57 | 57 |
|
58 | | -const themeStore = useThemeStore(); |
59 | | -const darkMode = computed(() => themeStore.darkMode); |
| 58 | +const themeStore = useThemeStore() |
| 59 | +const darkMode = computed(() => themeStore.darkMode) |
60 | 60 |
|
61 | 61 | const toggleDarkMode = () => { |
62 | | - themeStore.toggleDarkMode(); |
63 | | -}; |
| 62 | + themeStore.toggleDarkMode() |
| 63 | +} |
| 64 | +
|
| 65 | +const databaseEndpoint = computed(() => databaseStore.databaseEndpoint) |
| 66 | +
|
| 67 | +onMounted(() => { |
| 68 | + databaseStore.fetchDatabaseEndpoint() |
| 69 | +}) |
64 | 70 | </script> |
65 | 71 |
|
66 | 72 | <style scoped> |
67 | 73 | .app-header { |
68 | | - @apply fixed top-0 z-50 h-[81px] w-full border-b border-solid border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-800; |
| 74 | + @apply fixed top-0 z-50 h-[81px] w-full border-b border-solid border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-800; |
69 | 75 | } |
70 | 76 |
|
71 | 77 | .app-header__container { |
72 | | - @apply flex h-full items-center justify-between pr-10; |
| 78 | + @apply flex h-full items-center justify-between pr-10; |
73 | 79 | } |
74 | 80 |
|
75 | 81 | .app-header__logo-section { |
76 | | - @apply flex items-center justify-center min-w-[240px] h-full border-r border-solid border-gray-200 dark:border-gray-800; |
| 82 | + @apply flex items-center justify-center min-w-[240px] h-full; |
77 | 83 | } |
78 | 84 |
|
79 | 85 | .app-header__logo-image { |
80 | | - @apply h-10; |
| 86 | + @apply h-10; |
81 | 87 | } |
82 | 88 |
|
83 | 89 | .app-header__right-section { |
84 | | - @apply flex items-center space-x-4 pr-10; |
| 90 | + @apply flex items-center space-x-4 pr-10; |
85 | 91 | } |
86 | 92 |
|
87 | 93 | .app-header__button-container { |
88 | | - @apply pr-4; |
| 94 | + @apply pr-4; |
89 | 95 | } |
90 | 96 |
|
91 | 97 | .app-header__add-widget-button { |
92 | | - @apply bg-blue-600 text-white border-none dark:bg-blue-700 dark:text-white; |
| 98 | + @apply bg-blue-600 text-white border-none dark:bg-blue-700 dark:text-white; |
93 | 99 | } |
94 | 100 |
|
95 | 101 | .app-header__db-icon { |
96 | | - @apply text-gray-600 dark:text-gray-300; |
| 102 | + @apply text-gray-600 dark:text-gray-300; |
97 | 103 | } |
98 | 104 |
|
99 | 105 | .app-header__circle-icon { |
100 | | - @apply text-neutral-400 dark:text-neutral-600; |
| 106 | + @apply text-neutral-400 dark:text-neutral-600; |
101 | 107 | } |
102 | 108 |
|
103 | 109 | .app-header__database-icon { |
104 | | - @apply text-white dark:text-gray-200; |
| 110 | + @apply text-white dark:text-gray-200; |
105 | 111 | } |
106 | 112 |
|
107 | 113 | .app-header__tooltip-content { |
108 | | - @apply p-2 mr-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800; |
| 114 | + @apply p-2 mr-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800; |
109 | 115 | } |
110 | 116 |
|
111 | 117 | .tooltip-content__label { |
112 | | - @apply text-sm font-bold dark:text-white; |
| 118 | + @apply text-sm font-bold dark:text-white; |
113 | 119 | } |
114 | 120 |
|
115 | 121 | .tooltip-content__info { |
116 | | - @apply text-sm text-gray-500 font-normal dark:text-gray-400; |
| 122 | + @apply text-sm text-gray-500 font-normal dark:text-gray-400; |
117 | 123 | } |
118 | 124 |
|
119 | 125 | .app-header__toggle-theme-button { |
|
0 commit comments