<script setup lang="ts">
import type { LiveType } from '@/types'
import { formatLiveDate, formatLiveStatus } from '@/utils/index'

import { VideoPlay } from '@element-plus/icons-vue'

interface Props {
  data: LiveType
}
defineProps<Props>()
</script>

<template>
  <div class="course-live-item">
    <p>
      <a :href="data.join_url" target="_blank">
        <el-icon><VideoPlay /></el-icon>
        {{ data.subject }}
      </a>
    </p>
    <div class="actions">
      <span> {{ formatLiveDate(data.start_time) }}</span>
      <span style="margin-left: 10px">{{ formatLiveStatus(data.status) }}</span>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.course-live-item {
  display: flex;
  align-items: center;
  height: 48px;
  border-bottom: 1px solid #e6e6e6;
  p {
    flex: 1;
    line-height: 48px;
  }
  &:hover {
    color: var(--main-color);
  }

  .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
</style>
