@nualang/nualang-ui-components 0.1.1354 → 0.1.1356
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/CreatePhraseGroupDialog/CreatePhraseGroupDialog.js +1 -6
- package/dist/Dialogs/GeneratePhrases/GeneratePhrases.js +27 -62
- package/dist/Editors/PhraseList/PhraseList.js +5 -7
- package/dist/Editors/Phrases/Phrases.js +6 -0
- package/dist/Exercises/PhraseGroup/PhraseGroup.js +2 -0
- package/dist/Exercises/PhraseGroup/PhraseGroupGameOptions/PhraseGroupGame/PhraseGroupGame.js +104 -84
- package/dist/Exercises/PhraseGroup/PhraseGroupGameOptions/PhraseGroupGames.js +2 -0
- package/dist/Exercises/PhraseGroup/PhraseGroupInfo/PhraseGroupInfo.js +22 -32
- package/dist/Lists/Phrases/Phrases.js +16 -0
- package/dist/Misc/PhraseDisplay/PhraseDisplay.js +123 -0
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.js +13 -16
- package/dist/Screens/Activity/Exercise/Attempt/Attempt.js +1 -1
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +4 -0
- package/dist/Tables/Attempt/Attempt.js +2 -2
- package/dist/Tables/Progress/Progress.js +33 -2
- package/dist/Tables/Progress/ProgressList.js +94 -5
- package/dist/Tables/Progress/ProgressTable.js +103 -3
- package/dist/Tables/Progress/ProgressTableRow.js +17 -4
- package/dist/Tables/Progress/cells/index.js +44 -0
- package/dist/Tables/Progress/useProgressUrlParams.js +18 -2
- package/dist/Tables/Progress/viewState.js +5 -3
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ import Dialog from "@mui/material/Dialog";
|
|
|
6
6
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
7
7
|
import DialogContent from "@mui/material/DialogContent";
|
|
8
8
|
import DialogActions from "@mui/material/DialogActions";
|
|
9
|
-
import CircularProgress from "@mui/material/CircularProgress";
|
|
10
9
|
import Grid from "@mui/material/Grid";
|
|
11
10
|
import ImageSelector from "../../Forms/ImageSelector/ImageSelector";
|
|
12
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -132,11 +131,7 @@ export default function CreatePhraseGroupDialog({
|
|
|
132
131
|
color: "primary",
|
|
133
132
|
variant: "contained",
|
|
134
133
|
disabled: !name.trim() || isLoading,
|
|
135
|
-
|
|
136
|
-
size: 16,
|
|
137
|
-
color: "inherit"
|
|
138
|
-
}) : null,
|
|
139
|
-
children: isLoading ? t("creating") || "Creating..." : t("create") || "Create"
|
|
134
|
+
children: t("create") || "Create"
|
|
140
135
|
})]
|
|
141
136
|
})]
|
|
142
137
|
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import ResponsiveDialog from "../ResponsiveDialog/ResponsiveDialog";
|
|
3
3
|
import { AutoFixHigh } from "@mui/icons-material";
|
|
4
|
-
import { Alert, Grid, InputAdornment, LinearProgress, MenuItem, Slider, TextField, Tooltip, Typography, ListItem,
|
|
4
|
+
import { Alert, Grid, InputAdornment, LinearProgress, MenuItem, Slider, TextField, Tooltip, Typography, ListItem, useMediaQuery, FormControlLabel, Switch, Box, List } from "@mui/material";
|
|
5
5
|
import { useTheme } from "@mui/material/styles";
|
|
6
6
|
import { Link } from "react-router";
|
|
7
7
|
import InfoIcon from "@mui/icons-material/Info";
|
|
8
8
|
import NualaCreating from "../../Misc/NualaCreating/NualaCreating";
|
|
9
9
|
import InputHelper from "../../Forms/InputHelper/InputHelper";
|
|
10
|
+
import PhraseDisplay from "../../Misc/PhraseDisplay/PhraseDisplay";
|
|
10
11
|
import { makeStyles } from "tss-react/mui";
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
const useStyles = makeStyles()(theme => ({
|
|
@@ -19,80 +20,43 @@ const useStyles = makeStyles()(theme => ({
|
|
|
19
20
|
width: "60%",
|
|
20
21
|
wordBreak: "break-word",
|
|
21
22
|
overflowWrap: "break-word"
|
|
22
|
-
},
|
|
23
|
-
avatar: {
|
|
24
|
-
cursor: "pointer",
|
|
25
|
-
margin: theme.spacing()
|
|
26
|
-
},
|
|
27
|
-
avatarNoClick: {
|
|
28
|
-
margin: theme.spacing()
|
|
29
23
|
}
|
|
30
24
|
}));
|
|
31
25
|
function Phrase({
|
|
32
26
|
alternativeVersions,
|
|
33
27
|
translations,
|
|
34
28
|
definitions,
|
|
35
|
-
phrase
|
|
29
|
+
phrase,
|
|
30
|
+
t
|
|
36
31
|
}) {
|
|
37
32
|
const theme = useTheme();
|
|
38
33
|
const {
|
|
39
34
|
classes
|
|
40
35
|
} = useStyles();
|
|
41
36
|
const isLargeScreen = useMediaQuery(theme.breakpoints.up("sm"));
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (Array.isArray(definitions) && definitions.length) {
|
|
50
|
-
secondaryParts.push((definitions || []).join(", "));
|
|
51
|
-
}
|
|
52
|
-
const secondary = secondaryParts.join("\n");
|
|
53
|
-
console.log({
|
|
54
|
-
primary,
|
|
55
|
-
secondary
|
|
56
|
-
});
|
|
57
|
-
console.log("Phrase render", {
|
|
58
|
-
phrase,
|
|
59
|
-
translations,
|
|
60
|
-
definitions,
|
|
61
|
-
alternativeVersions
|
|
62
|
-
});
|
|
63
|
-
return /*#__PURE__*/_jsx(ListItem, {
|
|
64
|
-
"data-cy": "phrase-list-item",
|
|
65
|
-
children: isLargeScreen ? /*#__PURE__*/_jsx(Grid, {
|
|
66
|
-
container: true,
|
|
67
|
-
sx: {
|
|
68
|
-
width: "100%"
|
|
69
|
-
},
|
|
70
|
-
className: classes.phraseText,
|
|
71
|
-
children: /*#__PURE__*/_jsx(ListItemText, {
|
|
72
|
-
className: classes.phrases,
|
|
73
|
-
primary: primary,
|
|
74
|
-
secondary: secondary,
|
|
75
|
-
secondaryTypographyProps: {
|
|
76
|
-
style: {
|
|
77
|
-
whiteSpace: "pre-line"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}) : /*#__PURE__*/_jsx(Grid, {
|
|
82
|
-
container: true,
|
|
37
|
+
return /*#__PURE__*/_jsx(List, {
|
|
38
|
+
dense: true,
|
|
39
|
+
disablePadding: true,
|
|
40
|
+
children: /*#__PURE__*/_jsx(ListItem, {
|
|
41
|
+
"data-cy": "phrase-list-item",
|
|
42
|
+
divider: true,
|
|
83
43
|
sx: {
|
|
84
|
-
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
alignItems: "flex-start",
|
|
46
|
+
py: 2
|
|
85
47
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
48
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
49
|
+
className: isLargeScreen ? classes.phraseText : classes.phraseTextSmall,
|
|
50
|
+
children: /*#__PURE__*/_jsx(PhraseDisplay, {
|
|
51
|
+
phrase: phrase,
|
|
52
|
+
translations: translations,
|
|
53
|
+
definitions: definitions,
|
|
54
|
+
alternativeVersions: alternativeVersions,
|
|
55
|
+
t: t,
|
|
56
|
+
variant: "body2",
|
|
57
|
+
showIcons: true,
|
|
58
|
+
showImage: false
|
|
59
|
+
})
|
|
96
60
|
})
|
|
97
61
|
})
|
|
98
62
|
});
|
|
@@ -388,7 +352,8 @@ function GeneratePhrases({
|
|
|
388
352
|
children: [/*#__PURE__*/_jsx(Typography, {
|
|
389
353
|
children: t("generated_phrases")
|
|
390
354
|
}), generatedPhrases.map((phrase, index) => /*#__PURE__*/_jsx(Phrase, {
|
|
391
|
-
...phrase
|
|
355
|
+
...phrase,
|
|
356
|
+
t: t
|
|
392
357
|
}, index))]
|
|
393
358
|
}), errorMessage && /*#__PURE__*/_jsx(Grid, {
|
|
394
359
|
mt: 2,
|
|
@@ -106,12 +106,6 @@ function PhraseList({
|
|
|
106
106
|
const handleChangeTab = (event, newValue) => {
|
|
107
107
|
setTabValue(newValue);
|
|
108
108
|
};
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (!isSmallScreen && tabValue === 2) {
|
|
111
|
-
setTabValue(0);
|
|
112
|
-
}
|
|
113
|
-
}, [isSmallScreen]); // Only run when screen changes
|
|
114
|
-
|
|
115
109
|
const updatePhrases = async phrases => {
|
|
116
110
|
try {
|
|
117
111
|
handleUpdatePhrases(courseId, sectionId, topicId, phrases);
|
|
@@ -208,8 +202,9 @@ function PhraseList({
|
|
|
208
202
|
})
|
|
209
203
|
})]
|
|
210
204
|
}), tabValue === 0 ? /*#__PURE__*/_jsx(Box, {
|
|
205
|
+
className: hidden ? classes.paneFull : classes.pane,
|
|
211
206
|
sx: {
|
|
212
|
-
|
|
207
|
+
overflowY: "auto"
|
|
213
208
|
},
|
|
214
209
|
children: /*#__PURE__*/_jsx(PhrasesEditor, {
|
|
215
210
|
t: t,
|
|
@@ -247,6 +242,9 @@ function PhraseList({
|
|
|
247
242
|
})
|
|
248
243
|
}) : null, tabValue === 1 ? /*#__PURE__*/_jsx(Box, {
|
|
249
244
|
className: hidden ? classes.paneFull : classes.pane,
|
|
245
|
+
sx: {
|
|
246
|
+
overflowY: "auto"
|
|
247
|
+
},
|
|
250
248
|
children: /*#__PURE__*/_jsx(UpdatePhraseList, {
|
|
251
249
|
t: t,
|
|
252
250
|
touched: touched,
|
|
@@ -556,6 +556,9 @@ function PhrasesEditor(props) {
|
|
|
556
556
|
variant: "contained",
|
|
557
557
|
endIcon: /*#__PURE__*/_jsx(AutoFixHighIcon, {}),
|
|
558
558
|
size: "small",
|
|
559
|
+
sx: {
|
|
560
|
+
border: '1.5px solid transparent'
|
|
561
|
+
},
|
|
559
562
|
children: t("generate_phrases")
|
|
560
563
|
}), isCreator && mode === Modes.NORMAL && /*#__PURE__*/_jsx(Button, {
|
|
561
564
|
className: classes.actionButton,
|
|
@@ -565,6 +568,9 @@ function PhrasesEditor(props) {
|
|
|
565
568
|
variant: "contained",
|
|
566
569
|
endIcon: /*#__PURE__*/_jsx(AddIcon, {}),
|
|
567
570
|
size: "small",
|
|
571
|
+
sx: {
|
|
572
|
+
border: '1.5px solid transparent'
|
|
573
|
+
},
|
|
568
574
|
children: t("add_phrase")
|
|
569
575
|
}), /*#__PURE__*/_jsx(DefaultButton, {
|
|
570
576
|
className: classes.actionButton,
|
|
@@ -117,6 +117,7 @@ function PhraseGroup({
|
|
|
117
117
|
const activePhrases = phraseGroup?.phrases || phrases;
|
|
118
118
|
const isPhrasesEmpty = !activePhrases.length;
|
|
119
119
|
const isListeningDisabled = isPhrasesEmpty || learnLang === "irish" && activePhrases.filter(p => p?.voices?.length > 0).length === 0;
|
|
120
|
+
const isDefinitionsEmpty = activePhrases.every(p => !p.definitions || p.definitions.length === 0);
|
|
120
121
|
const gamesHidden = {
|
|
121
122
|
translation: hiddenPhraseGroupGames["translation"] || false,
|
|
122
123
|
listening: isListeningDisabled || hiddenPhraseGroupGames["listening"] || false,
|
|
@@ -218,6 +219,7 @@ function PhraseGroup({
|
|
|
218
219
|
phraseGroupCompletions: phraseGroupCompletions,
|
|
219
220
|
isCreator: isCreator,
|
|
220
221
|
isPhrasesEmpty: isPhrasesEmpty,
|
|
222
|
+
isDefinitionsEmpty: isDefinitionsEmpty,
|
|
221
223
|
hiddenWordBankGames: hiddenWordBankPhraseGroupGames,
|
|
222
224
|
isKeyboardHiddenGames: isKeyboardHiddenPhraseGroupGames,
|
|
223
225
|
onToggleGameVisibility: gameId => handleTogglePhraseGroupGameVisibility && handleTogglePhraseGroupGameVisibility(phraseGroup, gameId),
|
package/dist/Exercises/PhraseGroup/PhraseGroupGameOptions/PhraseGroupGame/PhraseGroupGame.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Typography from "@mui/material/Typography";
|
|
2
2
|
import Avatar from "@mui/material/Avatar";
|
|
3
|
-
import { Card, ListItemAvatar, ListItemText,
|
|
3
|
+
import { Card, ListItemAvatar, ListItemText, ListItemButton, Badge, IconButton, Tooltip } from "@mui/material";
|
|
4
4
|
import { makeStyles } from "tss-react/mui";
|
|
5
5
|
import Person from "@mui/icons-material/Person";
|
|
6
6
|
import Done from "@mui/icons-material/Done";
|
|
@@ -154,6 +154,7 @@ function PhraseGroupGame({
|
|
|
154
154
|
totalPhrases,
|
|
155
155
|
isGameHidden,
|
|
156
156
|
isPhrasesEmpty,
|
|
157
|
+
isDefinitionsEmpty,
|
|
157
158
|
isCreator,
|
|
158
159
|
isKeyboardHidden,
|
|
159
160
|
isWordBankHidden,
|
|
@@ -167,92 +168,111 @@ function PhraseGroupGame({
|
|
|
167
168
|
const theme = useTheme();
|
|
168
169
|
const hasKeyboard = gameId === "translation";
|
|
169
170
|
const hasWordBank = gameId === "translation" || gameId === "listening";
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"&:hover": {
|
|
193
|
-
border: `2px solid ${theme.palette.primary.main}`,
|
|
194
|
-
backgroundColor: "transparent"
|
|
195
|
-
},
|
|
196
|
-
"&:focus": {
|
|
197
|
-
backgroundColor: "transparent"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
children: [/*#__PURE__*/_jsx(ListItemAvatar, {
|
|
201
|
-
children: GameIcon ? /*#__PURE__*/_jsx(Avatar, {
|
|
202
|
-
variant: "square",
|
|
203
|
-
className: classes.avatar,
|
|
204
|
-
alt: "",
|
|
205
|
-
children: /*#__PURE__*/_jsx(GameIcon, {})
|
|
206
|
-
}) : /*#__PURE__*/_jsx(Avatar, {
|
|
207
|
-
sx: theme => ({
|
|
208
|
-
backgroundColor: theme.palette.mode === "dark" ? "white" : "",
|
|
209
|
-
color: theme.palette.mode === "dark" ? theme.palette.background.default : ""
|
|
210
|
-
}),
|
|
211
|
-
alt: "",
|
|
212
|
-
children: /*#__PURE__*/_jsx(Person, {
|
|
213
|
-
fontSize: "large"
|
|
214
|
-
})
|
|
215
|
-
})
|
|
216
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
217
|
-
primary: /*#__PURE__*/_jsx(Typography, {
|
|
171
|
+
const isDefinitionsDisabled = gameId === "meaning" && isDefinitionsEmpty && !isPhrasesEmpty;
|
|
172
|
+
const isDisabled = isPhrasesEmpty || isDefinitionsDisabled || isGameHidden && !isCreator;
|
|
173
|
+
const disabledTooltip = isPhrasesEmpty ? t("topic_no_phrases") : isDefinitionsDisabled ? t("meaning_no_definitions") : "";
|
|
174
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
175
|
+
title: disabledTooltip,
|
|
176
|
+
placement: "top",
|
|
177
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
178
|
+
children: /*#__PURE__*/_jsxs(ListItemButton, {
|
|
179
|
+
alignItems: "center",
|
|
180
|
+
disabled: isDisabled,
|
|
181
|
+
onClick: () => {
|
|
182
|
+
const canPlay = !isPhrasesEmpty && !isDefinitionsDisabled && (!isGameHidden || isCreator);
|
|
183
|
+
if (canPlay) {
|
|
184
|
+
handleSelectPhraseGroupGame(gameId);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
divider: true,
|
|
188
|
+
classes: {
|
|
189
|
+
selected: classes.listItemSelected
|
|
190
|
+
},
|
|
191
|
+
id: `phrase-group-game-${gameId}`,
|
|
192
|
+
component: Card,
|
|
218
193
|
sx: {
|
|
219
|
-
|
|
194
|
+
mb: 2,
|
|
195
|
+
ml: 2,
|
|
196
|
+
mr: 2,
|
|
197
|
+
borderRadius: "1.5em",
|
|
198
|
+
border: "2px solid transparent",
|
|
199
|
+
"&:hover": {
|
|
200
|
+
border: `2px solid ${theme.palette.primary.main}`,
|
|
201
|
+
backgroundColor: "transparent"
|
|
202
|
+
},
|
|
203
|
+
"&:focus": {
|
|
204
|
+
backgroundColor: "transparent"
|
|
205
|
+
},
|
|
206
|
+
"&.Mui-disabled": {
|
|
207
|
+
opacity: 0.6,
|
|
208
|
+
cursor: "not-allowed",
|
|
209
|
+
pointerEvents: "auto",
|
|
210
|
+
backgroundColor: theme.palette.action.disabledBackground,
|
|
211
|
+
filter: "grayscale(30%)",
|
|
212
|
+
border: `2px solid ${theme.palette.action.disabledBackground}`,
|
|
213
|
+
"&:hover": {
|
|
214
|
+
border: `2px solid ${theme.palette.action.disabledBackground}`
|
|
215
|
+
}
|
|
216
|
+
}
|
|
220
217
|
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
218
|
+
children: [/*#__PURE__*/_jsx(ListItemAvatar, {
|
|
219
|
+
children: GameIcon ? /*#__PURE__*/_jsx(Avatar, {
|
|
220
|
+
variant: "square",
|
|
221
|
+
className: classes.avatar,
|
|
222
|
+
alt: "",
|
|
223
|
+
children: /*#__PURE__*/_jsx(GameIcon, {})
|
|
224
|
+
}) : /*#__PURE__*/_jsx(Avatar, {
|
|
225
|
+
sx: theme => ({
|
|
226
|
+
backgroundColor: theme.palette.mode === "dark" ? "white" : "",
|
|
227
|
+
color: theme.palette.mode === "dark" ? theme.palette.background.default : ""
|
|
228
|
+
}),
|
|
229
|
+
alt: "",
|
|
230
|
+
children: /*#__PURE__*/_jsx(Person, {
|
|
231
|
+
fontSize: "large"
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
235
|
+
primary: /*#__PURE__*/_jsx(Typography, {
|
|
236
|
+
sx: {
|
|
237
|
+
fontWeight: "bold"
|
|
238
|
+
},
|
|
239
|
+
component: "h3",
|
|
240
|
+
children: gameName
|
|
241
|
+
}),
|
|
242
|
+
secondary: /*#__PURE__*/_jsx(Typography, {
|
|
243
|
+
component: "p",
|
|
244
|
+
variant: "body2",
|
|
245
|
+
color: "textSecondary",
|
|
246
|
+
children: gameDescription
|
|
247
|
+
})
|
|
248
|
+
}), !isCreator && /*#__PURE__*/_jsxs(_Fragment, {
|
|
249
|
+
children: [/*#__PURE__*/_jsx(InProgressBadge, {
|
|
250
|
+
classes: classes,
|
|
251
|
+
remainingQuestions: remainingQuestions,
|
|
252
|
+
totalPhrases: totalPhrases,
|
|
253
|
+
t: t,
|
|
254
|
+
gameName: gameName
|
|
255
|
+
}), /*#__PURE__*/_jsx(ProgressBadge, {
|
|
256
|
+
classes: classes,
|
|
257
|
+
gameId: gameId,
|
|
258
|
+
completions: phraseGroupCompletions,
|
|
259
|
+
t: t,
|
|
260
|
+
gameName: gameName
|
|
261
|
+
})]
|
|
262
|
+
}), isCreator && /*#__PURE__*/_jsx(CreatorActions, {
|
|
263
|
+
t: t,
|
|
264
|
+
gameId: gameId,
|
|
265
|
+
hasKeyboard: hasKeyboard,
|
|
266
|
+
hasWordBank: hasWordBank,
|
|
267
|
+
isGameHidden: isGameHidden,
|
|
268
|
+
isKeyboardHidden: isKeyboardHidden,
|
|
269
|
+
isWordBankHidden: isWordBankHidden,
|
|
270
|
+
onToggleVisibility: onToggleVisibility,
|
|
271
|
+
onToggleKeyboard: onToggleKeyboard,
|
|
272
|
+
onToggleWordBank: onToggleWordBank
|
|
273
|
+
})]
|
|
229
274
|
})
|
|
230
|
-
})
|
|
231
|
-
children: [/*#__PURE__*/_jsx(InProgressBadge, {
|
|
232
|
-
classes: classes,
|
|
233
|
-
remainingQuestions: remainingQuestions,
|
|
234
|
-
totalPhrases: totalPhrases,
|
|
235
|
-
t: t,
|
|
236
|
-
gameName: gameName
|
|
237
|
-
}), /*#__PURE__*/_jsx(ProgressBadge, {
|
|
238
|
-
classes: classes,
|
|
239
|
-
gameId: gameId,
|
|
240
|
-
completions: phraseGroupCompletions,
|
|
241
|
-
t: t,
|
|
242
|
-
gameName: gameName
|
|
243
|
-
})]
|
|
244
|
-
}), isCreator && /*#__PURE__*/_jsx(CreatorActions, {
|
|
245
|
-
t: t,
|
|
246
|
-
gameId: gameId,
|
|
247
|
-
hasKeyboard: hasKeyboard,
|
|
248
|
-
hasWordBank: hasWordBank,
|
|
249
|
-
isGameHidden: isGameHidden,
|
|
250
|
-
isKeyboardHidden: isKeyboardHidden,
|
|
251
|
-
isWordBankHidden: isWordBankHidden,
|
|
252
|
-
onToggleVisibility: onToggleVisibility,
|
|
253
|
-
onToggleKeyboard: onToggleKeyboard,
|
|
254
|
-
onToggleWordBank: onToggleWordBank
|
|
255
|
-
})]
|
|
275
|
+
})
|
|
256
276
|
});
|
|
257
277
|
}
|
|
258
278
|
PhraseGroupGame.propTypes = {};
|
|
@@ -11,6 +11,7 @@ function PhraseGroupGames({
|
|
|
11
11
|
phraseGroupCompletions,
|
|
12
12
|
isCreator,
|
|
13
13
|
isPhrasesEmpty,
|
|
14
|
+
isDefinitionsEmpty,
|
|
14
15
|
hiddenWordBankGames = {},
|
|
15
16
|
isKeyboardHiddenGames = {},
|
|
16
17
|
onToggleGameVisibility,
|
|
@@ -46,6 +47,7 @@ function PhraseGroupGames({
|
|
|
46
47
|
phraseGroupCompletions: phraseGroupCompletions,
|
|
47
48
|
isGameHidden: gamesHidden[game.gameId],
|
|
48
49
|
isPhrasesEmpty: isPhrasesEmpty,
|
|
50
|
+
isDefinitionsEmpty: isDefinitionsEmpty,
|
|
49
51
|
isCreator: isCreator,
|
|
50
52
|
isKeyboardHidden: isKeyboardHiddenGames[game.gameId],
|
|
51
53
|
isWordBankHidden: hiddenWordBankGames[game.gameId],
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import PlaceholderImages from "../../../utils/placeholder-images/index";
|
|
3
|
-
import { Typography, Box, Button, List, ListItem
|
|
3
|
+
import { Typography, Box, Button, List, ListItem } from "@mui/material";
|
|
4
4
|
import ListAltIcon from "@mui/icons-material/ListAlt";
|
|
5
5
|
import ResponsiveDialog from "../../../Dialogs/ResponsiveDialog/ResponsiveDialog";
|
|
6
|
-
import
|
|
6
|
+
import PhraseDisplay from "../../../Misc/PhraseDisplay/PhraseDisplay";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
function PhrasesPreview({
|
|
8
9
|
t,
|
|
9
10
|
phrases = []
|
|
@@ -31,39 +32,28 @@ function PhrasesPreview({
|
|
|
31
32
|
children: /*#__PURE__*/_jsx(List, {
|
|
32
33
|
dense: true,
|
|
33
34
|
disablePadding: true,
|
|
34
|
-
children: phrases.map((phrase, idx) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
children: phrases.map((phrase, idx) => {
|
|
36
|
+
const phraseText = phrase.phrase || phrase.learnLangPhrase || "";
|
|
37
|
+
const translations = phrase.translations || (phrase.forLangPhrase ? [phrase.forLangPhrase] : phrase.translation ? [phrase.translation] : []);
|
|
38
|
+
const definitions = phrase.definitions || [];
|
|
39
|
+
return /*#__PURE__*/_jsx(ListItem, {
|
|
40
|
+
divider: true,
|
|
40
41
|
sx: {
|
|
41
|
-
|
|
42
|
+
py: 2
|
|
42
43
|
},
|
|
43
|
-
children: /*#__PURE__*/_jsx(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
53
|
-
primary: /*#__PURE__*/_jsx(Typography, {
|
|
54
|
-
variant: "body2",
|
|
55
|
-
sx: {
|
|
56
|
-
fontWeight: 500
|
|
57
|
-
},
|
|
58
|
-
children: phrase.phrase || phrase.learnLangPhrase || ""
|
|
59
|
-
}),
|
|
60
|
-
secondary: phrase.translations?.[0] || phrase.forLangPhrase || phrase.translation ? /*#__PURE__*/_jsx(Typography, {
|
|
44
|
+
children: /*#__PURE__*/_jsx(PhraseDisplay, {
|
|
45
|
+
phrase: phraseText,
|
|
46
|
+
translations: translations,
|
|
47
|
+
definitions: definitions,
|
|
48
|
+
alternativeVersions: phrase.alternativeVersions || [],
|
|
49
|
+
picture: phrase.image || "",
|
|
50
|
+
t: t,
|
|
61
51
|
variant: "caption",
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
}
|
|
52
|
+
showIcons: true,
|
|
53
|
+
showImage: true
|
|
54
|
+
})
|
|
55
|
+
}, phrase.phraseId || idx);
|
|
56
|
+
})
|
|
67
57
|
})
|
|
68
58
|
})]
|
|
69
59
|
});
|
|
@@ -591,17 +591,22 @@ function PhraseList({
|
|
|
591
591
|
disabled: selectedPhrases.length === 0,
|
|
592
592
|
variant: "contained",
|
|
593
593
|
color: "primary",
|
|
594
|
+
size: "small",
|
|
594
595
|
onClick: () => handleDeletePhrases(),
|
|
595
596
|
startIcon: isLargeScreen ? /*#__PURE__*/_jsx(DeleteIcon, {}) : null,
|
|
596
597
|
className: classes.actionButton,
|
|
597
598
|
style: {
|
|
598
599
|
marginLeft: "10px"
|
|
599
600
|
},
|
|
601
|
+
sx: {
|
|
602
|
+
border: '1.5px solid transparent'
|
|
603
|
+
},
|
|
600
604
|
children: isLargeScreen ? t("Remove Phrases") : /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
601
605
|
}), /*#__PURE__*/_jsx(Button, {
|
|
602
606
|
disabled: selectedPhrases.length === 0,
|
|
603
607
|
variant: "contained",
|
|
604
608
|
color: "secondary",
|
|
609
|
+
size: "small",
|
|
605
610
|
className: classes.actionButton,
|
|
606
611
|
"aria-label": t("generate_definitions"),
|
|
607
612
|
onClick: () => setIsGenerateDefinitionsOpen(true),
|
|
@@ -609,6 +614,9 @@ function PhraseList({
|
|
|
609
614
|
style: {
|
|
610
615
|
marginLeft: "10px"
|
|
611
616
|
},
|
|
617
|
+
sx: {
|
|
618
|
+
border: '1.5px solid transparent'
|
|
619
|
+
},
|
|
612
620
|
children: isLargeScreen ? t("generate_definitions") : /*#__PURE__*/_jsx(AutoFixHighIcon, {})
|
|
613
621
|
})]
|
|
614
622
|
})]
|
|
@@ -701,6 +709,7 @@ function PhraseList({
|
|
|
701
709
|
}), /*#__PURE__*/_jsx(Button, {
|
|
702
710
|
variant: "contained",
|
|
703
711
|
color: "primary",
|
|
712
|
+
size: "small",
|
|
704
713
|
disabled: selectedPhrases.length === 0,
|
|
705
714
|
onClick: () => handleDeletePhrases(),
|
|
706
715
|
startIcon: isLargeScreen ? /*#__PURE__*/_jsx(DeleteIcon, {}) : null,
|
|
@@ -708,10 +717,14 @@ function PhraseList({
|
|
|
708
717
|
marginLeft: "10px"
|
|
709
718
|
},
|
|
710
719
|
className: classes.actionButton,
|
|
720
|
+
sx: {
|
|
721
|
+
border: '1.5px solid transparent'
|
|
722
|
+
},
|
|
711
723
|
children: isLargeScreen ? t("Remove Phrases") : /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
712
724
|
}), /*#__PURE__*/_jsx(Button, {
|
|
713
725
|
variant: "contained",
|
|
714
726
|
color: "secondary",
|
|
727
|
+
size: "small",
|
|
715
728
|
className: classes.actionButton,
|
|
716
729
|
disabled: selectedPhrases.length === 0,
|
|
717
730
|
"aria-label": t("generate_definitions"),
|
|
@@ -720,6 +733,9 @@ function PhraseList({
|
|
|
720
733
|
style: {
|
|
721
734
|
marginLeft: "10px"
|
|
722
735
|
},
|
|
736
|
+
sx: {
|
|
737
|
+
border: '1.5px solid transparent'
|
|
738
|
+
},
|
|
723
739
|
children: isLargeScreen ? t("generate_definitions") : /*#__PURE__*/_jsx(AutoFixHighIcon, {})
|
|
724
740
|
})]
|
|
725
741
|
})]
|