(#16) Layout списка лекций как таблица
All checks were successful
platform/bro/pipeline/head This commit looks good
platform/bro/pipeline/pr-master This commit looks good

This commit is contained in:
2024-04-01 17:42:30 +03:00
parent e30974acb7
commit c68cea7fa6
5 changed files with 227 additions and 163 deletions

View File

@@ -35,6 +35,7 @@ import { useAppSelector } from '../__data__/store'
import { api } from '../__data__/api/api'
import { isTeacher } from '../utils/user'
import { AddIcon, ArrowDownIcon, ArrowUpIcon, LinkIcon } from '@chakra-ui/icons'
import { Course } from '../__data__/model'
interface NewCourseForm {
startDt: string
@@ -226,7 +227,15 @@ const CoursesList = () => {
)
}
const CourseCard = ({ course, isOpened, openDetails }) => {
const CourseCard = ({
course,
isOpened,
openDetails,
}: {
course: Course
isOpened: boolean
openDetails: () => void
}) => {
const [getLessonList, lessonList] = api.useLazyLessonListQuery()
useEffect(() => {
if (isOpened) {
@@ -262,6 +271,7 @@ const CourseCard = ({ course, isOpened, openDetails }) => {
{lessonList.data?.body?.map((lesson) => (
<Link
as={ConnectedLink}
key={lesson._id}
to={
isTeacher(user)
? `${getNavigationsValue('journal.main')}/lesson/${course._id}/${lesson._id}`