Skip to content

Commit

Permalink
Added a new question page (#1122)
Browse files Browse the repository at this point in the history
* Added a new question page

* Added route for button
  • Loading branch information
Yurenko authored Sep 14, 2023
1 parent 34afc86 commit 29050b5
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/constants/translations/en/breadcrumbs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"myOffers": "My offers",
"editLesson": "Edit lesson",
"lessonDetails": "Lesson details",
"newQuiz": "New quiz"
"newQuiz": "New quiz",
"newQuestion": "New question"
}
3 changes: 2 additions & 1 deletion src/constants/translations/ua/breadcrumbs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"myOffers": "Мої пропозиції",
"editLesson": "Редагування уроку",
"lessonDetails": "Деталі уроку",
"newQuiz": "Новий тест"
"newQuiz": "Новий тест",
"newQuestion": "Нове питання"
}
3 changes: 2 additions & 1 deletion src/containers/my-quizzes/QuizzesContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useSort from '~/hooks/table/use-sort'
import useBreakpoints from '~/hooks/use-breakpoints'
import useAxios from '~/hooks/use-axios'
import usePagination from '~/hooks/table/use-pagination'
import { authRoutes } from '~/router/constants/authRoutes'

import { defaultResponses, snackbarVariants } from '~/constants'
import {
Expand Down Expand Up @@ -94,7 +95,7 @@ const QuizzesContainer = () => {
<AddResourceWithInput
btnText={'myResourcesPage.quizzes.addBtn'}
fetchData={fetchData}
link={'#'}
link={authRoutes.myResources.newQuiz.path}
searchRef={searchTitle}
/>
{loading ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Loader from '~/components/loader/Loader'
import useSort from '~/hooks/table/use-sort'
import useBreakpoints from '~/hooks/use-breakpoints'
import useAxios from '~/hooks/use-axios'
import { authRoutes } from '~/router/constants/authRoutes'

import { defaultResponses, snackbarVariants } from '~/constants'
import {
Expand Down Expand Up @@ -85,7 +86,7 @@ const QuestionsContainer = () => {
<AddResourceWithInput
btnText={'myResourcesPage.questions.addBtn'}
fetchData={fetchData}
link={'#'}
link={authRoutes.myResources.newQuestion.path}
searchRef={searchTitle}
/>
{loading ? (
Expand Down
11 changes: 11 additions & 0 deletions src/pages/create-or-edit-question/CreateOrEditQuestion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageWrapper from '~/components/page-wrapper/PageWrapper'

const CreateOrEditQuestion = () => {
return (
<PageWrapper>
<div>CreateOrEditQuestion</div>
</PageWrapper>
)
}

export default CreateOrEditQuestion
4 changes: 4 additions & 0 deletions src/router/constants/authRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const authRoutes = {
newQuiz: {
route: 'my-resources/new-quiz',
path: '/my-resources/new-quiz'
},
newQuestion: {
route: 'my-resources/new-question',
path: '/my-resources/new-question'
}
},
lessonDetails: { route: 'lesson-details/:id', path: '/lesson-details' },
Expand Down
5 changes: 5 additions & 0 deletions src/router/constants/crumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ export const chat = {
name: t('breadCrumbs.chat'),
path: authRoutes.chat.route
}

export const newQuestion = {
name: t('breadCrumbs.newQuestion'),
path: authRoutes.myResources.newQuestion.route
}
11 changes: 10 additions & 1 deletion src/router/routes/authRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
offerDetails,
subjects,
userProfile,
newQuiz
newQuiz,
newQuestion
} from '~/router/constants/crumbs'
import PrivateRoute from '~/router/helpers/PrivateRoute'
import { UserRoleEnum } from '~/types'
Expand All @@ -40,6 +41,9 @@ const CreateOrEditLesson = lazy(
)
const LessonDetails = lazy(() => import('~/pages/lesson-details/LessonDetails'))
const NewQuiz = lazy(() => import('~/pages/new-quiz/NewQuiz'))
const CreateOrEditQuestion = lazy(
() => import('~/pages/create-or-edit-question/CreateOrEditQuestion')
)

export const authRouter = (
<Route
Expand Down Expand Up @@ -121,5 +125,10 @@ export const authRouter = (
handle={{ crumb: [myResources, newQuiz] }}
path={authRoutes.myResources.newQuiz.route}
/>
<Route
element={<CreateOrEditQuestion />}
handle={{ crumb: [myResources, newQuestion] }}
path={authRoutes.myResources.newQuestion.route}
/>
</Route>
)

0 comments on commit 29050b5

Please sign in to comment.