Skip to content

Commit

Permalink
chore: types
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwisecodes committed Nov 28, 2024
1 parent 45746a9 commit c5835ae
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions apps/nextjs/src/app/image-spike/[slug]/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import LoadingWheel from "@/components/LoadingWheel";
import { trpc } from "@/utils/trpc";

export interface PageData {
id: string;
path: string;
title: string;
lessonPlan: {
cycle1: { explanation: { imagePrompt: string } };
cycle2: { explanation: { imagePrompt: string } };
cycle3: { explanation: { imagePrompt: string } };
id?: string;
path?: string;
title?: string;
lessonPlan?: {
cycle1?: { explanation?: { imagePrompt?: string } };
cycle2?: { explanation?: { imagePrompt?: string } };
cycle3?: { explanation?: { imagePrompt?: string } };
};
}

Expand Down Expand Up @@ -60,10 +60,18 @@ const ImagesPage = ({ pageData }: { pageData: PageData }) => {
},
]);

if (
!pageData?.lessonPlan?.cycle1?.explanation?.imagePrompt ||
!pageData?.lessonPlan?.cycle2?.explanation?.imagePrompt ||
!pageData?.lessonPlan?.cycle3?.explanation?.imagePrompt
) {
return "Please choose a lesson with all three learning cycles";
}

const slideTexts = {
cycle1: pageData.lessonPlan.cycle1.explanation.imagePrompt,
cycle2: pageData.lessonPlan.cycle2.explanation.imagePrompt,
cycle3: pageData.lessonPlan.cycle3.explanation.imagePrompt,
cycle1: pageData?.lessonPlan?.cycle1?.explanation?.imagePrompt,
cycle2: pageData?.lessonPlan?.cycle2?.explanation?.imagePrompt,
cycle3: pageData?.lessonPlan?.cycle3?.explanation?.imagePrompt,
};

const trpcMutations = {
Expand Down

0 comments on commit c5835ae

Please sign in to comment.