@nualang/nualang-ui-components 0.1.1221 → 0.1.1223

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.
@@ -23,7 +23,7 @@ function Category({
23
23
  const isSmallScreen = (0, _useMediaQuery.default)(theme.breakpoints.down("sm"));
24
24
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Card, {
25
25
  sx: {
26
- minHeight: isSmallScreen ? 40 : 150,
26
+ minHeight: isSmallScreen ? 100 : 150,
27
27
  background: backgroundColor,
28
28
  color: "white",
29
29
  position: "relative",
@@ -51,7 +51,7 @@ function Category({
51
51
  sx: {
52
52
  display: "flex",
53
53
  justifyContent: "flex-start",
54
- maxWidth: "55%"
54
+ maxWidth: isSmallScreen ? "75%" : "55%"
55
55
  },
56
56
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardElements.CardContent, {
57
57
  sx: {
@@ -85,7 +85,7 @@ function Category({
85
85
  })]
86
86
  }), image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
87
87
  src: image,
88
- alt: "category",
88
+ alt: `${categoryTitle} category image`,
89
89
  style: {
90
90
  position: "absolute",
91
91
  bottom: 10,
@@ -117,6 +117,8 @@ function AppSearch({
117
117
  const [debouncedSearchText, setDebouncedSearchText] = (0, _react.useState)("");
118
118
  const [prevDebouncedSearchText, setPrevDebouncedSearchText] = (0, _react.useState)("");
119
119
  const location = (0, _reactRouterDom.useLocation)().pathname;
120
+ const queryParams = new URLSearchParams(window.location.search);
121
+ const queryParamsSearchText = queryParams.get('searchText') || '';
120
122
  const handleSearchContent = (0, _react.useCallback)(text => {
121
123
  const searchQuery = text !== undefined ? text : debouncedSearchText;
122
124
  const extraData = {
@@ -135,6 +137,11 @@ function AppSearch({
135
137
  setPrevDebouncedSearchText("");
136
138
  }
137
139
  }, [location, setSearchText, setDebouncedSearchText]);
140
+ (0, _react.useEffect)(() => {
141
+ if (queryParamsSearchText.trim() !== '' && searchText.trim() === '') {
142
+ setSearchText(queryParamsSearchText);
143
+ }
144
+ }, [queryParamsSearchText, setSearchText]);
138
145
  (0, _react.useEffect)(() => {
139
146
  if (debouncedSearchText && debouncedSearchText !== prevDebouncedSearchText) {
140
147
  handleSearchContent();
@@ -285,7 +292,7 @@ function App({
285
292
  };
286
293
  const isSearchActive = searchText || isMobileSearchExpanded;
287
294
  const isTeacher = user && user["custom:role"] === "teach";
288
- const isUpgradePossible = subscription && !subscription.isPaidUser && subscription.isUpgradePossible;
295
+ const isUpgradePossible = subscription && subscription.isUpgradePossible;
289
296
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
290
297
  className: classes.root,
291
298
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Header.default, {
@@ -376,16 +383,7 @@ function App({
376
383
  onClick: handleClickCreate,
377
384
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {})
378
385
  })
379
- })), isUpgradePossible && authenticated && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultColourButton.default, {
380
- variant: "contained",
381
- href: upgradePlanURL,
382
- size: isLgScreen ? "medium" : "small",
383
- sx: {
384
- fontSize: isLgScreen ? null : 12,
385
- ml: 1
386
- },
387
- children: t("upgrade_plan")
388
- }), isLgScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WhatsNew.default, {
386
+ })), isLgScreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_WhatsNew.default, {
389
387
  t: t,
390
388
  whatsNewMarkdown: whatsNewMarkdown,
391
389
  whatsNewDate: whatsNewDate
@@ -472,6 +470,7 @@ function App({
472
470
  authenticated: authenticated,
473
471
  verificationStatus: verificationStatus,
474
472
  gameAward: gameAward,
473
+ subscription: subscription,
475
474
  ...user
476
475
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomBar.default, {
477
476
  navigation: bottomNav,
@@ -157,6 +157,43 @@ function FeedbackForm({
157
157
  });
158
158
  }
159
159
  }, [aiGrade]);
160
+ (0, _react.useEffect)(() => {
161
+ const initialSliders = {
162
+ feedback1: [{
163
+ feedbackLevel: 0,
164
+ feedbackLevelName: "Novice Low"
165
+ }],
166
+ feedback2: [{
167
+ feedbackLevel: 0,
168
+ feedbackLevelName: "Novice Low"
169
+ }],
170
+ feedback3: [{
171
+ feedbackLevel: 0,
172
+ feedbackLevelName: "Novice Low"
173
+ }],
174
+ feedback4: [{
175
+ feedbackLevel: 0,
176
+ feedbackLevelName: "Novice Low"
177
+ }],
178
+ feedback5: [{
179
+ feedbackLevel: 0,
180
+ feedbackLevelName: "Novice Low"
181
+ }],
182
+ feedback6: [{
183
+ feedbackLevel: 0,
184
+ feedbackLevelName: "Novice Low"
185
+ }],
186
+ feedbackText: ""
187
+ };
188
+ Object.entries(initialSliders).forEach(([field, value]) => {
189
+ handleChange({
190
+ target: {
191
+ name: field,
192
+ value
193
+ }
194
+ });
195
+ });
196
+ }, [selectedAttendeeName]);
160
197
  const marks = [{
161
198
  value: 0,
162
199
  label: "Novice Low"
@@ -166,10 +166,11 @@ function TranscriptBox({
166
166
  title: isWordNearCorrect ? t("word_near_correct") : `${t("pronunciation_score")}: ${wordPronunciationScorePercentage > -1 ? wordPronunciationScorePercentage : 0}%`,
167
167
  sx: theme => ({
168
168
  marginBottom: 4,
169
+ fontStyle: isWordNearCorrect ? 'italic' : 'normal',
169
170
  textDecoration: result === "incorrect" || result === "partially_correct" && !isWordCorrect ? "underline" : "none",
170
- color: isWordCorrect ? theme.palette.success.dark : isWordNearCorrect ? theme.palette.mode === "light" ? _colors.orange[900] : _colors.orange[200] : theme.palette.error.dark,
171
+ color: isWordCorrect ? theme.palette.success.dark : isWordNearCorrect ? theme.palette.mode === "light" ? _colors.orange[400] : _colors.orange[200] : theme.palette.error.dark,
171
172
  ...(isWordCorrect && wordPronunciationScorePercentage < 90 && {
172
- color: theme.palette.mode === "light" ? _colors.orange[900] : _colors.orange[200],
173
+ color: theme.palette.mode === "light" ? _colors.orange[400] : _colors.orange[200],
173
174
  fontStyle: "italic"
174
175
  })
175
176
  }),
@@ -19,6 +19,7 @@ var _styles = require("@mui/material/styles");
19
19
  var _index = require("../../utils/index");
20
20
  var _NualangVerifiedIcon = _interopRequireDefault(require("../../Misc/NualangVerifiedIcon/NualangVerifiedIcon"));
21
21
  var _MedalSelector = _interopRequireDefault(require("../../Misc/MedalSelector/MedalSelector"));
22
+ var _KeyboardDoubleArrowUp = _interopRequireDefault(require("@mui/icons-material/KeyboardDoubleArrowUp"));
22
23
  var _nav = _interopRequireDefault(require("../_nav"));
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
25
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -90,6 +91,27 @@ const useStyles = (0, _mui.makeStyles)()((theme, {
90
91
  color: theme.palette.primary.contrastText,
91
92
  backgroundColor: `${theme.palette.primary.main} !important`
92
93
  },
94
+ upgradeListItem: {
95
+ borderRadius: theme.shape.borderRadius,
96
+ marginBottom: theme.spacing(1),
97
+ textTransform: "capitalize",
98
+ transition: "background-color 0.3s ease-in-out, color 0.3s ease-in-out",
99
+ color: theme.palette.primary.main,
100
+ fontWeight: 500,
101
+ "&:hover": {
102
+ backgroundColor: theme.palette.mode === 'light' ? "#fdedff" : ""
103
+ }
104
+ },
105
+ upgradeListItemSelected: {
106
+ backgroundColor: `${theme.palette.primary.main} !important`,
107
+ color: `${theme.palette.primary.contrastText} !important`
108
+ },
109
+ upgradeSelectedIcon: {
110
+ color: theme.palette.primary.main
111
+ },
112
+ upgradeIconSelected: {
113
+ color: theme.palette.primary.contrastText
114
+ },
93
115
  selectedIcon: {
94
116
  color: theme.palette.primary.contrastText
95
117
  },
@@ -107,7 +129,8 @@ function NavItem({
107
129
  item,
108
130
  closeMobileDrawer,
109
131
  t,
110
- isCollapsed
132
+ isCollapsed,
133
+ upgradeItem
111
134
  }) {
112
135
  const location = (0, _reactRouterDom.useLocation)();
113
136
  const {
@@ -135,13 +158,13 @@ function NavItem({
135
158
  }
136
159
  const listItem = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItem, {
137
160
  button: true,
138
- className: classes.listItem,
161
+ className: upgradeItem ? classes.upgradeListItem : classes.listItem,
139
162
  component: component,
140
163
  onClick: onClick,
141
164
  to: to,
142
165
  selected: isSelected,
143
166
  classes: {
144
- selected: classes.listItemSelected
167
+ selected: upgradeItem ? classes.upgradeListItemSelected : classes.listItemSelected
145
168
  },
146
169
  href: href,
147
170
  target: target,
@@ -150,15 +173,15 @@ function NavItem({
150
173
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
151
174
  title: t(item.name),
152
175
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
153
- className: isSelected ? classes.selectedIcon : "",
154
- "aria-label": undefined,
176
+ className: upgradeItem ? isSelected ? classes.upgradeIconSelected : classes.upgradeSelectedIcon : isSelected ? classes.selectedIcon : "",
155
177
  children: item.icon
156
178
  })
157
179
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
158
180
  primaryTypographyProps: {
159
181
  noWrap: true
160
182
  },
161
- primary: t(item.name)
183
+ primary: t(item.name),
184
+ secondary: t(item.secondary)
162
185
  }), item.links && item.links.length > 0 && !isCollapsed && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemSecondaryAction, {
163
186
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
164
187
  onClick: handleClick,
@@ -236,8 +259,10 @@ function ResponsiveDrawer({
236
259
  navToSettings,
237
260
  authenticated,
238
261
  verificationStatus = "",
239
- gameAward = ""
262
+ gameAward = "",
263
+ subscription
240
264
  }) {
265
+ const isUpgradePossible = subscription && subscription.isUpgradePossible;
241
266
  const isGeneratedEmail = (0, _index.checkIsGeneratedEmail)(email);
242
267
  const {
243
268
  classes
@@ -450,16 +475,44 @@ function ResponsiveDrawer({
450
475
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Hidden, {
451
476
  smDown: true,
452
477
  implementation: "js",
453
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Drawer, {
478
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Drawer, {
454
479
  classes: {
455
480
  paper: classes.drawerPaper
456
481
  },
457
482
  variant: "permanent",
458
483
  open: true,
459
- children: [drawer, /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
460
- className: classes.toolbar,
461
- children: footerIcon(handleCollapseToggle)
462
- })]
484
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
485
+ display: "flex",
486
+ flexDirection: "column",
487
+ height: "100%",
488
+ children: [drawer, /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
489
+ flexGrow: 1
490
+ }), " ", isUpgradePossible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
491
+ sx: {
492
+ overflowY: "auto",
493
+ overflowX: "hidden",
494
+ paddingLeft: theme.spacing(1),
495
+ paddingRight: theme.spacing(1)
496
+ },
497
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NavItem, {
498
+ index: 0,
499
+ classes: classes,
500
+ Link: Link,
501
+ item: {
502
+ name: "upgrade_plan",
503
+ secondary: `subscription_status_${subscription?.subscriptionStatus}`,
504
+ url: "/settings#Subscription",
505
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardDoubleArrowUp.default, {})
506
+ },
507
+ t: t,
508
+ isCollapsed: isCollapsed,
509
+ upgradeItem: true
510
+ })
511
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
512
+ className: classes.toolbar,
513
+ children: footerIcon(handleCollapseToggle)
514
+ })]
515
+ })
463
516
  })
464
517
  })]
465
518
  });
@@ -71,31 +71,13 @@ const navigation = {
71
71
  url: "/dashboard",
72
72
  icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Home.default, {})
73
73
  }, {
74
- name: "library",
75
- open: true,
76
- //url: '/library',
77
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LibraryBooks.default, {}),
78
- links: [{
79
- name: "roleplays",
80
- url: "/roleplays",
81
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Forum.default, {})
82
- }, {
83
- name: "bots",
84
- url: "/bots",
85
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Face.default, {})
86
- }, {
87
- name: "courses",
88
- url: "/courses",
89
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BubbleChart.default, {})
90
- }]
74
+ name: "courses",
75
+ url: "/courses",
76
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BubbleChart.default, {})
91
77
  }, {
92
78
  name: "classrooms",
93
79
  url: "/classrooms",
94
80
  icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_School.default, {})
95
- }, {
96
- name: "activity",
97
- url: "/activity",
98
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Timeline.default, {})
99
81
  },
100
82
  // {
101
83
  // divider: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nualang/nualang-ui-components",
3
- "version": "0.1.1221",
3
+ "version": "0.1.1223",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",