Skip to content

Commit

Permalink
feat: add missing pages
Browse files Browse the repository at this point in the history
  • Loading branch information
PupoSDC committed Jan 20, 2024
1 parent 9b25fba commit ba1f587
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<PageProps> = ({
questionBank,
learningObjectiveId,
}) => {
const loLink = `/modules/${questionBank}/learning-objectives`;
const crumbs = [
[questionBank.toUpperCase(), `/modules/${questionBank}`],
["Learning Objectives", loLink],
learningObjectiveId,
] as Breadcrumbs;

return (
<LayoutModule fixedHeight questionBank={questionBank} breadcrumbs={crumbs}>
<AppHead />
<LearningObjectiveOverview
sx={{ mb: { xs: 1, sm: 2 } }}
questionBank={questionBank}
learningObjectiveId={learningObjectiveId}
/>
<LearningObjectiveQuestions
questionBank={questionBank}
learningObjectiveId={learningObjectiveId}
sx={{
flex: 1,
overflowY: "scroll",
display: "none",

"@media screen and (min-height: 520px) and (min-width: 600px)": {
display: "block",
},
}}
/>
<Sheet
sx={{
p: 2,

"@media screen and (min-height: 520px) and (min-width: 600px)": {
display: "none",
},
}}
>
<Link href={`${loLink}/${learningObjectiveId}/questions`}>
Questions
</Link>
</Sheet>
</LayoutModule>
);
};

export const getServerSideProps = ssrHandler<PageProps, PageParams>(
async ({ helper, params }) => {
await Promise.all([
LayoutModule.getData({ params, helper }),
LearningObjectiveOverview.getData({ params, helper }),
LearningObjectiveQuestions.getData({ params, helper }),
]);
return { props: params };
},
);

export default Page;
Original file line number Diff line number Diff line change
@@ -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<PageProps> = ({
questionBank,
learningObjectiveId,
}) => {
const loLink = `/modules/${questionBank}/learning-objectives`;
const crumbs = [
[questionBank.toUpperCase(), `/modules/${questionBank}`],
["Learning Objectives", `${loLink}`],
[learningObjectiveId, `${loLink}/${learningObjectiveId}`],
"Questions",
] as Breadcrumbs;

return (
<LayoutModule fixedHeight questionBank={questionBank} breadcrumbs={crumbs}>
<AppHead />
<LearningObjectiveQuestions
questionBank={questionBank}
learningObjectiveId={learningObjectiveId}
sx={{ flex: 1, overflowY: "scroll" }}
/>
</LayoutModule>
);
};

export const getServerSideProps = ssrHandler<PageProps, PageParams>(
async ({ helper, params }) => {
await Promise.all([
LayoutModule.getData({ params, helper }),
LearningObjectiveQuestions.getData({ params, helper }),
]);
return { props: params };
},
);

export default Page;

0 comments on commit ba1f587

Please sign in to comment.