<script setup lang="ts">
import { computed } from 'vue';
import { ConfigProvider, StyleProvider } from 'ant-design-vue';
import { legacyLogicalPropertiesTransformer } from 'ant-design-vue';
import { useAppStore } from './store/modules/app';
import { useThemeStore } from './store/modules/theme';
import { antdLocales } from './locales/antd';

defineOptions({
  name: 'App'
});

const appStore = useAppStore();
const themeStore = useThemeStore();

const antdLocale = computed(() => {
  appStore.changeLocale(appStore.locale);
  return antdLocales[appStore.locale];
});
</script>

<template>
  <ConfigProvider :theme="themeStore.antdTheme" :locale="antdLocale">
    <StyleProvider
      hash-priority="high"
      :transformers="[legacyLogicalPropertiesTransformer]"
    >
      <AppProvider>
        <RouterView class="bg-layout" />
      </AppProvider>
    </StyleProvider>
  </ConfigProvider>
</template>

<style scoped></style>
