<!-- 💥 这里是一次性加载 LayoutComponents -->
<template>
	<component :is="LayoutComponents[layout]" />
	<!--	<ThemeDrawer />-->
	<RightPanel v-if="showSettings">
		<Settings />
	</RightPanel>
</template>

<script setup lang="ts" name="layout">
import { computed, type Component } from 'vue'
import { LayoutType } from '@/store/interface'
import useStore from '@/store'
import RightPanel from '@/components/RightPanel/index.vue'
import LayoutTop from './LayoutTop/index.vue'
import LayoutTopMix from './LayoutTopMix/index.vue'
import LayoutLeft from './LayoutLeft/index.vue'
import LayoutLeftMix from './LayoutLeftMix/index.vue'
import { Settings } from '@/layout/components'

const LayoutComponents: Record<LayoutType, Component> = {
	topMix: LayoutTopMix,
	top: LayoutTop,
	left: LayoutLeft,
	leftMix: LayoutLeftMix
}
const { setting } = useStore()
const layout = computed(() => setting.layout)
const showSettings = computed(() => setting.showSettings)
</script>

<style scoped lang="scss">
.layout {
	min-width: 600px;
}
</style>
