@nualang/nualang-ui-components 0.1.1138 → 0.1.1140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -161,8 +161,8 @@ function GenerateRoleplayDialog({
161
161
  setGeneratedRoleplay([]);
162
162
  setErrorMessage("");
163
163
  let response;
164
- const prompt = usePdfContext ? `Create an informative conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} Return the conversation inside an array, each text in the conversation should be inside an object in the array. Each object should have the keys actor and text. If the text belongs to person 1 then the key actor should equal to 1 else it should equal to 2. The key text should equal to the text in the conversation. Your response should be in JSON.` : `Create a conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""}about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} Return the conversation inside an array, each text in the conversation should be inside an object in the array. Each object should have the keys actor and text. If the text belongs to person 1 then the key actor should equal to 1 else it should equal to 2. The key text should equal to the text in the conversation. Your response should be in JSON`;
165
- const promptWithQuestions = usePdfContext ? `Create an informative conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} The conversation should be returned inside a single array along with three comprehension questions related to the conversation. Each piece of dialogue and each question should be represented as an object in the array. For dialogue, the objects should have the keys 'actor' and 'text'. The 'actor' key should be set to 1 if the dialogue is spoken by the first actor, and 2 if it is spoken by the second actor. The 'text' key should be set to the dialogue text spoken by that actor. For questions, the objects should have the keys 'question' and 'answers'. The 'question' key should be set to the text of the question being asked. The 'answers' key should be an array of three objects, each representing a different answer to the question where only one is correct and two are incorrect. The objects in the 'answers' array should have the keys 'text', 'correct' and 'type'. The 'text' key should contain the answer text, 'correct' should be true for the correct answer and false for incorrect ones, and 'type' should always be equal to 'multichoice'. The entire output must be in a single JSON array without separating the dialogue and questions into different arrays.` : `Create a conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""}about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} The conversation should be returned inside a single array along with three comprehension questions related to the conversation. Each piece of dialogue and each question should be represented as an object in the array. For dialogue, the objects should have the keys 'actor' and 'text'. The 'actor' key should be set to 1 if the dialogue is spoken by the first actor, and 2 if it is spoken by the second actor. The 'text' key should be set to the dialogue text spoken by that actor. For questions, the objects should have the keys 'question' and 'answers'. The 'question' key should be set to the text of the question being asked. The 'answers' key should be an array of three objects, each representing a different answer to the question where only one is correct and two are incorrect. The objects in the 'answers' array should have the keys 'text', 'correct' and 'type'. The 'text' key should contain the answer text, 'correct' should be true for the correct answer and false for incorrect ones, and 'type' should always be equal to 'multichoice'. The entire output must be in a single JSON array without separating the dialogue and questions into different arrays.`;
164
+ const prompt = usePdfContext ? `Create an informative conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} Return the conversation inside an array that is ${values.roleplayLengthNumber} objects in length , each text in the conversation should be inside an object in the array. Each object should have the keys actor and text. If the text belongs to person 1 then the key actor should equal to 1 else it should equal to 2. The key text should equal to the text in the conversation. Your response should be in JSON.` : `Create a conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""}about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} Return the conversation inside an array that is ${values.roleplayLengthNumber} objects in length , each text in the conversation should be inside an object in the array. Each object should have the keys actor and text. If the text belongs to person 1 then the key actor should equal to 1 else it should equal to 2. The key text should equal to the text in the conversation. Your response should be in JSON`;
165
+ const promptWithQuestions = usePdfContext ? `Create an informative conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""} about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} The conversation should be returned inside a single array that is ${values.roleplayLengthNumber} objects in length along with ${values?.questionsAmount} comprehension questions related to the conversation. Each piece of dialogue and each question should be represented as an object in the array. For dialogue, the objects should have the keys 'actor' and 'text'. The 'actor' key should be set to 1 if the dialogue is spoken by the first actor, and 2 if it is spoken by the second actor. The 'text' key should be set to the dialogue text spoken by that actor. For questions, the objects should have the keys 'question' and 'answers'. The 'question' key should be set to the text of the question being asked. The 'answers' key should be an array of three objects, each representing a different answer to the question where only one is correct and two are incorrect. The objects in the 'answers' array should have the keys 'text', 'correct' and 'type'. The 'text' key should contain the answer text, 'correct' should be true for the correct answer and false for incorrect ones, and 'type' should always be equal to 'multichoice'. The entire output must be in a single JSON array without separating the dialogue and questions into different arrays.` : `Create a conversation between 2 people ${values?.actor1?.name && values?.actor2?.name ? `'${values.actor1.name}' and '${values.actor2.name}' ` : ""}about the topic '${values.roleplayTopic}' in the language ${learnLang}.${values.roleplayDifficulty ? ` The conversation should be ${i18nLanguage === "en-US" ? "ACTFL" : "CEFR"} level '${t(values.roleplayDifficulty)}.'` : ""} The conversation should be returned inside a single array that is ${values.roleplayLengthNumber} objects in length along with ${values?.questionsAmount} comprehension questions related to the conversation. Each piece of dialogue and each question should be represented as an object in the array. For dialogue, the objects should have the keys 'actor' and 'text'. The 'actor' key should be set to 1 if the dialogue is spoken by the first actor, and 2 if it is spoken by the second actor. The 'text' key should be set to the dialogue text spoken by that actor. For questions, the objects should have the keys 'question' and 'answers'. The 'question' key should be set to the text of the question being asked. The 'answers' key should be an array of three objects, each representing a different answer to the question where only one is correct and two are incorrect. The objects in the 'answers' array should have the keys 'text', 'correct' and 'type'. The 'text' key should contain the answer text, 'correct' should be true for the correct answer and false for incorrect ones, and 'type' should always be equal to 'multichoice'. The entire output must be in a single JSON array without separating the dialogue and questions into different arrays.`;
166
166
  const roleplayTemplate = {
167
167
  roleplayId: (0, _utils.randomId)(),
168
168
  roleplayName: values.roleplayTopic,
@@ -194,10 +194,22 @@ function GenerateRoleplayDialog({
194
194
  } = responseObject[responseKey][0];
195
195
  response = (0, _jsonrepair.jsonrepair)(text);
196
196
  } else {
197
- const chatGptResponse = await makeChatGptApiRequest({
197
+ let chatGptResponse = await makeChatGptApiRequest({
198
198
  model: "gpt-3.5-turbo",
199
199
  prompt: activePrompt
200
200
  });
201
+ let isComplete = false;
202
+ while (!isComplete) {
203
+ if (chatGptResponse.endsWith("...") || chatGptResponse.trim().endsWith(",")) {
204
+ const continuationResponse = await makeChatGptApiRequest({
205
+ model: "gpt-3.5-turbo",
206
+ prompt: "Continue: " + chatGptResponse
207
+ });
208
+ chatGptResponse += continuationResponse;
209
+ } else {
210
+ isComplete = true;
211
+ }
212
+ }
201
213
  response = chatGptResponse;
202
214
  }
203
215
  const jsonResponse = removeExtraTextFromChatGptResponse(response);
@@ -249,8 +261,21 @@ function GenerateRoleplayDialog({
249
261
  if (autoSelect) {
250
262
  isSubmitDisabled = !values.roleplayTopic || isRoleplayGenerating;
251
263
  } else {
252
- isSubmitDisabled = !(generatedRoleplay !== [] && !isRoleplayGenerating && previewMessages.length > 1);
264
+ isSubmitDisabled = !(generatedRoleplay.length !== 0 && !isRoleplayGenerating && previewMessages.length > 1);
253
265
  }
266
+ (0, _react.useEffect)(() => {
267
+ if (!generateQuestions) {
268
+ setValues(prevValues => ({
269
+ ...prevValues,
270
+ questionsAmount: 0
271
+ }));
272
+ } else {
273
+ setValues(prevValues => ({
274
+ ...prevValues,
275
+ questionsAmount: prevValues.questionsAmount || Math.floor(prevValues.roleplayLengthNumber / 2)
276
+ }));
277
+ }
278
+ }, [generateQuestions]);
254
279
  return /*#__PURE__*/_react.default.createElement(_ResponsiveDialog.default, {
255
280
  open: isGenerateRoleplayDialogOpen,
256
281
  handleClose: handleCloseDialog,
@@ -317,7 +342,8 @@ function GenerateRoleplayDialog({
317
342
  rows: 3
318
343
  }))), !hideRoleplayDifficultyOptions && !isRoleplayGenerating && /*#__PURE__*/_react.default.createElement(_material.Grid, {
319
344
  item: true,
320
- xs: 12
345
+ xs: 12,
346
+ marginBottom: 1
321
347
  }, /*#__PURE__*/_react.default.createElement(_material.TextField, {
322
348
  select: true,
323
349
  id: "roleplayDifficulty",
@@ -357,15 +383,58 @@ function GenerateRoleplayDialog({
357
383
  margin: "normal",
358
384
  variant: "outlined",
359
385
  fullWidth: true
360
- }, roleplayLengthOptions)), !isRoleplayGenerating && /*#__PURE__*/_react.default.createElement(_material.FormGroup, null, /*#__PURE__*/_react.default.createElement(_material.Grid, {
386
+ }, roleplayLengthOptions)), !isRoleplayGenerating && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Grid, {
361
387
  item: true,
362
388
  xs: 12
389
+ }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
390
+ id: "input-slider",
391
+ gutterBottom: true
392
+ }, t("number_of_interactions") + ": " + values.roleplayLengthNumber), /*#__PURE__*/_react.default.createElement(_material.Slider, {
393
+ "aria-label": "Number of Interactions",
394
+ defaultValue: 8,
395
+ valueLabelDisplay: "auto",
396
+ value: values.roleplayLengthNumber,
397
+ onChange: (e, newValue) => {
398
+ const maxQuestions = Math.floor(newValue / 2);
399
+ setValues(prevValues => ({
400
+ ...prevValues,
401
+ roleplayLengthNumber: newValue,
402
+ questionsAmount: Math.min(prevValues.questionsAmount, maxQuestions)
403
+ }));
404
+ },
405
+ step: 2,
406
+ marks: true,
407
+ min: 4,
408
+ max: 12
409
+ })), /*#__PURE__*/_react.default.createElement(_material.FormGroup, null, /*#__PURE__*/_react.default.createElement(_material.Grid, {
410
+ item: true,
411
+ xs: 12,
412
+ marginBottom: 1
363
413
  }, /*#__PURE__*/_react.default.createElement(_material.FormControlLabel, {
364
414
  control: /*#__PURE__*/_react.default.createElement(_material.Checkbox, {
365
415
  checked: generateQuestions,
366
416
  onChange: e => setGenerateQuestions(e.target.checked)
367
417
  }),
368
418
  label: "Generate Questions"
419
+ }))), generateQuestions && /*#__PURE__*/_react.default.createElement(_material.Grid, {
420
+ item: true,
421
+ xs: 12
422
+ }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
423
+ id: "input-slider",
424
+ gutterBottom: true
425
+ }, t("number_of_questions") + ": " + values.questionsAmount), /*#__PURE__*/_react.default.createElement(_material.Slider, {
426
+ "aria-label": "Number of Questions",
427
+ defaultValue: Math.floor(values?.roleplayLengthNumber / 2),
428
+ valueLabelDisplay: "auto",
429
+ value: values?.questionsAmount,
430
+ onChange: (e, newValue) => setValues({
431
+ ...values,
432
+ questionsAmount: newValue
433
+ }),
434
+ step: 1,
435
+ marks: true,
436
+ min: 1,
437
+ max: Math.floor(values?.roleplayLengthNumber / 2)
369
438
  }))), process.env.REACT_APP_STAGE === "dev" && !isRoleplayGenerating && pdfDetails && pdfVectorStoreCreationStatus === "CREATION_COMPLETE" && /*#__PURE__*/_react.default.createElement(_material.Grid, {
370
439
  item: true,
371
440
  xs: 12
@@ -404,7 +473,7 @@ function GenerateRoleplayDialog({
404
473
  loading: isRoleplayGenerating,
405
474
  loadingPosition: "start",
406
475
  startIcon: /*#__PURE__*/_react.default.createElement(_AutoFixHigh.default, null)
407
- }, t("generate_roleplay"))), !autoSelect && generatedRoleplay !== [] && !isRoleplayGenerating && previewMessages.length > 1 && /*#__PURE__*/_react.default.createElement(_material.Grid, {
476
+ }, t("generate_roleplay"))), !autoSelect && generatedRoleplay.length !== 0 && !isRoleplayGenerating && previewMessages.length > 1 && /*#__PURE__*/_react.default.createElement(_material.Grid, {
408
477
  item: true,
409
478
  xs: 12,
410
479
  mt: 2
@@ -441,6 +510,8 @@ GenerateRoleplayDialog.defaultProps = {
441
510
  initialValues: {
442
511
  roleplayTopic: "",
443
512
  roleplayDifficulty: "",
513
+ roleplayLengthNumber: 8,
514
+ questionsAmount: 0,
444
515
  roleplayLength: "",
445
516
  actor1: {
446
517
  name: "Carla",
@@ -54,13 +54,14 @@ function DotsMobileStepper({
54
54
  }, Math.abs(activeStep - index) <= 2 ? /*#__PURE__*/_react.default.createElement(_material.Box, {
55
55
  component: "img",
56
56
  sx: {
57
- height: 500,
58
57
  display: "block",
59
58
  maxWidth: 720,
60
59
  overflow: "hidden",
61
60
  width: "100%",
62
61
  margin: "auto",
63
- borderRadius: "10px"
62
+ borderRadius: "10px",
63
+ marginTop: 1,
64
+ marginBottom: 1
64
65
  },
65
66
  src: step.imgPath,
66
67
  alt: step.label
@@ -150,8 +151,16 @@ function LiveGameTutorial({
150
151
  handleClose: handleClose,
151
152
  dialogTitle: t(exerciseName),
152
153
  t: t
154
+ }, /*#__PURE__*/_react.default.createElement(_material.Box, {
155
+ sx: {
156
+ display: 'flex',
157
+ justifyContent: 'center',
158
+ alignItems: 'center',
159
+ width: '100%',
160
+ height: '100%'
161
+ }
153
162
  }, /*#__PURE__*/_react.default.createElement(DotsMobileStepper, {
154
163
  images: images,
155
164
  t: t
156
- }));
165
+ })));
157
166
  }
@@ -17,7 +17,8 @@ const useStyles = (0, _mui.makeStyles)()(() => ({
17
17
  function ModeratedDialog({
18
18
  t,
19
19
  open,
20
- handleClose
20
+ handleClose,
21
+ moderationReason
21
22
  }) {
22
23
  const {
23
24
  classes
@@ -27,7 +28,9 @@ function ModeratedDialog({
27
28
  handleClose: handleClose,
28
29
  dialogTitle: t("moderate_title"),
29
30
  className: classes.zIndex
30
- }, /*#__PURE__*/_react.default.createElement(_DialogContentText.default, null, /*#__PURE__*/_react.default.createElement("p", null, t("moderated_image_dialog"))));
31
+ }, /*#__PURE__*/_react.default.createElement(_DialogContentText.default, null, /*#__PURE__*/_react.default.createElement("p", null, t("moderated_image_dialog")), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("p", null, t("moderation_reason", {
32
+ moderationReason: moderationReason
33
+ }))));
31
34
  }
32
35
  ModeratedDialog.defaultProps = {
33
36
  t: text => text
@@ -25,6 +25,8 @@ function ReportProblem({
25
25
  open,
26
26
  handleClose,
27
27
  handleReportProblem,
28
+ currentPhrase,
29
+ isQuestion,
28
30
  ...otherProps
29
31
  }) {
30
32
  const [problem, setProblem] = (0, _react.useState)(initialProblem);
@@ -45,7 +47,9 @@ function ReportProblem({
45
47
  } = event.target;
46
48
  setProblem(prevProblem => ({
47
49
  ...prevProblem,
48
- [name]: value
50
+ [name]: value,
51
+ currentPhrase: currentPhrase,
52
+ isQuestion: isQuestion ? isQuestion : false
49
53
  }));
50
54
  };
51
55
  const problemTypes = [{
@@ -632,7 +632,7 @@ function Roleplay({
632
632
  run,
633
633
  steps
634
634
  } = joyrideState;
635
- const topBarActions = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, subscription?.isPaidUser && /*#__PURE__*/_react.default.createElement(_material.Button, {
635
+ const topBarActions = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, null, subscription?.isPaidUser && /*#__PURE__*/_react.default.createElement(_material.Button, {
636
636
  sx: {
637
637
  marginRight: 1
638
638
  },
@@ -656,7 +656,7 @@ function Roleplay({
656
656
  open: uploadRoleplayScript,
657
657
  handleClose: () => setUploadRoleplayScript(false),
658
658
  onSubmit: onSubmit
659
- }));
659
+ })));
660
660
  return /*#__PURE__*/_react.default.createElement(_material.Dialog, {
661
661
  fullScreen: true,
662
662
  open: open,
@@ -838,6 +838,8 @@ function Roleplay({
838
838
  roleplayTopic: roleplay.roleplayName,
839
839
  roleplayDifficulty: roleplay.difficulty,
840
840
  roleplayLength: "",
841
+ questionsAmount: 0,
842
+ roleplayLengthNumber: 8,
841
843
  actor1: roleplay.actor1,
842
844
  actor2: roleplay.actor2
843
845
  },
@@ -212,6 +212,7 @@ function Bot({
212
212
  isSpeaking,
213
213
  isSpeakingTextContainer
214
214
  } = exerciseState;
215
+ const currentPhrase = botMessages.length > 0 ? botMessages[botMessages.length - 1].text : "N/A";
215
216
  const joyrideSteps = [{
216
217
  content: /*#__PURE__*/_react.default.createElement("h2", null, t("bot_exercise_welcome")),
217
218
  placement: "center",
@@ -375,7 +376,8 @@ function Bot({
375
376
  isReportProblemOpen: isReportProblemOpen,
376
377
  handleOpenReportProblem: handleOpenReportProblem,
377
378
  handleCloseReportProblem: handleCloseReportProblem,
378
- handleReportProblem: handleReportProblem
379
+ handleReportProblem: handleReportProblem,
380
+ currentPhrase: currentPhrase
379
381
  }));
380
382
  const beforeElements = /*#__PURE__*/_react.default.createElement(_material.Box, {
381
383
  mb: 2
@@ -549,7 +549,8 @@ function Listener({
549
549
  isReportProblemOpen: isReportProblemOpen,
550
550
  handleOpenReportProblem: handleOpenReportProblem,
551
551
  handleCloseReportProblem: handleCloseReportProblem,
552
- handleReportProblem: handleReportProblem
552
+ handleReportProblem: handleReportProblem,
553
+ currentPhrase: currentPhrase
553
554
  })), /*#__PURE__*/_react.default.createElement(_material.Toolbar, {
554
555
  variant: "dense",
555
556
  className: classes.mobileAdditionalToolbar
@@ -488,7 +488,8 @@ function Pronouncer({
488
488
  isReportProblemOpen: isReportProblemOpen,
489
489
  handleOpenReportProblem: handleOpenReportProblem,
490
490
  handleCloseReportProblem: handleCloseReportProblem,
491
- handleReportProblem: handleReportProblem
491
+ handleReportProblem: handleReportProblem,
492
+ currentPhrase: currentPhrase
492
493
  })), /*#__PURE__*/_react.default.createElement(_material.Toolbar, {
493
494
  variant: "dense",
494
495
  className: classes.mobileAdditionalToolbar
@@ -127,7 +127,8 @@ function OverflowMenu({
127
127
  handleCloseReportProblem,
128
128
  handleReportProblem,
129
129
  handleRestart,
130
- setRestartRoleplayDialog
130
+ setRestartRoleplayDialog,
131
+ currentMessages
131
132
  }) {
132
133
  const {
133
134
  classes
@@ -139,6 +140,8 @@ function OverflowMenu({
139
140
  const handleCloseMenu = () => {
140
141
  setAnchorEl(null);
141
142
  };
143
+ const currentPhrase = currentMessages.length > 0 ? currentMessages[currentMessages.length - 1].text ? currentMessages[currentMessages.length - 1].text : currentMessages[currentMessages.length - 1].question : "N/A";
144
+ const isQuestion = currentMessages.length > 0 && currentMessages[currentMessages.length - 1].hasOwnProperty("question");
142
145
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
143
146
  title: t("more_options")
144
147
  }, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
@@ -183,7 +186,9 @@ function OverflowMenu({
183
186
  handleCloseReportProblem: handleCloseReportProblem,
184
187
  handleReportProblem: handleReportProblem,
185
188
  mode: "menuitem",
186
- menuIconClassname: classes.menuIcon
189
+ menuIconClassname: classes.menuIcon,
190
+ currentPhrase: currentPhrase,
191
+ isQuestion: isQuestion
187
192
  })));
188
193
  }
189
194
  const TopBarActions = ({
@@ -212,6 +217,8 @@ const TopBarActions = ({
212
217
  const {
213
218
  classes
214
219
  } = useStyles();
220
+ const currentPhrase = currentMessages.length > 0 ? currentMessages[currentMessages.length - 1].text ? currentMessages[currentMessages.length - 1].text : currentMessages[currentMessages.length - 1].question : "N/A";
221
+ const isQuestion = currentMessages.length > 0 && currentMessages[currentMessages.length - 1].hasOwnProperty("question");
215
222
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, roleplayHasStarted || isRoleplayPreview ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !isRoleplayPreview && /*#__PURE__*/_react.default.createElement("div", {
216
223
  className: classes.progress
217
224
  }, /*#__PURE__*/_react.default.createElement(RoundedLinearProgress, {
@@ -253,7 +260,9 @@ const TopBarActions = ({
253
260
  isReportProblemOpen: isReportProblemOpen,
254
261
  handleOpenReportProblem: handleOpenReportProblem,
255
262
  handleCloseReportProblem: handleCloseReportProblem,
256
- handleReportProblem: handleReportProblem
263
+ handleReportProblem: handleReportProblem,
264
+ currentPhrase: currentPhrase,
265
+ isQuestion: isQuestion
257
266
  })), /*#__PURE__*/_react.default.createElement(_material.Hidden, {
258
267
  smUp: true
259
268
  }, /*#__PURE__*/_react.default.createElement(_VoiceSpeed.default, {
@@ -272,7 +281,8 @@ const TopBarActions = ({
272
281
  isReportProblemOpen: isReportProblemOpen,
273
282
  handleOpenReportProblem: handleOpenReportProblem,
274
283
  handleCloseReportProblem: handleCloseReportProblem,
275
- handleReportProblem: handleReportProblem
284
+ handleReportProblem: handleReportProblem,
285
+ currentMessages: currentMessages
276
286
  }))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, handleShareRoleplay && /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
277
287
  title: t("share")
278
288
  }, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
@@ -543,7 +543,8 @@ function Translator({
543
543
  isReportProblemOpen: isReportProblemOpen,
544
544
  handleOpenReportProblem: handleOpenReportProblem,
545
545
  handleCloseReportProblem: handleCloseReportProblem,
546
- handleReportProblem: handleReportProblem
546
+ handleReportProblem: handleReportProblem,
547
+ currentPhrase: currentPhrase
547
548
  })), /*#__PURE__*/_react.default.createElement(_material.Toolbar, {
548
549
  variant: "dense",
549
550
  className: classes.mobileAdditionalToolbar
@@ -127,19 +127,11 @@ function VideoUploader({
127
127
  isDragAccept,
128
128
  isDragReject
129
129
  });
130
- const inputRef = _react.default.useRef();
131
- const handleFileChange = event => {
132
- const file = event.target.files[0];
133
- const url = URL.createObjectURL(file);
134
- setFile(url);
135
- };
136
130
  return /*#__PURE__*/_react.default.createElement("section", {
137
131
  className: "container"
138
132
  }, !file && /*#__PURE__*/_react.default.createElement("div", getRootProps({
139
133
  className: classes.dropzoneContainer
140
134
  }), /*#__PURE__*/_react.default.createElement("input", _extends({}, getInputProps(), {
141
- onChange: handleFileChange,
142
- ref: inputRef,
143
135
  accept: ".mov,.mp4"
144
136
  })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("img", {
145
137
  className: classes.selectFileImage,
@@ -11,7 +11,7 @@ var _CourseOutline = _interopRequireDefault(require("./CourseOutline"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  const Template = args => /*#__PURE__*/_react.default.createElement(_CourseOutline.default, args);
13
13
  const props = exports.props = {
14
- isMember: false,
14
+ isMember: true,
15
15
  isCreator: false,
16
16
  courseId: "123",
17
17
  sections: _Course.props.course.sections,
@@ -20,13 +20,17 @@ function ReportProblem({
20
20
  handleReportProblem,
21
21
  edge,
22
22
  mode,
23
- menuIconClassname
23
+ menuIconClassname,
24
+ currentPhrase,
25
+ isQuestion
24
26
  }) {
25
27
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ReportProblem.default, {
26
28
  t: t,
27
29
  open: isReportProblemOpen,
28
30
  handleClose: handleCloseReportProblem,
29
- handleReportProblem: handleReportProblem
31
+ handleReportProblem: handleReportProblem,
32
+ currentPhrase: currentPhrase,
33
+ isQuestion: isQuestion
30
34
  }), mode === "icon" && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
31
35
  title: t("report_problem")
32
36
  }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
@@ -312,6 +312,7 @@ function Course({
312
312
  setIsSubmitting(false);
313
313
  console.error(error);
314
314
  }
315
+ handleCloseMenu();
315
316
  };
316
317
  const handleCLickOpenUpload = () => {
317
318
  setIsUploadPdfOpen(true);
@@ -48,8 +48,6 @@ const useStyles = (0, _mui.makeStyles)()(theme => ({
48
48
  }));
49
49
  function Dashboard({
50
50
  t,
51
- learnCourses = [],
52
- teachCourses = [],
53
51
  completions = [],
54
52
  avatars = [],
55
53
  newRoleplays = [],
@@ -62,11 +60,12 @@ function Dashboard({
62
60
  handlePlayRoleplay,
63
61
  newCourses = [],
64
62
  recommendedCourses = [],
65
- isMyCoursesLoading,
63
+ popularCourses = [],
66
64
  isNewCoursesLoading,
67
65
  isRecommendedCoursesLoading,
68
66
  isNewRoleplaysLoading,
69
67
  isNewBotsLoading,
68
+ isPopularCoursesLoading,
70
69
  handleDuplicateBot,
71
70
  handleDuplicateRoleplay,
72
71
  singleLineGrid = true,
@@ -175,7 +174,7 @@ function Dashboard({
175
174
  }, /*#__PURE__*/_react.default.createElement(_material.ListItemIcon, null, /*#__PURE__*/_react.default.createElement(_Face.default, null)), t("bot")), /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
176
175
  onClick: handleCreateCourse,
177
176
  role: "link"
178
- }, /*#__PURE__*/_react.default.createElement(_material.ListItemIcon, null, /*#__PURE__*/_react.default.createElement(_BubbleChart.default, null)), t("course")))))), isMyCoursesLoading || learnCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
177
+ }, /*#__PURE__*/_react.default.createElement(_material.ListItemIcon, null, /*#__PURE__*/_react.default.createElement(_BubbleChart.default, null)), t("course")))))), isPopularCoursesLoading || popularCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
179
178
  pb: 2
180
179
  }, /*#__PURE__*/_react.default.createElement("div", {
181
180
  className: classes.header
@@ -184,7 +183,7 @@ function Dashboard({
184
183
  }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
185
184
  variant: "h5",
186
185
  component: "h2"
187
- }, learnCourses.length > 0 ? t("continue_learning") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
186
+ }, popularCourses.length > 0 ? t("popular_courses") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
188
187
  variant: "rectangular",
189
188
  height: 32,
190
189
  width: 250
@@ -210,14 +209,14 @@ function Dashboard({
210
209
  t: t,
211
210
  reviewPlaceholderImageUrl: reviewPlaceholderImageUrl,
212
211
  memberPlaceholderImageUrl: memberPlaceholderImageUrl,
213
- courses: Array.isArray(learnCourses) && learnCourses.length ? learnCourses : null,
212
+ courses: Array.isArray(popularCourses) && popularCourses.length ? popularCourses : null,
214
213
  completions: completions,
215
214
  handleStartCourse: handleStartCourse,
216
215
  handleLeaveCourse: handleLeaveCourse,
216
+ handleViewCourseTopic: handleViewCourseTopic,
217
217
  handleViewCourse: handleViewCourse,
218
218
  handleViewUserProfile: handleViewUserProfile,
219
219
  membersProps: membersProps,
220
- handleViewCourseTopic: handleViewCourseTopic,
221
220
  getMemberDetails: getMemberDetails,
222
221
  getMemberInfo: getMemberInfo,
223
222
  getUserReviews: getUserReviews,
@@ -230,11 +229,10 @@ function Dashboard({
230
229
  getCourseMembers: getCourseMembers,
231
230
  memberId: memberId,
232
231
  username: username,
233
- handleDuplicateCourse: handleDuplicateCourse,
234
- ariaText: "Continue learning "
232
+ handleDuplicateCourse: handleDuplicateCourse
235
233
  })), /*#__PURE__*/_react.default.createElement(_material.Box, {
236
234
  pb: 2
237
- }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null, isMyCoursesLoading || teachCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
235
+ }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null, isRecommendedCoursesLoading || recommendedCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
238
236
  pb: 2
239
237
  }, /*#__PURE__*/_react.default.createElement("div", {
240
238
  className: classes.header
@@ -243,7 +241,7 @@ function Dashboard({
243
241
  }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
244
242
  variant: "h5",
245
243
  component: "h2"
246
- }, teachCourses.length > 0 ? t("continue_teaching") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
244
+ }, recommendedCourses.length > 0 ? t("recommended_courses") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
247
245
  variant: "rectangular",
248
246
  height: 32,
249
247
  width: 250
@@ -269,7 +267,7 @@ function Dashboard({
269
267
  t: t,
270
268
  reviewPlaceholderImageUrl: reviewPlaceholderImageUrl,
271
269
  memberPlaceholderImageUrl: memberPlaceholderImageUrl,
272
- courses: Array.isArray(teachCourses) && teachCourses.length ? teachCourses : null,
270
+ courses: Array.isArray(recommendedCourses) && recommendedCourses.length ? recommendedCourses : null,
273
271
  completions: completions,
274
272
  handleStartCourse: handleStartCourse,
275
273
  handleLeaveCourse: handleLeaveCourse,
@@ -289,11 +287,10 @@ function Dashboard({
289
287
  getCourseMembers: getCourseMembers,
290
288
  memberId: memberId,
291
289
  username: username,
292
- handleDuplicateCourse: handleDuplicateCourse,
293
- ariaText: "Continue teaching "
290
+ handleDuplicateCourse: handleDuplicateCourse
294
291
  })), /*#__PURE__*/_react.default.createElement(_material.Box, {
295
292
  pb: 2
296
- }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null, isRecommendedCoursesLoading || recommendedCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
293
+ }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null, isNewCoursesLoading || newCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
297
294
  pb: 2
298
295
  }, /*#__PURE__*/_react.default.createElement("div", {
299
296
  className: classes.header
@@ -302,7 +299,7 @@ function Dashboard({
302
299
  }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
303
300
  variant: "h5",
304
301
  component: "h2"
305
- }, newCourses.length > 0 ? t("recommended_courses") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
302
+ }, newCourses.length > 0 ? t("new_courses") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
306
303
  variant: "rectangular",
307
304
  height: 32,
308
305
  width: 250
@@ -328,7 +325,7 @@ function Dashboard({
328
325
  t: t,
329
326
  reviewPlaceholderImageUrl: reviewPlaceholderImageUrl,
330
327
  memberPlaceholderImageUrl: memberPlaceholderImageUrl,
331
- courses: Array.isArray(recommendedCourses) && recommendedCourses.length ? recommendedCourses : null,
328
+ courses: Array.isArray(newCourses) && newCourses.length ? newCourses : null,
332
329
  completions: completions,
333
330
  handleStartCourse: handleStartCourse,
334
331
  handleLeaveCourse: handleLeaveCourse,
@@ -444,64 +441,6 @@ function Dashboard({
444
441
  disablePreview: true
445
442
  })), /*#__PURE__*/_react.default.createElement(_material.Box, {
446
443
  pb: 2
447
- }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null, isNewCoursesLoading || newCourses.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
448
- pb: 2
449
- }, /*#__PURE__*/_react.default.createElement("div", {
450
- className: classes.header
451
- }, /*#__PURE__*/_react.default.createElement("div", {
452
- className: classes.headerText
453
- }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
454
- variant: "h5",
455
- component: "h2"
456
- }, newCourses.length > 0 ? t("new_courses") : /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
457
- variant: "rectangular",
458
- height: 32,
459
- width: 250
460
- }))), /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
461
- title: t("find_course")
462
- }, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
463
- onClick: handleSearchCourses,
464
- "aria-label": t("find_course"),
465
- color: "inherit",
466
- "data-cy": "search-course-fab",
467
- size: "large",
468
- role: "link"
469
- }, /*#__PURE__*/_react.default.createElement(_Search.default, null))), /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
470
- title: t("create_course")
471
- }, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
472
- onClick: handleCreateCourse,
473
- "aria-label": t("create_course"),
474
- color: "inherit",
475
- "data-cy": "add-course-fab",
476
- size: "large",
477
- role: "link"
478
- }, /*#__PURE__*/_react.default.createElement(_Add.default, null)))), /*#__PURE__*/_react.default.createElement(_Courses.default, {
479
- t: t,
480
- reviewPlaceholderImageUrl: reviewPlaceholderImageUrl,
481
- memberPlaceholderImageUrl: memberPlaceholderImageUrl,
482
- courses: Array.isArray(newCourses) && newCourses.length ? newCourses : null,
483
- completions: completions,
484
- handleStartCourse: handleStartCourse,
485
- handleLeaveCourse: handleLeaveCourse,
486
- handleViewCourseTopic: handleViewCourseTopic,
487
- handleViewCourse: handleViewCourse,
488
- handleViewUserProfile: handleViewUserProfile,
489
- membersProps: membersProps,
490
- getMemberDetails: getMemberDetails,
491
- getMemberInfo: getMemberInfo,
492
- getUserReviews: getUserReviews,
493
- avatars: avatars,
494
- singleLineGrid: singleLineGrid,
495
- singleLineGridCols: singleLineGridCols,
496
- getCourseSections: getCourseSections,
497
- getCourseReviews: getCourseReviews,
498
- getCourseMember: getCourseMember,
499
- getCourseMembers: getCourseMembers,
500
- memberId: memberId,
501
- username: username,
502
- handleDuplicateCourse: handleDuplicateCourse
503
- })), /*#__PURE__*/_react.default.createElement(_material.Box, {
504
- pb: 2
505
444
  }, /*#__PURE__*/_react.default.createElement(_material.Divider, null))) : null);
506
445
  }
507
446
  Dashboard.defaultProps = {
@@ -79,8 +79,9 @@ Loading.storyName = "loading";
79
79
  const Loaded = exports.Loaded = Template.bind({});
80
80
  Loaded.args = {
81
81
  ...props,
82
- learnCourses: _Courses.courses,
83
- teachCourses: _Courses.courses,
82
+ popularCourses: _Courses.courses,
83
+ recommendedCourses: _Courses.courses,
84
+ newCourses: _Courses.courses,
84
85
  newRoleplays: _Roleplays.roleplays,
85
86
  newBots: _Bots.bots
86
87
  };