From ba1f58766d8ecf67f96c8758ab3d7a5cb3372265 Mon Sep 17 00:00:00 2001 From: Pedro Pupo Sa da Costa Date: Sat, 20 Jan 2024 00:30:03 +0000 Subject: [PATCH] feat: add missing pages --- .../[learningObjectiveId]/index.page.tsx | 83 +++++++++++++++++++ .../[learningObjectiveId]/questions.page.tsx | 55 ++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/index.page.tsx create mode 100644 apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/questions.page.tsx diff --git a/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/index.page.tsx b/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/index.page.tsx new file mode 100644 index 000000000..ebe661c27 --- /dev/null +++ b/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/index.page.tsx @@ -0,0 +1,83 @@ +import { Link, Sheet } from "@mui/joy"; +import { AppHead } from "@chair-flight/react/components"; +import { + LayoutModule, + LearningObjectiveOverview, + LearningObjectiveQuestions, +} from "@chair-flight/react/containers"; +import { ssrHandler } from "@chair-flight/trpc/server"; +import type { QuestionBankName } from "@chair-flight/base/types"; +import type { Breadcrumbs } from "@chair-flight/react/containers"; +import type { NextPage } from "next"; + +type PageParams = { + questionBank: QuestionBankName; + learningObjectiveId: string; +}; + +type PageProps = { + questionBank: QuestionBankName; + learningObjectiveId: string; +}; + +export const Page: NextPage = ({ + questionBank, + learningObjectiveId, +}) => { + const loLink = `/modules/${questionBank}/learning-objectives`; + const crumbs = [ + [questionBank.toUpperCase(), `/modules/${questionBank}`], + ["Learning Objectives", loLink], + learningObjectiveId, + ] as Breadcrumbs; + + return ( + + + + + + + Questions + + + + ); +}; + +export const getServerSideProps = ssrHandler( + async ({ helper, params }) => { + await Promise.all([ + LayoutModule.getData({ params, helper }), + LearningObjectiveOverview.getData({ params, helper }), + LearningObjectiveQuestions.getData({ params, helper }), + ]); + return { props: params }; + }, +); + +export default Page; diff --git a/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/questions.page.tsx b/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/questions.page.tsx new file mode 100644 index 000000000..0702fd464 --- /dev/null +++ b/apps/next-app/pages/modules/[questionBank]/learning-objectives/[learningObjectiveId]/questions.page.tsx @@ -0,0 +1,55 @@ +import { AppHead } from "@chair-flight/react/components"; +import { + LayoutModule, + LearningObjectiveQuestions, +} from "@chair-flight/react/containers"; +import { ssrHandler } from "@chair-flight/trpc/server"; +import type { QuestionBankName } from "@chair-flight/base/types"; +import type { Breadcrumbs } from "@chair-flight/react/containers"; +import type { NextPage } from "next"; + +type PageParams = { + questionBank: QuestionBankName; + learningObjectiveId: string; +}; + +type PageProps = { + questionBank: QuestionBankName; + learningObjectiveId: string; +}; + +export const Page: NextPage = ({ + questionBank, + learningObjectiveId, +}) => { + const loLink = `/modules/${questionBank}/learning-objectives`; + const crumbs = [ + [questionBank.toUpperCase(), `/modules/${questionBank}`], + ["Learning Objectives", `${loLink}`], + [learningObjectiveId, `${loLink}/${learningObjectiveId}`], + "Questions", + ] as Breadcrumbs; + + return ( + + + + + ); +}; + +export const getServerSideProps = ssrHandler( + async ({ helper, params }) => { + await Promise.all([ + LayoutModule.getData({ params, helper }), + LearningObjectiveQuestions.getData({ params, helper }), + ]); + return { props: params }; + }, +); + +export default Page;