Skip to content

Commit

Permalink
chore: capitalise LessonPlanTrackingContext
Browse files Browse the repository at this point in the history
  • Loading branch information
codeincontext committed Dec 11, 2024
1 parent c32d4a2 commit 2eaccdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from "react";

import type { Decorator } from "@storybook/react";

import { lessonPlanTrackingContext } from "../../src/lib/analytics/lessonPlanTrackingContext";
import { LessonPlanTrackingContext } from "../../src/lib/analytics/lessonPlanTrackingContext";

export const LessonPlanTrackingDecorator: Decorator = (Story) => (
<lessonPlanTrackingContext.Provider
<LessonPlanTrackingContext.Provider
value={{
onClickContinue: () => {},
onClickRetry: () => {},
Expand All @@ -16,5 +16,5 @@ export const LessonPlanTrackingDecorator: Decorator = (Story) => (
}}
>
<Story />
</lessonPlanTrackingContext.Provider>
</LessonPlanTrackingContext.Provider>
);
14 changes: 7 additions & 7 deletions apps/nextjs/src/lib/analytics/lessonPlanTrackingContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type OnStreamFinishedProps = {
nextLesson: LooseLessonPlan;
messages: Message[];
};
type LessonPlanTrackingContext = {
type LessonPlanTrackingContextProps = {
onStreamFinished: (props: OnStreamFinishedProps) => void;
onSubmitText: (text: string) => void;
onClickContinue: () => void;
Expand All @@ -30,8 +30,8 @@ type LessonPlanTrackingContext = {
onClickStartFromFreeText: (text: string) => void;
};

export const lessonPlanTrackingContext =
createContext<LessonPlanTrackingContext | null>(null);
export const LessonPlanTrackingContext =
createContext<LessonPlanTrackingContextProps | null>(null);

export type LessonPlanTrackingProviderProps = Readonly<{
readonly children?: React.ReactNode;
Expand Down Expand Up @@ -91,7 +91,7 @@ const LessonPlanTrackingProvider: FC<LessonPlanTrackingProviderProps> = ({
setUserMessageContent(text);
}, []);

const value: LessonPlanTrackingContext = useMemo(
const value: LessonPlanTrackingContextProps = useMemo(
() => ({
onStreamFinished,
onSubmitText,
Expand All @@ -111,14 +111,14 @@ const LessonPlanTrackingProvider: FC<LessonPlanTrackingProviderProps> = ({
);

return (
<lessonPlanTrackingContext.Provider value={value}>
<LessonPlanTrackingContext.Provider value={value}>
{children}
</lessonPlanTrackingContext.Provider>
</LessonPlanTrackingContext.Provider>
);
};

export const useLessonPlanTracking = () => {
const context = useContext(lessonPlanTrackingContext);
const context = useContext(LessonPlanTrackingContext);
if (!context) {
throw new Error(
"useLessonPlanTracking must be used within a LessonPlanTrackingProvider",
Expand Down

0 comments on commit 2eaccdd

Please sign in to comment.