refactor: натравил форматтер на весь фронт
This commit is contained in:
@@ -13,16 +13,24 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
const lecturesStore = useLecturesStore()
|
||||
const userStore = useUserStore()
|
||||
const addToast = inject('addToast') as ((message: string, type?: 'success' | 'error' | 'info') => void) | undefined
|
||||
const addToast = inject('addToast') as
|
||||
| ((message: string, type?: 'success' | 'error' | 'info') => void)
|
||||
| undefined
|
||||
const enrollmentLimitModalOpen = ref(false)
|
||||
|
||||
const lectureId = computed(() => String(route.params.id))
|
||||
const lecture = computed(() => lecturesStore.all.find(l => l.id === lectureId.value))
|
||||
const isRegistered = computed(() => (lecture.value ? lecturesStore.isRegistered(lecture.value.id) : false))
|
||||
const slotRegistrationDisabled = computed(() => !userStore.hasEnrollmentSlotAvailable && !isRegistered.value)
|
||||
const lecture = computed(() => lecturesStore.all.find((l) => l.id === lectureId.value))
|
||||
const isRegistered = computed(() =>
|
||||
lecture.value ? lecturesStore.isRegistered(lecture.value.id) : false,
|
||||
)
|
||||
const slotRegistrationDisabled = computed(
|
||||
() => !userStore.hasEnrollmentSlotAvailable && !isRegistered.value,
|
||||
)
|
||||
const isAttended = computed(() => lecture.value?.status === 'completed')
|
||||
|
||||
const similarLectures = computed(() => lecturesStore.all.filter(l => l.id !== lectureId.value).slice(0, 3))
|
||||
const similarLectures = computed(() =>
|
||||
lecturesStore.all.filter((l) => l.id !== lectureId.value).slice(0, 3),
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
if (!lecturesStore.all.length) await lecturesStore.fetchLectures()
|
||||
@@ -57,7 +65,10 @@ async function registerLecture() {
|
||||
</div>
|
||||
|
||||
<div v-else-if="!lecture" class="lecture-detail page-content">
|
||||
<EmptyState title="Лекция не найдена" :subtitle="lecturesStore.error ?? 'Попробуйте открыть каталог и выбрать лекцию заново.'" />
|
||||
<EmptyState
|
||||
title="Лекция не найдена"
|
||||
:subtitle="lecturesStore.error ?? 'Попробуйте открыть каталог и выбрать лекцию заново.'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-else class="lecture-detail page-content">
|
||||
@@ -76,9 +87,13 @@ async function registerLecture() {
|
||||
>
|
||||
Записаться
|
||||
</button>
|
||||
<button v-else class="btn-secondary" @click="lecturesStore.unregister(lecture.id)">Отменить запись</button>
|
||||
<button v-else class="btn-secondary" @click="lecturesStore.unregister(lecture.id)">
|
||||
Отменить запись
|
||||
</button>
|
||||
<button class="btn-secondary">Добавить в календарь</button>
|
||||
<button v-if="isAttended" class="btn-primary" @click="router.push(`/review/${lecture.id}`)">Оставить отзыв</button>
|
||||
<button v-if="isAttended" class="btn-primary" @click="router.push(`/review/${lecture.id}`)">
|
||||
Оставить отзыв
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,19 +101,34 @@ async function registerLecture() {
|
||||
<GlassCard>
|
||||
<div class="info-section">
|
||||
<h3>Преподаватель</h3>
|
||||
<div class="info-value">{{ lecture.teacher }}<span v-if="lecture.teacherTitle"> {{ lecture.teacherTitle }}</span></div>
|
||||
<div class="info-sub">{{ [lecture.department, lecture.institute].filter(Boolean).join(', ') }}</div>
|
||||
<div class="info-value">
|
||||
{{ lecture.teacher
|
||||
}}<span v-if="lecture.teacherTitle"> {{ lecture.teacherTitle }}</span>
|
||||
</div>
|
||||
<div class="info-sub">
|
||||
{{ [lecture.department, lecture.institute].filter(Boolean).join(', ') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<h3>Детали занятия</h3>
|
||||
<div class="info-value">{{ new Date(lecture.date).toLocaleDateString('ru-RU') }} {{ lecture.time }}</div>
|
||||
<div class="info-value">
|
||||
{{ new Date(lecture.date).toLocaleDateString('ru-RU') }} {{ lecture.time }}
|
||||
</div>
|
||||
<div class="info-sub">Длительность: {{ lecture.duration }} мин</div>
|
||||
<div class="info-sub">Локация: {{ lecture.building }} {{ lecture.room ? `ауд. ${lecture.room}` : '' }}</div>
|
||||
<div class="info-sub">
|
||||
Локация: {{ lecture.building }} {{ lecture.room ? `ауд. ${lecture.room}` : '' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<h3>Места</h3>
|
||||
<div class="info-value">Записано {{ lecture.enrolledSeats }} из {{ lecture.totalSeats }}</div>
|
||||
<StatusBadge :status="lecture.registrationClosed ? 'closed' : lecture.freeSeats === 0 ? 'full' : 'open'" />
|
||||
<div class="info-value">
|
||||
Записано {{ lecture.enrolledSeats }} из {{ lecture.totalSeats }}
|
||||
</div>
|
||||
<StatusBadge
|
||||
:status="
|
||||
lecture.registrationClosed ? 'closed' : lecture.freeSeats === 0 ? 'full' : 'open'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="info-section">
|
||||
<h3>Теги</h3>
|
||||
@@ -121,8 +151,16 @@ async function registerLecture() {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.lecture-detail { display: flex; flex-direction: column; gap: 24px; }
|
||||
.breadcrumb { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 6px; }
|
||||
.lecture-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
.breadcrumb {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
@@ -130,14 +168,39 @@ async function registerLecture() {
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
|
||||
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
|
||||
.info-section { margin-bottom: 16px; }
|
||||
.info-section:last-child { margin-bottom: 0; }
|
||||
.info-section h3 { font-size: 14px; margin-bottom: 8px; }
|
||||
.info-value { font-weight: 700; }
|
||||
.info-sub { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; }
|
||||
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.info-section {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.info-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.info-section h3 {
|
||||
font-size: 14px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.info-value {
|
||||
font-weight: 700;
|
||||
}
|
||||
.info-sub {
|
||||
font-size: 13px;
|
||||
color: var(--color-text-secondary);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.cards-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
|
||||
Reference in New Issue
Block a user