@nualang/nualang-ui-components 0.1.1353 → 0.1.1354
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.
- package/dist/Dialogs/CreatePhrase/CreatePhrase.js +43 -0
- package/dist/Dialogs/GroupedFeedbackDialog/GroupedFeedbackDialog.js +146 -47
- package/dist/Dialogs/GroupedFeedbackDialog/package.json +6 -0
- package/dist/Editors/PhraseList/PhraseList.js +38 -34
- package/dist/Editors/Phrases/Phrases.js +18 -10
- package/dist/Exercises/Meaning/Meaning.js +788 -0
- package/dist/Exercises/PhraseGroup/Games/MeaningGame/MeaningGame.js +86 -0
- package/dist/Exercises/PhraseGroup/Games/index.js +2 -1
- package/dist/Exercises/PhraseGroup/PhraseGroup.js +4 -3
- package/dist/Exercises/Roleplay/Roleplay.js +2 -1
- package/dist/Exercises/Roleplay/RoleplayGameOptions/RoleplayGames.js +11 -4
- package/dist/Forms/CreateRoleplay/Steps/RoleplaySettings/RoleplaySettings.js +5 -2
- package/dist/Forms/UpdatePhraseList/UpdatePhraseList.js +8 -0
- package/dist/Forms/UpdateRoleplay/UpdateRoleplay.js +2 -1
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +2 -2
- package/dist/Screens/Courses/ViewCourse/ViewTopic/ViewTopic.js +94 -104
- package/dist/hooks/useExerciseState.js +24 -4
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ function CreatePhrase({
|
|
|
56
56
|
validatePhraseRecognition,
|
|
57
57
|
verificationStatus,
|
|
58
58
|
makeChatGptApiRequest,
|
|
59
|
+
difficulty,
|
|
59
60
|
...otherProps
|
|
60
61
|
}) {
|
|
61
62
|
const translationInputRef = useRef();
|
|
@@ -78,6 +79,7 @@ function CreatePhrase({
|
|
|
78
79
|
const [definition, setDefinition] = useState("");
|
|
79
80
|
const [definitionList, setDefinitionList] = useState(otherProps.definitions || []);
|
|
80
81
|
const [autoTranslatedText, setAutoTranslatedText] = useState(false);
|
|
82
|
+
const [autoGeneratedDefinitions, setAutoGeneratedDefinitions] = useState(false);
|
|
81
83
|
const [checkingRecogniton, setCheckingRecogniton] = useState(false);
|
|
82
84
|
const [recognised, setRecognised] = useState(false);
|
|
83
85
|
const [notRecognised, setNotRecognised] = useState(false);
|
|
@@ -287,6 +289,39 @@ function CreatePhrase({
|
|
|
287
289
|
setIsSubmitting(false);
|
|
288
290
|
}
|
|
289
291
|
};
|
|
292
|
+
const generateDefinitions = async () => {
|
|
293
|
+
try {
|
|
294
|
+
setIsSubmitting(true);
|
|
295
|
+
let chatGptResponse = await makeChatGptApiRequest({
|
|
296
|
+
model: "gpt-4o",
|
|
297
|
+
promptKey: "generateDefinitions",
|
|
298
|
+
promptVariables: {
|
|
299
|
+
learnLang,
|
|
300
|
+
forLang,
|
|
301
|
+
siteLanguage,
|
|
302
|
+
difficulty,
|
|
303
|
+
phrases: [{
|
|
304
|
+
phrase,
|
|
305
|
+
translations: translationList
|
|
306
|
+
}],
|
|
307
|
+
generateDefinitions: true
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
const definitions = chatGptResponse?.result?.[0]?.definitions;
|
|
311
|
+
if (!validateResponse(definitions)) {
|
|
312
|
+
throw new Error("Invalid AI response");
|
|
313
|
+
}
|
|
314
|
+
setAutoGeneratedDefinitions(definitions[0]);
|
|
315
|
+
setDefinitionList(prevDefinitionList => {
|
|
316
|
+
const newDefinitions = definitions.filter(text => !prevDefinitionList.includes(text));
|
|
317
|
+
return [...prevDefinitionList, ...newDefinitions];
|
|
318
|
+
});
|
|
319
|
+
} catch (error) {
|
|
320
|
+
console.error("Error fetching definitions from OpenAI:", error.message);
|
|
321
|
+
} finally {
|
|
322
|
+
setIsSubmitting(false);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
290
325
|
const handleEditTranslation = (event, index) => {
|
|
291
326
|
const {
|
|
292
327
|
target: {
|
|
@@ -320,6 +355,7 @@ function CreatePhrase({
|
|
|
320
355
|
setDefinitionList([]);
|
|
321
356
|
setSelectedImage(initialSelectedImagestate);
|
|
322
357
|
setAutoTranslatedText("");
|
|
358
|
+
setAutoGeneratedDefinitions("");
|
|
323
359
|
};
|
|
324
360
|
const removePhraseImage = () => {
|
|
325
361
|
setSelectedImage({
|
|
@@ -495,6 +531,13 @@ function CreatePhrase({
|
|
|
495
531
|
className: classes.alternativeVersionButton,
|
|
496
532
|
startIcon: /*#__PURE__*/_jsx(AutoFixHighIcon, {}),
|
|
497
533
|
children: t("auto_generate_phrase_translation")
|
|
534
|
+
}), learnLang !== forLang && /*#__PURE__*/_jsx(DefaultButton, {
|
|
535
|
+
onClick: generateDefinitions,
|
|
536
|
+
disabled: !phrase || Array.isArray(definitionList) && definitionList.includes(autoGeneratedDefinitions),
|
|
537
|
+
size: "sm",
|
|
538
|
+
className: classes.alternativeVersionButton,
|
|
539
|
+
startIcon: /*#__PURE__*/_jsx(AutoFixHighIcon, {}),
|
|
540
|
+
children: t("auto_generate_definitions")
|
|
498
541
|
}), learnLang !== forLang && (import.meta.env.REACT_APP_STAGE === "dev" || window.location.host === "localhost:9009") && /*#__PURE__*/_jsx(Box, {
|
|
499
542
|
sx: {
|
|
500
543
|
display: "inline-flex",
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { useMemo, useEffect, useState, useRef, useCallback } from "react";
|
|
2
|
-
import { Dialog, DialogContent, IconButton, Box, Typography, AppBar, Toolbar, CircularProgress, Button, Checkbox, Paper, Divider, Tooltip, Skeleton, Grid } from "@mui/material";
|
|
2
|
+
import { Dialog, DialogContent, IconButton, Box, Typography, AppBar, Toolbar, CircularProgress, Button, Checkbox, Paper, Divider, Tooltip, Skeleton, Grid, TextField, LinearProgress, Alert } from "@mui/material";
|
|
3
|
+
import { Link } from "react-router";
|
|
4
|
+
import MuiLink from "@mui/material/Link";
|
|
3
5
|
import CloseIcon from "@mui/icons-material/Close";
|
|
4
6
|
import { red, orange, green, grey } from "@mui/material/colors";
|
|
5
7
|
import FeedbackCard from "../../Cards/FeedbackCard/FeedbackCard";
|
|
6
8
|
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
|
|
7
9
|
import NualaHeadphonesBackground from "../../img/NualaHeadphonesBackground.svg";
|
|
8
10
|
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
11
|
+
import { AutoFixHigh } from "@mui/icons-material";
|
|
9
12
|
import useConfirm from "../../hooks/useConfirm";
|
|
10
13
|
import NualaCreating from "../../Misc/NualaCreating/NualaCreating";
|
|
14
|
+
import ResponsiveDialog from "../ResponsiveDialog/ResponsiveDialog";
|
|
15
|
+
import PDFViewer from "../PDFViewer/PDFViewer";
|
|
16
|
+
import level1Rubric from "../PDFViewer/rubrics/level1Rubric.pdf";
|
|
17
|
+
import level2Rubric from "../PDFViewer/rubrics/level2Rubric.pdf";
|
|
18
|
+
import level3Rubric from "../PDFViewer/rubrics/level3Rubric.pdf";
|
|
19
|
+
import level4Rubric from "../PDFViewer/rubrics/level4Rubric.pdf";
|
|
11
20
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
21
|
export default function GroupFeedbackDialog({
|
|
13
22
|
open = false,
|
|
@@ -44,7 +53,20 @@ export default function GroupFeedbackDialog({
|
|
|
44
53
|
const [hasReachedBottom, setHasReachedBottom] = useState(false);
|
|
45
54
|
const [isGeneratingAll, setIsGeneratingAll] = useState(false);
|
|
46
55
|
const [isGeneratingIndividual, setIsGeneratingIndividual] = useState(false);
|
|
56
|
+
const [customFeedbackOpen, setCustomFeedbackOpen] = useState(false);
|
|
57
|
+
const [customFeedbackText, setCustomFeedbackText] = useState("");
|
|
58
|
+
const [openPDF, setOpenPDF] = useState(false);
|
|
59
|
+
const [pageNumber, setPageNumber] = useState(1);
|
|
60
|
+
const [scale, setScale] = useState(1);
|
|
47
61
|
const isAnyGenerating = isGeneratingAll || isGeneratingIndividual;
|
|
62
|
+
const pendingGenerateRef = useRef(null);
|
|
63
|
+
const rubricMap = {
|
|
64
|
+
1: level1Rubric,
|
|
65
|
+
2: level2Rubric,
|
|
66
|
+
3: level3Rubric,
|
|
67
|
+
4: level4Rubric
|
|
68
|
+
};
|
|
69
|
+
const pdfUrl = rubricMap[selectedRecording?.level] || level1Rubric;
|
|
48
70
|
const [confirm] = useConfirm(t);
|
|
49
71
|
const bottomRefCallback = useCallback(node => {
|
|
50
72
|
if (node) {
|
|
@@ -59,6 +81,12 @@ export default function GroupFeedbackDialog({
|
|
|
59
81
|
node._observer = observer;
|
|
60
82
|
}
|
|
61
83
|
}, []);
|
|
84
|
+
const handleOpenPDF = () => {
|
|
85
|
+
setOpenPDF(true);
|
|
86
|
+
};
|
|
87
|
+
const handleClosePDF = () => {
|
|
88
|
+
setOpenPDF(false);
|
|
89
|
+
};
|
|
62
90
|
useEffect(() => {
|
|
63
91
|
// dialog is shared between discussions, so reset when teacher selects another discussion
|
|
64
92
|
setGenerateAllUsed(false);
|
|
@@ -69,7 +97,42 @@ export default function GroupFeedbackDialog({
|
|
|
69
97
|
setCanSubmit({});
|
|
70
98
|
setHasReachedBottom(false);
|
|
71
99
|
setIsGeneratingAll(false);
|
|
100
|
+
pendingGenerateRef.current = null;
|
|
72
101
|
}, [groupedId]);
|
|
102
|
+
const openCustomPromptForAll = () => {
|
|
103
|
+
pendingGenerateRef.current = {
|
|
104
|
+
type: "all"
|
|
105
|
+
};
|
|
106
|
+
setCustomFeedbackText("");
|
|
107
|
+
setCustomFeedbackOpen(true);
|
|
108
|
+
};
|
|
109
|
+
const openCustomPromptForSingle = discussionData => {
|
|
110
|
+
pendingGenerateRef.current = {
|
|
111
|
+
type: "single",
|
|
112
|
+
payload: discussionData
|
|
113
|
+
};
|
|
114
|
+
setCustomFeedbackText("");
|
|
115
|
+
setCustomFeedbackOpen(true);
|
|
116
|
+
};
|
|
117
|
+
const handleCustomPromptCancel = () => {
|
|
118
|
+
setCustomFeedbackOpen(false);
|
|
119
|
+
pendingGenerateRef.current = null;
|
|
120
|
+
setCustomFeedbackText("");
|
|
121
|
+
};
|
|
122
|
+
const handleCustomPromptContinue = async () => {
|
|
123
|
+
try {
|
|
124
|
+
const pending = pendingGenerateRef.current;
|
|
125
|
+
pendingGenerateRef.current = null;
|
|
126
|
+
if (!pending) return;
|
|
127
|
+
if (pending.type === "all") {
|
|
128
|
+
await handleGenerateFeedbackForAll();
|
|
129
|
+
} else if (pending.type === "single") {
|
|
130
|
+
await handleGenerateFeedback(pending.payload);
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
setCustomFeedbackOpen(false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
73
136
|
useEffect(() => {
|
|
74
137
|
if (pendingSubmissions === 0 && submitTrigger !== null) {
|
|
75
138
|
setCheckedSubmissions({});
|
|
@@ -137,7 +200,9 @@ export default function GroupFeedbackDialog({
|
|
|
137
200
|
}).filter(member => member.name !== "Unknown");
|
|
138
201
|
};
|
|
139
202
|
const handleGenerateFeedback = async discussionData => {
|
|
140
|
-
if (handleBatchGradeConversations)
|
|
203
|
+
if (!handleBatchGradeConversations) return;
|
|
204
|
+
setIsGeneratingIndividual(true);
|
|
205
|
+
try {
|
|
141
206
|
const joinedMembersWithNames = getJoinedMembersNames(discussionData.joinedMembers || [], userData);
|
|
142
207
|
await handleBatchGradeConversations([{
|
|
143
208
|
meetingId: discussionData.meetingId || discussionData.meetingID,
|
|
@@ -148,8 +213,11 @@ export default function GroupFeedbackDialog({
|
|
|
148
213
|
meetingPrompt: discussionData.meetingPrompt,
|
|
149
214
|
learnLang: learnLang,
|
|
150
215
|
joinedMembers: discussionData.joinedMembers || [],
|
|
151
|
-
joinedMembersNames: joinedMembersWithNames
|
|
216
|
+
joinedMembersNames: joinedMembersWithNames,
|
|
217
|
+
customFeedback: customFeedbackText
|
|
152
218
|
}]);
|
|
219
|
+
} finally {
|
|
220
|
+
setIsGeneratingIndividual(false);
|
|
153
221
|
}
|
|
154
222
|
};
|
|
155
223
|
const handleGenerateFeedbackForAll = async () => {
|
|
@@ -171,7 +239,8 @@ export default function GroupFeedbackDialog({
|
|
|
171
239
|
meetingPrompt: discussion.meetingPrompt || submissionForThisDiscussion.meetingPrompt,
|
|
172
240
|
learnLang: learnLang,
|
|
173
241
|
joinedMembers: submissionForThisDiscussion.joinedMembers || [],
|
|
174
|
-
joinedMembersNames: joinedMembersWithNames
|
|
242
|
+
joinedMembersNames: joinedMembersWithNames,
|
|
243
|
+
customFeedback: customFeedbackText
|
|
175
244
|
};
|
|
176
245
|
});
|
|
177
246
|
if (conversationsToGrade.length > 0 && handleBatchGradeConversations) {
|
|
@@ -478,7 +547,7 @@ export default function GroupFeedbackDialog({
|
|
|
478
547
|
color: "secondary",
|
|
479
548
|
endIcon: /*#__PURE__*/_jsx(AutoFixHighIcon, {}),
|
|
480
549
|
disabled: selectedCount === 0 || isGeneratingAll,
|
|
481
|
-
onClick:
|
|
550
|
+
onClick: openCustomPromptForAll,
|
|
482
551
|
sx: {
|
|
483
552
|
fontWeight: 600
|
|
484
553
|
},
|
|
@@ -528,7 +597,7 @@ export default function GroupFeedbackDialog({
|
|
|
528
597
|
hasSubmission: hasSubmission,
|
|
529
598
|
aiGrade: aiGrade[discussionData.meetingId || discussionData.meetingID] || {},
|
|
530
599
|
existingFeedback: feedbackByMeetingId[feedbackMeetingId] || {},
|
|
531
|
-
onGenerateFeedback: () =>
|
|
600
|
+
onGenerateFeedback: () => openCustomPromptForSingle(discussionData),
|
|
532
601
|
onSubmitFeedback: handleSubmitFeedback,
|
|
533
602
|
setSelectedRecording: setSelectedRecording,
|
|
534
603
|
selectedRecording: selectedRecording,
|
|
@@ -556,53 +625,83 @@ export default function GroupFeedbackDialog({
|
|
|
556
625
|
})]
|
|
557
626
|
})
|
|
558
627
|
})]
|
|
559
|
-
}), /*#__PURE__*/_jsx(
|
|
560
|
-
open:
|
|
628
|
+
}), /*#__PURE__*/_jsx(ResponsiveDialog, {
|
|
629
|
+
open: customFeedbackOpen,
|
|
630
|
+
handleClose: handleCustomPromptCancel,
|
|
631
|
+
handleSubmit: handleCustomPromptContinue,
|
|
632
|
+
submitText: t("generate_feedback"),
|
|
561
633
|
maxWidth: "sm",
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
634
|
+
dialogTitle: isAnyGenerating ? t("generating_feedback") : t("generate_feedback"),
|
|
635
|
+
isSubmitDisabled: isAnyGenerating,
|
|
636
|
+
isExperimentalFeature: true,
|
|
637
|
+
startIcon: /*#__PURE__*/_jsx(AutoFixHigh, {}),
|
|
638
|
+
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
639
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
640
|
+
textAlign: "center",
|
|
641
|
+
sx: {
|
|
642
|
+
...(!isAnyGenerating && {
|
|
643
|
+
display: "none"
|
|
644
|
+
})
|
|
645
|
+
},
|
|
646
|
+
mx: 2,
|
|
647
|
+
size: 12,
|
|
648
|
+
children: /*#__PURE__*/_jsx(NualaCreating, {})
|
|
649
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
575
650
|
sx: {
|
|
576
|
-
|
|
651
|
+
...(!isAnyGenerating && {
|
|
652
|
+
display: "none"
|
|
653
|
+
})
|
|
577
654
|
},
|
|
578
|
-
|
|
655
|
+
mt: 2,
|
|
656
|
+
size: 12,
|
|
657
|
+
children: /*#__PURE__*/_jsx(LinearProgress, {})
|
|
658
|
+
}), !isAnyGenerating && /*#__PURE__*/_jsxs(Grid, {
|
|
659
|
+
container: true,
|
|
660
|
+
spacing: 2,
|
|
661
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
579
662
|
size: 12,
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
663
|
+
children: /*#__PURE__*/_jsxs(Alert, {
|
|
664
|
+
severity: "info",
|
|
665
|
+
children: [t("experimental_feature_desc"), " - ", " ", /*#__PURE__*/_jsxs(Link, {
|
|
666
|
+
to: "/contact",
|
|
667
|
+
children: [t("contact_form"), "."]
|
|
668
|
+
})]
|
|
669
|
+
})
|
|
670
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
671
|
+
size: {
|
|
672
|
+
xs: 12
|
|
588
673
|
},
|
|
589
|
-
children:
|
|
590
|
-
variant: "
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
674
|
+
children: /*#__PURE__*/_jsxs(Typography, {
|
|
675
|
+
variant: "body2",
|
|
676
|
+
children: [t("generate_feedback_view_the"), " ", /*#__PURE__*/_jsx(MuiLink, {
|
|
677
|
+
component: "button",
|
|
678
|
+
variant: "body2",
|
|
679
|
+
onClick: handleOpenPDF,
|
|
680
|
+
children: t("generate_feedback_rubric_name")
|
|
681
|
+
}), ", ", t("generate_feedback_rubric_desc")]
|
|
682
|
+
})
|
|
683
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
684
|
+
size: 12,
|
|
685
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
686
|
+
value: customFeedbackText,
|
|
687
|
+
onChange: e => setCustomFeedbackText(e.target.value),
|
|
688
|
+
placeholder: t("custom_feedback_placeholder"),
|
|
689
|
+
multiline: true,
|
|
690
|
+
minRows: 4,
|
|
691
|
+
fullWidth: true
|
|
692
|
+
})
|
|
693
|
+
})]
|
|
694
|
+
})]
|
|
605
695
|
})
|
|
696
|
+
}), /*#__PURE__*/_jsx(PDFViewer, {
|
|
697
|
+
open: openPDF,
|
|
698
|
+
handleClose: handleClosePDF,
|
|
699
|
+
pdfUrl: pdfUrl,
|
|
700
|
+
pageNumber: pageNumber,
|
|
701
|
+
setPageNumber: setPageNumber,
|
|
702
|
+
scale: scale,
|
|
703
|
+
setScale: setScale,
|
|
704
|
+
t: t
|
|
606
705
|
})]
|
|
607
706
|
});
|
|
608
707
|
}
|
|
@@ -86,7 +86,6 @@ function PhraseList({
|
|
|
86
86
|
isCreatePhraseDialogOpen,
|
|
87
87
|
setIsCreatePhraseDialogOpen,
|
|
88
88
|
handleAddPhrase,
|
|
89
|
-
topicName,
|
|
90
89
|
validatePhraseRecognition,
|
|
91
90
|
difficulty,
|
|
92
91
|
topicGoal,
|
|
@@ -208,39 +207,44 @@ function PhraseList({
|
|
|
208
207
|
})]
|
|
209
208
|
})
|
|
210
209
|
})]
|
|
211
|
-
}), tabValue === 0 ? /*#__PURE__*/_jsx(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
210
|
+
}), tabValue === 0 ? /*#__PURE__*/_jsx(Box, {
|
|
211
|
+
sx: {
|
|
212
|
+
minHeight: '100vh'
|
|
213
|
+
},
|
|
214
|
+
children: /*#__PURE__*/_jsx(PhrasesEditor, {
|
|
215
|
+
t: t,
|
|
216
|
+
phrases: phrases,
|
|
217
|
+
isCreator: isCreator,
|
|
218
|
+
isMember: isMember,
|
|
219
|
+
handleTranslate: handleTranslate,
|
|
220
|
+
handleUpdatePhrase: updatePhrase,
|
|
221
|
+
handleRemovePhrase: handleRemovePhrase,
|
|
222
|
+
uploadAudio: uploadAudio,
|
|
223
|
+
handleSpeak: handleSpeak,
|
|
224
|
+
updatePhrases: updatePhrases,
|
|
225
|
+
learnLang: learnLang,
|
|
226
|
+
forLang: forLang,
|
|
227
|
+
voices: voices,
|
|
228
|
+
userAttributes: userAttributes,
|
|
229
|
+
disablePadding: true,
|
|
230
|
+
forLangCharacters: forLangCharacters,
|
|
231
|
+
learnLangCharacters: learnLangCharacters,
|
|
232
|
+
fileSizeLimit: fileSizeLimit,
|
|
233
|
+
handleSpreadsheetSaveChanges: handleSpreadsheetSaveChanges,
|
|
234
|
+
isUploadPhrasesDialogOpen: isUploadPhrasesDialogOpen,
|
|
235
|
+
setIsUploadPhrasesDialogOpen: setIsUploadPhrasesDialogOpen,
|
|
236
|
+
isCreatePhraseDialogOpen: isCreatePhraseDialogOpen,
|
|
237
|
+
setIsCreatePhraseDialogOpen: setIsCreatePhraseDialogOpen,
|
|
238
|
+
handleAddPhrase: handleAddPhrase,
|
|
239
|
+
validatePhraseRecognition: validatePhraseRecognition,
|
|
240
|
+
siteLanguage: siteLanguage,
|
|
241
|
+
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
242
|
+
difficulty: difficulty,
|
|
243
|
+
subscription: subscription,
|
|
244
|
+
topicGoal: topicGoal,
|
|
245
|
+
verificationStatus: verificationStatus,
|
|
246
|
+
phraseListName: initialValues.phraseListName
|
|
247
|
+
})
|
|
244
248
|
}) : null, tabValue === 1 ? /*#__PURE__*/_jsx(Box, {
|
|
245
249
|
className: hidden ? classes.paneFull : classes.pane,
|
|
246
250
|
children: /*#__PURE__*/_jsx(UpdatePhraseList, {
|
|
@@ -20,6 +20,7 @@ import DefaultButton from "../../Misc/DefaultColourButton/DefaultColourButton";
|
|
|
20
20
|
import { Parser } from "@json2csv/plainjs";
|
|
21
21
|
import GeneratePhrases from "../../Dialogs/GeneratePhrases/GeneratePhrases";
|
|
22
22
|
import EmptyPhraseListImage from "../../img/course.svg";
|
|
23
|
+
import { capitalize } from "../../utils/index";
|
|
23
24
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
const Modes = {
|
|
25
26
|
NORMAL: "normal",
|
|
@@ -70,8 +71,8 @@ const useStyles = makeStyles()(theme => ({
|
|
|
70
71
|
width: "100%",
|
|
71
72
|
maxWidth: EditorMaxWidth,
|
|
72
73
|
margin: "0 auto",
|
|
73
|
-
backgroundColor:
|
|
74
|
-
minHeight: "
|
|
74
|
+
backgroundColor: theme.palette.background.paper,
|
|
75
|
+
minHeight: "100%"
|
|
75
76
|
},
|
|
76
77
|
placeholder: {
|
|
77
78
|
minHeight: "100vh",
|
|
@@ -230,7 +231,9 @@ const CreatorComponent = ({
|
|
|
230
231
|
});
|
|
231
232
|
function EmptyPhraseList({
|
|
232
233
|
t = text => text,
|
|
233
|
-
placeholderImageUrl = EmptyPhraseListImage
|
|
234
|
+
placeholderImageUrl = EmptyPhraseListImage,
|
|
235
|
+
siteLanguage,
|
|
236
|
+
learnLang
|
|
234
237
|
}) {
|
|
235
238
|
const {
|
|
236
239
|
classes
|
|
@@ -252,7 +255,9 @@ function EmptyPhraseList({
|
|
|
252
255
|
component: "h2",
|
|
253
256
|
variant: "subtitle1",
|
|
254
257
|
gutterBottom: true,
|
|
255
|
-
children: t("add_phrase_desc"
|
|
258
|
+
children: t("add_phrase_desc", {
|
|
259
|
+
language: ["en", "en-US", "ga", "de"].includes(siteLanguage) ? capitalize(t(learnLang.toLowerCase())) : t(learnLang.toLowerCase()).toLowerCase()
|
|
260
|
+
})
|
|
256
261
|
})]
|
|
257
262
|
})
|
|
258
263
|
});
|
|
@@ -285,7 +290,7 @@ function PhrasesEditor(props) {
|
|
|
285
290
|
handleTranslate,
|
|
286
291
|
handleAddPhrase,
|
|
287
292
|
fileSizeLimit,
|
|
288
|
-
|
|
293
|
+
phraseListName = "Unknown",
|
|
289
294
|
validatePhraseRecognition,
|
|
290
295
|
siteLanguage,
|
|
291
296
|
makeChatGptApiRequest,
|
|
@@ -500,7 +505,7 @@ function PhrasesEditor(props) {
|
|
|
500
505
|
type: "text/plain"
|
|
501
506
|
});
|
|
502
507
|
element.href = URL.createObjectURL(file);
|
|
503
|
-
element.download = `${
|
|
508
|
+
element.download = `${phraseListName}-${new Date().toLocaleDateString()}.csv`;
|
|
504
509
|
document.body.appendChild(element);
|
|
505
510
|
element.click();
|
|
506
511
|
// Cleanup
|
|
@@ -659,7 +664,9 @@ function PhrasesEditor(props) {
|
|
|
659
664
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
660
665
|
difficulty: difficulty
|
|
661
666
|
}) : /*#__PURE__*/_jsx(EmptyPhraseList, {
|
|
662
|
-
t: t
|
|
667
|
+
t: t,
|
|
668
|
+
siteLanguage: siteLanguage,
|
|
669
|
+
learnLang: learnLang
|
|
663
670
|
})), /*#__PURE__*/_jsx(CreatePhraseDialog, {
|
|
664
671
|
t: t,
|
|
665
672
|
learnLang: learnLang,
|
|
@@ -674,7 +681,8 @@ function PhrasesEditor(props) {
|
|
|
674
681
|
validatePhraseRecognition: validatePhraseRecognition,
|
|
675
682
|
siteLanguage: siteLanguage,
|
|
676
683
|
verificationStatus: verificationStatus,
|
|
677
|
-
makeChatGptApiRequest: makeChatGptApiRequest
|
|
684
|
+
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
685
|
+
difficulty: difficulty
|
|
678
686
|
}), /*#__PURE__*/_jsx(UploadPhrasesDialog, {
|
|
679
687
|
t: t,
|
|
680
688
|
learnLang: learnLang,
|
|
@@ -698,7 +706,7 @@ function PhrasesEditor(props) {
|
|
|
698
706
|
currentPhrases: phrases,
|
|
699
707
|
makeChatGptApiRequest: makeChatGptApiRequest,
|
|
700
708
|
initialValues: {
|
|
701
|
-
phrasesTopic:
|
|
709
|
+
phrasesTopic: phraseListName,
|
|
702
710
|
phraseAmount: 8,
|
|
703
711
|
topicGoal: topicGoal
|
|
704
712
|
},
|
|
@@ -733,7 +741,7 @@ PhrasesEditor.propTypes = {
|
|
|
733
741
|
updatePhrases: PropTypes.func,
|
|
734
742
|
voices: PropTypes.array,
|
|
735
743
|
userAttributes: PropTypes.object,
|
|
736
|
-
|
|
744
|
+
phraseListName: PropTypes.string,
|
|
737
745
|
validatePhraseRecognition: PropTypes.func,
|
|
738
746
|
siteLanguage: PropTypes.string,
|
|
739
747
|
makeChatGptApiRequest: PropTypes.func
|