<script lang="ts">
const GlobalFeedback = defineComponent({
  setup() {
    window.$dialog = useDialog();
    window.$loadingBar = useLoadingBar();
    window.$message = useMessage();
    window.$notification = useNotification();
    return () => null;
  },
});
</script>

<script setup lang="ts">
import { dateZhCN, NConfigProvider, NDialogProvider, NLoadingBarProvider, NMessageProvider, NNotificationProvider, useDialog, useLoadingBar, useMessage, useNotification, zhCN } from 'naive-ui';
import { defineComponent } from 'vue';
import { useThemeStore } from '@/stores/theme';
import { storeToRefs } from 'pinia';
import { VueQueryDevtools } from '@tanstack/vue-query-devtools';
import { useVersionCheckQuery } from './composables/query';

const themeStore = useThemeStore();
const { themeMode } = storeToRefs(themeStore);

useVersionCheckQuery();
</script>

<template>
  <NConfigProvider :date-locale="dateZhCN" :locale="zhCN" :theme="themeMode">
    <NDialogProvider>
      <NLoadingBarProvider>
        <NMessageProvider>
          <NNotificationProvider>
            <GlobalFeedback />
            <RouterView />
            <VueQueryDevtools />
          </NNotificationProvider>
        </NMessageProvider>
      </NLoadingBarProvider>
    </NDialogProvider>
  </NConfigProvider>
</template>

<style scoped></style>
