@nualang/nualang-ui-components 0.1.1399 → 0.1.1401
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/Cards/Bot/Bot.js +106 -56
- package/dist/Cards/CardElements/CardSubheader/CardSubheader.js +28 -0
- package/dist/Cards/CardElements/CardSubheader/package.json +6 -0
- package/dist/Cards/CardElements/CardTitle/CardTitle.js +6 -4
- package/dist/Cards/CardElements/index.js +17 -5
- package/dist/Cards/Classroom/Classroom.js +55 -20
- package/dist/Cards/Course/Course.js +90 -52
- package/dist/Cards/Roleplay/Roleplay.js +106 -56
- package/dist/Cards/Topic/Topic.js +96 -39
- package/dist/Chat/Messages/Message/Message.js +6 -6
- package/dist/Containers/App/App.js +1 -0
- package/dist/Dialogs/CreatePhraseGroupDialog/CreatePhraseGroupDialog.js +116 -72
- package/dist/Dialogs/FindTopicsDialog/FindTopicsDialog.js +442 -0
- package/dist/Dialogs/QuickCreateClassroomDialog/QuickCreateClassroomDialog.js +167 -102
- package/dist/Dialogs/QuickCreateCourseDialog/QuickCreateCourseDialog.js +174 -106
- package/dist/Dialogs/QuickCreateTopicDialog/QuickCreateTopicDialog.js +260 -0
- package/dist/Dialogs/ResponsiveDialog/ResponsiveDialog.js +5 -2
- package/dist/Exercises/ListenAndSpeak/ListenAndSpeak.js +41 -36
- package/dist/Exercises/Listener/Listener.js +20 -14
- package/dist/Exercises/Meaning/Meaning.js +20 -23
- package/dist/Exercises/MeaningReadWrite/MeaningReadWriteGame.js +27 -21
- package/dist/Exercises/PhraseGroup/Games/ListenAndSpeakGame/ListenAndSpeakGame.js +4 -2
- package/dist/Exercises/PhraseGroup/Games/ListeningGame/ListeningGame.js +4 -2
- package/dist/Exercises/PhraseGroup/Games/MeaningGame/MeaningGame.js +4 -2
- package/dist/Exercises/PhraseGroup/Games/PronunciationGame/PronunciationGame.js +4 -2
- package/dist/Exercises/PhraseGroup/Games/TranslationGame/TranslationGame.js +4 -2
- package/dist/Exercises/PhraseGroup/PhraseGroup.js +4 -2
- package/dist/Exercises/Pronouncer/Pronouncer.js +20 -23
- package/dist/Exercises/Roleplay/Games/ActItOutGameListeningAndSpeaking/ActItOutGame.js +12 -25
- package/dist/Exercises/Roleplay/Games/ActItOutGameSpeaking/ActItOutGame.js +12 -25
- package/dist/Exercises/Roleplay/Games/TopBarActions.js +10 -15
- package/dist/Exercises/Roleplay/OriginalRoleplay.js +11 -16
- package/dist/Exercises/Translator/Translator.js +20 -23
- package/dist/Lists/CourseOutline/CourseOutline.js +196 -19
- package/dist/Lists/ExerciseSelection/ExerciseSelection.js +7 -3
- package/dist/Lists/Exercises/Exercises.js +117 -29
- package/dist/Lists/PhraseListSelection/PhraseListSelection.js +8 -4
- package/dist/Lists/Phrases/Phrases.js +0 -1
- package/dist/Lists/RoleplaySelection/RoleplaySelection.js +8 -4
- package/dist/Lists/Topics/Topics.js +33 -38
- package/dist/Live/Game/Game.js +4 -0
- package/dist/Live/LiveListener/LiveListener.js +19 -13
- package/dist/Live/LiveMeaning/LiveMeaning.js +20 -23
- package/dist/Live/LiveMeaningReadWrite/LiveMeaningReadWrite.js +39 -36
- package/dist/Live/LiveTranslator/LiveTranslator.js +20 -23
- package/dist/Live/Misc/FinalScoreDrawer/FinalScoreDrawer.js +8 -7
- package/dist/Misc/AchievementsBanner/AchievementsBanner.js +62 -0
- package/dist/Misc/AnswerResult/AnswerResult.js +396 -134
- package/dist/Misc/ColorLinearProgress/ColorLinearProgress.js +14 -17
- package/dist/Misc/ExerciseProgressBar/ExerciseProgressBar.js +10 -16
- package/dist/Misc/MedalCard/MedalCard.js +98 -0
- package/dist/Misc/MedalSelector/MedalSelector.js +4 -0
- package/dist/Misc/MedalSelector/PlaceholderMedal.js +96 -0
- package/dist/Misc/MedalSelector/PlaceholderMedal.svg +27 -0
- package/dist/Misc/NotFound/ClassCourses.js +3 -1
- package/dist/Misc/NualaMascot/NualaMascot.js +68 -0
- package/dist/Misc/NualaMascot/NualaMascotGreen.js +212 -0
- package/dist/Misc/NualaMascot/NualaMascotPink.js +131 -0
- package/dist/Misc/NualaMascot/NualaMascotRed.js +148 -0
- package/dist/Misc/NualaMascot/NualaMascotYellow.js +140 -0
- package/dist/Misc/QuickCreateNualaAnimations/ChatbotNualaAnimation.js +154 -0
- package/dist/Misc/QuickCreateNualaAnimations/ClassroomNualaAnimation.js +201 -0
- package/dist/Misc/QuickCreateNualaAnimations/CourseNualaAnimation.js +154 -0
- package/dist/Misc/QuickCreateNualaAnimations/PhraseListNualaAnimation.js +268 -0
- package/dist/Misc/QuickCreateNualaAnimations/ScenarioNualaAnimation.js +128 -0
- package/dist/Misc/QuickCreateNualaAnimations/TopicNualaAnimation.js +134 -0
- package/dist/Misc/QuickCreateNualaAnimations/characterMotion.js +172 -0
- package/dist/Tables/Progress/constants.js +2 -1
- package/dist/animations/celebrationCharacterMotion.js +336 -0
- package/dist/animations/index.js +30 -0
- package/dist/animations/nuala_10_celebrating.js +233 -0
- package/dist/animations/nuala_11_celebrating.js +190 -0
- package/dist/animations/nuala_12_celebrating.js +172 -0
- package/dist/animations/nuala_13_celebrating.js +160 -0
- package/dist/animations/nuala_14_celebrating.js +135 -0
- package/dist/animations/nuala_15_celebrating.js +139 -0
- package/dist/animations/nuala_16_celebrating.js +121 -0
- package/dist/animations/nuala_17_celebrating.js +140 -0
- package/dist/animations/nuala_18_celebrating.js +134 -0
- package/dist/animations/nuala_19_celebrating.js +216 -0
- package/dist/animations/nuala_1_celebrating.js +131 -0
- package/dist/animations/nuala_1_speaking.js +163 -0
- package/dist/animations/nuala_20_celebrating.js +138 -0
- package/dist/animations/nuala_21_celebrating.js +137 -0
- package/dist/animations/nuala_2_celebrating.js +102 -0
- package/dist/animations/nuala_2_speaking.js +139 -0
- package/dist/animations/nuala_3_celebrating.js +104 -0
- package/dist/animations/nuala_3_speaking.js +136 -0
- package/dist/animations/nuala_4_celebrating.js +145 -0
- package/dist/animations/nuala_5_celebrating.js +131 -0
- package/dist/animations/nuala_6_celebrating.js +141 -0
- package/dist/animations/nuala_7_celebrating.js +160 -0
- package/dist/animations/nuala_8_celebrating.js +108 -0
- package/dist/animations/nuala_9_celebrating.js +119 -0
- package/dist/animations/speakingCharacterMotion.js +157 -0
- package/dist/config.js +8 -7
- package/dist/hooks/useExerciseState.js +42 -18
- package/dist/index.js +4 -1
- package/dist/theme/getComponents.js +8 -0
- package/package.json +8 -11
- package/dist/img/avatars/nuala_10_celebrating.svg +0 -44
- package/dist/img/avatars/nuala_11_celebrating.svg +0 -38
- package/dist/img/avatars/nuala_12_celebrating.svg +0 -48
- package/dist/img/avatars/nuala_13_celebrating.svg +0 -41
- package/dist/img/avatars/nuala_14_celebrating.svg +0 -35
- package/dist/img/avatars/nuala_15_celebrating.svg +0 -33
- package/dist/img/avatars/nuala_16_celebrating.svg +0 -29
- package/dist/img/avatars/nuala_17_celebrating.svg +0 -36
- package/dist/img/avatars/nuala_18_celebrating.svg +0 -34
- package/dist/img/avatars/nuala_19_celebrating.svg +0 -62
- package/dist/img/avatars/nuala_20_celebrating.svg +0 -35
- package/dist/img/avatars/nuala_21_celebrating.svg +0 -33
- package/dist/img/avatars/nuala_2_celebrating.svg +0 -21
- package/dist/img/avatars/nuala_3_celebrating.svg +0 -20
- package/dist/img/avatars/nuala_4_celebrating.svg +0 -33
- package/dist/img/avatars/nuala_5_celebrating.svg +0 -30
- package/dist/img/avatars/nuala_6_celebrating.svg +0 -37
- package/dist/img/avatars/nuala_7_celebrating.svg +0 -42
- package/dist/img/avatars/nuala_8_celebrating.svg +0 -26
- package/dist/img/avatars/nuala_9_celebrating.svg +0 -26
package/dist/Cards/Bot/Bot.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { useInView } from "react-intersection-observer";
|
|
4
4
|
import PlaceholderImages from "../../utils/placeholder-images/index";
|
|
5
|
-
import { Button,
|
|
5
|
+
import { Button, Typography, CardActionArea, CardActions, Menu, MenuItem, IconButton, Divider, Tooltip } from "@mui/material";
|
|
6
6
|
import Skeleton from "@mui/material/Skeleton";
|
|
7
7
|
import Person from "@mui/icons-material/Person";
|
|
8
8
|
import LanguageIcon from "@mui/icons-material/Public";
|
|
@@ -15,7 +15,7 @@ import DeleteIcon from "@mui/icons-material/Delete";
|
|
|
15
15
|
import ShareIcon from "@mui/icons-material/Share";
|
|
16
16
|
import CopyIcon from "@mui/icons-material/FileCopy";
|
|
17
17
|
import ProgressiveCardMedia from "../../Misc/ProgressiveCardMedia/ProgressiveCardMedia";
|
|
18
|
-
import { classes, CardContainer, CardAvatar, CardHeader, CardTitle, CardInfoSection, CardInfoSectionItem, CardDescription, CardTop, CardContent, CardMenuIcon, CardVisibility } from "../CardElements";
|
|
18
|
+
import { classes, CardContainer, CardAvatar, CardHeader, CardTitle, CardSubheader, CardInfoSection, CardInfoSectionItem, CardDescription, CardTop, CardContent, CardMenuIcon, CardVisibility } from "../CardElements";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
function OverflowMenu({
|
|
21
21
|
t,
|
|
@@ -119,7 +119,8 @@ function Bot({
|
|
|
119
119
|
disablePlays,
|
|
120
120
|
handleOpenPreview,
|
|
121
121
|
disablePreview,
|
|
122
|
-
cardTitleComponent = "h3"
|
|
122
|
+
cardTitleComponent = "h3",
|
|
123
|
+
compact = false
|
|
123
124
|
}) {
|
|
124
125
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
125
126
|
const [placeholderRef, visible] = useInView({
|
|
@@ -128,10 +129,16 @@ function Bot({
|
|
|
128
129
|
});
|
|
129
130
|
if (!bot) {
|
|
130
131
|
return /*#__PURE__*/_jsxs(CardContainer, {
|
|
132
|
+
compact: compact,
|
|
131
133
|
children: [/*#__PURE__*/_jsx(CardTop, {
|
|
132
134
|
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
133
135
|
variant: "rectangular",
|
|
134
|
-
sx:
|
|
136
|
+
sx: {
|
|
137
|
+
...classes.media,
|
|
138
|
+
...(compact ? {
|
|
139
|
+
paddingTop: "40%"
|
|
140
|
+
} : {})
|
|
141
|
+
}
|
|
135
142
|
})
|
|
136
143
|
}), /*#__PURE__*/_jsx(CardHeader, {
|
|
137
144
|
action: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -181,6 +188,7 @@ function Bot({
|
|
|
181
188
|
handleSelectBot(bot);
|
|
182
189
|
};
|
|
183
190
|
return /*#__PURE__*/_jsxs(CardContainer, {
|
|
191
|
+
compact: compact,
|
|
184
192
|
sx: disableRaised ? {} : classes.hover,
|
|
185
193
|
raised: disableRaised ? false : anchorEl,
|
|
186
194
|
"data-cy": "bot-card",
|
|
@@ -189,7 +197,12 @@ function Bot({
|
|
|
189
197
|
onClick: selectBot,
|
|
190
198
|
role: "link",
|
|
191
199
|
children: [/*#__PURE__*/_jsx(ProgressiveCardMedia, {
|
|
192
|
-
sx:
|
|
200
|
+
sx: {
|
|
201
|
+
...classes.media,
|
|
202
|
+
...(compact ? {
|
|
203
|
+
paddingTop: "40%"
|
|
204
|
+
} : {})
|
|
205
|
+
},
|
|
193
206
|
highQualitySrc: visible || !pictureXs ? cardPicture || picture || PlaceholderImages.bot : null,
|
|
194
207
|
lowQualitySrc: pictureXs,
|
|
195
208
|
title: botName,
|
|
@@ -217,12 +230,20 @@ function Bot({
|
|
|
217
230
|
badgeSize: "small",
|
|
218
231
|
sx: theme => ({
|
|
219
232
|
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
220
|
-
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white"
|
|
233
|
+
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white",
|
|
234
|
+
...(compact ? {
|
|
235
|
+
width: 44,
|
|
236
|
+
height: 44
|
|
237
|
+
} : {})
|
|
221
238
|
})
|
|
222
239
|
}) : /*#__PURE__*/_jsx(CardAvatar, {
|
|
223
240
|
sx: theme => ({
|
|
224
241
|
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
225
|
-
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white"
|
|
242
|
+
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white",
|
|
243
|
+
...(compact ? {
|
|
244
|
+
width: 44,
|
|
245
|
+
height: 44
|
|
246
|
+
} : {})
|
|
226
247
|
}),
|
|
227
248
|
"aria-label": `${t("go_to")} ${createdByName || `${botName} ${t("creator")}`} ${t("profile")}`,
|
|
228
249
|
title: createdByName || `${botName} creator`,
|
|
@@ -242,67 +263,96 @@ function Bot({
|
|
|
242
263
|
fontSize: "large"
|
|
243
264
|
})
|
|
244
265
|
})]
|
|
245
|
-
}), /*#__PURE__*/
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
action: /*#__PURE__*/_jsx(Tooltip, {
|
|
251
|
-
title: t("more_options"),
|
|
252
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
253
|
-
"aria-label": "More Options",
|
|
254
|
-
onClick: event => setAnchorEl(event.currentTarget),
|
|
255
|
-
"data-cy": `${botName}-more-options`,
|
|
256
|
-
disabled: disableActions,
|
|
257
|
-
size: "large",
|
|
258
|
-
"aria-expanded": Boolean(anchorEl),
|
|
259
|
-
children: /*#__PURE__*/_jsx(MoreVertIcon, {})
|
|
260
|
-
})
|
|
261
|
-
}),
|
|
262
|
-
subheader: createdByName
|
|
263
|
-
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(CardContent, {
|
|
264
|
-
children: [/*#__PURE__*/_jsxs(CardInfoSection, {
|
|
266
|
+
}), /*#__PURE__*/_jsxs(CardActionArea, {
|
|
267
|
+
onClick: selectBot,
|
|
268
|
+
disabled: disableActions,
|
|
269
|
+
sx: {
|
|
270
|
+
flexGrow: 1,
|
|
265
271
|
display: "flex",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
flexDirection: "column",
|
|
273
|
+
alignItems: "stretch"
|
|
274
|
+
},
|
|
275
|
+
children: [/*#__PURE__*/_jsx(CardHeader, {
|
|
276
|
+
title: /*#__PURE__*/_jsx(CardTitle, {
|
|
277
|
+
title: botName,
|
|
278
|
+
component: cardTitleComponent,
|
|
279
|
+
compact: compact
|
|
280
|
+
}),
|
|
281
|
+
action: /*#__PURE__*/_jsx(Tooltip, {
|
|
282
|
+
title: t("more_options"),
|
|
283
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
284
|
+
"aria-label": "More Options",
|
|
285
|
+
onClick: event => {
|
|
286
|
+
event.stopPropagation();
|
|
287
|
+
setAnchorEl(event.currentTarget);
|
|
288
|
+
},
|
|
289
|
+
"data-cy": `${botName}-more-options`,
|
|
290
|
+
disabled: disableActions,
|
|
291
|
+
size: "large",
|
|
292
|
+
"aria-expanded": Boolean(anchorEl),
|
|
293
|
+
children: /*#__PURE__*/_jsx(MoreVertIcon, {})
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
subheader: /*#__PURE__*/_jsx(CardSubheader, {
|
|
297
|
+
subheader: createdByName,
|
|
298
|
+
compact: compact
|
|
299
|
+
})
|
|
300
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(CardContent, {
|
|
301
|
+
children: [/*#__PURE__*/_jsxs(CardInfoSection, {
|
|
269
302
|
sx: {
|
|
270
|
-
|
|
303
|
+
columnGap: 1.5,
|
|
304
|
+
rowGap: 0.5
|
|
271
305
|
},
|
|
272
|
-
children: /*#__PURE__*/_jsxs(CardInfoSectionItem, {
|
|
273
|
-
variant: "
|
|
306
|
+
children: [/*#__PURE__*/_jsxs(CardInfoSectionItem, {
|
|
307
|
+
variant: "caption",
|
|
274
308
|
component: "span",
|
|
275
309
|
children: [/*#__PURE__*/_jsx(LanguageIcon, {
|
|
276
|
-
sx:
|
|
310
|
+
sx: {
|
|
311
|
+
...classes.infoIcon,
|
|
312
|
+
fontSize: compact ? 18 : undefined
|
|
313
|
+
},
|
|
314
|
+
fontSize: "small"
|
|
277
315
|
}), learnLang && capitalize(t(learnLang))]
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
sx: {
|
|
281
|
-
mr: 2
|
|
282
|
-
},
|
|
283
|
-
children: /*#__PURE__*/_jsxs(CardInfoSectionItem, {
|
|
284
|
-
variant: "body2",
|
|
316
|
+
}), /*#__PURE__*/_jsxs(CardInfoSectionItem, {
|
|
317
|
+
variant: "caption",
|
|
285
318
|
component: "span",
|
|
286
319
|
children: [/*#__PURE__*/_jsx(DifficultyIcon, {
|
|
287
|
-
sx:
|
|
320
|
+
sx: {
|
|
321
|
+
...classes.infoIcon,
|
|
322
|
+
fontSize: compact ? 18 : undefined
|
|
323
|
+
},
|
|
324
|
+
fontSize: "small"
|
|
288
325
|
}), t(`card_${bot.difficulty}`)]
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
326
|
+
}), !disablePlays && exerciseStartTotal > -1 && /*#__PURE__*/_jsxs(CardInfoSectionItem, {
|
|
327
|
+
variant: "caption",
|
|
328
|
+
component: "span",
|
|
329
|
+
children: [/*#__PURE__*/_jsx(PlayArrowIcon, {
|
|
330
|
+
sx: {
|
|
331
|
+
...classes.infoIcon,
|
|
332
|
+
fontSize: compact ? 18 : undefined
|
|
333
|
+
},
|
|
334
|
+
fontSize: "small"
|
|
335
|
+
}), t("plays", {
|
|
336
|
+
number: formatNumberTotal(exerciseStartTotal)
|
|
337
|
+
})]
|
|
297
338
|
})]
|
|
339
|
+
}), /*#__PURE__*/_jsx(CardDescription, {
|
|
340
|
+
variant: compact ? "caption" : "body2",
|
|
341
|
+
color: "textSecondary",
|
|
342
|
+
component: "p",
|
|
343
|
+
sx: compact ? {
|
|
344
|
+
height: "auto",
|
|
345
|
+
lineHeight: 1.4,
|
|
346
|
+
display: "-webkit-box",
|
|
347
|
+
WebkitLineClamp: 2,
|
|
348
|
+
WebkitBoxOrient: "vertical",
|
|
349
|
+
overflow: "hidden",
|
|
350
|
+
marginBottom: 1
|
|
351
|
+
} : {},
|
|
352
|
+
children: description
|
|
298
353
|
})]
|
|
299
|
-
}), /*#__PURE__*/_jsx(CardDescription, {
|
|
300
|
-
variant: "body1",
|
|
301
|
-
color: "textSecondary",
|
|
302
|
-
component: "p",
|
|
303
|
-
children: description
|
|
304
354
|
})]
|
|
305
|
-
}), /*#__PURE__*/_jsxs(CardActions, {
|
|
355
|
+
}), !compact && /*#__PURE__*/_jsxs(CardActions, {
|
|
306
356
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
307
357
|
onClick: selectBot,
|
|
308
358
|
color: "primary",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import Typography from "@mui/material/Typography";
|
|
3
|
+
import { styled } from "@mui/system";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const StyledCardSubheader = styled(Typography)(({
|
|
6
|
+
theme
|
|
7
|
+
}) => ({
|
|
8
|
+
color: theme.palette.text.secondary,
|
|
9
|
+
whiteSpace: "nowrap",
|
|
10
|
+
overflow: "hidden",
|
|
11
|
+
textOverflow: "ellipsis"
|
|
12
|
+
}));
|
|
13
|
+
function CardSubheader({
|
|
14
|
+
subheader = "",
|
|
15
|
+
component = "span",
|
|
16
|
+
compact = false
|
|
17
|
+
}) {
|
|
18
|
+
return /*#__PURE__*/_jsx(StyledCardSubheader, {
|
|
19
|
+
variant: compact ? "caption" : "body2",
|
|
20
|
+
component: component,
|
|
21
|
+
children: subheader
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
CardSubheader.propTypes = {
|
|
25
|
+
subheader: PropTypes.string,
|
|
26
|
+
component: PropTypes.string
|
|
27
|
+
};
|
|
28
|
+
export default CardSubheader;
|
|
@@ -5,17 +5,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
const StyledCardTitle = styled(Typography)(({
|
|
6
6
|
theme
|
|
7
7
|
}) => ({
|
|
8
|
-
fontSize: "1.125rem",
|
|
9
8
|
fontWeight: "600",
|
|
10
9
|
marginTop: theme.spacing(2)
|
|
11
10
|
}));
|
|
12
11
|
function CardTitle({
|
|
13
12
|
title = "",
|
|
14
|
-
component = "h3"
|
|
13
|
+
component = "h3",
|
|
14
|
+
compact = false
|
|
15
15
|
}) {
|
|
16
16
|
return /*#__PURE__*/_jsx(StyledCardTitle, {
|
|
17
|
-
variant: "
|
|
17
|
+
variant: compact ? "subtitle2" : "subtitle1",
|
|
18
18
|
component: component,
|
|
19
|
+
compact: compact,
|
|
19
20
|
noWrap: true,
|
|
20
21
|
"aria-label": title,
|
|
21
22
|
children: title
|
|
@@ -23,6 +24,7 @@ function CardTitle({
|
|
|
23
24
|
}
|
|
24
25
|
CardTitle.propTypes = {
|
|
25
26
|
title: PropTypes.string.isRequired,
|
|
26
|
-
component: PropTypes.string
|
|
27
|
+
component: PropTypes.string,
|
|
28
|
+
compact: PropTypes.bool
|
|
27
29
|
};
|
|
28
30
|
export default CardTitle;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { Box, Typography, Card, CardHeader as MuiCardHeader, Avatar, CardContent as MuiCardContent } from "@mui/material";
|
|
2
2
|
import { styled } from "@mui/system";
|
|
3
3
|
import CardTitle from "./CardTitle/CardTitle";
|
|
4
|
+
import CardSubheader from "./CardSubheader/CardSubheader";
|
|
4
5
|
import CardVisibility from "./CardVisibility/CardVisibility";
|
|
5
6
|
import NualangVerifiedIcon from "../../Misc/NualangVerifiedIcon/NualangVerifiedIcon";
|
|
6
7
|
import MedalSelector from "../../Misc/MedalSelector/MedalSelector";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const CardContainer = styled(Card
|
|
9
|
-
|
|
9
|
+
const CardContainer = styled(Card, {
|
|
10
|
+
shouldForwardProp: prop => prop !== "compact"
|
|
11
|
+
})(({
|
|
12
|
+
theme,
|
|
13
|
+
compact
|
|
10
14
|
}) => ({
|
|
11
15
|
textAlign: "left",
|
|
12
16
|
maxWidth: 600,
|
|
13
|
-
|
|
17
|
+
...(compact && {
|
|
18
|
+
width: "100%"
|
|
19
|
+
}),
|
|
20
|
+
...(!compact && {
|
|
21
|
+
minWidth: 320
|
|
22
|
+
}),
|
|
14
23
|
display: "flex",
|
|
15
24
|
flexDirection: "column",
|
|
16
25
|
borderRadius: theme.spacing(2),
|
|
@@ -109,7 +118,10 @@ const CardInfoSection = styled(Box)(({
|
|
|
109
118
|
marginBottom: 0
|
|
110
119
|
},
|
|
111
120
|
marginBottom: theme.spacing(2),
|
|
112
|
-
color: theme.palette.text.secondary
|
|
121
|
+
color: theme.palette.text.secondary,
|
|
122
|
+
display: "flex",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
flexWrap: "wrap"
|
|
113
125
|
}));
|
|
114
126
|
const CardInfoSectionItem = styled(Typography)(() => ({
|
|
115
127
|
display: "flex",
|
|
@@ -166,4 +178,4 @@ const classes = {
|
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
};
|
|
169
|
-
export { classes, CardContainer, CardTop, CardAvatar, CardHeader, CardTitle, CardContent, CardInfoSection, CardInfoSectionItem, CardDescription, CardMenuIcon, CardVisibility, LoadingCardContainer };
|
|
181
|
+
export { classes, CardContainer, CardTop, CardAvatar, CardHeader, CardTitle, CardSubheader, CardContent, CardInfoSection, CardInfoSectionItem, CardDescription, CardMenuIcon, CardVisibility, LoadingCardContainer };
|
|
@@ -15,7 +15,7 @@ import { capitalize } from "../../utils/index";
|
|
|
15
15
|
import PlaceholderImages from "../../utils/placeholder-images/index";
|
|
16
16
|
import ProgressiveCardMedia from "../../Misc/ProgressiveCardMedia/ProgressiveCardMedia";
|
|
17
17
|
import useClassroomState from "../../hooks/useClassroomState";
|
|
18
|
-
import { classes, CardContainer, CardAvatar, CardHeader, CardTitle, CardInfoSection, CardDescription, CardTop, CardContent, CardMenuIcon, CardVisibility } from "../CardElements";
|
|
18
|
+
import { classes, CardContainer, CardAvatar, CardHeader, CardTitle, CardSubheader, CardInfoSection, CardDescription, CardTop, CardContent, CardMenuIcon, CardVisibility } from "../CardElements";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
20
|
function OverflowMenu({
|
|
21
21
|
t,
|
|
@@ -67,12 +67,20 @@ function OverflowMenu({
|
|
|
67
67
|
})]
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function ClassroomLoading(
|
|
70
|
+
function ClassroomLoading({
|
|
71
|
+
compact = false
|
|
72
|
+
}) {
|
|
71
73
|
return /*#__PURE__*/_jsxs(CardContainer, {
|
|
74
|
+
compact: compact,
|
|
72
75
|
children: [/*#__PURE__*/_jsx(CardTop, {
|
|
73
76
|
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
74
77
|
variant: "rectangular",
|
|
75
|
-
sx:
|
|
78
|
+
sx: {
|
|
79
|
+
...classes.media,
|
|
80
|
+
...(compact ? {
|
|
81
|
+
paddingTop: "40%"
|
|
82
|
+
} : {})
|
|
83
|
+
}
|
|
76
84
|
})
|
|
77
85
|
}), /*#__PURE__*/_jsx(CardHeader, {
|
|
78
86
|
action: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -91,8 +99,6 @@ function ClassroomLoading() {
|
|
|
91
99
|
})
|
|
92
100
|
}), /*#__PURE__*/_jsxs(CardContent, {
|
|
93
101
|
children: [/*#__PURE__*/_jsxs(CardInfoSection, {
|
|
94
|
-
display: "flex",
|
|
95
|
-
alignItems: "center",
|
|
96
102
|
children: [/*#__PURE__*/_jsx(Skeleton, {
|
|
97
103
|
height: 12,
|
|
98
104
|
width: "20%"
|
|
@@ -129,7 +135,8 @@ function ClassroomCard({
|
|
|
129
135
|
handleViewUserProfile,
|
|
130
136
|
disableRaised,
|
|
131
137
|
cardTitleComponent = "h3",
|
|
132
|
-
featureFlags
|
|
138
|
+
featureFlags,
|
|
139
|
+
compact = false
|
|
133
140
|
}) {
|
|
134
141
|
const [placeholderRef, visible] = useInView({
|
|
135
142
|
rootMargin: "320px",
|
|
@@ -196,14 +203,21 @@ function ClassroomCard({
|
|
|
196
203
|
const memberCount = membersQuery.isSuccess ? (membersQuery.data.Items || []).length : 0;
|
|
197
204
|
const isInviteFeatureDisabled = classroomId && classroomId.toLowerCase().includes("wayside");
|
|
198
205
|
return /*#__PURE__*/_jsxs(CardContainer, {
|
|
206
|
+
compact: compact,
|
|
199
207
|
sx: disableRaised ? {} : classes.hover,
|
|
200
208
|
raised: disableRaised ? false : anchorEl,
|
|
209
|
+
"data-cy": "classroom-card",
|
|
201
210
|
children: [/*#__PURE__*/_jsxs(CardTop, {
|
|
202
211
|
children: [/*#__PURE__*/_jsxs(CardActionArea, {
|
|
203
212
|
onClick: handleClickImage,
|
|
204
213
|
role: "link",
|
|
205
214
|
children: [/*#__PURE__*/_jsx(ProgressiveCardMedia, {
|
|
206
|
-
sx:
|
|
215
|
+
sx: {
|
|
216
|
+
...classes.media,
|
|
217
|
+
...(compact ? {
|
|
218
|
+
paddingTop: "40%"
|
|
219
|
+
} : {})
|
|
220
|
+
},
|
|
207
221
|
highQualitySrc: visible || !pictureXs ? cardPicture || picture || PlaceholderImages.classroom : null,
|
|
208
222
|
lowQualitySrc: pictureXs,
|
|
209
223
|
title: classroomName,
|
|
@@ -216,7 +230,11 @@ function ClassroomCard({
|
|
|
216
230
|
}), userImage ? /*#__PURE__*/_jsx(CardAvatar, {
|
|
217
231
|
sx: theme => ({
|
|
218
232
|
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
219
|
-
color: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd"
|
|
233
|
+
color: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
234
|
+
...(compact ? {
|
|
235
|
+
width: 44,
|
|
236
|
+
height: 44
|
|
237
|
+
} : {})
|
|
220
238
|
}),
|
|
221
239
|
"aria-label": `${t("go_to")} ${createdByName || `${classroomName} ${t("creator")}`} ${t("profile")}`,
|
|
222
240
|
title: createdByName || `${classroomName} creator`,
|
|
@@ -236,7 +254,11 @@ function ClassroomCard({
|
|
|
236
254
|
}) : /*#__PURE__*/_jsx(CardAvatar, {
|
|
237
255
|
sx: theme => ({
|
|
238
256
|
backgroundColor: theme.palette.mode === "dark" ? "#ffffff" : "#bdbdbd",
|
|
239
|
-
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white"
|
|
257
|
+
color: theme.palette.mode === "dark" ? theme.palette.background.default : "white",
|
|
258
|
+
...(compact ? {
|
|
259
|
+
width: 44,
|
|
260
|
+
height: 44
|
|
261
|
+
} : {})
|
|
240
262
|
}),
|
|
241
263
|
"aria-label": `${t("go_to")} ${createdByName || `${classroomName} ${t("creator")}`} ${t("profile")}`,
|
|
242
264
|
title: createdByName || `${classroomName} creator`,
|
|
@@ -271,18 +293,20 @@ function ClassroomCard({
|
|
|
271
293
|
}),
|
|
272
294
|
title: /*#__PURE__*/_jsx(CardTitle, {
|
|
273
295
|
title: classroomName,
|
|
274
|
-
component: cardTitleComponent
|
|
296
|
+
component: cardTitleComponent,
|
|
297
|
+
compact: compact
|
|
275
298
|
}),
|
|
276
|
-
subheader:
|
|
277
|
-
|
|
278
|
-
|
|
299
|
+
subheader: /*#__PURE__*/_jsx(CardSubheader, {
|
|
300
|
+
subheader: t("learn_for_speakers_of", {
|
|
301
|
+
learnLang: capitalize(t(learnLang)),
|
|
302
|
+
forLang: capitalize(t(forLang))
|
|
303
|
+
}),
|
|
304
|
+
compact: compact
|
|
279
305
|
})
|
|
280
306
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(CardContent, {
|
|
281
307
|
children: [/*#__PURE__*/_jsxs(CardInfoSection, {
|
|
282
|
-
display: "flex",
|
|
283
|
-
alignItems: "center",
|
|
284
308
|
children: [membersQuery.isLoading ? /*#__PURE__*/_jsxs(Typography, {
|
|
285
|
-
variant: "
|
|
309
|
+
variant: "caption",
|
|
286
310
|
sx: isCreator ? classes.cursorPointer : null,
|
|
287
311
|
onClick: isCreator ? handleClickOpenMembers : null,
|
|
288
312
|
children: [/*#__PURE__*/_jsx(CircularProgress, {
|
|
@@ -290,7 +314,7 @@ function ClassroomCard({
|
|
|
290
314
|
color: "inherit"
|
|
291
315
|
}), " ", memberCount === 1 ? t("member") : t("members")]
|
|
292
316
|
}) : /*#__PURE__*/_jsxs(Typography, {
|
|
293
|
-
variant: "
|
|
317
|
+
variant: "caption",
|
|
294
318
|
sx: isCreator ? classes.cursorPointer : null,
|
|
295
319
|
onClick: isCreator ? handleClickOpenMembers : null,
|
|
296
320
|
children: [memberCount, " ", memberCount === 1 ? t("member") : t("members")]
|
|
@@ -300,12 +324,21 @@ function ClassroomCard({
|
|
|
300
324
|
}
|
|
301
325
|
})]
|
|
302
326
|
}), /*#__PURE__*/_jsx(CardDescription, {
|
|
303
|
-
variant: "
|
|
327
|
+
variant: compact ? "caption" : "body2",
|
|
304
328
|
color: "textSecondary",
|
|
305
329
|
component: "p",
|
|
330
|
+
sx: compact ? {
|
|
331
|
+
height: "auto",
|
|
332
|
+
lineHeight: 1.4,
|
|
333
|
+
display: "-webkit-box",
|
|
334
|
+
WebkitLineClamp: 2,
|
|
335
|
+
WebkitBoxOrient: "vertical",
|
|
336
|
+
overflow: "hidden",
|
|
337
|
+
marginBottom: 1
|
|
338
|
+
} : {},
|
|
306
339
|
children: description
|
|
307
340
|
})]
|
|
308
|
-
}), /*#__PURE__*/_jsxs(CardActions, {
|
|
341
|
+
}), !compact && /*#__PURE__*/_jsxs(CardActions, {
|
|
309
342
|
children: [isCreator && /*#__PURE__*/_jsx(Button, {
|
|
310
343
|
onClick: viewClassroom,
|
|
311
344
|
color: "primary",
|
|
@@ -355,7 +388,9 @@ function ClassroomCard({
|
|
|
355
388
|
}
|
|
356
389
|
function Classroom(props) {
|
|
357
390
|
if (!props.classroom) {
|
|
358
|
-
return /*#__PURE__*/_jsx(ClassroomLoading, {
|
|
391
|
+
return /*#__PURE__*/_jsx(ClassroomLoading, {
|
|
392
|
+
compact: props.compact
|
|
393
|
+
});
|
|
359
394
|
}
|
|
360
395
|
return /*#__PURE__*/_jsx(ClassroomCard, {
|
|
361
396
|
...props
|