@@ -3,17 +3,15 @@ import * as React from "react"
3
3
import type { Meta , StoryObj } from "@storybook/react"
4
4
import { http , HttpResponse } from "msw"
5
5
import { handlers } from "../../components/AiChat/test-utils/api"
6
- import { AiDrawer , AiDrawerInitMessage } from "./AiDrawer"
6
+ import { AiDrawer , AiDrawerSettings } from "./AiDrawer"
7
7
import { MathJaxContext } from "better-react-mathjax"
8
8
import Button from "@mui/material/Button"
9
9
10
- type InitPayload = AiDrawerInitMessage [ "payload" ]
11
-
12
10
const TEST_API_STREAMING = "http://localhost:4567/streaming"
13
11
const CONTENT_FILE_URL =
14
12
"http://localhost:4567/api/v1/contentfiles/?edx_module_id=1"
15
13
16
- const INITIAL_MESSAGES : InitPayload [ "chat" ] [ "initialMessages" ] = [
14
+ const INITIAL_MESSAGES : AiDrawerSettings [ "chat" ] [ "initialMessages" ] = [
17
15
{
18
16
content : "Hi! What are you interested in learning about?" ,
19
17
role : "assistant" ,
@@ -29,18 +27,18 @@ const STARTERS = [
29
27
const meta : Meta < typeof AiDrawer > = {
30
28
title : "smoot-design/AI/AiDrawer" ,
31
29
component : AiDrawer ,
32
- render : ( { payload } ) => {
30
+ render : ( { settings } ) => {
33
31
const [ open , setOpen ] = React . useState ( false )
34
32
return (
35
33
< >
36
34
< Button variant = "outlined" onClick = { ( ) => setOpen ( true ) } >
37
35
Open Drawer
38
36
</ Button >
39
37
< p > Message data:</ p >
40
- < pre > { JSON . stringify ( { payload } , null , 2 ) } </ pre >
38
+ < pre > { JSON . stringify ( { settings } , null , 2 ) } </ pre >
41
39
< MathJaxContext >
42
40
< AiDrawer
43
- payload = { payload }
41
+ settings = { settings }
44
42
open = { open }
45
43
onClose = { ( ) => setOpen ( false ) }
46
44
/>
@@ -49,7 +47,7 @@ const meta: Meta<typeof AiDrawer> = {
49
47
)
50
48
} ,
51
49
argTypes : {
52
- payload : {
50
+ settings : {
53
51
// JSON controls break form submission via keyboard. See
54
52
// https://github.com/storybookjs/storybook/issues/31881
55
53
control : false ,
@@ -63,9 +61,8 @@ type Story = StoryObj<typeof AiDrawer>
63
61
64
62
export const ProblemStory : Story = {
65
63
args : {
66
- payload : {
64
+ settings : {
67
65
blockType : "problem" ,
68
- target : "problem-frame" ,
69
66
title : "AskTIM for help with Problem: Derivatives 1.1" ,
70
67
chat : {
71
68
apiUrl : TEST_API_STREAMING ,
@@ -78,9 +75,9 @@ export const ProblemStory: Story = {
78
75
79
76
export const ProblemDefaultInitialMessagesStory : Story = {
80
77
args : {
81
- payload : {
78
+ settings : {
82
79
blockType : "problem" ,
83
- target : "problem-frame-default-initial-messages" ,
80
+
84
81
title : "AskTIM for help with Problem: Derivatives 1.1" ,
85
82
chat : {
86
83
apiUrl : TEST_API_STREAMING ,
@@ -92,9 +89,8 @@ export const ProblemDefaultInitialMessagesStory: Story = {
92
89
93
90
export const EntryScreenStory : Story = {
94
91
args : {
95
- payload : {
92
+ settings : {
96
93
blockType : "problem" ,
97
- target : "entry-screen-frame" ,
98
94
chat : {
99
95
apiUrl : TEST_API_STREAMING ,
100
96
initialMessages : INITIAL_MESSAGES ,
@@ -111,9 +107,8 @@ export const EntryScreenStory: Story = {
111
107
*/
112
108
export const VideoStory : Story = {
113
109
args : {
114
- payload : {
110
+ settings : {
115
111
blockType : "video" ,
116
- target : "video-frame" ,
117
112
chat : {
118
113
apiUrl : TEST_API_STREAMING ,
119
114
conversationStarters : STARTERS ,
@@ -141,9 +136,8 @@ export const VideoStory: Story = {
141
136
*/
142
137
export const FlashcardConversationStartersStory : Story = {
143
138
args : {
144
- payload : {
139
+ settings : {
145
140
blockType : "video" ,
146
- target : "starters-frame" ,
147
141
chat : {
148
142
apiUrl : TEST_API_STREAMING ,
149
143
} ,
0 commit comments