import { computed, defineComponent } from 'vue';
import { NConfigProvider, zhCN, dateZhCN } from 'naive-ui';
import { AppProvider } from './components/Application';
import { RouterView } from 'vue-router';
import setting from './settings/designSetting';
import { lighten } from './utils';
export default defineComponent({
  name: 'App',
  setup() {
    const getThemeOverrides = computed(() => {
      const appTheme = setting.appTheme;
      const lightenStr = lighten(setting.appTheme, 6);
      return {
        common: {
          primaryColor: appTheme,
          primaryColorHover: lightenStr,
          primaryColorPressed: lightenStr
        },
        LoadingBar: {
          colorLoading: appTheme
        }
      };
    });
    return () => (
      <>
        <NConfigProvider
          locale={zhCN}
          themeOverrides={getThemeOverrides.value}
          // :theme="getDarkTheme"
          // :theme-overrides="getThemeOverrides"
          dateLocale={dateZhCN}>
          <AppProvider>
            <RouterView />
            {/* <RouterError /> */}
          </AppProvider>
        </NConfigProvider>
      </>
    );
  }
});
