Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DOJO): Add back button to addExercise page #2393

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pages/curriculum/[lessonSlug]/mentor/addExercise/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import styles from '../../../../../scss/mentorPage.module.scss'
import { get } from 'lodash'
import QueryInfo from '../../../../../components/QueryInfo'
import { errorCheckAllFields } from '../../../../../helpers/admin/adminHelpers'
import { ArrowLeftIcon } from '@primer/octicons-react'
import Link from 'next/link'
import * as Sentry from '@sentry/nextjs'

type DetachedModule = Omit<Module, 'lesson' | 'author'>
Expand All @@ -43,10 +45,18 @@ const Header = <
setModule,
setErrorMsg
}: HeaderProps<T>) => {
const { query } = useRouter()
const { lessonSlug } = query

const modules = get(lesson, 'modules') ?? []

return (
<header className={styles.header}>
<Link href={`/curriculum/${lessonSlug}/mentor`}>
<a className="btn ps-0 d-flex align-items-center mb-3">
<ArrowLeftIcon size="medium" aria-label="Exit" />
</a>
</Link>
<div>
<h1>{get(lesson, 'title')}</h1>
</div>
Expand Down Expand Up @@ -133,8 +143,8 @@ const initValues = [
]

const AddExercisePage = ({ data }: GetAppProps) => {
const router = useRouter()
const { lessonSlug } = router.query
const { query } = useRouter()
const { lessonSlug } = query

// Omitting author and lesson because data.lessons[i].modules[i] mismatching type
const [module, setModule] = useState<null | DetachedModule>(null)
Expand Down