@elice/material-runbox 1.250310.0 → 1.250311.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 (43) hide show
  1. package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +0 -4
  2. package/cjs/components/material-runbox/MaterialRunboxContent.js +4 -14
  3. package/cjs/components/material-runbox/MaterialRunboxHeader.js +1 -5
  4. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -1
  5. package/cjs/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -10
  6. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -1
  7. package/cjs/components/material-runbox/actions/MaterialRunboxActionRestart.js +1 -3
  8. package/cjs/components/material-runbox/hooks/useRunboxControl.d.ts +1 -1
  9. package/cjs/components/material-runbox/hooks/useRunboxControl.js +2 -5
  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/runtime/Runtime.d.ts +0 -4
  15. package/cjs/components/material-runbox/runtime/Runtime.js +1 -1
  16. package/es/components/material-runbox/MaterialRunboxContent.d.ts +0 -4
  17. package/es/components/material-runbox/MaterialRunboxContent.js +4 -14
  18. package/es/components/material-runbox/MaterialRunboxHeader.js +1 -5
  19. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.d.ts +1 -1
  20. package/es/components/material-runbox/actions/MaterialRunboxActionMenu.js +1 -10
  21. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.d.ts +1 -1
  22. package/es/components/material-runbox/actions/MaterialRunboxActionRestart.js +1 -3
  23. package/es/components/material-runbox/hooks/useRunboxControl.d.ts +1 -1
  24. package/es/components/material-runbox/hooks/useRunboxControl.js +2 -5
  25. package/es/components/material-runbox/locales/en.json.js +1 -1
  26. package/es/components/material-runbox/locales/ja.json.js +1 -1
  27. package/es/components/material-runbox/locales/ko.json.js +1 -1
  28. package/es/components/material-runbox/locales/th.json.js +1 -1
  29. package/es/components/material-runbox/runtime/Runtime.d.ts +0 -4
  30. package/es/components/material-runbox/runtime/Runtime.js +1 -1
  31. package/package.json +4 -5
  32. package/cjs/components/material-runbox/actions/MaterialRunboxActionSubmitLog.d.ts +0 -7
  33. package/cjs/components/material-runbox/actions/MaterialRunboxActionSubmitLog.js +0 -67
  34. package/cjs/components/material-runbox/actions/MaterialRunboxActionSubmitLogDialog.d.ts +0 -9
  35. package/cjs/components/material-runbox/actions/MaterialRunboxActionSubmitLogDialog.js +0 -192
  36. package/cjs/components/material-runbox/hooks/useInfiniteRunboxRunboxIdGrade.d.ts +0 -13
  37. package/cjs/components/material-runbox/hooks/useInfiniteRunboxRunboxIdGrade.js +0 -59
  38. package/es/components/material-runbox/actions/MaterialRunboxActionSubmitLog.d.ts +0 -7
  39. package/es/components/material-runbox/actions/MaterialRunboxActionSubmitLog.js +0 -59
  40. package/es/components/material-runbox/actions/MaterialRunboxActionSubmitLogDialog.d.ts +0 -9
  41. package/es/components/material-runbox/actions/MaterialRunboxActionSubmitLogDialog.js +0 -183
  42. package/es/components/material-runbox/hooks/useInfiniteRunboxRunboxIdGrade.d.ts +0 -13
  43. package/es/components/material-runbox/hooks/useInfiniteRunboxRunboxIdGrade.js +0 -57
@@ -1,183 +0,0 @@
1
- import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { __rest } from 'tslib';
3
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import React from 'react';
5
- import { useInView } from 'react-intersection-observer';
6
- import { useRawEliceIntl } from '@elice/intl';
7
- import { Tag, EliceIcon } from '@elice/mui-elements';
8
- import { useTheme } from '@emotion/react';
9
- import { faArrowDownToLine } from '@fortawesome/pro-regular-svg-icons';
10
- import { useMediaQuery, Dialog, DialogTitle, DialogContent, Stack, DialogActions, Button, Typography, List, ListItemButton, ListItemText, ListItemSecondaryAction, Tooltip, IconButton, Box } from '@mui/material';
11
- import dayjs from 'dayjs';
12
- import '../contexts/MaterialRunboxApiContext.js';
13
- import '../contexts/MaterialRunboxCommandContext.js';
14
- import { useMaterialRunboxContext } from '../contexts/MaterialRunboxContext.js';
15
- import { useInfiniteRunboxRunboxIdGrade } from '../hooks/useInfiniteRunboxRunboxIdGrade.js';
16
-
17
- //
18
- //
19
- //
20
- var MaterialRunboxActionSubmitLogDialog = function MaterialRunboxActionSubmitLogDialog(_a) {
21
- var isOpen = _a.isOpen,
22
- onClose = _a.onClose,
23
- props = __rest(_a, ["isOpen", "onClose"]);
24
- var intl = useRawEliceIntl();
25
- //
26
- var _useMaterialRunboxCon = useMaterialRunboxContext(),
27
- locale = _useMaterialRunboxCon.locale;
28
- dayjs.locale(locale);
29
- //
30
- var theme = useTheme();
31
- var isMobileOrSmaller = useMediaQuery(theme.breakpoints.down('sm'));
32
- //
33
- var _useInfiniteRunboxRun = useInfiniteRunboxRunboxIdGrade(Object.assign(Object.assign({}, props), {
34
- enabled: Boolean(isOpen && props.runboxId && props.userId)
35
- })),
36
- grade = _useInfiniteRunboxRun.grade,
37
- fetchNextPage = _useInfiniteRunboxRun.fetchNextPage;
38
- var _useInView = useInView(),
39
- inView = _useInView.inView,
40
- ref = _useInView.ref;
41
- //
42
- var _React$useState = React.useState(null),
43
- _React$useState2 = _slicedToArray(_React$useState, 2),
44
- selectedGrade = _React$useState2[0],
45
- setSelectedGrade = _React$useState2[1];
46
- /**
47
- *
48
- */
49
- var renderEmpty = function renderEmpty() {
50
- return jsx(Stack, {
51
- justifyContent: "center",
52
- alignItems: "center",
53
- children: jsx(Typography, {
54
- variant: "body1",
55
- children: intl.formatMessage({
56
- id: 'runbox.action.submitLog.empty'
57
- })
58
- })
59
- });
60
- };
61
- /**
62
- *
63
- */
64
- var renderGradeList = function renderGradeList() {
65
- return jsxs(List, {
66
- ref: ref,
67
- sx: {
68
- width: '100%',
69
- maxHeight: '100%',
70
- overflow: 'auto'
71
- },
72
- children: [grade === null || grade === void 0 ? void 0 : grade.map(function (item) {
73
- return jsxs(ListItemButton, {
74
- selected: (selectedGrade === null || selectedGrade === void 0 ? void 0 : selectedGrade.id) === item.id,
75
- onClick: function onClick() {
76
- return setSelectedGrade(item);
77
- },
78
- children: [jsx(ListItemText, {
79
- primary: dayjs(item.created).format(isMobileOrSmaller ? 'YYYY.MM.DD' : 'YYYY.MM.DD A HH:mm')
80
- }), jsx(ListItemSecondaryAction, {
81
- children: jsxs(Stack, {
82
- direction: "row",
83
- alignItems: "center",
84
- gap: "0.5rem",
85
- children: [(item === null || item === void 0 ? void 0 : item.score) ? jsx(Tag, {
86
- variant: "muted",
87
- color: "info",
88
- label: intl.formatMessage({
89
- id: 'runbox.common.score'
90
- }, {
91
- score: item.score
92
- })
93
- }) : null, jsx(Tooltip, {
94
- title: intl.formatMessage({
95
- id: 'runbox.action.submitLog.dialog.download.tooltip'
96
- }),
97
- children: jsx(IconButton, {
98
- onClick: function onClick() {
99
- window.open(item.submissionFileUrl, '_blank');
100
- },
101
- children: jsx(EliceIcon, {
102
- icon: faArrowDownToLine
103
- })
104
- })
105
- })]
106
- })
107
- })]
108
- }, item.id);
109
- }), jsx("div", {
110
- ref: ref
111
- })]
112
- });
113
- };
114
- /**
115
- *
116
- */
117
- var renderCodebox = function renderCodebox() {
118
- return jsx(Box, {
119
- bgcolor: function bgcolor(theme) {
120
- return theme.palette.common.black;
121
- },
122
- borderRadius: "0.5rem",
123
- padding: "1rem",
124
- width: "100%",
125
- overflow: "auto",
126
- fontFamily: "Elice Digital Coding, monospace",
127
- fontSize: "0.875rem",
128
- whiteSpace: "pre-wrap",
129
- lineHeight: "1.375rem",
130
- children: selectedGrade === null || selectedGrade === void 0 ? void 0 : selectedGrade.output
131
- });
132
- };
133
- //
134
- //
135
- //
136
- React.useEffect(function () {
137
- if (inView) {
138
- fetchNextPage();
139
- }
140
- }, [inView, fetchNextPage]);
141
- //
142
- //
143
- //
144
- React.useEffect(function () {
145
- if ((grade === null || grade === void 0 ? void 0 : grade.length) && !selectedGrade) {
146
- setSelectedGrade(grade[0]);
147
- }
148
- }, [grade, selectedGrade]);
149
- //
150
- //
151
- //
152
- return jsxs(Dialog, {
153
- fullWidth: true,
154
- maxWidth: "lg",
155
- open: isOpen,
156
- onClose: onClose,
157
- children: [jsx(DialogTitle, {
158
- children: intl.formatMessage({
159
- id: 'runbox.action.submitLog.dialog.title'
160
- })
161
- }), jsx(DialogContent, {
162
- children: jsx(Stack, {
163
- direction: "row",
164
- gap: "0.5rem",
165
- overflow: "auto",
166
- maxHeight: "30rem",
167
- children: (grade === null || grade === void 0 ? void 0 : grade.length) ? jsxs(Fragment, {
168
- children: [renderGradeList(), renderCodebox()]
169
- }) : renderEmpty()
170
- })
171
- }), jsx(DialogActions, {
172
- children: jsx(Button, {
173
- color: "inherit",
174
- onClick: onClose,
175
- children: intl.formatMessage({
176
- id: 'runbox.common.close'
177
- })
178
- })
179
- })]
180
- });
181
- };
182
-
183
- export { MaterialRunboxActionSubmitLogDialog as default };
@@ -1,13 +0,0 @@
1
- import type { RunboxGradeGetResponse, RunboxRunboxIdGradeGetRequest } from '@elice/openapi-client-material-runbox';
2
- type UseInfiniteRunboxRunboxIdGradeProps = RunboxRunboxIdGradeGetRequest & {
3
- enabled: boolean;
4
- };
5
- type UseInfiniteRunboxRunboxIdGradeReturn = {
6
- grade: RunboxGradeGetResponse[] | undefined;
7
- isGradeLoading: boolean;
8
- isGradeError: boolean;
9
- refetchGrade: () => void;
10
- fetchNextPage: () => void;
11
- };
12
- export declare const useInfiniteRunboxRunboxIdGrade: (props: Omit<UseInfiniteRunboxRunboxIdGradeProps, 'skip' | 'count'>) => UseInfiniteRunboxRunboxIdGradeReturn;
13
- export {};
@@ -1,57 +0,0 @@
1
- import { useRef, useCallback } from 'react';
2
- import { useInfiniteQuery } from '@tanstack/react-query';
3
- import { useMaterialRunboxApiContext } from '../contexts/MaterialRunboxApiContext.js';
4
- import '../contexts/MaterialRunboxCommandContext.js';
5
- import '../contexts/MaterialRunboxContext.js';
6
-
7
- //
8
- //
9
- //
10
- var DEFAULT_COUNT = 10;
11
- var DEFAULT_SKIP = 0;
12
- //
13
- //
14
- //
15
- var useInfiniteRunboxRunboxIdGrade = function useInfiniteRunboxRunboxIdGrade(props) {
16
- var _return = useRef({});
17
- var enabled = props.enabled;
18
- var materialRunboxApi = useMaterialRunboxApiContext();
19
- //
20
- var _useInfiniteQuery = useInfiniteQuery({
21
- queryKey: ['runboxRunboxIdGrade', props],
22
- queryFn: function queryFn(_ref) {
23
- var _ref$pageParam = _ref.pageParam,
24
- pageParam = _ref$pageParam === void 0 ? DEFAULT_SKIP : _ref$pageParam;
25
- return materialRunboxApi.runbox.runboxRunboxIdGradeGet(Object.assign(Object.assign({}, props), {
26
- skip: pageParam,
27
- count: DEFAULT_COUNT
28
- }));
29
- },
30
- getNextPageParam: function getNextPageParam(lastPage, pages) {
31
- return lastPage.length === DEFAULT_COUNT ? pages.length * DEFAULT_COUNT : undefined;
32
- },
33
- enabled: enabled
34
- }),
35
- data = _useInfiniteQuery.data,
36
- isLoading = _useInfiniteQuery.isLoading,
37
- isFetchingNextPage = _useInfiniteQuery.isFetchingNextPage,
38
- hasNextPage = _useInfiniteQuery.hasNextPage,
39
- isError = _useInfiniteQuery.isError,
40
- fetchNextPage = _useInfiniteQuery.fetchNextPage,
41
- refetch = _useInfiniteQuery.refetch;
42
- //
43
- _return.current.grade = data === null || data === void 0 ? void 0 : data.pages.flatMap(function (page) {
44
- return page;
45
- });
46
- _return.current.isGradeLoading = isLoading || isFetchingNextPage;
47
- _return.current.isGradeError = isError;
48
- _return.current.refetchGrade = refetch;
49
- _return.current.fetchNextPage = useCallback(function () {
50
- if (hasNextPage && !isFetchingNextPage) {
51
- void fetchNextPage();
52
- }
53
- }, [fetchNextPage, hasNextPage, isFetchingNextPage]);
54
- return _return.current;
55
- };
56
-
57
- export { useInfiniteRunboxRunboxIdGrade };