feat: первое подключение фронтенда
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, ref } from 'vue'
|
||||
import { computed, inject, onMounted, ref } from 'vue'
|
||||
import { useLecturesStore } from '@/stores/lectures'
|
||||
import SearchInput from '@/components/ui/SearchInput.vue'
|
||||
import LectureCard from '@/components/ui/LectureCard.vue'
|
||||
@@ -21,6 +21,10 @@ const onlyFree = ref(false)
|
||||
const filtersOpen = ref(false)
|
||||
const addToast = inject('addToast') as ((message: string, type?: 'success' | 'error' | 'info') => void) | undefined
|
||||
|
||||
onMounted(() => {
|
||||
if (!lecturesStore.all.length) void lecturesStore.fetchLectures()
|
||||
})
|
||||
|
||||
const tagFilters = ref([
|
||||
{ label: '#ML', value: '#ML', active: false },
|
||||
{ label: '#ИИ', value: '#ИИ', active: false },
|
||||
@@ -97,9 +101,13 @@ const calendarGroups = computed(() => {
|
||||
return Object.entries(groups)
|
||||
})
|
||||
|
||||
function registerLecture(id: string) {
|
||||
lecturesStore.register(id)
|
||||
addToast?.('Вы записаны на лекцию. Напоминание придет за сутки.', 'success')
|
||||
async function registerLecture(id: string) {
|
||||
try {
|
||||
await lecturesStore.register(id)
|
||||
addToast?.('Вы записаны на лекцию. Напоминание придет за сутки.', 'success')
|
||||
} catch (err) {
|
||||
addToast?.(err instanceof Error ? err.message : 'Не удалось записаться на лекцию.', 'error')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -179,7 +187,15 @@ function registerLecture(id: string) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="filtered.length === 0">
|
||||
<GlassCard v-if="lecturesStore.loading">
|
||||
<div class="text-secondary">Загружаем лекции...</div>
|
||||
</GlassCard>
|
||||
|
||||
<div v-else-if="lecturesStore.error">
|
||||
<EmptyState title="Не удалось загрузить каталог" :subtitle="lecturesStore.error" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="filtered.length === 0">
|
||||
<EmptyState title="Нет результатов" subtitle="Попробуйте изменить фильтры или сбросить поиск." />
|
||||
</div>
|
||||
|
||||
@@ -212,7 +228,13 @@ function registerLecture(id: string) {
|
||||
</span>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<button class="btn-primary btn-sm" :disabled="row.freeSeats === 0 || row.registrationClosed">Записаться</button>
|
||||
<button
|
||||
class="btn-primary btn-sm"
|
||||
:disabled="row.freeSeats === 0 || row.registrationClosed || lecturesStore.registeredIds.includes(row.id)"
|
||||
@click="registerLecture(row.id)"
|
||||
>
|
||||
{{ lecturesStore.registeredIds.includes(row.id) ? 'Записан' : 'Записаться' }}
|
||||
</button>
|
||||
</template>
|
||||
</DataTable>
|
||||
</GlassCard>
|
||||
|
||||
Reference in New Issue
Block a user