feat: 移除暗夜模式

This commit is contained in:
baiqi 2023-06-19 18:04:07 +08:00 committed by rubylliu
parent e460c98d92
commit 87f7b3265d
6 changed files with 0 additions and 91 deletions

View File

@ -35,18 +35,6 @@
</template>
</a-dropdown>
</li>
<li>
<a-tooltip
:content="theme === 'light' ? $t('settings.navbar.theme.toDark') : $t('settings.navbar.theme.toLight')"
>
<a-button class="nav-btn" type="outline" :shape="'circle'" @click="handleToggleTheme">
<template #icon>
<icon-moon-fill v-if="theme === 'dark'" />
<icon-sun-fill v-else />
</template>
</a-button>
</a-tooltip>
</li>
<li>
<a-tooltip :content="$t('settings.navbar.alerts')">
<div class="message-box-trigger">
@ -157,21 +145,6 @@
return appStore.theme;
});
const topMenu = computed(() => appStore.topMenu && appStore.menu);
const isDark = useDark({
selector: 'body',
attribute: 'MS-theme',
valueDark: 'dark',
valueLight: 'light',
storageKey: 'MS-theme',
onChanged(dark: boolean) {
// overridden default behavior
appStore.toggleTheme(dark);
},
});
const toggleTheme = useToggle(isDark);
const handleToggleTheme = () => {
toggleTheme();
};
// const setVisible = () => {
// appStore.updateSettings({ globalSettings: true });
// };

View File

@ -1,30 +0,0 @@
import { computed } from 'vue';
import { EChartsOption } from 'echarts';
import { useAppStore } from '@/store';
// for code hints
// import { SeriesOption } from 'echarts';
// Because there are so many configuration items, this provides a relatively convenient code hint.
// When using vue, pay attention to the reactive issues. It is necessary to ensure that corresponding functions can be triggered, TypeScript does not report errors, and code writing is convenient.
interface optionsFn {
(isDark: boolean): EChartsOption;
}
/**
* echarts
*/
export default function useChartOption(sourceOption: optionsFn) {
const appStore = useAppStore();
const isDark = computed(() => {
return appStore.theme === 'dark';
});
// echarts support https://echarts.apache.org/zh/theme-builder.html
// It's not used here
// TODO echarts themes
const chartOption = computed<EChartsOption>(() => {
return sourceOption(isDark.value);
});
return {
chartOption,
};
}

View File

@ -1,16 +0,0 @@
import { computed } from 'vue';
import { useAppStore } from '@/store';
/**
*
* @returns
*/
export default function useThemes() {
const appStore = useAppStore();
const isDark = computed(() => {
return appStore.theme === 'dark';
});
return {
isDark,
};
}

View File

@ -6,8 +6,6 @@ export default {
'settings.language': 'Language',
'settings.navbar': 'Navbar',
'settings.menuWidth': 'Menu Width (px)',
'settings.navbar.theme.toLight': 'Click to use light mode',
'settings.navbar.theme.toDark': 'Click to use dark mode',
'settings.navbar.screen.toFull': 'Click to switch to full screen mode',
'settings.navbar.screen.toExit': 'Click to exit the full screen mode',
'settings.navbar.alerts': 'alerts',

View File

@ -6,8 +6,6 @@ export default {
'settings.language': '语言',
'settings.navbar': '导航栏',
'settings.menuWidth': '菜单宽度 (px)',
'settings.navbar.theme.toLight': '点击切换为亮色模式',
'settings.navbar.theme.toDark': '点击切换为暗黑模式',
'settings.navbar.screen.toFull': '点击切换全屏模式',
'settings.navbar.screen.toExit': '点击退出全屏模式',
'settings.navbar.alerts': '消息通知',

View File

@ -33,20 +33,6 @@ const useAppStore = defineStore('app', {
// @ts-ignore-next-line
this.$patch(partial);
},
/**
*
* @param dark
*/
toggleTheme(dark: boolean) {
if (dark) {
this.theme = 'dark';
document.body.setAttribute('MS-theme', 'dark');
} else {
this.theme = 'light';
document.body.removeAttribute('MS-theme');
}
},
/**
*
* @param device mobile | desktop