diff --git a/apps/nextjs/src/components/AppComponents/Chat/chat-dropdownsection.tsx b/apps/nextjs/src/components/AppComponents/Chat/chat-dropdownsection.tsx index f8c599961..a7da18e1a 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/chat-dropdownsection.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/chat-dropdownsection.tsx @@ -16,6 +16,7 @@ const DropDownSection = ({ value, documentContainerRef, userHasCancelledAutoScroll, + showLessonMobile, }: { objectKey: string; sectionRefs: Record>; @@ -23,6 +24,7 @@ const DropDownSection = ({ value: any; documentContainerRef: React.MutableRefObject; userHasCancelledAutoScroll: boolean; + showLessonMobile: boolean; }) => { const sectionRef = useRef(null); if (sectionRefs) sectionRefs[objectKey] = sectionRef; @@ -33,6 +35,12 @@ const DropDownSection = ({ const [prevValue, setPrevValue] = useState>({}); const [sectionHasFired, setSectionHasFired] = useState(false); + useEffect(() => { + if (!showLessonMobile) { + setIsOpen(false); + } + }, [showLessonMobile]); + useEffect(() => { if (value === null || value === undefined || !value) { setStatus("empty"); diff --git a/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx b/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx index 753c9fbb3..5e0862a8e 100644 --- a/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx +++ b/apps/nextjs/src/components/AppComponents/Chat/chat-lessonPlanDisplay.tsx @@ -173,6 +173,7 @@ export const LessonPlanDisplay = ({ value={value} userHasCancelledAutoScroll={userHasCancelledAutoScroll} documentContainerRef={documentContainerRef} + showLessonMobile={showLessonMobile} /> ); }