-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add chat-quick-bottons stories
- Loading branch information
1 parent
054c8ee
commit 7fb03cf
Showing
2 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
apps/nextjs/src/components/AppComponents/Chat/chat-quick-buttons.stories.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,133 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { | ||
ChatContext, | ||
type ChatContextProps, | ||
} from "@/components/ContextProviders/ChatProvider"; | ||
import { lessonPlanTrackingContext } from "@/lib/analytics/lessonPlanTrackingContext"; | ||
|
||
import ChatQuickButtons from "./chat-quick-buttons"; | ||
|
||
const DummyMessage = {}; | ||
|
||
const ChatDecorator: Story["decorators"] = (Story, { parameters }) => ( | ||
<ChatContext.Provider | ||
value={ | ||
{ | ||
messages: [DummyMessage], | ||
...parameters.chatContext, | ||
} as unknown as ChatContextProps | ||
} | ||
> | ||
<Story /> | ||
</ChatContext.Provider> | ||
); | ||
|
||
const LessonPlanTrackingContextDecorator: Story["decorators"] = (Story) => ( | ||
<lessonPlanTrackingContext.Provider | ||
value={{ | ||
onClickContinue: () => {}, | ||
onClickRetry: () => {}, | ||
onClickStartFromExample: () => {}, | ||
onClickStartFromFreeText: () => {}, | ||
onStreamFinished: () => {}, | ||
onSubmitText: () => {}, | ||
}} | ||
> | ||
<Story /> | ||
</lessonPlanTrackingContext.Provider> | ||
); | ||
|
||
const meta: Meta<typeof ChatQuickButtons> = { | ||
title: "Components/Chat/ChatQuickButtons", | ||
component: ChatQuickButtons, | ||
tags: ["autodocs"], | ||
decorators: [ChatDecorator, LessonPlanTrackingContextDecorator], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof ChatQuickButtons>; | ||
|
||
export const Idle: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "Idle", | ||
}, | ||
}, | ||
}; | ||
|
||
export const Loading: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "Loading", | ||
}, | ||
}, | ||
}; | ||
|
||
export const LoadingWithoutMessages: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "Loading", | ||
messages: [], | ||
}, | ||
}, | ||
}; | ||
|
||
export const RequestMade: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "RequestMade", | ||
}, | ||
}, | ||
}; | ||
|
||
export const StreamingLessonPlan: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "StreamingLessonPlan", | ||
}, | ||
}, | ||
}; | ||
|
||
export const StreamingChatResponse: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "StreamingChatResponse", | ||
}, | ||
}, | ||
}; | ||
|
||
export const Moderating: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
ailaStreamingStatus: "Moderating", | ||
}, | ||
}, | ||
}; | ||
|
||
export const StreamingWithQueuedUserAction: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
queuedUserAction: "regenerate", | ||
ailaStreamingStatus: "StreamingLessonPlan", | ||
}, | ||
}, | ||
}; | ||
|
||
export const ModeratingWithQueuedUserAction: Story = { | ||
args: {}, | ||
parameters: { | ||
chatContext: { | ||
queuedUserAction: "regenerate", | ||
ailaStreamingStatus: "Moderating", | ||
}, | ||
}, | ||
}; |
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