Skip to content

Commit

Permalink
feat: link to lesson overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigMcCahill committed Dec 15, 2022
1 parent ba21657 commit 67bfe2c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 9 additions & 1 deletion src/common-lib/urls/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export type LessonIndexLinkProps = {
subject: string;
slug: string;
};
export type LessonOverviewLinkProps = {
page: "lesson-overview";
slug: string;
};

export type ResolveOakHrefProps =
| {
Expand All @@ -117,7 +121,8 @@ export type ResolveOakHrefProps =
| PostIndexLinkProps
| TierSelectionLinkProps
| UnitIndexLinkProps
| LessonIndexLinkProps;
| LessonIndexLinkProps
| LessonOverviewLinkProps;

/**
* Pass readable props which are unlikely to need to change, and return an href.
Expand Down Expand Up @@ -193,6 +198,9 @@ export const resolveOakHref = (props: ResolveOakHrefProps) => {
case "lesson-index": {
return `/beta/teachers/key-stages/${props.keyStage}/subjects/${props.subject}/units/${props.slug}`;
}
case "lesson-overview": {
return `/beta/teachers/lessons/${props.slug}`;
}

default:
return OAK_PAGES[props.page];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type LessonListItemProps = {
slug: string;
keyStageSlug: string;
subjectSlug: string;
unitSlug: string;
quizCount: number | null;
videoCount: number | null;
presentationCount: number | null;
Expand All @@ -30,9 +31,7 @@ export type LessonListItemProps = {
const LessonListItem: FC<LessonListItemProps> = (props) => {
const {
title,
subjectSlug,
slug,
keyStageSlug,
description,
quizCount,
videoCount,
Expand Down Expand Up @@ -75,13 +74,7 @@ const LessonListItem: FC<LessonListItemProps> = (props) => {
$flexDirection={"column"}
$width={"100%"}
>
<OakLink
keyStage={keyStageSlug}
subject={subjectSlug}
slug={slug}
page={"lesson-index"}
{...primaryTargetProps}
>
<OakLink slug={slug} page={"lesson-overview"} {...primaryTargetProps}>
<Flex>
<Heading
$mt={24}
Expand Down
1 change: 1 addition & 0 deletions src/node-lib/curriculum-api/_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type TeachersKeyStageSubjectUnitsLessonsData = {
keyStageTitle: string;
subjectSlug: string;
subjectTitle: string;
unitSlug: string;
themeSlug: string;
themeTitle: string;
quizCount: number | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ const teachersKeyStageSubjectUnitsLessonsFixture = (
unitTitle: "Some unit",
lessons: [
{
slug: "geometry",
slug: "macbeth-lesson-1",
title: "Islamic Geometry",
description:
"In this lesson, we will focus on Islamic beliefs about holy books and we will consider why in Islam the Qur'an is a revelation prized above all others. We will explore the importance of holy books (Scrolls of Ibrahim, Tawrat, Zabur, Injil), the difference between those revelations and the revelation of the Qur'an and what the Qur'an is and what the Qur'an contains.",
keyStageSlug: "ks4",
keyStageTitle: "Key stage 4",
subjectSlug: "maths",
unitSlug: "some-unit-slug",
subjectTitle: "Maths",
themeSlug: "some-theme-slug",
themeTitle: "Some theme title",
Expand All @@ -29,14 +30,15 @@ const teachersKeyStageSubjectUnitsLessonsFixture = (
worksheetCount: 2,
},
{
slug: "trig",
slug: "macbeth-lesson-1",
title:
"Creating a sculpture inspired by Chakaia Booker and Anish Kapoor",
description:
"In this lesson, we will look at artworks in relation to biomorphism. We will look at how Anish Kapoor and Chakaia Booker's sculptures have a biomorphic shape, and then create our own sculpture inspired by nature.",
keyStageSlug: "ks4",
keyStageTitle: "Key stage 4",
subjectSlug: "maths",
unitSlug: "some-unit-slug",
subjectTitle: "Maths",
themeSlug: "some-theme-slug",
themeTitle: "Some theme title",
Expand Down

0 comments on commit 67bfe2c

Please sign in to comment.