@elice/material-runbox 1.260825.0-runboxusability.2 → 1.260826.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.
Files changed (81) hide show
  1. package/cjs/assets/runbox_logo.png.js +7 -0
  2. package/cjs/components/material-runbox/MaterialRunboxContent.js +2 -1
  3. package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  4. package/cjs/components/material-runbox/MaterialRunboxFooter.js +64 -0
  5. package/cjs/components/material-runbox/MaterialRunboxHeader.js +29 -12
  6. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
  7. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -22
  8. package/cjs/components/material-runbox/hooks/index.d.ts +0 -2
  9. package/cjs/components/material-runbox/hooks/index.js +0 -10
  10. package/cjs/components/material-runbox/locales/en.json.js +1 -1
  11. package/cjs/components/material-runbox/locales/ja.json.js +1 -1
  12. package/cjs/components/material-runbox/locales/ko.json.js +1 -1
  13. package/cjs/components/material-runbox/locales/th.json.js +1 -1
  14. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
  15. package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +90 -0
  16. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
  17. package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +16 -20
  18. package/cjs/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +81 -21
  19. package/es/assets/runbox_logo.png.js +3 -0
  20. package/es/components/material-runbox/MaterialRunboxContent.js +2 -1
  21. package/es/components/material-runbox/MaterialRunboxFooter.d.ts +4 -0
  22. package/es/components/material-runbox/MaterialRunboxFooter.js +56 -0
  23. package/es/components/material-runbox/MaterialRunboxHeader.js +30 -13
  24. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -3
  25. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +3 -24
  26. package/es/components/material-runbox/hooks/index.d.ts +0 -2
  27. package/es/components/material-runbox/hooks/index.js +0 -2
  28. package/es/components/material-runbox/locales/en.json.js +1 -1
  29. package/es/components/material-runbox/locales/ja.json.js +1 -1
  30. package/es/components/material-runbox/locales/ko.json.js +1 -1
  31. package/es/components/material-runbox/locales/th.json.js +1 -1
  32. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +6 -0
  33. package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +86 -0
  34. package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +0 -6
  35. package/es/components/material-runbox/timer/MaterialRunboxTimer.js +15 -19
  36. package/es/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +78 -18
  37. package/package.json +6 -6
  38. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
  39. package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -65
  40. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
  41. package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -67
  42. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
  43. package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -89
  44. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
  45. package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -35
  46. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  47. package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -142
  48. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  49. package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -41
  50. package/cjs/components/material-runbox/status/index.d.ts +0 -4
  51. package/cjs/components/material-runbox/status/index.js +0 -9
  52. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
  53. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -117
  54. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
  55. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -56
  56. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
  57. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -118
  58. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
  59. package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -50
  60. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +0 -14
  61. package/es/components/material-runbox/hooks/useRunboxNetworkStatus.js +0 -59
  62. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +0 -18
  63. package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.js +0 -63
  64. package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +0 -18
  65. package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +0 -81
  66. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +0 -12
  67. package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +0 -31
  68. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +0 -17
  69. package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +0 -138
  70. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +0 -11
  71. package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +0 -37
  72. package/es/components/material-runbox/status/index.d.ts +0 -4
  73. package/es/components/material-runbox/status/index.js +0 -2
  74. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +0 -11
  75. package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +0 -113
  76. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +0 -13
  77. package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +0 -52
  78. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +0 -12
  79. package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +0 -114
  80. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +0 -15
  81. package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +0 -46
@@ -1,142 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
6
- var tslib = require('tslib');
7
- var jsxRuntime = require('react/jsx-runtime');
8
- var intl = require('@elice/intl');
9
- var muiElements = require('@elice/mui-elements');
10
- var runboxClient = require('@elice/runbox-client');
11
- var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
12
- var material = require('@mui/material');
13
- var MaterialRunboxStatusConnectionItem = require('./MaterialRunboxStatusConnectionItem.js');
14
- var MaterialRunboxStatusResourceItem = require('./MaterialRunboxStatusResourceItem.js');
15
- var useRunboxNetworkStatus = require('../hooks/useRunboxNetworkStatus.js');
16
-
17
- //
18
- //
19
- //
20
- var POPOVER_WIDTH = '15.25rem'; // 244px
21
- var NETWORK_ICON = Object.freeze(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, useRunboxNetworkStatus.RunboxNetworkStatus.Good, proSolidSvgIcons.faWifi), useRunboxNetworkStatus.RunboxNetworkStatus.NotGood, proSolidSvgIcons.faWifiFair), useRunboxNetworkStatus.RunboxNetworkStatus.Bad, proSolidSvgIcons.faWifiSlash));
22
- var NETWORK_COLOR = Object.freeze(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, useRunboxNetworkStatus.RunboxNetworkStatus.Good, 'success.main'), useRunboxNetworkStatus.RunboxNetworkStatus.NotGood, 'warning.main'), useRunboxNetworkStatus.RunboxNetworkStatus.Bad, 'error.main'));
23
- //
24
- //
25
- //
26
- var MaterialRunboxStatusPopover = function MaterialRunboxStatusPopover(_a) {
27
- var open = _a.open,
28
- onClose = _a.onClose,
29
- bottomAction = _a.bottomAction,
30
- props = tslib.__rest(_a, ["open", "onClose", "bottomAction"]);
31
- var intl$1 = intl.useRawEliceIntl();
32
- var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
33
- status = _useEliceRunboxRunnin.status;
34
- var _useRunboxNetworkStat = useRunboxNetworkStatus.useRunboxNetworkStatus(),
35
- networkStatus = _useRunboxNetworkStat.status;
36
- var contStats = runboxClient.useEliceRunboxContainerStats();
37
- var stats = contStats ? contStats[contStats.length - 1] : null;
38
- var isRunboxConnecting = status === 'queued' || status === 'assigned';
39
- var isRunboxRunning = status === 'running';
40
- //
41
- //
42
- //
43
- return jsxRuntime.jsx(material.Popover, Object.assign({
44
- open: open,
45
- TransitionComponent: material.Fade,
46
- onClose: onClose
47
- }, props, {
48
- children: jsxRuntime.jsxs(material.Stack, {
49
- direction: "column",
50
- gap: "0.75rem",
51
- padding: "0.75rem",
52
- width: POPOVER_WIDTH,
53
- bgcolor: "background.paper",
54
- children: [jsxRuntime.jsxs(material.Stack, {
55
- direction: "column",
56
- children: [networkStatus ? jsxRuntime.jsx(MaterialRunboxStatusConnectionItem.default, {
57
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
58
- icon: NETWORK_ICON[networkStatus],
59
- fontSize: "small"
60
- }),
61
- label: intl$1.formatMessage({
62
- id: 'runbox.status.network'
63
- }),
64
- color: NETWORK_COLOR[networkStatus]
65
- }) : null, jsxRuntime.jsx(MaterialRunboxStatusConnectionItem.default, {
66
- icon: isRunboxConnecting ? jsxRuntime.jsx(material.CircularProgress, {
67
- color: "inherit",
68
- size: "1rem"
69
- }) : jsxRuntime.jsx(muiElements.EliceIcon, {
70
- icon: isRunboxRunning ? proSolidSvgIcons.faLinkSimple : proSolidSvgIcons.faLinkSimpleSlash,
71
- fontSize: "small"
72
- }),
73
- label: intl$1.formatMessage({
74
- id: isRunboxConnecting ? 'runbox.status.runtime.connecting' : isRunboxRunning ? 'runbox.status.runtime.connected' : 'runbox.status.runtime.disconnected'
75
- }),
76
- color: isRunboxRunning ? 'success.main' : 'text.disabled'
77
- })]
78
- }), stats ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
79
- children: [jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsxs(material.Stack, {
80
- direction: "column",
81
- children: [jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
82
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
83
- icon: proSolidSvgIcons.faMicrochip,
84
- fontSize: "small"
85
- }),
86
- label: "CPU",
87
- value: intl$1.formatNumber(stats.avgCpu, {
88
- style: 'percent',
89
- maximumFractionDigits: 2
90
- })
91
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
92
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
93
- icon: proSolidSvgIcons.faMemory,
94
- fontSize: "small"
95
- }),
96
- label: "Memory",
97
- value: "".concat(intl$1.formatDataSize(stats.memCurrent, {
98
- unitSystem: 'iec',
99
- maximumFractionDigits: 2
100
- }), " / ").concat(intl$1.formatDataSize(stats.memTotal, {
101
- unitSystem: 'iec',
102
- maximumFractionDigits: 2
103
- }))
104
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
105
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
106
- icon: proSolidSvgIcons.faArrowUpRight,
107
- fontSize: "small"
108
- }),
109
- label: "UP",
110
- value: "".concat(intl$1.formatDataSize(stats.netOutPsec, {
111
- unitSystem: 'iec'
112
- }), "/s")
113
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
114
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
115
- icon: proSolidSvgIcons.faArrowDownLeft,
116
- fontSize: "small"
117
- }),
118
- label: "DOWN",
119
- value: "".concat(intl$1.formatDataSize(stats.netInPsec, {
120
- unitSystem: 'iec'
121
- }), "/s")
122
- }), jsxRuntime.jsx(MaterialRunboxStatusResourceItem.default, {
123
- icon: jsxRuntime.jsx(muiElements.EliceIcon, {
124
- icon: proSolidSvgIcons.faDiscDrive,
125
- fontSize: "small"
126
- }),
127
- label: "DISK",
128
- value: "".concat(intl$1.formatDataSize(stats.diskCurrent, {
129
- unitSystem: 'iec',
130
- maximumFractionDigits: 2
131
- }), " / ").concat(intl$1.formatDataSize(stats.diskTotal, {
132
- unitSystem: 'iec',
133
- maximumFractionDigits: 2
134
- }))
135
- })]
136
- })]
137
- }) : null, bottomAction]
138
- })
139
- }));
140
- };
141
-
142
- exports.default = MaterialRunboxStatusPopover;
@@ -1,11 +0,0 @@
1
- import type React from 'react';
2
- export interface MaterialRunboxStatusResourceItemProps {
3
- /** Leading icon element. */
4
- icon: React.ReactNode;
5
- /** Resource label, e.g. `CPU`. */
6
- label: React.ReactNode;
7
- /** Formatted value, e.g. `438.33 MiB / 4 GiB`. */
8
- value: React.ReactNode;
9
- }
10
- declare const MaterialRunboxStatusResourceItem: React.FC<MaterialRunboxStatusResourceItemProps>;
11
- export default MaterialRunboxStatusResourceItem;
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var material = require('@mui/material');
7
-
8
- //
9
- //
10
- //
11
- var MaterialRunboxStatusResourceItem = function MaterialRunboxStatusResourceItem(_ref) {
12
- var icon = _ref.icon,
13
- label = _ref.label,
14
- value = _ref.value;
15
- return jsxRuntime.jsxs(material.Stack, {
16
- direction: "row",
17
- alignItems: "center",
18
- gap: "0.75rem",
19
- padding: "0.375rem 0.75rem",
20
- children: [jsxRuntime.jsx(material.Typography, {
21
- component: "span",
22
- display: "inline-flex",
23
- color: "text.tertiary",
24
- children: icon
25
- }), jsxRuntime.jsxs(material.Stack, {
26
- direction: "column",
27
- children: [jsxRuntime.jsx(material.Typography, {
28
- variant: "body2",
29
- color: "text.tertiary",
30
- children: label
31
- }), jsxRuntime.jsx(material.Typography, {
32
- variant: "caption",
33
- color: "text.tertiary",
34
- fontFamily: "'JetBrains Mono', monospace",
35
- children: value
36
- })]
37
- })]
38
- });
39
- };
40
-
41
- exports.default = MaterialRunboxStatusResourceItem;
@@ -1,4 +0,0 @@
1
- export { default as MaterialRunboxStatusButton } from './MaterialRunboxStatusButton';
2
- export { default as MaterialRunboxStatusPopover } from './MaterialRunboxStatusPopover';
3
- export type { MaterialRunboxStatusButtonProps } from './MaterialRunboxStatusButton';
4
- export type { MaterialRunboxStatusPopoverProps } from './MaterialRunboxStatusPopover';
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- var MaterialRunboxStatusButton = require('./MaterialRunboxStatusButton.js');
4
- var MaterialRunboxStatusPopover = require('./MaterialRunboxStatusPopover.js');
5
-
6
-
7
-
8
- exports.MaterialRunboxStatusButton = MaterialRunboxStatusButton.default;
9
- exports.MaterialRunboxStatusPopover = MaterialRunboxStatusPopover.default;
@@ -1,11 +0,0 @@
1
- interface MaterialRunboxQuotaAlmostEndDialogProps {
2
- open: boolean;
3
- onClose: () => void;
4
- }
5
- /**
6
- * Warns the learner that the *total* available time is about to run out.
7
- *
8
- * Once it does, the practice ends for good — there is no reconnecting.
9
- */
10
- declare const MaterialRunboxQuotaAlmostEndDialog: React.FC<MaterialRunboxQuotaAlmostEndDialogProps>;
11
- export default MaterialRunboxQuotaAlmostEndDialog;
@@ -1,117 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var intl = require('@elice/intl');
7
- var runboxClient = require('@elice/runbox-client');
8
- var material = require('@mui/material');
9
- var useRunboxSessionEndWarning = require('../hooks/useRunboxSessionEndWarning.js');
10
- var MaterialRunboxQuotaAmount = require('./MaterialRunboxQuotaAmount.js');
11
-
12
- //
13
- //
14
- //
15
- /**
16
- * Warns the learner that the *total* available time is about to run out.
17
- *
18
- * Once it does, the practice ends for good — there is no reconnecting.
19
- */
20
- var MaterialRunboxQuotaAlmostEndDialog = function MaterialRunboxQuotaAlmostEndDialog(_ref) {
21
- var open = _ref.open,
22
- onClose = _ref.onClose;
23
- var intl$1 = intl.useRawEliceIntl();
24
- var _useEliceRunboxQuota = runboxClient.useEliceRunboxQuota(),
25
- quotaInfo = _useEliceRunboxQuota.quotaInfo,
26
- quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
27
- if (quotaInfo.isUnlimited) {
28
- return null;
29
- }
30
- var isQuotaAlmostEnd = quotaInfo.remainingQuota <= useRunboxSessionEndWarning.QUOTA_ALMOST_END_MINUTES;
31
- var isQuotaPerSessionAlmostEnd = !quotaPerSessionInfo.isUnlimited && quotaPerSessionInfo.remainingQuota <= useRunboxSessionEndWarning.QUOTA_PER_SESSION_ALMOST_END_MINUTES;
32
- return jsxRuntime.jsxs(material.Dialog, {
33
- fullWidth: true,
34
- maxWidth: "xs",
35
- open: open,
36
- onClose: onClose,
37
- children: [jsxRuntime.jsx(material.DialogTitle, {
38
- children: intl$1.formatMessage({
39
- id: 'runbox.timer.almost_end.dialog.quota.title'
40
- }, {
41
- time: intl$1.formatNumber(useRunboxSessionEndWarning.QUOTA_ALMOST_END_MINUTES, {
42
- style: 'unit',
43
- unit: 'minute',
44
- unitDisplay: 'short'
45
- })
46
- })
47
- }), jsxRuntime.jsx(material.DialogContent, {
48
- children: jsxRuntime.jsxs(material.Stack, {
49
- direction: "column",
50
- gap: "1.5rem",
51
- children: [jsxRuntime.jsxs(material.Card, {
52
- elevation: 0,
53
- sx: {
54
- bgcolor: 'background.neutral'
55
- },
56
- children: [jsxRuntime.jsxs(material.Stack, {
57
- direction: "column",
58
- gap: "0.5rem",
59
- padding: "1rem",
60
- bgcolor: isQuotaAlmostEnd ? 'warning.opacity03' : undefined,
61
- children: [jsxRuntime.jsx(material.Typography, {
62
- variant: "body2",
63
- fontWeight: "bold",
64
- children: intl$1.formatMessage({
65
- id: 'runbox.timer.popover.quota.title'
66
- })
67
- }), jsxRuntime.jsx(MaterialRunboxQuotaAmount.default, {
68
- remainingQuota: quotaInfo.remainingQuota,
69
- quota: quotaInfo.quota,
70
- color: isQuotaAlmostEnd ? 'warning.main' : 'success.main'
71
- })]
72
- }), jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsxs(material.Stack, {
73
- direction: "column",
74
- gap: "0.5rem",
75
- padding: "1rem",
76
- bgcolor: isQuotaPerSessionAlmostEnd ? 'warning.opacity03' : undefined,
77
- children: [jsxRuntime.jsx(material.Typography, {
78
- variant: "body2",
79
- fontWeight: "bold",
80
- children: intl$1.formatMessage({
81
- id: 'runbox.timer.popover.quota_per_session.title'
82
- })
83
- }), quotaPerSessionInfo.isUnlimited ? jsxRuntime.jsx(material.Typography, {
84
- component: "span",
85
- variant: "h5",
86
- fontWeight: "extraBold",
87
- children: intl$1.formatMessage({
88
- id: 'runbox.timer.unlimited'
89
- })
90
- }) : jsxRuntime.jsx(MaterialRunboxQuotaAmount.default, {
91
- remainingQuota: quotaPerSessionInfo.remainingQuota,
92
- quota: quotaPerSessionInfo.quota,
93
- color: isQuotaPerSessionAlmostEnd ? 'warning.main' : 'success.main'
94
- })]
95
- })]
96
- }), jsxRuntime.jsx(material.Typography, {
97
- variant: "body2",
98
- whiteSpace: "pre-line",
99
- children: intl$1.formatMessage({
100
- id: 'runbox.timer.almost_end.dialog.quota.description'
101
- })
102
- })]
103
- })
104
- }), jsxRuntime.jsx(material.DialogActions, {
105
- children: jsxRuntime.jsx(material.Button, {
106
- variant: "contained",
107
- color: "inherit",
108
- onClick: onClose,
109
- children: intl$1.formatMessage({
110
- id: 'runbox.timer.almost_end.dialog.confirm'
111
- })
112
- })
113
- })]
114
- });
115
- };
116
-
117
- exports.default = MaterialRunboxQuotaAlmostEndDialog;
@@ -1,13 +0,0 @@
1
- export interface MaterialRunboxQuotaAmountProps {
2
- /** Remaining time, in minutes. */
3
- remainingQuota: number;
4
- /** Total granted time, in minutes. */
5
- quota: number;
6
- /** Color of the remaining time. */
7
- color?: string;
8
- }
9
- /**
10
- * Renders `<remaining> / <total>`, e.g. `4시간 11분 / 5시간`.
11
- */
12
- declare const MaterialRunboxQuotaAmount: React.FC<MaterialRunboxQuotaAmountProps>;
13
- export default MaterialRunboxQuotaAmount;
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var intl = require('@elice/intl');
7
- var material = require('@mui/material');
8
- var MaterialRunboxQuotaTimePart = require('./MaterialRunboxQuotaTimePart.js');
9
- var time = require('../../../utils/time.js');
10
-
11
- //
12
- //
13
- //
14
- /**
15
- * Renders `<remaining> / <total>`, e.g. `4시간 11분 / 5시간`.
16
- */
17
- var MaterialRunboxQuotaAmount = function MaterialRunboxQuotaAmount(_ref) {
18
- var remainingQuota = _ref.remainingQuota,
19
- quota = _ref.quota,
20
- color = _ref.color;
21
- var intl$1 = intl.useRawEliceIntl();
22
- var _getTimeParts = time.getTimeParts(remainingQuota * 60),
23
- remainingHours = _getTimeParts.hours,
24
- remainingMinutes = _getTimeParts.minutes;
25
- var _getTimeParts2 = time.getTimeParts(quota * 60),
26
- totalHours = _getTimeParts2.hours,
27
- totalMinutes = _getTimeParts2.minutes;
28
- return jsxRuntime.jsxs(material.Typography, {
29
- variant: "body2",
30
- children: [jsxRuntime.jsxs(material.Stack, {
31
- component: "span",
32
- display: "inline-flex",
33
- direction: "row",
34
- gap: "0.25rem",
35
- children: [jsxRuntime.jsx(MaterialRunboxQuotaTimePart.default, {
36
- value: remainingHours,
37
- unit: "hour",
38
- color: color
39
- }), jsxRuntime.jsx(MaterialRunboxQuotaTimePart.default, {
40
- value: remainingMinutes,
41
- unit: "minute",
42
- color: color
43
- })]
44
- }), " / ", [totalHours > 0 ? intl$1.formatNumber(totalHours, {
45
- style: 'unit',
46
- unit: 'hour',
47
- unitDisplay: 'short'
48
- }) : null, totalMinutes > 0 ? intl$1.formatNumber(totalMinutes, {
49
- style: 'unit',
50
- unit: 'minute',
51
- unitDisplay: 'short'
52
- }) : null].filter(Boolean).join(' ')]
53
- });
54
- };
55
-
56
- exports.default = MaterialRunboxQuotaAmount;
@@ -1,12 +0,0 @@
1
- interface MaterialRunboxQuotaPerSessionAlmostEndDialogProps {
2
- open: boolean;
3
- onClose: () => void;
4
- }
5
- /**
6
- * Warns the learner that the time granted to *this connection* is about to run out.
7
- *
8
- * Unlike the total quota, the learner can reconnect and keep going as long as total
9
- * time is left — so this dialog is about saving work, not about the practice ending.
10
- */
11
- declare const MaterialRunboxQuotaPerSessionAlmostEndDialog: React.FC<MaterialRunboxQuotaPerSessionAlmostEndDialogProps>;
12
- export default MaterialRunboxQuotaPerSessionAlmostEndDialog;
@@ -1,118 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var intl = require('@elice/intl');
7
- var runboxClient = require('@elice/runbox-client');
8
- var material = require('@mui/material');
9
- var useRunboxSessionEndWarning = require('../hooks/useRunboxSessionEndWarning.js');
10
- var MaterialRunboxQuotaAmount = require('./MaterialRunboxQuotaAmount.js');
11
-
12
- //
13
- //
14
- //
15
- /**
16
- * Warns the learner that the time granted to *this connection* is about to run out.
17
- *
18
- * Unlike the total quota, the learner can reconnect and keep going as long as total
19
- * time is left — so this dialog is about saving work, not about the practice ending.
20
- */
21
- var MaterialRunboxQuotaPerSessionAlmostEndDialog = function MaterialRunboxQuotaPerSessionAlmostEndDialog(_ref) {
22
- var open = _ref.open,
23
- onClose = _ref.onClose;
24
- var intl$1 = intl.useRawEliceIntl();
25
- var _useEliceRunboxQuota = runboxClient.useEliceRunboxQuota(),
26
- quotaInfo = _useEliceRunboxQuota.quotaInfo,
27
- quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
28
- if (quotaPerSessionInfo.isUnlimited) {
29
- return null;
30
- }
31
- var isQuotaAlmostEnd = !quotaInfo.isUnlimited && quotaInfo.remainingQuota <= useRunboxSessionEndWarning.QUOTA_ALMOST_END_MINUTES;
32
- var isQuotaPerSessionAlmostEnd = quotaPerSessionInfo.remainingQuota <= useRunboxSessionEndWarning.QUOTA_PER_SESSION_ALMOST_END_MINUTES;
33
- return jsxRuntime.jsxs(material.Dialog, {
34
- fullWidth: true,
35
- maxWidth: "xs",
36
- open: open,
37
- onClose: onClose,
38
- children: [jsxRuntime.jsx(material.DialogTitle, {
39
- children: intl$1.formatMessage({
40
- id: 'runbox.timer.almost_end.dialog.quota_per_session.title'
41
- }, {
42
- time: intl$1.formatNumber(useRunboxSessionEndWarning.QUOTA_PER_SESSION_ALMOST_END_MINUTES, {
43
- style: 'unit',
44
- unit: 'minute',
45
- unitDisplay: 'short'
46
- })
47
- })
48
- }), jsxRuntime.jsx(material.DialogContent, {
49
- children: jsxRuntime.jsxs(material.Stack, {
50
- direction: "column",
51
- gap: "1.5rem",
52
- children: [jsxRuntime.jsxs(material.Card, {
53
- elevation: 0,
54
- sx: {
55
- bgcolor: 'background.neutral'
56
- },
57
- children: [jsxRuntime.jsxs(material.Stack, {
58
- direction: "column",
59
- gap: "0.5rem",
60
- padding: "1rem",
61
- bgcolor: isQuotaAlmostEnd ? 'warning.opacity03' : undefined,
62
- children: [jsxRuntime.jsx(material.Typography, {
63
- variant: "body2",
64
- fontWeight: "bold",
65
- children: intl$1.formatMessage({
66
- id: 'runbox.timer.popover.quota.title'
67
- })
68
- }), quotaInfo.isUnlimited ? jsxRuntime.jsx(material.Typography, {
69
- component: "span",
70
- variant: "h5",
71
- fontWeight: "extraBold",
72
- children: intl$1.formatMessage({
73
- id: 'runbox.timer.unlimited'
74
- })
75
- }) : jsxRuntime.jsx(MaterialRunboxQuotaAmount.default, {
76
- remainingQuota: quotaInfo.remainingQuota,
77
- quota: quotaInfo.quota,
78
- color: isQuotaAlmostEnd ? 'warning.main' : 'success.main'
79
- })]
80
- }), jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsxs(material.Stack, {
81
- direction: "column",
82
- gap: "0.5rem",
83
- padding: "1rem",
84
- bgcolor: isQuotaPerSessionAlmostEnd ? 'warning.opacity03' : undefined,
85
- children: [jsxRuntime.jsx(material.Typography, {
86
- variant: "body2",
87
- fontWeight: "bold",
88
- children: intl$1.formatMessage({
89
- id: 'runbox.timer.popover.quota_per_session.title'
90
- })
91
- }), jsxRuntime.jsx(MaterialRunboxQuotaAmount.default, {
92
- remainingQuota: quotaPerSessionInfo.remainingQuota,
93
- quota: quotaPerSessionInfo.quota,
94
- color: isQuotaPerSessionAlmostEnd ? 'warning.main' : 'success.main'
95
- })]
96
- })]
97
- }), jsxRuntime.jsx(material.Typography, {
98
- variant: "body2",
99
- whiteSpace: "pre-line",
100
- children: intl$1.formatMessage({
101
- id: 'runbox.timer.almost_end.dialog.quota_per_session.description'
102
- })
103
- })]
104
- })
105
- }), jsxRuntime.jsx(material.DialogActions, {
106
- children: jsxRuntime.jsx(material.Button, {
107
- variant: "contained",
108
- color: "inherit",
109
- onClick: onClose,
110
- children: intl$1.formatMessage({
111
- id: 'runbox.timer.almost_end.dialog.confirm'
112
- })
113
- })
114
- })]
115
- });
116
- };
117
-
118
- exports.default = MaterialRunboxQuotaPerSessionAlmostEndDialog;
@@ -1,15 +0,0 @@
1
- export interface MaterialRunboxQuotaTimePartProps {
2
- value: number;
3
- unit: 'hour' | 'minute';
4
- color?: string;
5
- }
6
- /**
7
- * A single `4시간` / `11분` part, with the unit rendered smaller than the number.
8
- *
9
- * The number and its unit are split with `formatNumberToParts` rather than by hand,
10
- * because where the unit sits and how it is written differs per locale.
11
- *
12
- * Renders nothing when `value` is 0, so `29분` does not come out as `0시간 29분`.
13
- */
14
- declare const MaterialRunboxQuotaTimePart: React.FC<MaterialRunboxQuotaTimePartProps>;
15
- export default MaterialRunboxQuotaTimePart;
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var intl = require('@elice/intl');
7
- var material = require('@mui/material');
8
-
9
- //
10
- //
11
- //
12
- /**
13
- * A single `4시간` / `11분` part, with the unit rendered smaller than the number.
14
- *
15
- * The number and its unit are split with `formatNumberToParts` rather than by hand,
16
- * because where the unit sits and how it is written differs per locale.
17
- *
18
- * Renders nothing when `value` is 0, so `29분` does not come out as `0시간 29분`.
19
- */
20
- var MaterialRunboxQuotaTimePart = function MaterialRunboxQuotaTimePart(_ref) {
21
- var value = _ref.value,
22
- unit = _ref.unit,
23
- color = _ref.color;
24
- var intl$1 = intl.useRawEliceIntl();
25
- if (value === 0) {
26
- return null;
27
- }
28
- return jsxRuntime.jsx(material.Typography, {
29
- component: "span",
30
- variant: "h5",
31
- fontWeight: "extraBold",
32
- color: color,
33
- children: intl$1.formatNumberToParts(value, {
34
- style: 'unit',
35
- unit: unit,
36
- unitDisplay: 'short'
37
- }).map(function (part, index) {
38
- return part.type === 'unit' ? jsxRuntime.jsx(material.Typography, {
39
- component: "span",
40
- variant: "body2",
41
- fontWeight: "regular",
42
- children: part.value
43
- }, index) : jsxRuntime.jsx("span", {
44
- children: part.value
45
- }, index);
46
- })
47
- });
48
- };
49
-
50
- exports.default = MaterialRunboxQuotaTimePart;
@@ -1,14 +0,0 @@
1
- export declare enum RunboxNetworkStatus {
2
- Good = "good",
3
- NotGood = "not_good",
4
- Bad = "bad"
5
- }
6
- /**
7
- * Runbox network quality, derived from the heartbeat round trip.
8
- *
9
- * `null` until the first sample arrives.
10
- */
11
- export declare const useRunboxNetworkStatus: () => {
12
- avgRtt: number | null;
13
- status: RunboxNetworkStatus | null;
14
- };