diff --git a/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx b/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx index a09bea2d5..4119fdd70 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx @@ -24,7 +24,7 @@ function basedOnTitle(basedOn: string | BasedOnOptional) { } const displayStyles = cva( - "relative flex flex-col space-y-10 px-14 pb-28 opacity-100 sm:px-24 ", + "relative flex flex-col space-y-10 px-14 pb-28 opacity-100 sm:px-24", ); export type LessonPlanDisplayProps = Readonly<{ @@ -143,7 +143,7 @@ export const LessonPlanDisplay = ({ return ( ; -const ChatSection = ({ objectKey, value }: ChatSectionProps) => { +const ChatSection = ({ section, value }: ChatSectionProps) => { return ( { $position="relative" $display={["none", "flex"]} > - {objectKey === "additionalMaterials" && value === "None" ? ( + {section === "additionalMaterials" && value === "None" ? ( ) : ( )} diff --git a/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.stories.tsx b/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.stories.tsx index f34fcc4c9..8c116fdae 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.stories.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.stories.tsx @@ -40,7 +40,7 @@ const meta: Meta = { component: DropDownSection, tags: ["autodocs"], args: { - objectKey: "learningOutcome", + section: "learningOutcome", value: "I can explain the reasons why frogs are so important to British society and culture", documentContainerRef: { current: null }, @@ -89,7 +89,7 @@ export const Closed: Story = { export const AdditionalMaterials: Story = { args: { - objectKey: "additionalMaterials", + section: "additionalMaterials", value: "None", }, }; @@ -116,7 +116,7 @@ export const ModifyAdditionalMaterials: Story = { }, }, args: { - objectKey: "additionalMaterials", + section: "additionalMaterials", value: "None", }, play: async ({ canvasElement }) => { diff --git a/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.tsx b/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.tsx index aac7f06e6..de23ece61 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/drop-down-section/index.tsx @@ -1,5 +1,6 @@ import { useEffect, useRef, useState } from "react"; +import type { LessonPlanKeys } from "@oakai/aila/src/protocol/schema"; import { camelCaseToSentenceCase } from "@oakai/core/src/utils/camelCaseConversion"; import { OakBox, OakFlex, OakP } from "@oaknational/oak-components"; import { equals } from "ramda"; @@ -15,7 +16,7 @@ import ChatSection from "./chat-section"; const HALF_SECOND = 500; export type DropDownSectionProps = Readonly<{ - objectKey: string; + section: LessonPlanKeys; sectionRefs: Record>; // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any; @@ -26,7 +27,7 @@ export type DropDownSectionProps = Readonly<{ }>; const DropDownSection = ({ - objectKey, + section, sectionRefs, value, documentContainerRef, @@ -35,7 +36,7 @@ const DropDownSection = ({ streamingTimeout = HALF_SECOND, }: DropDownSectionProps) => { const sectionRef = useRef(null); - if (sectionRefs) sectionRefs[objectKey] = sectionRef; + if (sectionRefs) sectionRefs[section] = sectionRef; const [isOpen, setIsOpen] = useState(false); const [status, setStatus] = useState<"empty" | "isStreaming" | "isLoaded">( "empty", @@ -56,7 +57,7 @@ const DropDownSection = ({ setStatus("isStreaming"); if (sectionRef && sectionHasFired === false && status === "isStreaming") { - if (objectKey && value) { + if (section && value) { function scrollToSection() { if (!userHasCancelledAutoScroll) { scrollToRef({ @@ -86,7 +87,7 @@ const DropDownSection = ({ sectionRef, sectionHasFired, status, - objectKey, + section, setIsOpen, prevValue, documentContainerRef, @@ -109,7 +110,7 @@ const DropDownSection = ({ setIsOpen(!isOpen)} aria-label="toggle"> - {sectionTitle(objectKey)} + {sectionTitle(section)} @@ -118,7 +119,7 @@ const DropDownSection = ({ {isOpen && (
{status === "isLoaded" ? ( - + ) : (

Loading

diff --git a/apps/nextjs/src/data/lessonSectionTitlesAndMiniDescriptions.ts b/apps/nextjs/src/data/lessonSectionTitlesAndMiniDescriptions.ts index ac9d00013..5f3622c26 100644 --- a/apps/nextjs/src/data/lessonSectionTitlesAndMiniDescriptions.ts +++ b/apps/nextjs/src/data/lessonSectionTitlesAndMiniDescriptions.ts @@ -1,4 +1,24 @@ -export const lessonSectionTitlesAndMiniDescriptions = { +import type { LessonPlanKeys } from "@oakai/aila/src/protocol/schema"; + +export const lessonSectionTitlesAndMiniDescriptions: Record< + LessonPlanKeys, + { description: string } +> = { + title: { + description: "The name of the lesson.", + }, + keyStage: { + description: "The educational stage for which the lesson is intended.", + }, + subject: { + description: "The subject area of the lesson.", + }, + topic: { + description: "An optional topic that this lesson is part of.", + }, + basedOn: { + description: "An Oak lesson that this lesson is based on.", + }, learningOutcome: { description: "A short summary of the knowledge, skills and understanding students are expected to acquire by the end of the lesson.", @@ -47,8 +67,8 @@ export const lessonSectionTitlesAndMiniDescriptions = { description: "Extra resources for further study or practice, including worksheets, readings, and interactive activities.", }, - slides: { - description: - "Visual aids and presentations used throughout the lesson to support teaching and learning.", - }, + // slides: { + // description: + // "Visual aids and presentations used throughout the lesson to support teaching and learning.", + // }, };