import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import { themeConfig } from './styles/theme.js'
import './styles/global.css'
import './styles/responsive.css'
import { useUserStore } from './stores/user.js'

// 导入图标组件
import * as Icons from '@ant-design/icons-vue'

const app = createApp(App)
const pinia = createPinia()

// 注册所有图标组件
Object.keys(Icons).forEach(key => {
  app.component(key, Icons[key])
})

app.use(pinia)
app.use(router)
app.use(Antd, {
  theme: themeConfig
})

// 在应用挂载前初始化用户登录状态
const userStore = useUserStore()
userStore.checkLoginStatus()

app.mount('#app')