@elice/material-runbox 1.250310.0 → 1.250313.0

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.
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
+ import type { TagProps } from '@elice/mui-elements';
3
+ export type GetAchievementColor = {
4
+ (params: {
5
+ score: number;
6
+ variant: 'text' | 'chart';
7
+ }): string | null;
8
+ (params: {
9
+ score: number;
10
+ variant: 'tag';
11
+ }): TagProps['color'];
12
+ };
2
13
  export interface MaterialRunboxContentProps {
3
14
  /** Runbox ID. */
4
15
  runboxId: string | null;
@@ -10,6 +21,8 @@ export interface MaterialRunboxContentProps {
10
21
  userId: number;
11
22
  /** Whether tutoring is enabled. */
12
23
  isTutoring: boolean;
24
+ /** Used for submit log score tag color. */
25
+ getAchievementColor?: GetAchievementColor;
13
26
  }
14
27
  declare const MaterialRunboxContent: React.FC<MaterialRunboxContentProps>;
15
28
  export default MaterialRunboxContent;
@@ -35,7 +35,8 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
35
35
  enabledLxpPlan = _ref.enabledLxpPlan,
36
36
  userId = _ref.userId,
37
37
  _ref$isTutoring = _ref.isTutoring,
38
- isTutoring = _ref$isTutoring === void 0 ? false : _ref$isTutoring;
38
+ isTutoring = _ref$isTutoring === void 0 ? false : _ref$isTutoring,
39
+ getAchievementColor = _ref.getAchievementColor;
39
40
  var intl$1 = intl.useRawEliceIntl();
40
41
  var _useMaterialRunboxCon = MaterialRunboxContext.useMaterialRunboxContext(),
41
42
  showMessenger = _useMaterialRunboxCon.showMessenger;
@@ -170,7 +171,8 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
170
171
  courseId: courseId,
171
172
  userId: userId,
172
173
  isTutoring: isTutoring,
173
- refetch: refetch
174
+ refetch: refetch,
175
+ getAchievementColor: getAchievementColor
174
176
  };
175
177
  return jsxRuntime.jsx(MaterialRunboxCommandContext.default, {
176
178
  runtime: runtime,
@@ -45,7 +45,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
45
45
  courseId = _ref3.courseId,
46
46
  userId = _ref3.userId,
47
47
  isTutoring = _ref3.isTutoring,
48
- refetch = _ref3.refetch;
48
+ refetch = _ref3.refetch,
49
+ getAchievementColor = _ref3.getAchievementColor;
49
50
  var intl$1 = intl.useRawEliceIntl();
50
51
  var _useMaterialRunboxCon = MaterialRunboxContext.useMaterialRunboxContext(),
51
52
  enableAutoShutdownToggle = _useMaterialRunboxCon.enableAutoShutdownToggle;
@@ -127,7 +128,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
127
128
  *
128
129
  */
129
130
  var renderHeaderActionGrade = function renderHeaderActionGrade() {
130
- if (!runbox.submission.enabled) {
131
+ if (!runbox.submission.enabled || isTutoring) {
131
132
  return null;
132
133
  }
133
134
  return jsxRuntime.jsx(MaterialRunboxActionGrade.default, {
@@ -160,7 +161,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
160
161
  isTutoring: isTutoring,
161
162
  menuAnchorEl: menuAnchorEl,
162
163
  refetch: refetch,
163
- handleMenuClose: handleMenuClose
164
+ handleMenuClose: handleMenuClose,
165
+ getAchievementColor: getAchievementColor
164
166
  })]
165
167
  });
166
168
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { RuntimeProps } from '../runtime/Runtime';
3
- type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'isTutoring'> & {
3
+ type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'isTutoring' | 'getAchievementColor'> & {
4
4
  menuAnchorEl: null | HTMLButtonElement;
5
5
  handleMenuClose: () => void;
6
6
  };
@@ -26,6 +26,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
26
26
  isTutoring = _ref.isTutoring,
27
27
  menuAnchorEl = _ref.menuAnchorEl,
28
28
  refetch = _ref.refetch,
29
+ getAchievementColor = _ref.getAchievementColor,
29
30
  handleMenuClose = _ref.handleMenuClose;
30
31
  var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
31
32
  status = _useEliceRunboxRunnin.status;
@@ -66,6 +67,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
66
67
  runboxId: runbox === null || runbox === void 0 ? void 0 : runbox.id,
67
68
  userId: userId,
68
69
  eliceCourseId: courseId,
70
+ getAchievementColor: getAchievementColor,
69
71
  handleMenuClose: handleMenuClose
70
72
  }) : jsxRuntime.jsx(MaterialRunboxActionReset.default, {
71
73
  runtime: runtime,
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { RunboxRunboxIdGradeGetRequest } from '@elice/openapi-client-material-runbox';
3
+ import type { GetAchievementColor } from '../MaterialRunboxContent';
3
4
  export type MaterialRunboxActionSubmitLogProps = Omit<RunboxRunboxIdGradeGetRequest, 'skip' | 'count'> & {
4
5
  handleMenuClose: () => void;
6
+ getAchievementColor?: GetAchievementColor;
5
7
  };
6
8
  declare const MaterialRunboxActionSubmitLog: React.FC<MaterialRunboxActionSubmitLogProps>;
7
9
  export default MaterialRunboxActionSubmitLog;
@@ -29,7 +29,8 @@ var dayjs__default = /*#__PURE__*/_interopDefaultCompat(dayjs);
29
29
  var MaterialRunboxActionSubmitLogDialog = function MaterialRunboxActionSubmitLogDialog(_a) {
30
30
  var isOpen = _a.isOpen,
31
31
  onClose = _a.onClose,
32
- props = tslib.__rest(_a, ["isOpen", "onClose"]);
32
+ getAchievementColor = _a.getAchievementColor,
33
+ props = tslib.__rest(_a, ["isOpen", "onClose", "getAchievementColor"]);
33
34
  var intl$1 = intl.useRawEliceIntl();
34
35
  //
35
36
  var _useMaterialRunboxCon = MaterialRunboxContext.useMaterialRunboxContext(),
@@ -93,7 +94,10 @@ var MaterialRunboxActionSubmitLogDialog = function MaterialRunboxActionSubmitLog
93
94
  gap: "0.5rem",
94
95
  children: [(item === null || item === void 0 ? void 0 : item.score) ? jsxRuntime.jsx(muiElements.Tag, {
95
96
  variant: "muted",
96
- color: "info",
97
+ color: typeof getAchievementColor === 'function' ? getAchievementColor({
98
+ score: Number(item.score),
99
+ variant: 'tag'
100
+ }) : 'info',
97
101
  label: intl$1.formatMessage({
98
102
  id: 'runbox.common.score'
99
103
  }, {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { RunboxGetAndListResponse, RuntimeGetAndListResponse, RuntimeTemplateGetAndListResponse } from '@elice/openapi-client-material-runbox';
3
3
  import type { QueryObserverResult } from '@tanstack/react-query';
4
+ import type { GetAchievementColor } from '../MaterialRunboxContent';
4
5
  export interface RuntimeProps {
5
6
  /** */
6
7
  runbox: RunboxGetAndListResponse;
@@ -20,6 +21,8 @@ export interface RuntimeProps {
20
21
  RuntimeGetAndListResponse,
21
22
  RuntimeTemplateGetAndListResponse
22
23
  ], unknown>>;
24
+ /** */
25
+ getAchievementColor?: GetAchievementColor;
23
26
  }
24
27
  declare const Runtime: React.FC<RuntimeProps>;
25
28
  export default Runtime;
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
+ import type { TagProps } from '@elice/mui-elements';
3
+ export type GetAchievementColor = {
4
+ (params: {
5
+ score: number;
6
+ variant: 'text' | 'chart';
7
+ }): string | null;
8
+ (params: {
9
+ score: number;
10
+ variant: 'tag';
11
+ }): TagProps['color'];
12
+ };
2
13
  export interface MaterialRunboxContentProps {
3
14
  /** Runbox ID. */
4
15
  runboxId: string | null;
@@ -10,6 +21,8 @@ export interface MaterialRunboxContentProps {
10
21
  userId: number;
11
22
  /** Whether tutoring is enabled. */
12
23
  isTutoring: boolean;
24
+ /** Used for submit log score tag color. */
25
+ getAchievementColor?: GetAchievementColor;
13
26
  }
14
27
  declare const MaterialRunboxContent: React.FC<MaterialRunboxContentProps>;
15
28
  export default MaterialRunboxContent;
@@ -31,7 +31,8 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
31
31
  enabledLxpPlan = _ref.enabledLxpPlan,
32
32
  userId = _ref.userId,
33
33
  _ref$isTutoring = _ref.isTutoring,
34
- isTutoring = _ref$isTutoring === void 0 ? false : _ref$isTutoring;
34
+ isTutoring = _ref$isTutoring === void 0 ? false : _ref$isTutoring,
35
+ getAchievementColor = _ref.getAchievementColor;
35
36
  var intl = useRawEliceIntl();
36
37
  var _useMaterialRunboxCon = useMaterialRunboxContext(),
37
38
  showMessenger = _useMaterialRunboxCon.showMessenger;
@@ -166,7 +167,8 @@ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
166
167
  courseId: courseId,
167
168
  userId: userId,
168
169
  isTutoring: isTutoring,
169
- refetch: refetch
170
+ refetch: refetch,
171
+ getAchievementColor: getAchievementColor
170
172
  };
171
173
  return jsx(MaterialRunboxCommandContextProvider, {
172
174
  runtime: runtime,
@@ -36,7 +36,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
36
36
  courseId = _ref3.courseId,
37
37
  userId = _ref3.userId,
38
38
  isTutoring = _ref3.isTutoring,
39
- refetch = _ref3.refetch;
39
+ refetch = _ref3.refetch,
40
+ getAchievementColor = _ref3.getAchievementColor;
40
41
  var intl = useRawEliceIntl();
41
42
  var _useMaterialRunboxCon = useMaterialRunboxContext(),
42
43
  enableAutoShutdownToggle = _useMaterialRunboxCon.enableAutoShutdownToggle;
@@ -118,7 +119,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
118
119
  *
119
120
  */
120
121
  var renderHeaderActionGrade = function renderHeaderActionGrade() {
121
- if (!runbox.submission.enabled) {
122
+ if (!runbox.submission.enabled || isTutoring) {
122
123
  return null;
123
124
  }
124
125
  return jsx(MaterialRunboxActionGrade, {
@@ -151,7 +152,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref3) {
151
152
  isTutoring: isTutoring,
152
153
  menuAnchorEl: menuAnchorEl,
153
154
  refetch: refetch,
154
- handleMenuClose: handleMenuClose
155
+ handleMenuClose: handleMenuClose,
156
+ getAchievementColor: getAchievementColor
155
157
  })]
156
158
  });
157
159
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { RuntimeProps } from '../runtime/Runtime';
3
- type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'isTutoring'> & {
3
+ type MaterialRunboxActionMenuProps = Pick<RuntimeProps, 'runbox' | 'runtime' | 'courseId' | 'refetch' | 'userId' | 'isTutoring' | 'getAchievementColor'> & {
4
4
  menuAnchorEl: null | HTMLButtonElement;
5
5
  handleMenuClose: () => void;
6
6
  };
@@ -18,6 +18,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
18
18
  isTutoring = _ref.isTutoring,
19
19
  menuAnchorEl = _ref.menuAnchorEl,
20
20
  refetch = _ref.refetch,
21
+ getAchievementColor = _ref.getAchievementColor,
21
22
  handleMenuClose = _ref.handleMenuClose;
22
23
  var _useEliceRunboxRunnin = useEliceRunboxRunning(),
23
24
  status = _useEliceRunboxRunnin.status;
@@ -58,6 +59,7 @@ var MaterialRunboxActionMenu = function MaterialRunboxActionMenu(_ref) {
58
59
  runboxId: runbox === null || runbox === void 0 ? void 0 : runbox.id,
59
60
  userId: userId,
60
61
  eliceCourseId: courseId,
62
+ getAchievementColor: getAchievementColor,
61
63
  handleMenuClose: handleMenuClose
62
64
  }) : jsx(MaterialRunboxActionReset, {
63
65
  runtime: runtime,
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { RunboxRunboxIdGradeGetRequest } from '@elice/openapi-client-material-runbox';
3
+ import type { GetAchievementColor } from '../MaterialRunboxContent';
3
4
  export type MaterialRunboxActionSubmitLogProps = Omit<RunboxRunboxIdGradeGetRequest, 'skip' | 'count'> & {
4
5
  handleMenuClose: () => void;
6
+ getAchievementColor?: GetAchievementColor;
5
7
  };
6
8
  declare const MaterialRunboxActionSubmitLog: React.FC<MaterialRunboxActionSubmitLogProps>;
7
9
  export default MaterialRunboxActionSubmitLog;
@@ -20,7 +20,8 @@ import { useInfiniteRunboxRunboxIdGrade } from '../hooks/useInfiniteRunboxRunbox
20
20
  var MaterialRunboxActionSubmitLogDialog = function MaterialRunboxActionSubmitLogDialog(_a) {
21
21
  var isOpen = _a.isOpen,
22
22
  onClose = _a.onClose,
23
- props = __rest(_a, ["isOpen", "onClose"]);
23
+ getAchievementColor = _a.getAchievementColor,
24
+ props = __rest(_a, ["isOpen", "onClose", "getAchievementColor"]);
24
25
  var intl = useRawEliceIntl();
25
26
  //
26
27
  var _useMaterialRunboxCon = useMaterialRunboxContext(),
@@ -84,7 +85,10 @@ var MaterialRunboxActionSubmitLogDialog = function MaterialRunboxActionSubmitLog
84
85
  gap: "0.5rem",
85
86
  children: [(item === null || item === void 0 ? void 0 : item.score) ? jsx(Tag, {
86
87
  variant: "muted",
87
- color: "info",
88
+ color: typeof getAchievementColor === 'function' ? getAchievementColor({
89
+ score: Number(item.score),
90
+ variant: 'tag'
91
+ }) : 'info',
88
92
  label: intl.formatMessage({
89
93
  id: 'runbox.common.score'
90
94
  }, {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { RunboxGetAndListResponse, RuntimeGetAndListResponse, RuntimeTemplateGetAndListResponse } from '@elice/openapi-client-material-runbox';
3
3
  import type { QueryObserverResult } from '@tanstack/react-query';
4
+ import type { GetAchievementColor } from '../MaterialRunboxContent';
4
5
  export interface RuntimeProps {
5
6
  /** */
6
7
  runbox: RunboxGetAndListResponse;
@@ -20,6 +21,8 @@ export interface RuntimeProps {
20
21
  RuntimeGetAndListResponse,
21
22
  RuntimeTemplateGetAndListResponse
22
23
  ], unknown>>;
24
+ /** */
25
+ getAchievementColor?: GetAchievementColor;
23
26
  }
24
27
  declare const Runtime: React.FC<RuntimeProps>;
25
28
  export default Runtime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-runbox",
3
- "version": "1.250310.0",
3
+ "version": "1.250313.0",
4
4
  "description": "User view and editing components of Elice material runbox",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@elice/intl": "0.241127.0",
54
- "@elice/material-shared-types": "1.250310.0",
55
- "@elice/material-shared-utils": "1.250310.0",
54
+ "@elice/material-shared-types": "1.250313.0",
55
+ "@elice/material-shared-utils": "1.250313.0",
56
56
  "@elice/mui-elements": "^5.250108.0-controllabel.0",
57
57
  "@elice/mui-system": "^5.250108.0-controllabel.0",
58
58
  "@elice/mui-x-snackbar": "^5.250108.0-controllabel.0",