adminforth 1.3.56-next.6 → 1.3.56-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/spa/src/App.vue
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<span
|
|
33
|
-
|
|
34
|
-
<IconMoonSolid class="w-5 h-5 text-blue-300" v-if="theme !== 'dark'" />
|
|
33
|
+
@click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-lightHtml dark:text-darkSidebarTextHover dark:hover:bg-darkHtml dark:hover:text-darkSidebarTextActive" role="menuitem">
|
|
34
|
+
<IconMoonSolid class="w-5 h-5 text-blue-300" v-if="coreStore.theme !== 'dark'" />
|
|
35
35
|
<IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
|
|
36
36
|
</span>
|
|
37
37
|
<div>
|
|
@@ -294,9 +294,7 @@ const theme = ref('light');
|
|
|
294
294
|
|
|
295
295
|
function toggleTheme() {
|
|
296
296
|
theme.value = theme.value === 'light' ? 'dark' : 'light';
|
|
297
|
-
|
|
298
|
-
window.localStorage.setItem('af__theme', theme.value);
|
|
299
|
-
|
|
297
|
+
coreStore.toggleTheme();
|
|
300
298
|
}
|
|
301
299
|
|
|
302
300
|
function clickOnMenuItem (label: string) {
|
|
@@ -6,6 +6,8 @@ import type { Ref } from 'vue'
|
|
|
6
6
|
|
|
7
7
|
export const useCoreStore = defineStore('core', () => {
|
|
8
8
|
const resourceById: Ref<Object> = ref({});
|
|
9
|
+
const theme: Ref<'light'| 'dark'> = ref(window.localStorage.getItem('af__theme') as ('light'|'dark') || 'light');
|
|
10
|
+
|
|
9
11
|
const menu = ref([]);
|
|
10
12
|
const config = ref({});
|
|
11
13
|
const record: Ref<any | null> = ref({});
|
|
@@ -23,6 +25,19 @@ export const useCoreStore = defineStore('core', () => {
|
|
|
23
25
|
const resourceColumnsId = ref(null);
|
|
24
26
|
const adminUser = ref(null);
|
|
25
27
|
|
|
28
|
+
async function toggleTheme() {
|
|
29
|
+
theme.value = theme.value === 'light' ? 'dark' : 'light';
|
|
30
|
+
if (theme.value === 'light') {
|
|
31
|
+
document.documentElement.classList.remove('dark');
|
|
32
|
+
} else {
|
|
33
|
+
document.documentElement.classList.add('dark');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
document.documentElement.setAttribute('data-theme', theme.value);
|
|
37
|
+
theme.value = theme.value;
|
|
38
|
+
window.localStorage.setItem('af__theme', theme.value);
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
async function fetchMenuAndResource() {
|
|
27
42
|
const resp = await callAdminForthApi({
|
|
28
43
|
path: '/get_base_config',
|
|
@@ -143,6 +158,8 @@ export const useCoreStore = defineStore('core', () => {
|
|
|
143
158
|
resourceOptions,
|
|
144
159
|
resource,
|
|
145
160
|
adminUser,
|
|
146
|
-
resourceColumnsWithFilters
|
|
161
|
+
resourceColumnsWithFilters,
|
|
162
|
+
toggleTheme,
|
|
163
|
+
theme,
|
|
147
164
|
}
|
|
148
165
|
})
|