-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: updates to download resources page #17
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f976669
feat: updates to download resources page
mantagen 821bb85
copy changes
mantagen 21eab93
copy
mantagen 1514435
Merge branch 'main' into fix/download-sections
mantagen 7087965
fix tests
mantagen 4ca8fff
changes test logic to reflect that only one learning cycle is valie
mantagen cc42587
types on kew words and learning outcomes
mantagen aaf8434
sentence case
mantagen d09522b
fix progress bar flickering
mantagen d6a05e9
sentence case
mantagen bd6b667
sentence case
mantagen 45cd59d
colon to dot after quiz question numbers
mantagen 59705d2
Merge branch 'main' into fix/download-sections
mantagen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
export const lessonSections = [ | ||
"Title", | ||
"Subject", | ||
"Key Stage", | ||
"Learning Outcome", | ||
"Learning Cycles", | ||
"Prior Knowledge", | ||
"Key Learning Points", | ||
"Key stage", | ||
"Learning outcome", | ||
"Learning cycles", | ||
"Prior knowledge", | ||
"Key learning points", | ||
"Misconceptions", | ||
"Keywords", | ||
"Starter Quiz", | ||
"Cycle 1", | ||
"Exit Quiz", | ||
"Starter quiz", | ||
"Learning cycle 1", | ||
"Exit quiz", | ||
]; |
176 changes: 176 additions & 0 deletions
176
apps/nextjs/src/app/aila/[id]/download/DownloadView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
"use client"; | ||
|
||
import { AilaPersistedChat } from "@oakai/aila/src/protocol/schema"; | ||
import { Box, Flex, Grid } from "@radix-ui/themes"; | ||
|
||
import Layout from "@/components/AppComponents/Layout"; | ||
import Button from "@/components/Button"; | ||
import DialogContents from "@/components/DialogControl/DialogContents"; | ||
import { DialogRoot } from "@/components/DialogControl/DialogRoot"; | ||
import { DownloadButton } from "@/components/DownloadButton"; | ||
import { Icon } from "@/components/Icon"; | ||
|
||
import { SurveyDialogLauncher } from "./SurveyDialogLauncher"; | ||
import { useDownloadView } from "./useDownloadView"; | ||
|
||
type DownloadViewProps = Readonly<{ | ||
chat: AilaPersistedChat; | ||
featureFlag: boolean; | ||
}>; | ||
export function DownloadView({ | ||
chat, | ||
featureFlag, | ||
}: Readonly<DownloadViewProps>) { | ||
const { lessonPlan } = chat; | ||
const { | ||
lessonSlidesExport, | ||
worksheetExport, | ||
lessonPlanExport, | ||
starterQuizExport, | ||
exitQuizExport, | ||
additionalMaterialsExport, | ||
sections, | ||
totalSections, | ||
totalSectionsComplete, | ||
} = useDownloadView(chat); | ||
|
||
return ( | ||
<Layout featureFlag={featureFlag}> | ||
<DialogRoot> | ||
<DialogContents | ||
chatId={chat.id} | ||
lesson={lessonPlan} | ||
isShared={chat.isShared} | ||
/> | ||
<SurveyDialogLauncher /> | ||
<div className="mx-auto mb-26 mt-30 w-full max-w-[1280px] px-9"> | ||
<Box width="100%"> | ||
<Box className="w-full"> | ||
<Button | ||
variant="text-link" | ||
href={`/aila/${chat.id}`} | ||
icon="chevron-left" | ||
iconPosition="leading" | ||
size="sm" | ||
> | ||
<span className="text-base font-light underline"> | ||
{lessonPlan.title ? lessonPlan.title : "Back to lesson"} | ||
</span> | ||
</Button> | ||
|
||
<div> | ||
<h1 className="my-24 text-4xl font-bold">Download resources</h1> | ||
<p className="mb-24 max-w-[600px]"> | ||
Choose the resources you would like to generate and download. | ||
</p> | ||
</div> | ||
<Grid | ||
columns={{ | ||
initial: "1", | ||
sm: "2", | ||
}} | ||
className="gap-26" | ||
> | ||
<Flex direction="column" className="gap-14"> | ||
<DownloadButton | ||
onClick={() => lessonPlanExport.start()} | ||
title="Lesson" | ||
subTitle="Overview of the complete lesson" | ||
downloadAvailable={!!lessonPlanExport.readyToExport} | ||
downloadLoading={lessonPlanExport.status === "loading"} | ||
data={lessonPlanExport.data} | ||
exportsType="lessonPlanDoc" | ||
data-testid="chat-download-lesson-plan" | ||
lesson={lessonPlan} | ||
/> | ||
<DownloadButton | ||
onClick={() => starterQuizExport.start()} | ||
title="Starter quiz" | ||
subTitle="Questions and answers to assess prior knowledge" | ||
downloadAvailable={!!starterQuizExport.readyToExport} | ||
downloadLoading={starterQuizExport.status === "loading"} | ||
data={starterQuizExport.data} | ||
exportsType="starterQuiz" | ||
lesson={lessonPlan} | ||
/> | ||
<DownloadButton | ||
onClick={() => lessonSlidesExport.start()} | ||
data-testid="chat-download-slides-btn" | ||
title="Slide deck" | ||
subTitle="Learning outcome, keywords and learning cycles" | ||
downloadAvailable={lessonSlidesExport.readyToExport} | ||
downloadLoading={lessonSlidesExport.status === "loading"} | ||
data={lessonSlidesExport.data} | ||
exportsType="lessonSlides" | ||
lesson={lessonPlan} | ||
/> | ||
<DownloadButton | ||
onClick={() => worksheetExport.start()} | ||
title="Worksheet" | ||
subTitle="Practice tasks" | ||
downloadAvailable={!!worksheetExport.readyToExport} | ||
downloadLoading={worksheetExport.status === "loading"} | ||
data={worksheetExport.data} | ||
lesson={lessonPlan} | ||
exportsType="worksheet" | ||
/> | ||
<DownloadButton | ||
onClick={() => exitQuizExport.start()} | ||
title="Exit quiz" | ||
subTitle="Questions and answers to assess understanding" | ||
downloadAvailable={!!exitQuizExport.readyToExport} | ||
downloadLoading={exitQuizExport.status === "loading"} | ||
data={exitQuizExport.data} | ||
exportsType="exitQuiz" | ||
lesson={lessonPlan} | ||
/> | ||
{lessonPlan.additionalMaterials && | ||
lessonPlan.additionalMaterials !== "None" && ( | ||
<DownloadButton | ||
onClick={() => additionalMaterialsExport.start()} | ||
title="Additional materials" | ||
subTitle="Document containing any additional materials" | ||
downloadAvailable={ | ||
!!additionalMaterialsExport.readyToExport | ||
} | ||
downloadLoading={ | ||
additionalMaterialsExport.status === "loading" | ||
} | ||
data={additionalMaterialsExport.data} | ||
exportsType="additionalMaterials" | ||
lesson={lessonPlan} | ||
/> | ||
)} | ||
</Flex> | ||
<Box> | ||
<div className="mb-17"> | ||
<span className=" font-bold"> | ||
{`${totalSectionsComplete} of ${totalSections} sections complete`} | ||
</span> | ||
</div> | ||
{sections.map((section) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also using this sections array rather than what was in the previous version |
||
return ( | ||
<span | ||
key={`progress-sections-${section.label}`} | ||
className="mb-7 flex gap-6 py-5" | ||
> | ||
<span | ||
className={`flex w-14 items-center justify-center ${ | ||
section.complete ? "opacity-100" : "opacity-30" | ||
}`} | ||
> | ||
<Icon icon="tick" className="mr-2" size="sm" /> | ||
</span> | ||
<p>{section.label}</p> | ||
</span> | ||
); | ||
})} | ||
</Box> | ||
</Grid> | ||
</Box> | ||
</Box> | ||
</div> | ||
</DialogRoot> | ||
</Layout> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
apps/nextjs/src/app/aila/[id]/download/SurveyDialogLauncher.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useEffect } from "react"; | ||
|
||
import { usePosthogFeedbackSurvey } from "hooks/surveys/usePosthogFeedbackSurvey"; | ||
|
||
import { useDialog } from "@/components/AppComponents/DialogContext"; | ||
|
||
export function SurveyDialogLauncher() { | ||
const { survey } = usePosthogFeedbackSurvey({ | ||
closeDialog: () => null, | ||
surveyName: "End of Aila generation survey launch aug24", | ||
}); | ||
const { setDialogWindow } = useDialog(); | ||
|
||
useEffect(() => { | ||
if (survey) { | ||
const timer = setTimeout(() => { | ||
setDialogWindow("feedback"); | ||
}, 3000); | ||
return () => clearTimeout(timer); | ||
} | ||
}, [survey, setDialogWindow]); | ||
|
||
return null; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is mostly changing the file name. But the introduction of this hook is the substantive change in this file