@elice/material-runbox 1.260908.0 → 1.260910.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.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +16 -0
- package/cjs/assets/runbox-loading.svg.js +7 -0
- package/cjs/components/material-runbox/MaterialRunbox.js +16 -11
- package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +2 -0
- package/cjs/components/material-runbox/MaterialRunboxContent.js +93 -65
- package/cjs/components/material-runbox/MaterialRunboxHeader.js +55 -69
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +29 -2
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +3 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +90 -0
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +3 -1
- package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +26 -7
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
- package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
- package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
- package/cjs/components/material-runbox/contexts/MaterialRunboxControlContext.js +56 -0
- package/cjs/components/material-runbox/contexts/index.d.ts +2 -0
- package/cjs/components/material-runbox/contexts/index.js +4 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +13 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +71 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +98 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +10 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +151 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +13 -0
- package/cjs/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +98 -0
- package/cjs/components/material-runbox/disk/index.d.ts +8 -1
- package/cjs/components/material-runbox/disk/index.js +8 -2
- package/cjs/components/material-runbox/hooks/index.d.ts +3 -0
- package/cjs/components/material-runbox/hooks/index.js +14 -0
- package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
- package/cjs/components/material-runbox/hooks/useRunboxControl.js +43 -14
- package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
- package/cjs/components/material-runbox/hooks/useRunboxDiskUsage.js +50 -0
- package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +14 -0
- package/cjs/components/material-runbox/hooks/useRunboxNetworkStatus.js +65 -0
- package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +18 -0
- package/cjs/components/material-runbox/hooks/useRunboxSessionEndWarning.js +67 -0
- package/cjs/components/material-runbox/locales/en.json.js +1 -1
- package/cjs/components/material-runbox/locales/ja.json.js +1 -1
- package/cjs/components/material-runbox/locales/ko.json.js +1 -1
- package/cjs/components/material-runbox/locales/th.json.js +1 -1
- package/cjs/components/material-runbox/runtime/Runtime.js +21 -18
- package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
- package/cjs/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +5 -3
- package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +6 -54
- package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
- package/cjs/components/material-runbox/runtime/RuntimeOverlayConflicted.js +68 -64
- package/cjs/components/material-runbox/runtime/RuntimeOverlayLoading.d.ts +9 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayLoading.js +283 -0
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +5 -3
- package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +6 -64
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +4 -1
- package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +92 -70
- package/cjs/components/material-runbox/runtime/runtime-loading-tips.d.ts +7 -0
- package/cjs/components/material-runbox/runtime/runtime-loading-tips.js +148 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +15 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusButton.js +117 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +12 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +35 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +14 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusPopover.js +161 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +11 -0
- package/cjs/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +41 -0
- package/cjs/components/material-runbox/status/index.d.ts +4 -0
- package/cjs/components/material-runbox/status/index.js +9 -0
- package/cjs/components/material-runbox/theme.d.ts +2 -0
- package/cjs/components/material-runbox/theme.js +15 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +11 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +125 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +13 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +56 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +12 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +126 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +15 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +50 -0
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.d.ts +6 -1
- package/cjs/components/material-runbox/timer/MaterialRunboxTimer.js +26 -18
- package/cjs/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +21 -81
- package/cjs/components/shared/hooks/index.d.ts +1 -0
- package/cjs/components/shared/hooks/index.js +7 -0
- package/cjs/components/shared/hooks/useBreakpoint.d.ts +4 -0
- package/cjs/components/shared/hooks/useBreakpoint.js +12 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +13 -1
- package/es/assets/runbox-loading.svg.js +3 -0
- package/es/components/material-runbox/MaterialRunbox.js +16 -11
- package/es/components/material-runbox/MaterialRunboxContent.d.ts +2 -0
- package/es/components/material-runbox/MaterialRunboxContent.js +94 -66
- package/es/components/material-runbox/MaterialRunboxHeader.js +56 -70
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.d.ts +1 -4
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnect.js +30 -3
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.d.ts +3 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionDisconnectMenuItem.js +82 -0
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +3 -1
- package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +28 -9
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -2
- package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +9 -26
- package/es/components/material-runbox/contexts/MaterialRunboxControlContext.d.ts +14 -0
- package/es/components/material-runbox/contexts/MaterialRunboxControlContext.js +46 -0
- package/es/components/material-runbox/contexts/index.d.ts +2 -0
- package/es/components/material-runbox/contexts/index.js +1 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.d.ts +13 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageAlert.js +67 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.d.ts +10 -0
- package/es/components/material-runbox/disk/MaterialRunboxDiskUsageDialog.js +94 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.d.ts +10 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetButton.js +143 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.d.ts +13 -0
- package/es/components/material-runbox/disk/MaterialRunboxEnvResetDialog.js +90 -0
- package/es/components/material-runbox/disk/index.d.ts +8 -1
- package/es/components/material-runbox/disk/index.js +4 -1
- package/es/components/material-runbox/hooks/index.d.ts +3 -0
- package/es/components/material-runbox/hooks/index.js +3 -0
- package/es/components/material-runbox/hooks/useRunboxControl.d.ts +4 -3
- package/es/components/material-runbox/hooks/useRunboxControl.js +43 -14
- package/es/components/material-runbox/hooks/useRunboxDiskUsage.d.ts +16 -0
- package/es/components/material-runbox/hooks/useRunboxDiskUsage.js +42 -0
- package/es/components/material-runbox/hooks/useRunboxNetworkStatus.d.ts +14 -0
- package/es/components/material-runbox/hooks/useRunboxNetworkStatus.js +59 -0
- package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.d.ts +18 -0
- package/es/components/material-runbox/hooks/useRunboxSessionEndWarning.js +63 -0
- package/es/components/material-runbox/locales/en.json.js +1 -1
- package/es/components/material-runbox/locales/ja.json.js +1 -1
- package/es/components/material-runbox/locales/ko.json.js +1 -1
- package/es/components/material-runbox/locales/th.json.js +1 -1
- package/es/components/material-runbox/runtime/Runtime.js +22 -19
- package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.d.ts +0 -1
- package/es/components/material-runbox/runtime/RuntimeChangeMaterialDialog.js +9 -3
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.d.ts +5 -3
- package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +7 -55
- package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.d.ts +0 -1
- package/es/components/material-runbox/runtime/RuntimeOverlayConflicted.js +69 -65
- package/es/components/material-runbox/runtime/RuntimeOverlayLoading.d.ts +9 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayLoading.js +275 -0
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.d.ts +5 -3
- package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +7 -65
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.d.ts +4 -1
- package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +82 -60
- package/es/components/material-runbox/runtime/runtime-loading-tips.d.ts +7 -0
- package/es/components/material-runbox/runtime/runtime-loading-tips.js +146 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.d.ts +15 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusButton.js +109 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.d.ts +12 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusConnectionItem.js +31 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.d.ts +14 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusPopover.js +157 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.d.ts +11 -0
- package/es/components/material-runbox/status/MaterialRunboxStatusResourceItem.js +37 -0
- package/es/components/material-runbox/status/index.d.ts +4 -0
- package/es/components/material-runbox/status/index.js +2 -0
- package/es/components/material-runbox/theme.d.ts +2 -0
- package/es/components/material-runbox/theme.js +12 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.d.ts +11 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAlmostEndDialog.js +121 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.d.ts +13 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaAmount.js +52 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.d.ts +12 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaPerSessionAlmostEndDialog.js +122 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.d.ts +15 -0
- package/es/components/material-runbox/timer/MaterialRunboxQuotaTimePart.js +46 -0
- package/es/components/material-runbox/timer/MaterialRunboxTimer.d.ts +6 -1
- package/es/components/material-runbox/timer/MaterialRunboxTimer.js +25 -17
- package/es/components/material-runbox/timer/MaterialRunboxTimerDetailPopover.js +18 -78
- package/es/components/shared/hooks/index.d.ts +1 -0
- package/es/components/shared/hooks/index.js +1 -0
- package/es/components/shared/hooks/useBreakpoint.d.ts +4 -0
- package/es/components/shared/hooks/useBreakpoint.js +10 -0
- package/package.json +7 -7
- package/cjs/assets/queue.gif.js +0 -7
- package/cjs/assets/runbox_logo.png.js +0 -7
- package/cjs/components/material-runbox/MaterialRunboxFooter.d.ts +0 -4
- package/cjs/components/material-runbox/MaterialRunboxFooter.js +0 -64
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
- package/cjs/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -98
- package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +0 -6
- package/cjs/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +0 -90
- package/es/assets/queue.gif.js +0 -3
- package/es/assets/runbox_logo.png.js +0 -3
- package/es/components/material-runbox/MaterialRunboxFooter.d.ts +0 -4
- package/es/components/material-runbox/MaterialRunboxFooter.js +0 -56
- package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.d.ts +0 -5
- package/es/components/material-runbox/disk/MaterialRunboxDiskAlmostFullSnackbar.js +0 -94
- package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.d.ts +0 -6
- package/es/components/material-runbox/timer/MaterialRunboxAlmostEndSnackbars.js +0 -86
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { useEliceRunboxQuota } from '@elice/runbox-client';
|
|
4
|
+
import { Dialog, DialogTitle, DialogContent, Stack, Card, Typography, Divider, DialogActions, Button } from '@mui/material';
|
|
5
|
+
import { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
|
|
6
|
+
import MaterialRunboxQuotaAmount from './MaterialRunboxQuotaAmount.js';
|
|
7
|
+
import { getTimeParts } from '../../../utils/time.js';
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
/**
|
|
13
|
+
* Warns the learner that the *total* available time is about to run out.
|
|
14
|
+
*
|
|
15
|
+
* Once it does, the practice ends for good — there is no reconnecting.
|
|
16
|
+
*/
|
|
17
|
+
var MaterialRunboxQuotaAlmostEndDialog = function MaterialRunboxQuotaAlmostEndDialog(_ref) {
|
|
18
|
+
var open = _ref.open,
|
|
19
|
+
onClose = _ref.onClose;
|
|
20
|
+
var intl = useRawEliceIntl();
|
|
21
|
+
var _useEliceRunboxQuota = useEliceRunboxQuota(),
|
|
22
|
+
quotaInfo = _useEliceRunboxQuota.quotaInfo,
|
|
23
|
+
quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
|
|
24
|
+
if (quotaInfo.isUnlimited) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var _getTimeParts = getTimeParts(quotaInfo.remainingQuota * 60),
|
|
28
|
+
remainingHours = _getTimeParts.hours,
|
|
29
|
+
remainingMinutes = _getTimeParts.minutes;
|
|
30
|
+
var isQuotaAlmostEnd = quotaInfo.remainingQuota <= QUOTA_ALMOST_END_MINUTES;
|
|
31
|
+
var isQuotaPerSessionAlmostEnd = !quotaPerSessionInfo.isUnlimited && quotaPerSessionInfo.remainingQuota <= QUOTA_PER_SESSION_ALMOST_END_MINUTES;
|
|
32
|
+
return jsxs(Dialog, {
|
|
33
|
+
fullWidth: true,
|
|
34
|
+
maxWidth: "xs",
|
|
35
|
+
open: open,
|
|
36
|
+
onClose: onClose,
|
|
37
|
+
children: [jsx(DialogTitle, {
|
|
38
|
+
children: intl.formatMessage({
|
|
39
|
+
id: 'runbox.timer.almost_end.dialog.quota.title'
|
|
40
|
+
}, {
|
|
41
|
+
time: [remainingHours > 0 ? intl.formatNumber(remainingHours, {
|
|
42
|
+
style: 'unit',
|
|
43
|
+
unit: 'hour',
|
|
44
|
+
unitDisplay: 'short'
|
|
45
|
+
}) : null, remainingMinutes > 0 || remainingHours === 0 ? intl.formatNumber(remainingMinutes, {
|
|
46
|
+
style: 'unit',
|
|
47
|
+
unit: 'minute',
|
|
48
|
+
unitDisplay: 'short'
|
|
49
|
+
}) : null].filter(Boolean).join(' ')
|
|
50
|
+
})
|
|
51
|
+
}), jsx(DialogContent, {
|
|
52
|
+
children: jsxs(Stack, {
|
|
53
|
+
direction: "column",
|
|
54
|
+
gap: "1.5rem",
|
|
55
|
+
children: [jsxs(Card, {
|
|
56
|
+
elevation: 0,
|
|
57
|
+
sx: {
|
|
58
|
+
bgcolor: 'background.neutral'
|
|
59
|
+
},
|
|
60
|
+
children: [jsxs(Stack, {
|
|
61
|
+
direction: "column",
|
|
62
|
+
gap: "0.5rem",
|
|
63
|
+
padding: "1rem",
|
|
64
|
+
bgcolor: isQuotaAlmostEnd ? 'warning.opacity03' : undefined,
|
|
65
|
+
children: [jsx(Typography, {
|
|
66
|
+
variant: "body2",
|
|
67
|
+
fontWeight: "bold",
|
|
68
|
+
children: intl.formatMessage({
|
|
69
|
+
id: 'runbox.timer.popover.quota.title'
|
|
70
|
+
})
|
|
71
|
+
}), jsx(MaterialRunboxQuotaAmount, {
|
|
72
|
+
remainingQuota: quotaInfo.remainingQuota,
|
|
73
|
+
quota: quotaInfo.quota,
|
|
74
|
+
color: isQuotaAlmostEnd ? 'warning.main' : 'success.main'
|
|
75
|
+
})]
|
|
76
|
+
}), jsx(Divider, {}), jsxs(Stack, {
|
|
77
|
+
direction: "column",
|
|
78
|
+
gap: "0.5rem",
|
|
79
|
+
padding: "1rem",
|
|
80
|
+
bgcolor: isQuotaPerSessionAlmostEnd ? 'warning.opacity03' : undefined,
|
|
81
|
+
children: [jsx(Typography, {
|
|
82
|
+
variant: "body2",
|
|
83
|
+
fontWeight: "bold",
|
|
84
|
+
children: intl.formatMessage({
|
|
85
|
+
id: 'runbox.timer.popover.quota_per_session.title'
|
|
86
|
+
})
|
|
87
|
+
}), quotaPerSessionInfo.isUnlimited ? jsx(Typography, {
|
|
88
|
+
component: "span",
|
|
89
|
+
variant: "h5",
|
|
90
|
+
fontWeight: "extraBold",
|
|
91
|
+
children: intl.formatMessage({
|
|
92
|
+
id: 'runbox.timer.unlimited'
|
|
93
|
+
})
|
|
94
|
+
}) : jsx(MaterialRunboxQuotaAmount, {
|
|
95
|
+
remainingQuota: quotaPerSessionInfo.remainingQuota,
|
|
96
|
+
quota: quotaPerSessionInfo.quota,
|
|
97
|
+
color: isQuotaPerSessionAlmostEnd ? 'warning.main' : 'success.main'
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
}), jsx(Typography, {
|
|
101
|
+
variant: "body2",
|
|
102
|
+
whiteSpace: "pre-line",
|
|
103
|
+
children: intl.formatMessage({
|
|
104
|
+
id: 'runbox.timer.almost_end.dialog.quota.description'
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
})
|
|
108
|
+
}), jsx(DialogActions, {
|
|
109
|
+
children: jsx(Button, {
|
|
110
|
+
variant: "contained",
|
|
111
|
+
color: "inherit",
|
|
112
|
+
onClick: onClose,
|
|
113
|
+
children: intl.formatMessage({
|
|
114
|
+
id: 'runbox.timer.almost_end.dialog.confirm'
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export { MaterialRunboxQuotaAlmostEndDialog as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { Typography, Stack } from '@mui/material';
|
|
4
|
+
import MaterialRunboxQuotaTimePart from './MaterialRunboxQuotaTimePart.js';
|
|
5
|
+
import { getTimeParts } from '../../../utils/time.js';
|
|
6
|
+
|
|
7
|
+
//
|
|
8
|
+
//
|
|
9
|
+
//
|
|
10
|
+
/**
|
|
11
|
+
* Renders `<remaining> / <total>`, e.g. `4시간 11분 / 5시간`.
|
|
12
|
+
*/
|
|
13
|
+
var MaterialRunboxQuotaAmount = function MaterialRunboxQuotaAmount(_ref) {
|
|
14
|
+
var remainingQuota = _ref.remainingQuota,
|
|
15
|
+
quota = _ref.quota,
|
|
16
|
+
color = _ref.color;
|
|
17
|
+
var intl = useRawEliceIntl();
|
|
18
|
+
var _getTimeParts = getTimeParts(remainingQuota * 60),
|
|
19
|
+
remainingHours = _getTimeParts.hours,
|
|
20
|
+
remainingMinutes = _getTimeParts.minutes;
|
|
21
|
+
var _getTimeParts2 = getTimeParts(quota * 60),
|
|
22
|
+
totalHours = _getTimeParts2.hours,
|
|
23
|
+
totalMinutes = _getTimeParts2.minutes;
|
|
24
|
+
return jsxs(Typography, {
|
|
25
|
+
variant: "body2",
|
|
26
|
+
children: [jsxs(Stack, {
|
|
27
|
+
component: "span",
|
|
28
|
+
display: "inline-flex",
|
|
29
|
+
direction: "row",
|
|
30
|
+
gap: "0.25rem",
|
|
31
|
+
children: [jsx(MaterialRunboxQuotaTimePart, {
|
|
32
|
+
value: remainingHours,
|
|
33
|
+
unit: "hour",
|
|
34
|
+
color: color
|
|
35
|
+
}), jsx(MaterialRunboxQuotaTimePart, {
|
|
36
|
+
value: remainingMinutes,
|
|
37
|
+
unit: "minute",
|
|
38
|
+
color: color
|
|
39
|
+
})]
|
|
40
|
+
}), " / ", [totalHours > 0 ? intl.formatNumber(totalHours, {
|
|
41
|
+
style: 'unit',
|
|
42
|
+
unit: 'hour',
|
|
43
|
+
unitDisplay: 'short'
|
|
44
|
+
}) : null, totalMinutes > 0 ? intl.formatNumber(totalMinutes, {
|
|
45
|
+
style: 'unit',
|
|
46
|
+
unit: 'minute',
|
|
47
|
+
unitDisplay: 'short'
|
|
48
|
+
}) : null].filter(Boolean).join(' ')]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { MaterialRunboxQuotaAmount as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { useEliceRunboxQuota } from '@elice/runbox-client';
|
|
4
|
+
import { Dialog, DialogTitle, DialogContent, Stack, Card, Typography, Divider, DialogActions, Button } from '@mui/material';
|
|
5
|
+
import { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
|
|
6
|
+
import MaterialRunboxQuotaAmount from './MaterialRunboxQuotaAmount.js';
|
|
7
|
+
import { getTimeParts } from '../../../utils/time.js';
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
/**
|
|
13
|
+
* Warns the learner that the time granted to *this connection* is about to run out.
|
|
14
|
+
*
|
|
15
|
+
* Unlike the total quota, the learner can reconnect and keep going as long as total
|
|
16
|
+
* time is left — so this dialog is about saving work, not about the practice ending.
|
|
17
|
+
*/
|
|
18
|
+
var MaterialRunboxQuotaPerSessionAlmostEndDialog = function MaterialRunboxQuotaPerSessionAlmostEndDialog(_ref) {
|
|
19
|
+
var open = _ref.open,
|
|
20
|
+
onClose = _ref.onClose;
|
|
21
|
+
var intl = useRawEliceIntl();
|
|
22
|
+
var _useEliceRunboxQuota = useEliceRunboxQuota(),
|
|
23
|
+
quotaInfo = _useEliceRunboxQuota.quotaInfo,
|
|
24
|
+
quotaPerSessionInfo = _useEliceRunboxQuota.quotaPerSessionInfo;
|
|
25
|
+
if (quotaPerSessionInfo.isUnlimited) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
var _getTimeParts = getTimeParts(quotaPerSessionInfo.remainingQuota * 60),
|
|
29
|
+
remainingHours = _getTimeParts.hours,
|
|
30
|
+
remainingMinutes = _getTimeParts.minutes;
|
|
31
|
+
var isQuotaAlmostEnd = !quotaInfo.isUnlimited && quotaInfo.remainingQuota <= QUOTA_ALMOST_END_MINUTES;
|
|
32
|
+
var isQuotaPerSessionAlmostEnd = quotaPerSessionInfo.remainingQuota <= QUOTA_PER_SESSION_ALMOST_END_MINUTES;
|
|
33
|
+
return jsxs(Dialog, {
|
|
34
|
+
fullWidth: true,
|
|
35
|
+
maxWidth: "xs",
|
|
36
|
+
open: open,
|
|
37
|
+
onClose: onClose,
|
|
38
|
+
children: [jsx(DialogTitle, {
|
|
39
|
+
children: intl.formatMessage({
|
|
40
|
+
id: 'runbox.timer.almost_end.dialog.quota_per_session.title'
|
|
41
|
+
}, {
|
|
42
|
+
time: [remainingHours > 0 ? intl.formatNumber(remainingHours, {
|
|
43
|
+
style: 'unit',
|
|
44
|
+
unit: 'hour',
|
|
45
|
+
unitDisplay: 'short'
|
|
46
|
+
}) : null, remainingMinutes > 0 || remainingHours === 0 ? intl.formatNumber(remainingMinutes, {
|
|
47
|
+
style: 'unit',
|
|
48
|
+
unit: 'minute',
|
|
49
|
+
unitDisplay: 'short'
|
|
50
|
+
}) : null].filter(Boolean).join(' ')
|
|
51
|
+
})
|
|
52
|
+
}), jsx(DialogContent, {
|
|
53
|
+
children: jsxs(Stack, {
|
|
54
|
+
direction: "column",
|
|
55
|
+
gap: "1.5rem",
|
|
56
|
+
children: [jsxs(Card, {
|
|
57
|
+
elevation: 0,
|
|
58
|
+
sx: {
|
|
59
|
+
bgcolor: 'background.neutral'
|
|
60
|
+
},
|
|
61
|
+
children: [jsxs(Stack, {
|
|
62
|
+
direction: "column",
|
|
63
|
+
gap: "0.5rem",
|
|
64
|
+
padding: "1rem",
|
|
65
|
+
bgcolor: isQuotaAlmostEnd ? 'warning.opacity03' : undefined,
|
|
66
|
+
children: [jsx(Typography, {
|
|
67
|
+
variant: "body2",
|
|
68
|
+
fontWeight: "bold",
|
|
69
|
+
children: intl.formatMessage({
|
|
70
|
+
id: 'runbox.timer.popover.quota.title'
|
|
71
|
+
})
|
|
72
|
+
}), quotaInfo.isUnlimited ? jsx(Typography, {
|
|
73
|
+
component: "span",
|
|
74
|
+
variant: "h5",
|
|
75
|
+
fontWeight: "extraBold",
|
|
76
|
+
children: intl.formatMessage({
|
|
77
|
+
id: 'runbox.timer.unlimited'
|
|
78
|
+
})
|
|
79
|
+
}) : jsx(MaterialRunboxQuotaAmount, {
|
|
80
|
+
remainingQuota: quotaInfo.remainingQuota,
|
|
81
|
+
quota: quotaInfo.quota,
|
|
82
|
+
color: isQuotaAlmostEnd ? 'warning.main' : 'success.main'
|
|
83
|
+
})]
|
|
84
|
+
}), jsx(Divider, {}), jsxs(Stack, {
|
|
85
|
+
direction: "column",
|
|
86
|
+
gap: "0.5rem",
|
|
87
|
+
padding: "1rem",
|
|
88
|
+
bgcolor: isQuotaPerSessionAlmostEnd ? 'warning.opacity03' : undefined,
|
|
89
|
+
children: [jsx(Typography, {
|
|
90
|
+
variant: "body2",
|
|
91
|
+
fontWeight: "bold",
|
|
92
|
+
children: intl.formatMessage({
|
|
93
|
+
id: 'runbox.timer.popover.quota_per_session.title'
|
|
94
|
+
})
|
|
95
|
+
}), jsx(MaterialRunboxQuotaAmount, {
|
|
96
|
+
remainingQuota: quotaPerSessionInfo.remainingQuota,
|
|
97
|
+
quota: quotaPerSessionInfo.quota,
|
|
98
|
+
color: isQuotaPerSessionAlmostEnd ? 'warning.main' : 'success.main'
|
|
99
|
+
})]
|
|
100
|
+
})]
|
|
101
|
+
}), jsx(Typography, {
|
|
102
|
+
variant: "body2",
|
|
103
|
+
whiteSpace: "pre-line",
|
|
104
|
+
children: intl.formatMessage({
|
|
105
|
+
id: 'runbox.timer.almost_end.dialog.quota_per_session.description'
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
})
|
|
109
|
+
}), jsx(DialogActions, {
|
|
110
|
+
children: jsx(Button, {
|
|
111
|
+
variant: "contained",
|
|
112
|
+
color: "inherit",
|
|
113
|
+
onClick: onClose,
|
|
114
|
+
children: intl.formatMessage({
|
|
115
|
+
id: 'runbox.timer.almost_end.dialog.confirm'
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { MaterialRunboxQuotaPerSessionAlmostEndDialog as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRawEliceIntl } from '@elice/intl';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//
|
|
8
|
+
/**
|
|
9
|
+
* A single `4시간` / `11분` part, with the unit rendered smaller than the number.
|
|
10
|
+
*
|
|
11
|
+
* The number and its unit are split with `formatNumberToParts` rather than by hand,
|
|
12
|
+
* because where the unit sits and how it is written differs per locale.
|
|
13
|
+
*
|
|
14
|
+
* Renders nothing when `value` is 0, so `29분` does not come out as `0시간 29분`.
|
|
15
|
+
*/
|
|
16
|
+
var MaterialRunboxQuotaTimePart = function MaterialRunboxQuotaTimePart(_ref) {
|
|
17
|
+
var value = _ref.value,
|
|
18
|
+
unit = _ref.unit,
|
|
19
|
+
color = _ref.color;
|
|
20
|
+
var intl = useRawEliceIntl();
|
|
21
|
+
if (value === 0) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return jsx(Typography, {
|
|
25
|
+
component: "span",
|
|
26
|
+
variant: "h5",
|
|
27
|
+
fontWeight: "extraBold",
|
|
28
|
+
color: color,
|
|
29
|
+
children: intl.formatNumberToParts(value, {
|
|
30
|
+
style: 'unit',
|
|
31
|
+
unit: unit,
|
|
32
|
+
unitDisplay: 'short'
|
|
33
|
+
}).map(function (part, index) {
|
|
34
|
+
return part.type === 'unit' ? jsx(Typography, {
|
|
35
|
+
component: "span",
|
|
36
|
+
variant: "body2",
|
|
37
|
+
fontWeight: "regular",
|
|
38
|
+
children: part.value
|
|
39
|
+
}, index) : jsx("span", {
|
|
40
|
+
children: part.value
|
|
41
|
+
}, index);
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { MaterialRunboxQuotaTimePart as default };
|
|
@@ -3,12 +3,17 @@ export interface MaterialRunboxTimerProps {
|
|
|
3
3
|
runboxId: string;
|
|
4
4
|
userId: number | undefined;
|
|
5
5
|
headerElement: HTMLElement | null;
|
|
6
|
-
stopRuntime: () => Promise<void>;
|
|
7
6
|
/**
|
|
8
7
|
* Hide timer detail popover?
|
|
9
8
|
* @default false
|
|
10
9
|
*/
|
|
11
10
|
hideTimerPopover?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Tutoring mode? Session-end warnings are for the learner, not for the tutor
|
|
13
|
+
* looking at their runbox.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
isTutoring?: boolean;
|
|
12
17
|
}
|
|
13
18
|
declare const MaterialRunboxTimer: React.FC<MaterialRunboxTimerProps>;
|
|
14
19
|
export default MaterialRunboxTimer;
|
|
@@ -8,14 +8,14 @@ import { EliceIcon } from '@elice/mui-elements';
|
|
|
8
8
|
import { useEliceRunboxRunning, useEliceRunboxQuota } from '@elice/runbox-client';
|
|
9
9
|
import { faTimer } from '@fortawesome/pro-solid-svg-icons';
|
|
10
10
|
import { Chip, chipClasses, Tooltip, Typography } from '@mui/material';
|
|
11
|
-
import
|
|
11
|
+
import { useRunboxSessionEndWarning, QUOTA_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
|
|
12
|
+
import MaterialRunboxQuotaAlmostEndDialog from './MaterialRunboxQuotaAlmostEndDialog.js';
|
|
13
|
+
import MaterialRunboxQuotaPerSessionAlmostEndDialog from './MaterialRunboxQuotaPerSessionAlmostEndDialog.js';
|
|
12
14
|
import MaterialRunboxTimerDetailPopover, { QUOTA_POPOVER_NOT_SHOW_ON_START } from './MaterialRunboxTimerDetailPopover.js';
|
|
15
|
+
import { useMaterialRunboxControlContext } from '../contexts/MaterialRunboxControlContext.js';
|
|
16
|
+
import { useBreakpoint } from '../../shared/hooks/useBreakpoint.js';
|
|
13
17
|
import { getTimeParts } from '../../../utils/time.js';
|
|
14
18
|
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
var QUOTA_ALMOST_END_MINUTES = 30;
|
|
19
19
|
//
|
|
20
20
|
//
|
|
21
21
|
//
|
|
@@ -35,15 +35,25 @@ var MaterialRunboxTimer = function MaterialRunboxTimer(_ref3) {
|
|
|
35
35
|
var runboxId = _ref3.runboxId,
|
|
36
36
|
userId = _ref3.userId,
|
|
37
37
|
headerElement = _ref3.headerElement,
|
|
38
|
-
stopRuntime = _ref3.stopRuntime,
|
|
39
38
|
_ref3$hideTimerPopove = _ref3.hideTimerPopover,
|
|
40
|
-
hideTimerPopover = _ref3$hideTimerPopove === void 0 ? false : _ref3$hideTimerPopove
|
|
39
|
+
hideTimerPopover = _ref3$hideTimerPopove === void 0 ? false : _ref3$hideTimerPopove,
|
|
40
|
+
_ref3$isTutoring = _ref3.isTutoring,
|
|
41
|
+
isTutoring = _ref3$isTutoring === void 0 ? false : _ref3$isTutoring;
|
|
41
42
|
var intl = useRawEliceIntl();
|
|
43
|
+
var isSmallTabletOrSmaller = useBreakpoint('md', 'down');
|
|
42
44
|
var _useEliceRunboxRunnin = useEliceRunboxRunning(),
|
|
43
45
|
status = _useEliceRunboxRunnin.status;
|
|
44
46
|
var isRunboxRunning = status === 'running';
|
|
45
47
|
var _useEliceRunboxQuota = useEliceRunboxQuota(),
|
|
46
48
|
quotaInfo = _useEliceRunboxQuota.quotaInfo;
|
|
49
|
+
var _useMaterialRunboxCon = useMaterialRunboxControlContext(),
|
|
50
|
+
stopRuntime = _useMaterialRunboxCon.stop;
|
|
51
|
+
var _useRunboxSessionEndW = useRunboxSessionEndWarning({
|
|
52
|
+
runboxId: runboxId,
|
|
53
|
+
disabled: isTutoring || !isRunboxRunning
|
|
54
|
+
}),
|
|
55
|
+
warning = _useRunboxSessionEndW.warning,
|
|
56
|
+
dismiss = _useRunboxSessionEndW.dismiss;
|
|
47
57
|
var _React$useState = React.useState(false),
|
|
48
58
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
49
59
|
isTimerDetailPopoverOpen = _React$useState2[0],
|
|
@@ -98,7 +108,7 @@ var MaterialRunboxTimer = function MaterialRunboxTimer(_ref3) {
|
|
|
98
108
|
children: jsx(StyledChip, {
|
|
99
109
|
variant: isAlmostEnd ? 'filled' : 'outlined',
|
|
100
110
|
color: isAlmostEnd ? 'warning' : 'default',
|
|
101
|
-
size:
|
|
111
|
+
size: isSmallTabletOrSmaller ? 'small' : 'medium',
|
|
102
112
|
icon: jsx(EliceIcon, {
|
|
103
113
|
icon: faTimer
|
|
104
114
|
}),
|
|
@@ -151,19 +161,17 @@ var MaterialRunboxTimer = function MaterialRunboxTimer(_ref3) {
|
|
|
151
161
|
}
|
|
152
162
|
});
|
|
153
163
|
};
|
|
154
|
-
var renderAlmostEndSnackbars = function renderAlmostEndSnackbars() {
|
|
155
|
-
return jsx(MaterialRunboxAlmostEndSnackbars, {
|
|
156
|
-
runboxId: runboxId,
|
|
157
|
-
onClickDetail: function onClickDetail() {
|
|
158
|
-
return setTimerDetailPopoverOpen(true);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
164
|
if (!isRunboxRunning) {
|
|
163
165
|
return null;
|
|
164
166
|
}
|
|
165
167
|
return jsxs(Fragment, {
|
|
166
|
-
children: [renderTimer(), renderTimerDetailPopover(),
|
|
168
|
+
children: [renderTimer(), renderTimerDetailPopover(), jsx(MaterialRunboxQuotaAlmostEndDialog, {
|
|
169
|
+
open: warning === 'quota',
|
|
170
|
+
onClose: dismiss
|
|
171
|
+
}), jsx(MaterialRunboxQuotaPerSessionAlmostEndDialog, {
|
|
172
|
+
open: warning === 'quotaPerSession',
|
|
173
|
+
onClose: dismiss
|
|
174
|
+
})]
|
|
167
175
|
});
|
|
168
176
|
};
|
|
169
177
|
|
|
@@ -7,15 +7,14 @@ import { useRawEliceIntl } from '@elice/intl';
|
|
|
7
7
|
import { EliceIcon } from '@elice/mui-elements';
|
|
8
8
|
import { useEliceRunboxQuota } from '@elice/runbox-client';
|
|
9
9
|
import { faXmarkLarge } from '@fortawesome/pro-regular-svg-icons';
|
|
10
|
-
import { Popover, Stack, Card, Divider, Button, FormControlLabel, Typography, Checkbox, IconButton } from '@mui/material';
|
|
10
|
+
import { Popover, Fade, Stack, Card, Divider, Button, FormControlLabel, Typography, Checkbox, IconButton } from '@mui/material';
|
|
11
11
|
import { useQuery } from '@tanstack/react-query';
|
|
12
|
-
import {
|
|
12
|
+
import { QUOTA_ALMOST_END_MINUTES, QUOTA_PER_SESSION_ALMOST_END_MINUTES } from '../hooks/useRunboxSessionEndWarning.js';
|
|
13
|
+
import MaterialRunboxQuotaAmount from './MaterialRunboxQuotaAmount.js';
|
|
13
14
|
|
|
14
15
|
//
|
|
15
16
|
//
|
|
16
17
|
//
|
|
17
|
-
var QUOTA_ALMOST_END_MINUTES = 30;
|
|
18
|
-
var QUOTA_PER_SESSION_ALMOST_END_MINUTES = 10;
|
|
19
18
|
var QUOTA_POPOVER_NOT_SHOW_ON_START = 'MaterialRunboxTimer.timerDetailPopover.notShowOnStart';
|
|
20
19
|
//
|
|
21
20
|
//
|
|
@@ -114,48 +113,6 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
114
113
|
})]
|
|
115
114
|
});
|
|
116
115
|
};
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
var formatTimePart = function formatTimePart(value, unit) {
|
|
121
|
-
return intl.formatNumber(value, {
|
|
122
|
-
style: 'unit',
|
|
123
|
-
unit: unit,
|
|
124
|
-
unitDisplay: 'short'
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
*/
|
|
130
|
-
var renderQuotaTimePart = function renderQuotaTimePart(value, unit, color) {
|
|
131
|
-
if (value === 0) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
var parts = intl.formatNumberToParts(value, {
|
|
135
|
-
style: 'unit',
|
|
136
|
-
unit: unit,
|
|
137
|
-
unitDisplay: 'short'
|
|
138
|
-
});
|
|
139
|
-
return jsx(Typography, {
|
|
140
|
-
component: "span",
|
|
141
|
-
variant: "h5",
|
|
142
|
-
fontWeight: "extraBold",
|
|
143
|
-
color: color,
|
|
144
|
-
children: parts.map(function (part, index) {
|
|
145
|
-
if (part.type === 'unit') {
|
|
146
|
-
return jsx(Typography, {
|
|
147
|
-
component: "span",
|
|
148
|
-
variant: "body2",
|
|
149
|
-
fontWeight: "regular",
|
|
150
|
-
children: part.value
|
|
151
|
-
}, index);
|
|
152
|
-
}
|
|
153
|
-
return jsx("span", {
|
|
154
|
-
children: part.value
|
|
155
|
-
}, index);
|
|
156
|
-
})
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
116
|
/**
|
|
160
117
|
*
|
|
161
118
|
*/
|
|
@@ -181,13 +138,6 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
181
138
|
})]
|
|
182
139
|
});
|
|
183
140
|
}
|
|
184
|
-
// Sync UI with the timer.
|
|
185
|
-
var _getTimeParts = getTimeParts(quotaInfo.remainingQuota * 60),
|
|
186
|
-
remainingHours = _getTimeParts.hours,
|
|
187
|
-
remainingMinutes = _getTimeParts.minutes;
|
|
188
|
-
var _getTimeParts2 = getTimeParts(quotaInfo.quota * 60),
|
|
189
|
-
totalHours = _getTimeParts2.hours,
|
|
190
|
-
totalMinutes = _getTimeParts2.minutes;
|
|
191
141
|
var quotaColor = quotaInfo.remainingQuota > QUOTA_ALMOST_END_MINUTES ? 'success.main' : 'warning.main';
|
|
192
142
|
var quotaBgColor = quotaInfo.remainingQuota > QUOTA_ALMOST_END_MINUTES ? undefined : 'warning.opacity03';
|
|
193
143
|
return jsxs(Stack, {
|
|
@@ -201,15 +151,10 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
201
151
|
children: intl.formatMessage({
|
|
202
152
|
id: 'runbox.timer.popover.quota.title'
|
|
203
153
|
})
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
display: "inline-flex",
|
|
209
|
-
direction: "row",
|
|
210
|
-
gap: "0.25rem",
|
|
211
|
-
children: [renderQuotaTimePart(remainingHours, 'hour', quotaColor), renderQuotaTimePart(remainingMinutes, 'minute', quotaColor)]
|
|
212
|
-
}), [" / ", totalHours > 0 ? formatTimePart(totalHours, 'hour') : null, totalMinutes > 0 ? formatTimePart(totalMinutes, 'minute') : null].filter(Boolean).join(' ')]
|
|
154
|
+
}), jsx(MaterialRunboxQuotaAmount, {
|
|
155
|
+
remainingQuota: quotaInfo.remainingQuota,
|
|
156
|
+
quota: quotaInfo.quota,
|
|
157
|
+
color: quotaColor
|
|
213
158
|
})]
|
|
214
159
|
});
|
|
215
160
|
};
|
|
@@ -228,12 +173,6 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
228
173
|
})]
|
|
229
174
|
});
|
|
230
175
|
}
|
|
231
|
-
var _getTimeParts3 = getTimeParts(quotaPerSessionInfo.remainingQuota * 60),
|
|
232
|
-
remainingHours = _getTimeParts3.hours,
|
|
233
|
-
remainingMinutes = _getTimeParts3.minutes;
|
|
234
|
-
var _getTimeParts4 = getTimeParts(quotaPerSessionInfo.quota * 60),
|
|
235
|
-
totalHours = _getTimeParts4.hours,
|
|
236
|
-
totalMinutes = _getTimeParts4.minutes;
|
|
237
176
|
var perSessionColor = quotaPerSessionInfo.remainingQuota > QUOTA_PER_SESSION_ALMOST_END_MINUTES ? 'success.main' : 'warning.main';
|
|
238
177
|
var perSessionBgColor = quotaPerSessionInfo.remainingQuota > QUOTA_PER_SESSION_ALMOST_END_MINUTES ? undefined : 'warning.opacity03';
|
|
239
178
|
return jsxs(Stack, {
|
|
@@ -247,28 +186,28 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
247
186
|
children: intl.formatMessage({
|
|
248
187
|
id: 'runbox.timer.popover.quota_per_session.title'
|
|
249
188
|
})
|
|
250
|
-
}),
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
display: "inline-flex",
|
|
255
|
-
direction: "row",
|
|
256
|
-
gap: "0.25rem",
|
|
257
|
-
children: [renderQuotaTimePart(remainingHours, 'hour', perSessionColor), renderQuotaTimePart(remainingMinutes, 'minute', perSessionColor)]
|
|
258
|
-
}), [" / ", totalHours > 0 ? formatTimePart(totalHours, 'hour') : null, totalMinutes > 0 ? formatTimePart(totalMinutes, 'minute') : null].filter(Boolean).join(' ')]
|
|
189
|
+
}), jsx(MaterialRunboxQuotaAmount, {
|
|
190
|
+
remainingQuota: quotaPerSessionInfo.remainingQuota,
|
|
191
|
+
quota: quotaPerSessionInfo.quota,
|
|
192
|
+
color: perSessionColor
|
|
259
193
|
}), jsx(Typography, {
|
|
260
194
|
variant: "body2",
|
|
261
195
|
color: "text.tertiary",
|
|
262
196
|
children: intl.formatMessage({
|
|
263
197
|
id: 'runbox.timer.popover.quota_per_session.description'
|
|
264
198
|
}, {
|
|
265
|
-
time:
|
|
199
|
+
time: intl.formatNumber(quotaPerSessionInfo.quota, {
|
|
200
|
+
style: 'unit',
|
|
201
|
+
unit: 'minute',
|
|
202
|
+
unitDisplay: 'short'
|
|
203
|
+
})
|
|
266
204
|
})
|
|
267
205
|
})]
|
|
268
206
|
});
|
|
269
207
|
};
|
|
270
208
|
return jsx(Popover, Object.assign({
|
|
271
209
|
open: open,
|
|
210
|
+
TransitionComponent: Fade,
|
|
272
211
|
onClose: onClose
|
|
273
212
|
}, props, {
|
|
274
213
|
children: jsxs(Stack, {
|
|
@@ -279,6 +218,7 @@ var MaterialRunboxTimerDetailPopover = function MaterialRunboxTimerDetailPopover
|
|
|
279
218
|
width: "22rem",
|
|
280
219
|
bgcolor: "background.paper",
|
|
281
220
|
children: [renderHeader(), renderCloseButton(), jsxs(Card, {
|
|
221
|
+
elevation: 0,
|
|
282
222
|
sx: {
|
|
283
223
|
bgcolor: 'background.neutral'
|
|
284
224
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useBreakpoint';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useBreakpoint } from './useBreakpoint.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useTheme, useMediaQuery } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
var useBreakpoint = function useBreakpoint(key) {
|
|
4
|
+
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'up';
|
|
5
|
+
var theme = useTheme();
|
|
6
|
+
var matches = useMediaQuery(theme.breakpoints[query](key));
|
|
7
|
+
return matches;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useBreakpoint };
|