touchstudy-core 0.1.60 → 0.1.61
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/dist/containers/ExamResult/components/MyAnswer/components/CreateNewQuestion.d.ts +5 -3
- package/dist/containers/ExamResult/components/MyAnswer/hooks/useCreateDialog.d.ts +9 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +458 -155
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +459 -156
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/constants.d.ts +0 -3
- package/dist/utils/getAcademyDomain.d.ts +2 -0
- package/dist/utils/getRedirectUrl.d.ts +2 -0
- package/dist/utils/hooks/useLayoutContext.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -9,7 +9,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
9
9
|
import axios from 'axios';
|
10
10
|
import { useTranslation, initReactI18next } from 'react-i18next';
|
11
11
|
export { I18nextProvider, useTranslation } from 'react-i18next';
|
12
|
-
import { Paper, Card, Stack, Grid, Dialog, DialogTitle, IconButton, DialogContent, TextField, DialogActions, Button, Box, Typography, Pagination, styled, useTheme, useMediaQuery, Tooltip, tooltipClasses, ClickAwayListener, CircularProgress, FormControl, RadioGroup, FormControlLabel, Radio, FormGroup, FormLabel, Checkbox, InputLabel, Container, Table, TableBody, TableRow, TableCell, TableHead, InputBase } from '@mui/material';
|
12
|
+
import { Paper, Card, Stack, Grid, Dialog, DialogTitle, IconButton, DialogContent, TextField, DialogActions, Button, Box, Typography, Pagination, styled, useTheme, useMediaQuery, MenuList, Tooltip, tooltipClasses, ClickAwayListener, CircularProgress, FormControl, RadioGroup, FormControlLabel, Radio, FormGroup, FormLabel, Checkbox, InputLabel, Container, Table, TableBody, TableRow, TableCell, TableHead, InputBase } from '@mui/material';
|
13
13
|
import 'moment/locale/ko.js';
|
14
14
|
import 'moment/locale/en-au.js';
|
15
15
|
import { gapi } from 'gapi-script';
|
@@ -77,27 +77,6 @@ var DATE_MIN_VALUE = "0001-01-01T00:00:00+00:00";
|
|
77
77
|
var DATE_TIME_MIN_VALUE = "0001-01-01T00:00:00";
|
78
78
|
var EXAM_CHANNEL = "presence-exam-channel";
|
79
79
|
var EXAM_STUDENT_CHANNEL = "EXAM-CHANNEL-{examCode}-STUDENT-{studentId}";
|
80
|
-
var getAccessToken = function getAccessToken() {
|
81
|
-
try {
|
82
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
83
|
-
} catch (err) {
|
84
|
-
return null;
|
85
|
-
}
|
86
|
-
};
|
87
|
-
var getAcademyDomain = function getAcademyDomain() {
|
88
|
-
try {
|
89
|
-
return localStorage.getItem(ACADEMY_DOMAIN);
|
90
|
-
} catch (err) {
|
91
|
-
return null;
|
92
|
-
}
|
93
|
-
};
|
94
|
-
var getRedirectUrl = function getRedirectUrl() {
|
95
|
-
try {
|
96
|
-
return localStorage.getItem(REDIRECT_URL);
|
97
|
-
} catch (err) {
|
98
|
-
return undefined;
|
99
|
-
}
|
100
|
-
};
|
101
80
|
var encodeParams = function encodeParams(params) {
|
102
81
|
return Object.keys(params).filter(function (key) {
|
103
82
|
return params[key] || params[key] === 0 || params[key] === false;
|
@@ -381,6 +360,22 @@ function _finally(body, finalizer) {
|
|
381
360
|
return finalizer();
|
382
361
|
}
|
383
362
|
|
363
|
+
var getAcademyDomain = function getAcademyDomain() {
|
364
|
+
try {
|
365
|
+
return localStorage.getItem(ACADEMY_DOMAIN);
|
366
|
+
} catch (err) {
|
367
|
+
return null;
|
368
|
+
}
|
369
|
+
};
|
370
|
+
|
371
|
+
var getAccessToken = (function () {
|
372
|
+
try {
|
373
|
+
return localStorage.getItem(ACCESS_TOKEN);
|
374
|
+
} catch (err) {
|
375
|
+
return null;
|
376
|
+
}
|
377
|
+
});
|
378
|
+
|
384
379
|
var api = axios.create({
|
385
380
|
baseURL: BASE_URL,
|
386
381
|
timeout: 0,
|
@@ -507,14 +502,23 @@ var pushTo = function pushTo(history, data) {
|
|
507
502
|
};
|
508
503
|
|
509
504
|
var getErrorMessage = function getErrorMessage(t, error, defaultErrorMessage) {
|
510
|
-
var _error$response, _error$response$data, _error$response2, _error$
|
505
|
+
var _error$response, _error$response$data, _error$response2, _error$response3, _error$response3$data;
|
511
506
|
var errorMessage = error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title;
|
512
|
-
if (
|
513
|
-
|
507
|
+
if ((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 500) return defaultErrorMessage || t(DefaultErrorMessage);
|
508
|
+
if (typeof errorMessage === "string") return decodeURIComponent(errorMessage);
|
509
|
+
errorMessage = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : _error$response3$data.message);
|
514
510
|
if (typeof errorMessage === "string") return errorMessage;
|
515
511
|
return defaultErrorMessage || t(DefaultErrorMessage);
|
516
512
|
};
|
517
513
|
|
514
|
+
var getRedirectUrl = function getRedirectUrl() {
|
515
|
+
try {
|
516
|
+
return localStorage.getItem(REDIRECT_URL);
|
517
|
+
} catch (err) {
|
518
|
+
return undefined;
|
519
|
+
}
|
520
|
+
};
|
521
|
+
|
518
522
|
var useLogin = function useLogin(history, homeAcademyUrl, homeUrl, registerUrl) {
|
519
523
|
var dispatch = useDispatch();
|
520
524
|
var _useTranslation = useTranslation(),
|
@@ -597,7 +601,9 @@ var useLogin = function useLogin(history, homeAcademyUrl, homeUrl, registerUrl)
|
|
597
601
|
var needToRegister = isStudent && isFirstLogin && isAcademy;
|
598
602
|
var redirectUrl = getRedirectUrl();
|
599
603
|
if (!redirectUrl) redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
600
|
-
redirectLoginUser(
|
604
|
+
redirectLoginUser(_extends({}, user, {
|
605
|
+
isFirstLogin: isFirstLogin
|
606
|
+
}), token, redirectUrl);
|
601
607
|
});
|
602
608
|
}, function (error) {
|
603
609
|
alert(getErrorMessage(t, error));
|
@@ -998,14 +1004,6 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
998
1004
|
})));
|
999
1005
|
};
|
1000
1006
|
|
1001
|
-
var getAccessToken$1 = (function () {
|
1002
|
-
try {
|
1003
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
1004
|
-
} catch (err) {
|
1005
|
-
return null;
|
1006
|
-
}
|
1007
|
-
});
|
1008
|
-
|
1009
1007
|
var defaultInfo = {
|
1010
1008
|
email: "",
|
1011
1009
|
password: "",
|
@@ -1035,7 +1033,7 @@ var useLogin$1 = function useLogin(history) {
|
|
1035
1033
|
!!gapi && gapi.load("client:auth2", start);
|
1036
1034
|
}, [gapi]);
|
1037
1035
|
useEffect(function () {
|
1038
|
-
var token = getAccessToken
|
1036
|
+
var token = getAccessToken();
|
1039
1037
|
if (!!token) pushTo(history, "/");
|
1040
1038
|
}, []);
|
1041
1039
|
return {
|
@@ -1322,6 +1320,7 @@ var TITLE = "Not found";
|
|
1322
1320
|
var NotFound = function NotFound() {
|
1323
1321
|
var _useTranslation = useTranslation(),
|
1324
1322
|
t = _useTranslation.t;
|
1323
|
+
useLanguage();
|
1325
1324
|
useEffect(function () {
|
1326
1325
|
document.title = TITLE;
|
1327
1326
|
});
|
@@ -1390,12 +1389,8 @@ var switchAcademy = function switchAcademy(academyId) {
|
|
1390
1389
|
return api.post(ACADEMY_URL + "/switch-academy?academyId=" + academyId);
|
1391
1390
|
};
|
1392
1391
|
|
1393
|
-
var
|
1392
|
+
var useLayoutContext = function useLayoutContext(role, pusherRegisterUrls) {
|
1394
1393
|
var _currentPusher$connec2;
|
1395
|
-
var children = _ref.children,
|
1396
|
-
role = _ref.role,
|
1397
|
-
_ref$pusherRegisterUr = _ref.pusherRegisterUrls,
|
1398
|
-
pusherRegisterUrls = _ref$pusherRegisterUr === void 0 ? [] : _ref$pusherRegisterUr;
|
1399
1394
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
1400
1395
|
handleSignOut = _useGoogleSignOut.handleSignOut;
|
1401
1396
|
var _useTranslation = useTranslation(),
|
@@ -1446,7 +1441,10 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1446
1441
|
var checkRoleUser = useCallback(function () {
|
1447
1442
|
if (!user) return;
|
1448
1443
|
if (!roles.includes(role) && !!academyDomain) {
|
1449
|
-
alert(
|
1444
|
+
alert(t("user_not_allow_to_register_role", {
|
1445
|
+
user: user.email,
|
1446
|
+
role: role
|
1447
|
+
}));
|
1450
1448
|
resetAuth();
|
1451
1449
|
}
|
1452
1450
|
}, [role, JSON.stringify(user)]);
|
@@ -1481,9 +1479,10 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1481
1479
|
}
|
1482
1480
|
};
|
1483
1481
|
var registerPusher = useCallback(function () {
|
1482
|
+
if (!academyDomain) return;
|
1484
1483
|
if (pusherRegisterUrls.includes(pathname.toLocaleLowerCase())) {
|
1485
1484
|
var _currentPusher$connec;
|
1486
|
-
if (academyDomain
|
1485
|
+
if (academyDomain !== (concurrentConnectionPusher === null || concurrentConnectionPusher === void 0 ? void 0 : concurrentConnectionPusher.academyDomain) && isReadyRegisterPusher) {
|
1487
1486
|
var _headers;
|
1488
1487
|
if (currentPusher) {
|
1489
1488
|
currentPusher.disconnect();
|
@@ -1539,6 +1538,14 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1539
1538
|
}
|
1540
1539
|
};
|
1541
1540
|
}, [registerPusher]);
|
1541
|
+
};
|
1542
|
+
|
1543
|
+
var LayoutContext = function LayoutContext(_ref) {
|
1544
|
+
var children = _ref.children,
|
1545
|
+
role = _ref.role,
|
1546
|
+
_ref$pusherRegisterUr = _ref.pusherRegisterUrls,
|
1547
|
+
pusherRegisterUrls = _ref$pusherRegisterUr === void 0 ? [] : _ref$pusherRegisterUr;
|
1548
|
+
useLayoutContext(role, pusherRegisterUrls);
|
1542
1549
|
return React__default.createElement(Fragment$1, null, children);
|
1543
1550
|
};
|
1544
1551
|
|
@@ -1875,7 +1882,7 @@ var number_problem = "{{number}}문제";
|
|
1875
1882
|
var problems = "문제";
|
1876
1883
|
var problem_solving_time = "문제풀이 시간";
|
1877
1884
|
var minutes = "분";
|
1878
|
-
var correct_rate = "
|
1885
|
+
var correct_rate = "정답률";
|
1879
1886
|
var title = "제목";
|
1880
1887
|
var duration = "시험 시간";
|
1881
1888
|
var answer_count = "답변 수";
|
@@ -2186,7 +2193,7 @@ var password = "비밀번호";
|
|
2186
2193
|
var email_address = "이메일 주소";
|
2187
2194
|
var please_enter_your_question = "질문할 내용을 입력해주세요.";
|
2188
2195
|
var test_selection = "테스트 선택";
|
2189
|
-
var half_selection = "
|
2196
|
+
var half_selection = "반 선택";
|
2190
2197
|
var choose_a_problem = "문제를 선택하세요";
|
2191
2198
|
var question_content = "질문 내용";
|
2192
2199
|
var questions_to_ask = "질문할 문제";
|
@@ -2269,6 +2276,7 @@ var export_csv = "CSV 내보내기";
|
|
2269
2276
|
var select_type = "유형 선택";
|
2270
2277
|
var no_message = "메시지 없음";
|
2271
2278
|
var this_is_the_guidance_text = "안내 텍스트입니다.";
|
2279
|
+
var the_page_you_are_looking_for_was_not_found = "찾으시는 페이지를 찾을 수 없습니다.";
|
2272
2280
|
var oops = "이런! 당신이졌다.";
|
2273
2281
|
var please_enter = "들어 오세요...";
|
2274
2282
|
var hint = "힌트";
|
@@ -2328,6 +2336,67 @@ var the_code_has_been_copied_to_your_clipboard = "코드가 클립보드에 복
|
|
2328
2336
|
var an_unexpected_error_has_occurred = "예상치 못한 오류가 발생했습니다";
|
2329
2337
|
var select_roles = "역할 선택";
|
2330
2338
|
var no_academy_selected = "선택한 아카데미 없음";
|
2339
|
+
var delete_data_successfully = "데이터를 성공적으로 삭제했습니다.";
|
2340
|
+
var update_academy_successfully = "아카데미를 성공적으로 업데이트했습니다";
|
2341
|
+
var create_academy_successfully = "아카데미를 성공적으로 만들었습니다";
|
2342
|
+
var update_article_successfully = "기사를 업데이트했습니다.";
|
2343
|
+
var create_article_successfully = "기사를 성공적으로 작성했습니다.";
|
2344
|
+
var update_category_successfully = "카테고리를 업데이트했습니다.";
|
2345
|
+
var create_category_successfully = "카테고리가 성공적으로 생성되었습니다.";
|
2346
|
+
var please_fill_in_all_fields_for_this = "이번 {{day}}에 대한 모든 필드를 작성해 주세요.";
|
2347
|
+
var duplicate_weekly_day = "주간 일이 중복됩니다.";
|
2348
|
+
var remove_lesson_failed = "강의 삭제 실패";
|
2349
|
+
var update_lesson_successfully = "강의를 성공적으로 업데이트했습니다.";
|
2350
|
+
var create_lesson_successfully = "수업을 성공적으로 만들었습니다.";
|
2351
|
+
var update_class_successfully = "수업을 업데이트했습니다.";
|
2352
|
+
var create_class_successfully = "수업을 성공적으로 만들었습니다";
|
2353
|
+
var start_times_and_end_times_are_required = "시작 시간과 종료 시간은 필수 항목입니다.";
|
2354
|
+
var start_times_must_be_less_than_end_time = "시작 시간은 종료 시간보다 이전이어야 합니다.";
|
2355
|
+
var remove_student_successfully = "학생을 성공적으로 제거했습니다.";
|
2356
|
+
var remove_teacher_successfully = "교사를 삭제했습니다.";
|
2357
|
+
var update_notification_successfully = "업데이트 알림이 성공적으로 완료되었습니다.";
|
2358
|
+
var create_notification_successfully = "알림이 성공적으로 생성되었습니다.";
|
2359
|
+
var please_select_category = "카테고리를 선택해주세요";
|
2360
|
+
var update_social_successfully = "소셜 업데이트를 성공적으로 완료했습니다.";
|
2361
|
+
var import_csv_successfully = "CSV를 성공적으로 가져왔습니다.";
|
2362
|
+
var download_successfully = "성공적으로 다운로드";
|
2363
|
+
var file_type_not_valid = "파일 형식이 잘못되었습니다! csv 파일을 업로드해주세요.";
|
2364
|
+
var upload_image_successfully = "이미지를 성공적으로 업로드했습니다.";
|
2365
|
+
var category_is_required = "카테고리는 필수 항목입니다.";
|
2366
|
+
var textbook_name_is_required = "교과서 이름이 필요합니다";
|
2367
|
+
var textbook_subject_is_required = "교과서 과목은 필수입니다";
|
2368
|
+
var update_the_textbook_successfully = "교과서를 성공적으로 업데이트했습니다.";
|
2369
|
+
var create_the_textbook_successfully = "교과서를 성공적으로 만들었습니다.";
|
2370
|
+
var finish_exam_successful = "시험을 성공적으로 마쳤습니다";
|
2371
|
+
var you_has_been_kicked_out = "당신은 쫓겨났습니다";
|
2372
|
+
var the_teacher_has_closed_or_deleted_the_exam = "선생님이 시험을 종료했거나 삭제했습니다. 나중에 다시 시도해 주세요.";
|
2373
|
+
var check_in_lesson_successfully = "수업 체크인 성공";
|
2374
|
+
var update_attendance_status_successfully = "출석 상태를 성공적으로 업데이트했습니다.";
|
2375
|
+
var save_exam_successfully = "시험을 성공적으로 저장했습니다.";
|
2376
|
+
var kick_out_student_successful = "학생 퇴출 성공!";
|
2377
|
+
var please_select_an_exam_subject = "시험과목을 선택해주세요";
|
2378
|
+
var please_enter_exam_title = "시험 제목을 입력해주세요";
|
2379
|
+
var exam_required_at_least_one_question = "시험에는 하나 이상의 질문이 필요합니다.";
|
2380
|
+
var create_exam_failed = "시험 생성 실패";
|
2381
|
+
var please_select_category_for_article = "기사 {{article}}의 카테고리를 선택하세요.";
|
2382
|
+
var placeholder_student_selector = "검색하려면 2자 이상 입력하세요.";
|
2383
|
+
var error_uploading_file = "파일을 업로드하는 중 오류가 발생했습니다.";
|
2384
|
+
var remove_lesson_successfully = "강의를 성공적으로 삭제했습니다.";
|
2385
|
+
var user_not_allow_to_register_role = "{{user}}이(가) {{role}} 등록을 허용하지 않습니다.";
|
2386
|
+
var are_you_sure_to_delete_article_from_chapter = "{{chapterName}} 장에서 기사 {{articleNumber}}을(를) 삭제하시겠습니까?";
|
2387
|
+
var are_you_sure_to_delete_subchapter_from_chapter = "{{chapter}} 장에서 {{subchapter}} 하위 장을 삭제하시겠습니까?";
|
2388
|
+
var are_you_sure_to_delete_chapter_from_textbook = "교과서 {{chapter}}에서 {{textbook}}장을 삭제하시겠습니까?";
|
2389
|
+
var do_you_want_to_quit_your_exam = "당신의 시험을 종료하시겠습니까?";
|
2390
|
+
var home = "집";
|
2391
|
+
var profile = "프로필";
|
2392
|
+
var settings = "설정";
|
2393
|
+
var sign_up_school_information = "회원가입 - 학교정보";
|
2394
|
+
var korean_high_school = "한국 고등학교";
|
2395
|
+
var sign_up_student_information = "회원가입 - 학생정보";
|
2396
|
+
var placeholder_student_name = "김ㅇㅇ";
|
2397
|
+
var student_name_is_required = "학생 이름은 필수입니다!";
|
2398
|
+
var the_parent_phone_is_not_valid = "부모 전화번호가 유효하지 않습니다.";
|
2399
|
+
var the_number_must_be_11_number_or_10_number = "숫자는 11자리 또는 10자리여야 합니다.";
|
2331
2400
|
var lang_ko = {
|
2332
2401
|
problem_solving: problem_solving,
|
2333
2402
|
my_story: my_story,
|
@@ -2782,7 +2851,7 @@ var lang_ko = {
|
|
2782
2851
|
select_type: select_type,
|
2783
2852
|
no_message: no_message,
|
2784
2853
|
this_is_the_guidance_text: this_is_the_guidance_text,
|
2785
|
-
|
2854
|
+
the_page_you_are_looking_for_was_not_found: the_page_you_are_looking_for_was_not_found,
|
2786
2855
|
oops: oops,
|
2787
2856
|
please_enter: please_enter,
|
2788
2857
|
hint: hint,
|
@@ -2842,7 +2911,68 @@ var lang_ko = {
|
|
2842
2911
|
the_code_has_been_copied_to_your_clipboard: the_code_has_been_copied_to_your_clipboard,
|
2843
2912
|
an_unexpected_error_has_occurred: an_unexpected_error_has_occurred,
|
2844
2913
|
select_roles: select_roles,
|
2845
|
-
no_academy_selected: no_academy_selected
|
2914
|
+
no_academy_selected: no_academy_selected,
|
2915
|
+
delete_data_successfully: delete_data_successfully,
|
2916
|
+
update_academy_successfully: update_academy_successfully,
|
2917
|
+
create_academy_successfully: create_academy_successfully,
|
2918
|
+
update_article_successfully: update_article_successfully,
|
2919
|
+
create_article_successfully: create_article_successfully,
|
2920
|
+
update_category_successfully: update_category_successfully,
|
2921
|
+
create_category_successfully: create_category_successfully,
|
2922
|
+
please_fill_in_all_fields_for_this: please_fill_in_all_fields_for_this,
|
2923
|
+
duplicate_weekly_day: duplicate_weekly_day,
|
2924
|
+
remove_lesson_failed: remove_lesson_failed,
|
2925
|
+
update_lesson_successfully: update_lesson_successfully,
|
2926
|
+
create_lesson_successfully: create_lesson_successfully,
|
2927
|
+
update_class_successfully: update_class_successfully,
|
2928
|
+
create_class_successfully: create_class_successfully,
|
2929
|
+
start_times_and_end_times_are_required: start_times_and_end_times_are_required,
|
2930
|
+
start_times_must_be_less_than_end_time: start_times_must_be_less_than_end_time,
|
2931
|
+
remove_student_successfully: remove_student_successfully,
|
2932
|
+
remove_teacher_successfully: remove_teacher_successfully,
|
2933
|
+
update_notification_successfully: update_notification_successfully,
|
2934
|
+
create_notification_successfully: create_notification_successfully,
|
2935
|
+
please_select_category: please_select_category,
|
2936
|
+
update_social_successfully: update_social_successfully,
|
2937
|
+
import_csv_successfully: import_csv_successfully,
|
2938
|
+
download_successfully: download_successfully,
|
2939
|
+
file_type_not_valid: file_type_not_valid,
|
2940
|
+
upload_image_successfully: upload_image_successfully,
|
2941
|
+
category_is_required: category_is_required,
|
2942
|
+
textbook_name_is_required: textbook_name_is_required,
|
2943
|
+
textbook_subject_is_required: textbook_subject_is_required,
|
2944
|
+
update_the_textbook_successfully: update_the_textbook_successfully,
|
2945
|
+
create_the_textbook_successfully: create_the_textbook_successfully,
|
2946
|
+
finish_exam_successful: finish_exam_successful,
|
2947
|
+
you_has_been_kicked_out: you_has_been_kicked_out,
|
2948
|
+
the_teacher_has_closed_or_deleted_the_exam: the_teacher_has_closed_or_deleted_the_exam,
|
2949
|
+
check_in_lesson_successfully: check_in_lesson_successfully,
|
2950
|
+
update_attendance_status_successfully: update_attendance_status_successfully,
|
2951
|
+
save_exam_successfully: save_exam_successfully,
|
2952
|
+
kick_out_student_successful: kick_out_student_successful,
|
2953
|
+
please_select_an_exam_subject: please_select_an_exam_subject,
|
2954
|
+
please_enter_exam_title: please_enter_exam_title,
|
2955
|
+
exam_required_at_least_one_question: exam_required_at_least_one_question,
|
2956
|
+
create_exam_failed: create_exam_failed,
|
2957
|
+
please_select_category_for_article: please_select_category_for_article,
|
2958
|
+
placeholder_student_selector: placeholder_student_selector,
|
2959
|
+
error_uploading_file: error_uploading_file,
|
2960
|
+
remove_lesson_successfully: remove_lesson_successfully,
|
2961
|
+
user_not_allow_to_register_role: user_not_allow_to_register_role,
|
2962
|
+
are_you_sure_to_delete_article_from_chapter: are_you_sure_to_delete_article_from_chapter,
|
2963
|
+
are_you_sure_to_delete_subchapter_from_chapter: are_you_sure_to_delete_subchapter_from_chapter,
|
2964
|
+
are_you_sure_to_delete_chapter_from_textbook: are_you_sure_to_delete_chapter_from_textbook,
|
2965
|
+
do_you_want_to_quit_your_exam: do_you_want_to_quit_your_exam,
|
2966
|
+
home: home,
|
2967
|
+
profile: profile,
|
2968
|
+
settings: settings,
|
2969
|
+
sign_up_school_information: sign_up_school_information,
|
2970
|
+
korean_high_school: korean_high_school,
|
2971
|
+
sign_up_student_information: sign_up_student_information,
|
2972
|
+
placeholder_student_name: placeholder_student_name,
|
2973
|
+
student_name_is_required: student_name_is_required,
|
2974
|
+
the_parent_phone_is_not_valid: the_parent_phone_is_not_valid,
|
2975
|
+
the_number_must_be_11_number_or_10_number: the_number_must_be_11_number_or_10_number
|
2846
2976
|
};
|
2847
2977
|
|
2848
2978
|
var problem_solving$1 = "Problem Solving";
|
@@ -3256,7 +3386,7 @@ var password$1 = "Password";
|
|
3256
3386
|
var email_address$1 = "Email Address";
|
3257
3387
|
var please_enter_your_question$1 = "Please enter your question.";
|
3258
3388
|
var test_selection$1 = "Test selection";
|
3259
|
-
var half_selection$1 = "
|
3389
|
+
var half_selection$1 = "Selection class";
|
3260
3390
|
var choose_a_problem$1 = "Choose a problem";
|
3261
3391
|
var question_content$1 = "Question content";
|
3262
3392
|
var questions_to_ask$1 = "Questions to ask";
|
@@ -3339,6 +3469,7 @@ var export_csv$1 = "Export csv";
|
|
3339
3469
|
var select_type$1 = "Select type";
|
3340
3470
|
var no_message$1 = "No message";
|
3341
3471
|
var this_is_the_guidance_text$1 = "This is the guidance text.";
|
3472
|
+
var the_page_you_are_looking_for_was_not_found$1 = "The page you are looking for was not found.";
|
3342
3473
|
var oops$1 = "Oops! You are lost.";
|
3343
3474
|
var please_enter$1 = "Please enter...";
|
3344
3475
|
var notifications$1 = "Notifications";
|
@@ -3391,6 +3522,67 @@ var the_code_has_been_copied_to_your_clipboard$1 = "The code has been copied to
|
|
3391
3522
|
var an_unexpected_error_has_occurred$1 = "An unexpected error has occurred";
|
3392
3523
|
var select_roles$1 = "Select roles";
|
3393
3524
|
var no_academy_selected$1 = "No Academy Selected";
|
3525
|
+
var delete_data_successfully$1 = "Delete data successfully";
|
3526
|
+
var update_academy_successfully$1 = "Update academy successfully";
|
3527
|
+
var create_academy_successfully$1 = "Create academy successfully";
|
3528
|
+
var update_article_successfully$1 = "Update article successfully";
|
3529
|
+
var create_article_successfully$1 = "Create article successfully";
|
3530
|
+
var update_category_successfully$1 = "Update category successfully";
|
3531
|
+
var create_category_successfully$1 = "Create category successfully";
|
3532
|
+
var please_fill_in_all_fields_for_this$1 = "Please fill in all fields for this {{day}}";
|
3533
|
+
var duplicate_weekly_day$1 = "Duplicate weekly day";
|
3534
|
+
var remove_lesson_failed$1 = "Remove lesson failed";
|
3535
|
+
var update_lesson_successfully$1 = "Update lesson successfully";
|
3536
|
+
var create_lesson_successfully$1 = "Create lesson successfully";
|
3537
|
+
var update_class_successfully$1 = "Update class successfully";
|
3538
|
+
var create_class_successfully$1 = "Create class successfully";
|
3539
|
+
var start_times_and_end_times_are_required$1 = "Start times and end times are required";
|
3540
|
+
var start_times_must_be_less_than_end_time$1 = "Start times must be less than end time";
|
3541
|
+
var remove_student_successfully$1 = "Remove student successfully";
|
3542
|
+
var remove_teacher_successfully$1 = "Remove teacher successfully";
|
3543
|
+
var update_notification_successfully$1 = "Update Notification successfully";
|
3544
|
+
var create_notification_successfully$1 = "Create Notification successfully";
|
3545
|
+
var please_select_category$1 = "Please select category";
|
3546
|
+
var update_social_successfully$1 = "Update social successfully";
|
3547
|
+
var import_csv_successfully$1 = "Import CSV successfully";
|
3548
|
+
var download_successfully$1 = "Download successfully";
|
3549
|
+
var file_type_not_valid$1 = "File type not valid! Please upload a csv file.";
|
3550
|
+
var upload_image_successfully$1 = "Upload image successfully";
|
3551
|
+
var category_is_required$1 = "Category is required";
|
3552
|
+
var textbook_name_is_required$1 = "Textbook name is required";
|
3553
|
+
var textbook_subject_is_required$1 = "Textbook subject is required";
|
3554
|
+
var update_the_textbook_successfully$1 = "Update the textbook successfully";
|
3555
|
+
var create_the_textbook_successfully$1 = "Create the textbook successfully";
|
3556
|
+
var finish_exam_successful$1 = "Finish exam successful";
|
3557
|
+
var you_has_been_kicked_out$1 = "You has been kicked out";
|
3558
|
+
var the_teacher_has_closed_or_deleted_the_exam$1 = "The teacher has closed or deleted the exam, please try again later";
|
3559
|
+
var check_in_lesson_successfully$1 = "Check in lesson successfully";
|
3560
|
+
var update_attendance_status_successfully$1 = "Update attendance status successfully";
|
3561
|
+
var save_exam_successfully$1 = "Save exam successfully";
|
3562
|
+
var kick_out_student_successful$1 = "Kick out student successful!";
|
3563
|
+
var please_select_an_exam_subject$1 = "Please select an exam subject";
|
3564
|
+
var please_enter_exam_title$1 = "Please enter exam title";
|
3565
|
+
var exam_required_at_least_one_question$1 = "Exam required at least one question";
|
3566
|
+
var create_exam_failed$1 = "Create exam failed";
|
3567
|
+
var please_select_category_for_article$1 = "Please select category for article {{article}}";
|
3568
|
+
var placeholder_student_selector$1 = "Type at least 2 characters to search";
|
3569
|
+
var error_uploading_file$1 = "Error uploading file";
|
3570
|
+
var remove_lesson_successfully$1 = "Remove lesson successfully";
|
3571
|
+
var user_not_allow_to_register_role$1 = "{{user}} not allow to register {{role}}";
|
3572
|
+
var are_you_sure_to_delete_article_from_chapter$1 = "Are you sure to delete article {{articleNumber}} from chapter {{chapterName}}?";
|
3573
|
+
var are_you_sure_to_delete_subchapter_from_chapter$1 = "Are you sure to delete subchapter {{subchapter}} from chapter {{chapter}}?";
|
3574
|
+
var are_you_sure_to_delete_chapter_from_textbook$1 = "Are you sure to delete chapter {{chapter}} from textbook {{textbook}}?";
|
3575
|
+
var do_you_want_to_quit_your_exam$1 = "Do you want to quit your exam?";
|
3576
|
+
var home$1 = "Home";
|
3577
|
+
var profile$1 = "Profile";
|
3578
|
+
var settings$1 = "Settings";
|
3579
|
+
var sign_up_school_information$1 = "Sign up - School information";
|
3580
|
+
var korean_high_school$1 = "Korean high school";
|
3581
|
+
var sign_up_student_information$1 = "Sign up - Student Information";
|
3582
|
+
var placeholder_student_name$1 = "Kim ㅇㅇ";
|
3583
|
+
var student_name_is_required$1 = "Student Name is required!";
|
3584
|
+
var the_parent_phone_is_not_valid$1 = "The parent phone is not valid";
|
3585
|
+
var the_number_must_be_11_number_or_10_number$1 = "The number must be 11 number or 10 number";
|
3394
3586
|
var lang_en = {
|
3395
3587
|
problem_solving: problem_solving$1,
|
3396
3588
|
my_story: my_story$1,
|
@@ -3879,7 +4071,7 @@ var lang_en = {
|
|
3879
4071
|
select_type: select_type$1,
|
3880
4072
|
no_message: no_message$1,
|
3881
4073
|
this_is_the_guidance_text: this_is_the_guidance_text$1,
|
3882
|
-
|
4074
|
+
the_page_you_are_looking_for_was_not_found: the_page_you_are_looking_for_was_not_found$1,
|
3883
4075
|
oops: oops$1,
|
3884
4076
|
please_enter: please_enter$1,
|
3885
4077
|
notifications: notifications$1,
|
@@ -3932,7 +4124,68 @@ var lang_en = {
|
|
3932
4124
|
the_code_has_been_copied_to_your_clipboard: the_code_has_been_copied_to_your_clipboard$1,
|
3933
4125
|
an_unexpected_error_has_occurred: an_unexpected_error_has_occurred$1,
|
3934
4126
|
select_roles: select_roles$1,
|
3935
|
-
no_academy_selected: no_academy_selected$1
|
4127
|
+
no_academy_selected: no_academy_selected$1,
|
4128
|
+
delete_data_successfully: delete_data_successfully$1,
|
4129
|
+
update_academy_successfully: update_academy_successfully$1,
|
4130
|
+
create_academy_successfully: create_academy_successfully$1,
|
4131
|
+
update_article_successfully: update_article_successfully$1,
|
4132
|
+
create_article_successfully: create_article_successfully$1,
|
4133
|
+
update_category_successfully: update_category_successfully$1,
|
4134
|
+
create_category_successfully: create_category_successfully$1,
|
4135
|
+
please_fill_in_all_fields_for_this: please_fill_in_all_fields_for_this$1,
|
4136
|
+
duplicate_weekly_day: duplicate_weekly_day$1,
|
4137
|
+
remove_lesson_failed: remove_lesson_failed$1,
|
4138
|
+
update_lesson_successfully: update_lesson_successfully$1,
|
4139
|
+
create_lesson_successfully: create_lesson_successfully$1,
|
4140
|
+
update_class_successfully: update_class_successfully$1,
|
4141
|
+
create_class_successfully: create_class_successfully$1,
|
4142
|
+
start_times_and_end_times_are_required: start_times_and_end_times_are_required$1,
|
4143
|
+
start_times_must_be_less_than_end_time: start_times_must_be_less_than_end_time$1,
|
4144
|
+
remove_student_successfully: remove_student_successfully$1,
|
4145
|
+
remove_teacher_successfully: remove_teacher_successfully$1,
|
4146
|
+
update_notification_successfully: update_notification_successfully$1,
|
4147
|
+
create_notification_successfully: create_notification_successfully$1,
|
4148
|
+
please_select_category: please_select_category$1,
|
4149
|
+
update_social_successfully: update_social_successfully$1,
|
4150
|
+
import_csv_successfully: import_csv_successfully$1,
|
4151
|
+
download_successfully: download_successfully$1,
|
4152
|
+
file_type_not_valid: file_type_not_valid$1,
|
4153
|
+
upload_image_successfully: upload_image_successfully$1,
|
4154
|
+
category_is_required: category_is_required$1,
|
4155
|
+
textbook_name_is_required: textbook_name_is_required$1,
|
4156
|
+
textbook_subject_is_required: textbook_subject_is_required$1,
|
4157
|
+
update_the_textbook_successfully: update_the_textbook_successfully$1,
|
4158
|
+
create_the_textbook_successfully: create_the_textbook_successfully$1,
|
4159
|
+
finish_exam_successful: finish_exam_successful$1,
|
4160
|
+
you_has_been_kicked_out: you_has_been_kicked_out$1,
|
4161
|
+
the_teacher_has_closed_or_deleted_the_exam: the_teacher_has_closed_or_deleted_the_exam$1,
|
4162
|
+
check_in_lesson_successfully: check_in_lesson_successfully$1,
|
4163
|
+
update_attendance_status_successfully: update_attendance_status_successfully$1,
|
4164
|
+
save_exam_successfully: save_exam_successfully$1,
|
4165
|
+
kick_out_student_successful: kick_out_student_successful$1,
|
4166
|
+
please_select_an_exam_subject: please_select_an_exam_subject$1,
|
4167
|
+
please_enter_exam_title: please_enter_exam_title$1,
|
4168
|
+
exam_required_at_least_one_question: exam_required_at_least_one_question$1,
|
4169
|
+
create_exam_failed: create_exam_failed$1,
|
4170
|
+
please_select_category_for_article: please_select_category_for_article$1,
|
4171
|
+
placeholder_student_selector: placeholder_student_selector$1,
|
4172
|
+
error_uploading_file: error_uploading_file$1,
|
4173
|
+
remove_lesson_successfully: remove_lesson_successfully$1,
|
4174
|
+
user_not_allow_to_register_role: user_not_allow_to_register_role$1,
|
4175
|
+
are_you_sure_to_delete_article_from_chapter: are_you_sure_to_delete_article_from_chapter$1,
|
4176
|
+
are_you_sure_to_delete_subchapter_from_chapter: are_you_sure_to_delete_subchapter_from_chapter$1,
|
4177
|
+
are_you_sure_to_delete_chapter_from_textbook: are_you_sure_to_delete_chapter_from_textbook$1,
|
4178
|
+
do_you_want_to_quit_your_exam: do_you_want_to_quit_your_exam$1,
|
4179
|
+
home: home$1,
|
4180
|
+
profile: profile$1,
|
4181
|
+
settings: settings$1,
|
4182
|
+
sign_up_school_information: sign_up_school_information$1,
|
4183
|
+
korean_high_school: korean_high_school$1,
|
4184
|
+
sign_up_student_information: sign_up_student_information$1,
|
4185
|
+
placeholder_student_name: placeholder_student_name$1,
|
4186
|
+
student_name_is_required: student_name_is_required$1,
|
4187
|
+
the_parent_phone_is_not_valid: the_parent_phone_is_not_valid$1,
|
4188
|
+
the_number_must_be_11_number_or_10_number: the_number_must_be_11_number_or_10_number$1
|
3936
4189
|
};
|
3937
4190
|
|
3938
4191
|
i18n.use(initReactI18next).init({
|
@@ -4079,8 +4332,7 @@ var useSwitchAcademy = function useSwitchAcademy(role, history, homeAcademyUrl,
|
|
4079
4332
|
if (_temp && _temp.then) return _temp.then(function () {});
|
4080
4333
|
});
|
4081
4334
|
}, function (error) {
|
4082
|
-
|
4083
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title) || "Get user academies failed");
|
4335
|
+
toast.error(getErrorMessage(t, error));
|
4084
4336
|
});
|
4085
4337
|
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
4086
4338
|
} catch (e) {
|
@@ -4113,9 +4365,8 @@ var useSwitchAcademy = function useSwitchAcademy(role, history, homeAcademyUrl,
|
|
4113
4365
|
return Promise.resolve(handleLoginAccessToken(requestBody, false, user.academyDomain ? academyDomain : undefined)).then(function () {});
|
4114
4366
|
});
|
4115
4367
|
}, function (error) {
|
4116
|
-
var _error$response2, _error$response2$data;
|
4117
4368
|
academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
4118
|
-
toast.error((
|
4369
|
+
toast.error(getErrorMessage(t, error));
|
4119
4370
|
});
|
4120
4371
|
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
4121
4372
|
} catch (e) {
|
@@ -4242,7 +4493,8 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4242
4493
|
xs: 6,
|
4243
4494
|
lg: 2,
|
4244
4495
|
justifyContent: "center",
|
4245
|
-
alignItems: "center"
|
4496
|
+
alignItems: "center",
|
4497
|
+
className: "d-sm-none d-md-flex"
|
4246
4498
|
}, React__default.createElement(Stack, {
|
4247
4499
|
flexDirection: "row",
|
4248
4500
|
width: "100%",
|
@@ -4280,6 +4532,11 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4280
4532
|
}
|
4281
4533
|
}
|
4282
4534
|
}
|
4535
|
+
}, React__default.createElement(MenuList, {
|
4536
|
+
sx: {
|
4537
|
+
maxHeight: 240,
|
4538
|
+
overflowY: "auto"
|
4539
|
+
}
|
4283
4540
|
}, academyList.map(function (option) {
|
4284
4541
|
var _option$name$charAt;
|
4285
4542
|
return React__default.createElement(MenuItemCustom, {
|
@@ -4319,7 +4576,7 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4319
4576
|
fontWeight: 600
|
4320
4577
|
}
|
4321
4578
|
}, option.name))));
|
4322
|
-
}), React__default.createElement(MenuItemCustom, {
|
4579
|
+
})), React__default.createElement(MenuItemCustom, {
|
4323
4580
|
sx: {
|
4324
4581
|
whiteSpace: "wrap",
|
4325
4582
|
borderRadius: "6px"
|
@@ -4652,7 +4909,7 @@ var ChatRightItem = function ChatRightItem(_ref) {
|
|
4652
4909
|
disableFocusListener: true,
|
4653
4910
|
disableHoverListener: true,
|
4654
4911
|
disableTouchListener: true,
|
4655
|
-
placement: "top
|
4912
|
+
placement: "top"
|
4656
4913
|
}, React__default.createElement("div", {
|
4657
4914
|
onClick: handleOpenTooltip
|
4658
4915
|
}, React__default.createElement(iconMore, null))))), contentType ? React__default.createElement(Stack, {
|
@@ -4855,8 +5112,8 @@ var useDialog = function useDialog() {
|
|
4855
5112
|
toggleDialog();
|
4856
5113
|
toast.success(t("complete_conversation_successfully"));
|
4857
5114
|
});
|
4858
|
-
}, function () {
|
4859
|
-
toast.error(t("fail_to_complete_conversation"));
|
5115
|
+
}, function (error) {
|
5116
|
+
toast.error(getErrorMessage(t, error, t("fail_to_complete_conversation")));
|
4860
5117
|
});
|
4861
5118
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
4862
5119
|
} catch (e) {
|
@@ -4885,11 +5142,10 @@ var useDialog = function useDialog() {
|
|
4885
5142
|
setSelectedFile({
|
4886
5143
|
content: res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.url
|
4887
5144
|
});
|
4888
|
-
toast.success(
|
5145
|
+
toast.success(t('upload_image_successfully'));
|
4889
5146
|
});
|
4890
5147
|
}, function (error) {
|
4891
|
-
|
4892
|
-
toast.error((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data);
|
5148
|
+
toast.error(getErrorMessage(t, error));
|
4893
5149
|
});
|
4894
5150
|
}, function () {}));
|
4895
5151
|
} catch (e) {
|
@@ -5802,6 +6058,8 @@ var useMessageList = function useMessageList() {
|
|
5802
6058
|
var _useState3 = useState(false),
|
5803
6059
|
isLoading = _useState3[0],
|
5804
6060
|
setLoading = _useState3[1];
|
6061
|
+
var _useTranslation = useTranslation(),
|
6062
|
+
t = _useTranslation.t;
|
5805
6063
|
var getMessageList = function getMessageList(conversationId) {
|
5806
6064
|
try {
|
5807
6065
|
var _temp2 = function _temp2() {
|
@@ -5822,8 +6080,8 @@ var useMessageList = function useMessageList() {
|
|
5822
6080
|
});
|
5823
6081
|
});
|
5824
6082
|
});
|
5825
|
-
}, function () {
|
5826
|
-
toast.error(
|
6083
|
+
}, function (error) {
|
6084
|
+
toast.error(getErrorMessage(t, error));
|
5827
6085
|
});
|
5828
6086
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
5829
6087
|
} catch (e) {
|
@@ -5863,8 +6121,8 @@ var useMessageList = function useMessageList() {
|
|
5863
6121
|
}
|
5864
6122
|
});
|
5865
6123
|
});
|
5866
|
-
}, function () {
|
5867
|
-
toast.error(
|
6124
|
+
}, function (error) {
|
6125
|
+
toast.error(getErrorMessage(t, error));
|
5868
6126
|
_exit = true;
|
5869
6127
|
});
|
5870
6128
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
@@ -5886,8 +6144,8 @@ var useMessageList = function useMessageList() {
|
|
5886
6144
|
if (isLoading) return Promise.resolve();
|
5887
6145
|
var _temp5 = _catch(function () {
|
5888
6146
|
return Promise.resolve(deleteMessage(conversationId, id)).then(function () {});
|
5889
|
-
}, function () {
|
5890
|
-
toast.error(
|
6147
|
+
}, function (error) {
|
6148
|
+
toast.error(getErrorMessage(t, error));
|
5891
6149
|
_exit2 = true;
|
5892
6150
|
});
|
5893
6151
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
@@ -5922,8 +6180,8 @@ var useMessageList = function useMessageList() {
|
|
5922
6180
|
var _exit3 = false;
|
5923
6181
|
var _temp7 = _catch(function () {
|
5924
6182
|
return Promise.resolve(updateMessage(conversationId, id, message)).then(function () {});
|
5925
|
-
}, function () {
|
5926
|
-
toast.error(
|
6183
|
+
}, function (error) {
|
6184
|
+
toast.error(getErrorMessage(t, error));
|
5927
6185
|
_exit3 = true;
|
5928
6186
|
});
|
5929
6187
|
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
@@ -5950,6 +6208,8 @@ var useChatContainer = function useChatContainer(props) {
|
|
5950
6208
|
var _selectedConversation3;
|
5951
6209
|
var conversation = props.conversation,
|
5952
6210
|
student = props.student;
|
6211
|
+
var _useTranslation = useTranslation(),
|
6212
|
+
t = _useTranslation.t;
|
5953
6213
|
var concurrentConnectionPusher = useSelector(function (state) {
|
5954
6214
|
var _state$common;
|
5955
6215
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.concurrentConnectionPusher;
|
@@ -6027,13 +6287,12 @@ var useChatContainer = function useChatContainer(props) {
|
|
6027
6287
|
}();
|
6028
6288
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
6029
6289
|
}, function (error) {
|
6030
|
-
var _error$response;
|
6031
6290
|
setMessages(function (state) {
|
6032
6291
|
return [].concat(state.filter(function (i) {
|
6033
6292
|
return (i === null || i === void 0 ? void 0 : i.id) !== 0;
|
6034
6293
|
}));
|
6035
6294
|
});
|
6036
|
-
toast.error((
|
6295
|
+
toast.error(getErrorMessage(t, error));
|
6037
6296
|
});
|
6038
6297
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
6039
6298
|
} catch (e) {
|
@@ -6052,13 +6311,12 @@ var useChatContainer = function useChatContainer(props) {
|
|
6052
6311
|
});
|
6053
6312
|
});
|
6054
6313
|
}, function (error) {
|
6055
|
-
var _error$response2;
|
6056
6314
|
setMessages(function (state) {
|
6057
6315
|
return [].concat(state.filter(function (i) {
|
6058
6316
|
return (i === null || i === void 0 ? void 0 : i.id) !== 0;
|
6059
6317
|
}));
|
6060
6318
|
});
|
6061
|
-
toast.error((
|
6319
|
+
toast.error(getErrorMessage(t, error));
|
6062
6320
|
});
|
6063
6321
|
}, function () {})) : Promise.resolve();
|
6064
6322
|
};
|
@@ -7218,12 +7476,14 @@ var useExam = function useExam(props) {
|
|
7218
7476
|
callback === null || callback === void 0 ? void 0 : callback();
|
7219
7477
|
};
|
7220
7478
|
var validateExam = function validateExam(exam) {
|
7221
|
-
if (!exam.subjectId) return t("
|
7222
|
-
if (!exam.title.trim().length) return t("
|
7223
|
-
if (!exam.questions.length) return t("
|
7479
|
+
if (!exam.subjectId) return t("please_select_an_exam_subject");
|
7480
|
+
if (!exam.title.trim().length) return t("please_enter_exam_title");
|
7481
|
+
if (!exam.questions.length) return t("exam_required_at_least_one_question");
|
7224
7482
|
for (var i = 0; i < exam.questions.length; i++) {
|
7225
7483
|
var question = exam.questions[i];
|
7226
|
-
if (!question.categoryId) return t(
|
7484
|
+
if (!question.categoryId) return t('please_select_category_for_article', {
|
7485
|
+
article: question.article
|
7486
|
+
});
|
7227
7487
|
}
|
7228
7488
|
return false;
|
7229
7489
|
};
|
@@ -7245,20 +7505,19 @@ var useExam = function useExam(props) {
|
|
7245
7505
|
}))).then(function (res) {
|
7246
7506
|
var _temp = function (_res$data, _res$data$data) {
|
7247
7507
|
if (!((_res$data = res.data) !== null && _res$data !== void 0 && (_res$data$data = _res$data.data) !== null && _res$data$data !== void 0 && _res$data$data.id)) {
|
7248
|
-
toast.error(
|
7508
|
+
toast.error(t('create_exam_failed'));
|
7249
7509
|
} else {
|
7250
7510
|
var _res$data2, _res$data2$data;
|
7251
7511
|
return Promise.resolve(apiCreateExamSession((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$data = _res$data2.data) === null || _res$data2$data === void 0 ? void 0 : _res$data2$data.id)).then(function () {
|
7252
7512
|
setExamRequest(DEFAULT_EXAM_REQUEST);
|
7253
|
-
toast.success(
|
7513
|
+
toast.success(t('create_exam_successfully'));
|
7254
7514
|
});
|
7255
7515
|
}
|
7256
7516
|
}();
|
7257
7517
|
if (_temp && _temp.then) return _temp.then(function () {});
|
7258
7518
|
});
|
7259
7519
|
}, function (error) {
|
7260
|
-
|
7261
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || "Create exam failed");
|
7520
|
+
toast.error(getErrorMessage(t, error));
|
7262
7521
|
});
|
7263
7522
|
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
7264
7523
|
} catch (e) {
|
@@ -7282,12 +7541,11 @@ var useExam = function useExam(props) {
|
|
7282
7541
|
duration: minutesToTimeSpan(examRequest.duration || 0)
|
7283
7542
|
}))).then(function () {
|
7284
7543
|
handleCloseDialog();
|
7285
|
-
toast.success(
|
7544
|
+
toast.success(t('save_exam_successfully'));
|
7286
7545
|
isTeacher ? navigate('/teacher/exam-list') : navigate('/exams');
|
7287
7546
|
});
|
7288
7547
|
}, function (error) {
|
7289
|
-
|
7290
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || "Save exam failed");
|
7548
|
+
toast.error(getErrorMessage(t, error));
|
7291
7549
|
});
|
7292
7550
|
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
7293
7551
|
} catch (e) {
|
@@ -7375,8 +7633,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7375
7633
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7376
7634
|
});
|
7377
7635
|
}, function (error) {
|
7378
|
-
|
7379
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title) || "Couldn't update the chapter");
|
7636
|
+
toast.error(getErrorMessage(t, error));
|
7380
7637
|
});
|
7381
7638
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
7382
7639
|
} catch (e) {
|
@@ -7410,8 +7667,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7410
7667
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7411
7668
|
});
|
7412
7669
|
}, function (error) {
|
7413
|
-
|
7414
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.title) || "Couldn't add the article to the chapter");
|
7670
|
+
toast.error(getErrorMessage(t, error));
|
7415
7671
|
});
|
7416
7672
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
7417
7673
|
} catch (e) {
|
@@ -7430,8 +7686,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7430
7686
|
callback === null || callback === void 0 ? void 0 : callback();
|
7431
7687
|
});
|
7432
7688
|
}, function (error) {
|
7433
|
-
|
7434
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : _error$response3$data.title) || "Couldn't delete the article from the chapter");
|
7689
|
+
toast.error(getErrorMessage(t, error));
|
7435
7690
|
});
|
7436
7691
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
7437
7692
|
} catch (e) {
|
@@ -7469,8 +7724,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7469
7724
|
callback === null || callback === void 0 ? void 0 : callback();
|
7470
7725
|
});
|
7471
7726
|
}, function (error) {
|
7472
|
-
|
7473
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : _error$response4$data.title) || "Couldn't delete the subchapter from the chapter");
|
7727
|
+
toast.error(getErrorMessage(t, error));
|
7474
7728
|
});
|
7475
7729
|
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
7476
7730
|
} catch (e) {
|
@@ -7500,8 +7754,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7500
7754
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7501
7755
|
});
|
7502
7756
|
}, function (error) {
|
7503
|
-
|
7504
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : (_error$response5$data = _error$response5.data) === null || _error$response5$data === void 0 ? void 0 : _error$response5$data.title) || "Couldn't update the article");
|
7757
|
+
toast.error(getErrorMessage(t, error));
|
7505
7758
|
});
|
7506
7759
|
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
7507
7760
|
} catch (e) {
|
@@ -7620,7 +7873,10 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7620
7873
|
articleNumber: articleNumber,
|
7621
7874
|
value: articles,
|
7622
7875
|
name: "" + articleNumber,
|
7623
|
-
confirmText:
|
7876
|
+
confirmText: t('are_you_sure_to_delete_article_from_chapter', {
|
7877
|
+
articleNumber: articleNumber,
|
7878
|
+
chapterName: chapterName
|
7879
|
+
})
|
7624
7880
|
});
|
7625
7881
|
};
|
7626
7882
|
var handleOpenRemoveChapterConfirmDialog = function handleOpenRemoveChapterConfirmDialog(chapterName, chapterId, parentChapterId) {
|
@@ -7632,14 +7888,20 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7632
7888
|
chapterId: chapterId,
|
7633
7889
|
parentChapterId: parentChapterId,
|
7634
7890
|
name: "" + chapterName,
|
7635
|
-
confirmText:
|
7891
|
+
confirmText: t('are_you_sure_to_delete_subchapter_from_chapter', {
|
7892
|
+
subchapter: chapterName,
|
7893
|
+
chapter: textbook.chapters[parentChapterIndex].name
|
7894
|
+
})
|
7636
7895
|
});
|
7637
7896
|
} else {
|
7638
7897
|
setSelectedDeleteItem({
|
7639
7898
|
chapterId: chapterId,
|
7640
7899
|
parentChapterId: parentChapterId,
|
7641
7900
|
name: "" + chapterName,
|
7642
|
-
confirmText:
|
7901
|
+
confirmText: t('are_you_sure_to_delete_chapter_from_textbook', {
|
7902
|
+
chapter: chapterName,
|
7903
|
+
textbook: textbook.name
|
7904
|
+
})
|
7643
7905
|
});
|
7644
7906
|
}
|
7645
7907
|
};
|
@@ -7804,8 +8066,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7804
8066
|
handleCloseChapterNameDialog();
|
7805
8067
|
});
|
7806
8068
|
}, function (error) {
|
7807
|
-
|
7808
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response6 = error.response) === null || _error$response6 === void 0 ? void 0 : (_error$response6$data = _error$response6.data) === null || _error$response6$data === void 0 ? void 0 : _error$response6$data.title) || "Couldn't add new chapter to the textbook");
|
8069
|
+
toast.error(getErrorMessage(t, error));
|
7809
8070
|
});
|
7810
8071
|
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10));
|
7811
8072
|
} catch (e) {
|
@@ -7819,11 +8080,11 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7819
8080
|
var validateTextbook = function validateTextbook() {
|
7820
8081
|
var _textbook$subject;
|
7821
8082
|
if (!textbook.name.trim().length) {
|
7822
|
-
toast.error(
|
8083
|
+
toast.error(t('textbook_name_is_required'));
|
7823
8084
|
return false;
|
7824
8085
|
}
|
7825
8086
|
if (!((_textbook$subject = textbook.subject) !== null && _textbook$subject !== void 0 && _textbook$subject.id)) {
|
7826
|
-
toast.error(
|
8087
|
+
toast.error(t('textbook_subject_is_required'));
|
7827
8088
|
return false;
|
7828
8089
|
}
|
7829
8090
|
return true;
|
@@ -7843,7 +8104,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7843
8104
|
dispatch(setLoading(true));
|
7844
8105
|
var _temp14 = _catch(function () {
|
7845
8106
|
function _temp13() {
|
7846
|
-
toast.success((textbook.id ? "
|
8107
|
+
toast.success(t(textbook.id ? "update_the_textbook_successfully" : "create_the_textbook_successfully"));
|
7847
8108
|
}
|
7848
8109
|
var _temp12 = function () {
|
7849
8110
|
if (textbook.id) {
|
@@ -7866,8 +8127,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7866
8127
|
}();
|
7867
8128
|
return _temp12 && _temp12.then ? _temp12.then(_temp13) : _temp13(_temp12);
|
7868
8129
|
}, function (error) {
|
7869
|
-
|
7870
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response7 = error.response) === null || _error$response7 === void 0 ? void 0 : (_error$response7$data = _error$response7.data) === null || _error$response7$data === void 0 ? void 0 : _error$response7$data.title) || "Couldn't " + (textbook.id ? "update" : "create") + " the textbook detail");
|
8130
|
+
toast.error(getErrorMessage(t, error));
|
7871
8131
|
});
|
7872
8132
|
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp15) : _temp15(_temp14));
|
7873
8133
|
} catch (e) {
|
@@ -7946,8 +8206,8 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7946
8206
|
setNotFound(false);
|
7947
8207
|
});
|
7948
8208
|
}, function (error) {
|
7949
|
-
var _error$
|
7950
|
-
if ((error === null || error === void 0 ? void 0 : (_error$
|
8209
|
+
var _error$response;
|
8210
|
+
if ((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 404) setNotFound(true);else toast.error(getErrorMessage(t, error));
|
7951
8211
|
});
|
7952
8212
|
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp17) : _temp17(_temp16));
|
7953
8213
|
} catch (e) {
|
@@ -8190,7 +8450,7 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
8190
8450
|
article = _useState[0],
|
8191
8451
|
setArticle = _useState[1];
|
8192
8452
|
var handleSubmit = function handleSubmit() {
|
8193
|
-
if (!article.categoryId) toast.error(
|
8453
|
+
if (!article.categoryId) toast.error(t('category_is_required'));
|
8194
8454
|
onSubmitForm(article);
|
8195
8455
|
};
|
8196
8456
|
var handleChangeQuestionCount = function handleChangeQuestionCount(_ref2) {
|
@@ -8377,6 +8637,8 @@ var SubjectSelector = function SubjectSelector(_ref) {
|
|
8377
8637
|
var _state$common2, _state$common2$user;
|
8378
8638
|
return (state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : (_state$common2$user = _state$common2.user) === null || _state$common2$user === void 0 ? void 0 : _state$common2$user.roles) || [];
|
8379
8639
|
}).includes(Role.Admin) && !isDomain;
|
8640
|
+
var _useTranslation = useTranslation(),
|
8641
|
+
t = _useTranslation.t;
|
8380
8642
|
var loadData = useCallback(function () {
|
8381
8643
|
try {
|
8382
8644
|
var _temp2 = function _temp2() {
|
@@ -8394,9 +8656,8 @@ var SubjectSelector = function SubjectSelector(_ref) {
|
|
8394
8656
|
items = _res$data$items === void 0 ? [] : _res$data$items;
|
8395
8657
|
setSubjects(items);
|
8396
8658
|
});
|
8397
|
-
}, function (
|
8398
|
-
|
8399
|
-
toast.error(((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.title) || err.message);
|
8659
|
+
}, function (error) {
|
8660
|
+
toast.error(getErrorMessage(t, error));
|
8400
8661
|
});
|
8401
8662
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
8402
8663
|
} catch (e) {
|
@@ -9113,7 +9374,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
|
|
9113
9374
|
return;
|
9114
9375
|
}
|
9115
9376
|
if (!paramAcademyDomain) {
|
9116
|
-
|
9377
|
+
searchParams.set("domain", academyDomain);
|
9117
9378
|
pushTo(history, _extends({}, window.location, {
|
9118
9379
|
search: searchParams.toString()
|
9119
9380
|
}));
|
@@ -9152,6 +9413,8 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
9152
9413
|
setSelectedItem = _useState4[1];
|
9153
9414
|
var textSearchRef = useRef(null);
|
9154
9415
|
var isFirstLoadRef = useRef(true);
|
9416
|
+
var _useTranslation = useTranslation(),
|
9417
|
+
t = _useTranslation.t;
|
9155
9418
|
var handleChangeSelectedItem = function handleChangeSelectedItem(item) {
|
9156
9419
|
setSelectedItem(item);
|
9157
9420
|
};
|
@@ -9178,10 +9441,9 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
9178
9441
|
setData(items);
|
9179
9442
|
});
|
9180
9443
|
}, function (error) {
|
9181
|
-
var _error$response, _error$response$data;
|
9182
9444
|
setPaging(DEFAULT_PAGING_RESPONSE);
|
9183
9445
|
setData([]);
|
9184
|
-
toast.error((
|
9446
|
+
toast.error(getErrorMessage(t, error));
|
9185
9447
|
});
|
9186
9448
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
9187
9449
|
} catch (e) {
|
@@ -9266,6 +9528,8 @@ var useTextbookList = function useTextbookList(props) {
|
|
9266
9528
|
calcOrderNumber = _useList.calcOrderNumber,
|
9267
9529
|
handleChangeSelectedItem = _useList.handleChangeSelectedItem,
|
9268
9530
|
getData = _useList.getData;
|
9531
|
+
var _useTranslation = useTranslation(),
|
9532
|
+
t = _useTranslation.t;
|
9269
9533
|
var textbookUrl = role === Role.Teacher ? TEXTBOOK_URL$1 : ADMIN_TEXTBOOK_URL;
|
9270
9534
|
var dispatch = useDispatch();
|
9271
9535
|
var handleViewTextbook = function handleViewTextbook(id) {
|
@@ -9303,8 +9567,7 @@ var useTextbookList = function useTextbookList(props) {
|
|
9303
9567
|
});
|
9304
9568
|
});
|
9305
9569
|
}, function (error) {
|
9306
|
-
|
9307
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title) || "Textbook deleted failed");
|
9570
|
+
toast.error(getErrorMessage(t, error));
|
9308
9571
|
});
|
9309
9572
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
9310
9573
|
} catch (e) {
|
@@ -10503,8 +10766,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10503
10766
|
setCategoryResponses(((_result$4$data = result[4].data) === null || _result$4$data === void 0 ? void 0 : _result$4$data.data) || []);
|
10504
10767
|
});
|
10505
10768
|
}, function (error) {
|
10506
|
-
|
10507
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error.message);
|
10769
|
+
toast.error(getErrorMessage(t, error));
|
10508
10770
|
});
|
10509
10771
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
10510
10772
|
};
|
@@ -10540,8 +10802,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10540
10802
|
setCategoryResponses(((_result$4$data2 = result[4].data) === null || _result$4$data2 === void 0 ? void 0 : _result$4$data2.data) || []);
|
10541
10803
|
});
|
10542
10804
|
}, function (error) {
|
10543
|
-
|
10544
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || error.message);
|
10805
|
+
toast.error(getErrorMessage(t, error));
|
10545
10806
|
});
|
10546
10807
|
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
10547
10808
|
};
|
@@ -10897,7 +11158,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10897
11158
|
console.log({
|
10898
11159
|
error: error
|
10899
11160
|
});
|
10900
|
-
toast.error(
|
11161
|
+
toast.error(getErrorMessage(t, error));
|
10901
11162
|
});
|
10902
11163
|
return Promise.resolve(_temp23 && _temp23.then ? _temp23.then(_temp24) : _temp24(_temp23));
|
10903
11164
|
} catch (e) {
|
@@ -12197,18 +12458,21 @@ var useMyAnswer = function useMyAnswer() {
|
|
12197
12458
|
};
|
12198
12459
|
};
|
12199
12460
|
|
12200
|
-
var useCreateQuestionDialog = function useCreateQuestionDialog() {
|
12461
|
+
var useCreateQuestionDialog = function useCreateQuestionDialog(_ref) {
|
12462
|
+
var questions = _ref.questions;
|
12201
12463
|
var _useState = useState(false),
|
12202
12464
|
openDialog = _useState[0],
|
12203
12465
|
setOpenDialog = _useState[1];
|
12204
12466
|
var dispatch = useDispatch();
|
12467
|
+
var _useTranslation = useTranslation(),
|
12468
|
+
t = _useTranslation.t;
|
12205
12469
|
var toggleDialog = function toggleDialog() {
|
12206
12470
|
setOpenDialog(!openDialog);
|
12207
12471
|
};
|
12208
|
-
var handleCreateQuestion = function handleCreateQuestion(
|
12209
|
-
var content =
|
12210
|
-
examSessionId =
|
12211
|
-
questionId =
|
12472
|
+
var handleCreateQuestion = function handleCreateQuestion(_ref2) {
|
12473
|
+
var content = _ref2.content,
|
12474
|
+
examSessionId = _ref2.examSessionId,
|
12475
|
+
questionId = _ref2.questionId;
|
12212
12476
|
try {
|
12213
12477
|
var _temp2 = function _temp2() {
|
12214
12478
|
dispatch(setLoading(false));
|
@@ -12223,18 +12487,31 @@ var useCreateQuestionDialog = function useCreateQuestionDialog() {
|
|
12223
12487
|
toggleDialog();
|
12224
12488
|
});
|
12225
12489
|
}, function (error) {
|
12226
|
-
|
12227
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title) || "Fail to Create Question!");
|
12490
|
+
toast.error(getErrorMessage(t, error));
|
12228
12491
|
});
|
12229
12492
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
12230
12493
|
} catch (e) {
|
12231
12494
|
return Promise.reject(e);
|
12232
12495
|
}
|
12233
12496
|
};
|
12497
|
+
var questionOptions = useMemo(function () {
|
12498
|
+
if (!questions) return [];
|
12499
|
+
return questions.map(function (_ref3) {
|
12500
|
+
var id = _ref3.id,
|
12501
|
+
questionOrder = _ref3.questionOrder;
|
12502
|
+
return {
|
12503
|
+
label: t("question_order", {
|
12504
|
+
number: questionOrder + 1
|
12505
|
+
}),
|
12506
|
+
value: id
|
12507
|
+
};
|
12508
|
+
});
|
12509
|
+
}, [questions]);
|
12234
12510
|
return {
|
12235
12511
|
openCreateQuestionDialog: openDialog,
|
12236
12512
|
toggleCreateQuestion: toggleDialog,
|
12237
|
-
handleCreateQuestion: handleCreateQuestion
|
12513
|
+
handleCreateQuestion: handleCreateQuestion,
|
12514
|
+
questionOptions: questionOptions
|
12238
12515
|
};
|
12239
12516
|
};
|
12240
12517
|
|
@@ -12283,7 +12560,7 @@ function CreateNewQuestionDialog(_ref) {
|
|
12283
12560
|
toggleCreateQuestion = _ref.toggleCreateQuestion,
|
12284
12561
|
examSessionId = _ref.examSessionId,
|
12285
12562
|
questionOrderSelected = _ref.questionOrderSelected,
|
12286
|
-
|
12563
|
+
questionOptions = _ref.questionOptions;
|
12287
12564
|
var _useTranslation = useTranslation(),
|
12288
12565
|
t = _useTranslation.t;
|
12289
12566
|
return React__default.createElement(Dialog, {
|
@@ -12329,7 +12606,8 @@ function CreateNewQuestionDialog(_ref) {
|
|
12329
12606
|
}));
|
12330
12607
|
}
|
12331
12608
|
}, function (_ref2) {
|
12332
|
-
var errors = _ref2.errors
|
12609
|
+
var errors = _ref2.errors,
|
12610
|
+
setFieldValue = _ref2.setFieldValue;
|
12333
12611
|
return React__default.createElement(Form, null, React__default.createElement(Box, {
|
12334
12612
|
display: "flex",
|
12335
12613
|
flexDirection: "column",
|
@@ -12339,20 +12617,22 @@ function CreateNewQuestionDialog(_ref) {
|
|
12339
12617
|
htmlFor: "questions",
|
12340
12618
|
className: styles['form-label'] + " " + styles$4['form-label-dialog']
|
12341
12619
|
}, t('questions_to_ask')), React__default.createElement(Field, {
|
12342
|
-
as: "select",
|
12343
12620
|
id: "questions",
|
12344
12621
|
name: "questionId",
|
12345
|
-
|
12346
|
-
|
12347
|
-
|
12348
|
-
|
12349
|
-
|
12350
|
-
|
12351
|
-
|
12352
|
-
|
12353
|
-
|
12354
|
-
|
12355
|
-
|
12622
|
+
render: function render(_ref3) {
|
12623
|
+
var field = _ref3.field;
|
12624
|
+
return React__default.createElement(CustomSelect, Object.assign({}, field, {
|
12625
|
+
id: "questions",
|
12626
|
+
menuPlacement: "bottom",
|
12627
|
+
options: questionOptions,
|
12628
|
+
onChange: function onChange(_ref4) {
|
12629
|
+
var value = _ref4.value;
|
12630
|
+
return setFieldValue("questionId", value);
|
12631
|
+
},
|
12632
|
+
isClearable: false
|
12633
|
+
}));
|
12634
|
+
}
|
12635
|
+
})), React__default.createElement(Stack, null, React__default.createElement("label", {
|
12356
12636
|
htmlFor: "content-question",
|
12357
12637
|
className: styles['form-label'] + " " + styles$4['form-label-dialog']
|
12358
12638
|
}, t('question_content')), React__default.createElement(Box, {
|
@@ -12420,10 +12700,13 @@ function MyAnswer(_ref) {
|
|
12420
12700
|
categories = _ref.categories,
|
12421
12701
|
isStudent = _ref.isStudent,
|
12422
12702
|
isPrint = _ref.isPrint;
|
12423
|
-
var _useCreateQuestionDia = useCreateQuestionDialog(
|
12703
|
+
var _useCreateQuestionDia = useCreateQuestionDialog({
|
12704
|
+
questions: data.questions
|
12705
|
+
}),
|
12424
12706
|
handleCreateQuestion = _useCreateQuestionDia.handleCreateQuestion,
|
12425
12707
|
openCreateQuestionDialog = _useCreateQuestionDia.openCreateQuestionDialog,
|
12426
|
-
toggleCreateQuestion = _useCreateQuestionDia.toggleCreateQuestion
|
12708
|
+
toggleCreateQuestion = _useCreateQuestionDia.toggleCreateQuestion,
|
12709
|
+
questionOptions = _useCreateQuestionDia.questionOptions;
|
12427
12710
|
var _useMyAnswer = useMyAnswer(),
|
12428
12711
|
isOpenTime = _useMyAnswer.isOpenTime,
|
12429
12712
|
handleSelectQuestionOrder = _useMyAnswer.handleSelectQuestionOrder,
|
@@ -12637,7 +12920,7 @@ function MyAnswer(_ref) {
|
|
12637
12920
|
className: styles$4["contentMyAnswer"]
|
12638
12921
|
}, isPrint ? renderPrintQuestions(item.questions) : renderQuestions(item.questions)));
|
12639
12922
|
}), React__default.createElement(CreateNewQuestionDialog, {
|
12640
|
-
|
12923
|
+
questionOptions: questionOptions,
|
12641
12924
|
questionOrderSelected: questionOrderSelected,
|
12642
12925
|
examSessionId: data === null || data === void 0 ? void 0 : data.examSessionId,
|
12643
12926
|
handleCreateQuestion: handleCreateQuestion,
|
@@ -13180,6 +13463,8 @@ var useCreateQuestionDialog$1 = function useCreateQuestionDialog() {
|
|
13180
13463
|
openDialog = _useState[0],
|
13181
13464
|
setOpenDialog = _useState[1];
|
13182
13465
|
var dispatch = useDispatch();
|
13466
|
+
var _useTranslation = useTranslation(),
|
13467
|
+
t = _useTranslation.t;
|
13183
13468
|
var toggleDialog = function toggleDialog() {
|
13184
13469
|
setOpenDialog(!openDialog);
|
13185
13470
|
};
|
@@ -13199,8 +13484,7 @@ var useCreateQuestionDialog$1 = function useCreateQuestionDialog() {
|
|
13199
13484
|
toggleDialog();
|
13200
13485
|
});
|
13201
13486
|
}, function (error) {
|
13202
|
-
|
13203
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title) || "Fail to Create Question!");
|
13487
|
+
toast.error(getErrorMessage(t, error));
|
13204
13488
|
});
|
13205
13489
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
13206
13490
|
} catch (e) {
|
@@ -13965,7 +14249,7 @@ var useLogin$2 = function useLogin(_ref) {
|
|
13965
14249
|
});
|
13966
14250
|
}, function (error) {
|
13967
14251
|
console.log(error);
|
13968
|
-
toast.error(t('request_login_fail'));
|
14252
|
+
toast.error(getErrorMessage(t, error, t('request_login_fail')));
|
13969
14253
|
}));
|
13970
14254
|
} catch (e) {
|
13971
14255
|
return Promise.reject(e);
|
@@ -13979,7 +14263,7 @@ var useLogin$2 = function useLogin(_ref) {
|
|
13979
14263
|
if (redirectUrl) pushTo(history, redirectUrl);
|
13980
14264
|
};
|
13981
14265
|
useEffect(function () {
|
13982
|
-
var token = getAccessToken
|
14266
|
+
var token = getAccessToken();
|
13983
14267
|
if (!!token) pushTo(history, "/");
|
13984
14268
|
}, []);
|
13985
14269
|
return {
|
@@ -14453,7 +14737,10 @@ var Header = function Header(_ref) {
|
|
14453
14737
|
width: "100%",
|
14454
14738
|
display: "flex",
|
14455
14739
|
flexDirection: "row",
|
14456
|
-
gap:
|
14740
|
+
gap: {
|
14741
|
+
xs: "16",
|
14742
|
+
md: "24"
|
14743
|
+
},
|
14457
14744
|
className: styles["tabBox"] + " " + styles["headers"]
|
14458
14745
|
}, React__default.createElement(Stack, {
|
14459
14746
|
padding: "10px 0",
|
@@ -14514,7 +14801,23 @@ var Header = function Header(_ref) {
|
|
14514
14801
|
})), React__default.createElement(Stack, {
|
14515
14802
|
direction: "row",
|
14516
14803
|
alignItems: "center"
|
14517
|
-
}, React__default.createElement(
|
14804
|
+
}, React__default.createElement(Typography, {
|
14805
|
+
color: styles.gray_700,
|
14806
|
+
className: "fw-bold me-3 text-nowrap flex-shrink-1",
|
14807
|
+
sx: {
|
14808
|
+
minWidth: "60px",
|
14809
|
+
maxWidth: {
|
14810
|
+
md: "100px",
|
14811
|
+
xs: "60px"
|
14812
|
+
},
|
14813
|
+
fontSize: {
|
14814
|
+
md: "16px",
|
14815
|
+
xs: "14px"
|
14816
|
+
},
|
14817
|
+
overflow: "hidden",
|
14818
|
+
textOverflow: "ellipsis"
|
14819
|
+
}
|
14820
|
+
}, user === null || user === void 0 ? void 0 : user.fullName), React__default.createElement(Link, {
|
14518
14821
|
"aria-current": "page",
|
14519
14822
|
to: homeRoute.path,
|
14520
14823
|
className: "border-none"
|
@@ -14551,6 +14854,8 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14551
14854
|
var _state$common, _state$common$user;
|
14552
14855
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : (_state$common$user = _state$common.user) === null || _state$common$user === void 0 ? void 0 : _state$common$user.email;
|
14553
14856
|
});
|
14857
|
+
var _useTranslation = useTranslation(),
|
14858
|
+
t = _useTranslation.t;
|
14554
14859
|
var getAcademies = function getAcademies() {
|
14555
14860
|
try {
|
14556
14861
|
var _temp2 = function _temp2() {
|
@@ -14562,8 +14867,7 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14562
14867
|
setAcademyList(res.data.items || []);
|
14563
14868
|
});
|
14564
14869
|
}, function (error) {
|
14565
|
-
|
14566
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.tile) || "Get user academies failed");
|
14870
|
+
toast.error(getErrorMessage(t, error));
|
14567
14871
|
});
|
14568
14872
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
14569
14873
|
} catch (e) {
|
@@ -14589,8 +14893,7 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14589
14893
|
return Promise.resolve(handleLoginAccessToken(requestBody, false)).then(function () {});
|
14590
14894
|
});
|
14591
14895
|
}, function (error) {
|
14592
|
-
|
14593
|
-
toast.error((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.tile) || "Failed");
|
14896
|
+
toast.error(getErrorMessage(t, error));
|
14594
14897
|
});
|
14595
14898
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
14596
14899
|
} catch (e) {
|
@@ -14682,5 +14985,5 @@ var AcademyList = function AcademyList(_ref) {
|
|
14682
14985
|
}, React__default.createElement("span", null, t("no_academy_available"), "."))))));
|
14683
14986
|
};
|
14684
14987
|
|
14685
|
-
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, LayoutContext, Loading, Login, SignIn as LoginWithPassword, NotFound, PUSHER_CONFIG, QuestionCountSelector, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, api, apiUpload, canAccess as canAccessRoute, diffFromNow, formatTime, getAcademyDomain, getAccessToken
|
14988
|
+
export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, LayoutContext, Loading, Login, SignIn as LoginWithPassword, NotFound, PUSHER_CONFIG, QuestionCountSelector, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, api, apiUpload, canAccess as canAccessRoute, diffFromNow, formatTime, getAcademyDomain, getAccessToken, getErrorMessage, i18n, minutesToTimeSpan, setAlert, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, times as timeUtils, toISOString, useAutoAcademyDomain, useCategorySelect, useChatContainer, useGoogleSignOut, useLanguage, useLogin, usePusherConversation, useSubjectSelect, useSwitchAcademy, utcToLocalTime };
|
14686
14989
|
//# sourceMappingURL=index.modern.js.map
|