import React from 'react' import dayjs from 'dayjs' import { Link as ConnectedLink } from 'react-router-dom' import { getNavigationValue, getHistory } from '@brojs/cli' import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react' import { useAppSelector } from '../../__data__/store' import { isTeacher } from '../../utils/user' import { PopulatedCourse } from '../../__data__/model' import { api } from '../../__data__/api/api' import { LinkIcon } from '@chakra-ui/icons' type CourseDetailsProps = { populatedCourse: PopulatedCourse } const history = getHistory() export const CourseDetails = ({ populatedCourse }: CourseDetailsProps) => { const user = useAppSelector((s) => s.user) const exam = populatedCourse.examWithJury const [toggleExamWithJury, examWithJuryRequest] = api.useToggleExamWithJuryMutation() return ( <> {isTeacher(user) && ( Экзамен: {exam?.name}{' '} {exam && getNavigationValue('exam.main') && getNavigationValue('link.exam.details') && ( )} )} {!Boolean(exam) && ( <> Не задан )} {Boolean(exam) && ( <> Количество членов жюри: {populatedCourse.examWithJury.jury.length} )} Список занятий: {populatedCourse?.lessons?.map((lesson) => ( {lesson.name} ))} ) }