From 34afc86374e857c571016d6a2f4ef187fa40c2b0 Mon Sep 17 00:00:00 2001 From: Mav-Ivan <110425368+Mav-Ivan@users.noreply.github.com> Date: Wed, 13 Sep 2023 20:08:55 +0300 Subject: [PATCH] Implement edit lesson button (#1117) * fixed troubles * added button with redirect * fixed mistakes * fixed mistakes --- src/pages/lesson-details/LessonDetails.tsx | 13 +++++++++++++ .../lesson-details/LessonsDetails.styles.ts | 19 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/pages/lesson-details/LessonDetails.tsx b/src/pages/lesson-details/LessonDetails.tsx index 76fd65e45..d443c5ae1 100644 --- a/src/pages/lesson-details/LessonDetails.tsx +++ b/src/pages/lesson-details/LessonDetails.tsx @@ -1,8 +1,10 @@ import { useCallback, useState } from 'react' import { useParams, useNavigate } from 'react-router-dom' +import { useTranslation } from 'react-i18next' import { AxiosResponse } from 'axios' import Box from '@mui/material/Box' import ExpandMoreIcon from '@mui/icons-material/ExpandMore' +import EditIcon from '@mui/icons-material/Edit' import Loader from '~/components/loader/Loader' import TitleWithDescription from '~/components/title-with-description/TitleWithDescription' @@ -15,16 +17,20 @@ import { } from '~/pages/lesson-details/LessonDetails.constants' import Accordions from '~/components/accordion/Accordions' import IconExtensionWithTitle from '~/components/icon-extension-with-title/IconExtensionWithTitle' +import AppButton from '~/components/app-button/AppButton' import { errorRoutes } from '~/router/constants/errorRoutes' +import { authRoutes } from '~/router/constants/authRoutes' import { styles } from '~/pages/lesson-details/LessonsDetails.styles' import { Lesson, TypographyVariantEnum } from '~/types' +import { createUrlPath } from '~/utils/helper-functions' const LessonDetails = () => { const [activeItems, setActiveItems] = useState([]) const { id } = useParams() const navigate = useNavigate() + const { t } = useTranslation() const onChange = (activeItem: number) => { setActiveItems((prevActiveItems) => { @@ -57,6 +63,10 @@ const LessonDetails = () => { return } + const handleEditLesson = () => { + navigate(createUrlPath(authRoutes.myResources.editLesson.path, id)) + } + const attachmentsList = attachmentsMock.map((attachment) => ( { return ( + + {t('common.edit')} +