check exam link to render

This commit is contained in:
Primakov Alexandr Alexandrovich 2025-01-08 18:33:02 +03:00
parent d0f7dfb87d
commit 462ba85fe8

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { Link as ConnectedLink } from 'react-router-dom' import { Link as ConnectedLink } from 'react-router-dom'
import { getNavigationsValue, getHistory } from '@brojs/cli' import { getNavigationValue, getHistory } from '@brojs/cli'
import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react' import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react'
import { useAppSelector } from '../../__data__/store' import { useAppSelector } from '../../__data__/store'
@ -27,23 +27,23 @@ export const CourseDetails = ({ populatedCourse }: CourseDetailsProps) => {
{isTeacher(user) && ( {isTeacher(user) && (
<Heading as="h3" mt={4} mb={3} size="lg"> <Heading as="h3" mt={4} mb={3} size="lg">
Экзамен: {exam?.name}{' '} Экзамен: {exam?.name}{' '}
{exam && ( {exam && getNavigationValue('exam.main') && getNavigationValue('link.exam.details') && (
<Tooltip label="Начать экзамен" fontSize="12px" top="16px"> <Tooltip label="Начать экзамен" fontSize="12px" top="16px">
<Button <Button
leftIcon={<LinkIcon />} leftIcon={<LinkIcon />}
as={'a'} as={'a'}
colorScheme="blue" colorScheme="blue"
href={ href={
getNavigationsValue('exam.main') + getNavigationValue('exam.main') +
getNavigationsValue('link.exam.details') getNavigationValue('link.exam.details')
.replace(':courseId', populatedCourse.id) .replace(':courseId', populatedCourse.id)
.replace(':examId', exam.id) .replace(':examId', exam.id)
} }
onClick={(event) => { onClick={(event) => {
event.preventDefault() event.preventDefault()
history.push( history.push(
getNavigationsValue('exam.main') + getNavigationValue('exam.main') +
getNavigationsValue('link.exam.details') getNavigationValue('link.exam.details')
.replace(':courseId', populatedCourse.id) .replace(':courseId', populatedCourse.id)
.replace(':examId', exam.id), .replace(':examId', exam.id),
) )