<template>
  <el-dialog v-model="show" :class="$style['el-dialog']" align-center>
    <template #header><b>社团信息</b></template>
    <div class="flex flex-col" v-if="club">
      <club-list-item :club="club" mode="h" />
      <div>简介：{{ club.commit }}</div>
      <template v-if="userStore.logined && userInfo">
        <el-button
          v-if="userInfo.club && userInfo.club.id === club.id"
          class="self-end"
          type="primary"
        >
          进入主页
        </el-button>
        <el-button v-else class="self-end" type="success">加入社团</el-button>
      </template>
    </div>
  </el-dialog>
</template>
<style lang="scss" module>
.el-dialog {
  position: relative;
  --el-text-color-regular: black;
}
</style>
<script setup lang="ts">
import ClubListItem from '@/components/club/ClubListItem.vue';
import type { Club } from '@/schemas/response';
import { useUserStore } from '@/stores/user';
import { storeToRefs } from 'pinia';
const userStore = useUserStore();
const { userInfo } = storeToRefs(userStore);
const { club } = defineProps<{ club: Club | undefined }>();
const show = defineModel<boolean>({ required: true });
</script>
