touchstudy-core 0.1.59 → 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 +455 -153
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +456 -154
- 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,
|
@@ -510,12 +505,20 @@ var getErrorMessage = function getErrorMessage(t, error, defaultErrorMessage) {
|
|
510
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
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);
|
513
|
-
if (typeof errorMessage === "string") return errorMessage;
|
508
|
+
if (typeof errorMessage === "string") return decodeURIComponent(errorMessage);
|
514
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);
|
515
510
|
if (typeof errorMessage === "string") return errorMessage;
|
516
511
|
return defaultErrorMessage || t(DefaultErrorMessage);
|
517
512
|
};
|
518
513
|
|
514
|
+
var getRedirectUrl = function getRedirectUrl() {
|
515
|
+
try {
|
516
|
+
return localStorage.getItem(REDIRECT_URL);
|
517
|
+
} catch (err) {
|
518
|
+
return undefined;
|
519
|
+
}
|
520
|
+
};
|
521
|
+
|
519
522
|
var useLogin = function useLogin(history, homeAcademyUrl, homeUrl, registerUrl) {
|
520
523
|
var dispatch = useDispatch();
|
521
524
|
var _useTranslation = useTranslation(),
|
@@ -598,7 +601,9 @@ var useLogin = function useLogin(history, homeAcademyUrl, homeUrl, registerUrl)
|
|
598
601
|
var needToRegister = isStudent && isFirstLogin && isAcademy;
|
599
602
|
var redirectUrl = getRedirectUrl();
|
600
603
|
if (!redirectUrl) redirectUrl = needToRegister ? registerUrl : isAcademy ? homeAcademyUrl : homeUrl;
|
601
|
-
redirectLoginUser(
|
604
|
+
redirectLoginUser(_extends({}, user, {
|
605
|
+
isFirstLogin: isFirstLogin
|
606
|
+
}), token, redirectUrl);
|
602
607
|
});
|
603
608
|
}, function (error) {
|
604
609
|
alert(getErrorMessage(t, error));
|
@@ -999,14 +1004,6 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
999
1004
|
})));
|
1000
1005
|
};
|
1001
1006
|
|
1002
|
-
var getAccessToken$1 = (function () {
|
1003
|
-
try {
|
1004
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
1005
|
-
} catch (err) {
|
1006
|
-
return null;
|
1007
|
-
}
|
1008
|
-
});
|
1009
|
-
|
1010
1007
|
var defaultInfo = {
|
1011
1008
|
email: "",
|
1012
1009
|
password: "",
|
@@ -1036,7 +1033,7 @@ var useLogin$1 = function useLogin(history) {
|
|
1036
1033
|
!!gapi && gapi.load("client:auth2", start);
|
1037
1034
|
}, [gapi]);
|
1038
1035
|
useEffect(function () {
|
1039
|
-
var token = getAccessToken
|
1036
|
+
var token = getAccessToken();
|
1040
1037
|
if (!!token) pushTo(history, "/");
|
1041
1038
|
}, []);
|
1042
1039
|
return {
|
@@ -1323,6 +1320,7 @@ var TITLE = "Not found";
|
|
1323
1320
|
var NotFound = function NotFound() {
|
1324
1321
|
var _useTranslation = useTranslation(),
|
1325
1322
|
t = _useTranslation.t;
|
1323
|
+
useLanguage();
|
1326
1324
|
useEffect(function () {
|
1327
1325
|
document.title = TITLE;
|
1328
1326
|
});
|
@@ -1391,12 +1389,8 @@ var switchAcademy = function switchAcademy(academyId) {
|
|
1391
1389
|
return api.post(ACADEMY_URL + "/switch-academy?academyId=" + academyId);
|
1392
1390
|
};
|
1393
1391
|
|
1394
|
-
var
|
1392
|
+
var useLayoutContext = function useLayoutContext(role, pusherRegisterUrls) {
|
1395
1393
|
var _currentPusher$connec2;
|
1396
|
-
var children = _ref.children,
|
1397
|
-
role = _ref.role,
|
1398
|
-
_ref$pusherRegisterUr = _ref.pusherRegisterUrls,
|
1399
|
-
pusherRegisterUrls = _ref$pusherRegisterUr === void 0 ? [] : _ref$pusherRegisterUr;
|
1400
1394
|
var _useGoogleSignOut = useGoogleSignOut({}),
|
1401
1395
|
handleSignOut = _useGoogleSignOut.handleSignOut;
|
1402
1396
|
var _useTranslation = useTranslation(),
|
@@ -1447,7 +1441,10 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1447
1441
|
var checkRoleUser = useCallback(function () {
|
1448
1442
|
if (!user) return;
|
1449
1443
|
if (!roles.includes(role) && !!academyDomain) {
|
1450
|
-
alert(
|
1444
|
+
alert(t("user_not_allow_to_register_role", {
|
1445
|
+
user: user.email,
|
1446
|
+
role: role
|
1447
|
+
}));
|
1451
1448
|
resetAuth();
|
1452
1449
|
}
|
1453
1450
|
}, [role, JSON.stringify(user)]);
|
@@ -1482,9 +1479,10 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1482
1479
|
}
|
1483
1480
|
};
|
1484
1481
|
var registerPusher = useCallback(function () {
|
1482
|
+
if (!academyDomain) return;
|
1485
1483
|
if (pusherRegisterUrls.includes(pathname.toLocaleLowerCase())) {
|
1486
1484
|
var _currentPusher$connec;
|
1487
|
-
if (academyDomain
|
1485
|
+
if (academyDomain !== (concurrentConnectionPusher === null || concurrentConnectionPusher === void 0 ? void 0 : concurrentConnectionPusher.academyDomain) && isReadyRegisterPusher) {
|
1488
1486
|
var _headers;
|
1489
1487
|
if (currentPusher) {
|
1490
1488
|
currentPusher.disconnect();
|
@@ -1540,6 +1538,14 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
1540
1538
|
}
|
1541
1539
|
};
|
1542
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);
|
1543
1549
|
return React__default.createElement(Fragment$1, null, children);
|
1544
1550
|
};
|
1545
1551
|
|
@@ -1876,7 +1882,7 @@ var number_problem = "{{number}}문제";
|
|
1876
1882
|
var problems = "문제";
|
1877
1883
|
var problem_solving_time = "문제풀이 시간";
|
1878
1884
|
var minutes = "분";
|
1879
|
-
var correct_rate = "
|
1885
|
+
var correct_rate = "정답률";
|
1880
1886
|
var title = "제목";
|
1881
1887
|
var duration = "시험 시간";
|
1882
1888
|
var answer_count = "답변 수";
|
@@ -2187,7 +2193,7 @@ var password = "비밀번호";
|
|
2187
2193
|
var email_address = "이메일 주소";
|
2188
2194
|
var please_enter_your_question = "질문할 내용을 입력해주세요.";
|
2189
2195
|
var test_selection = "테스트 선택";
|
2190
|
-
var half_selection = "
|
2196
|
+
var half_selection = "반 선택";
|
2191
2197
|
var choose_a_problem = "문제를 선택하세요";
|
2192
2198
|
var question_content = "질문 내용";
|
2193
2199
|
var questions_to_ask = "질문할 문제";
|
@@ -2270,6 +2276,7 @@ var export_csv = "CSV 내보내기";
|
|
2270
2276
|
var select_type = "유형 선택";
|
2271
2277
|
var no_message = "메시지 없음";
|
2272
2278
|
var this_is_the_guidance_text = "안내 텍스트입니다.";
|
2279
|
+
var the_page_you_are_looking_for_was_not_found = "찾으시는 페이지를 찾을 수 없습니다.";
|
2273
2280
|
var oops = "이런! 당신이졌다.";
|
2274
2281
|
var please_enter = "들어 오세요...";
|
2275
2282
|
var hint = "힌트";
|
@@ -2329,6 +2336,67 @@ var the_code_has_been_copied_to_your_clipboard = "코드가 클립보드에 복
|
|
2329
2336
|
var an_unexpected_error_has_occurred = "예상치 못한 오류가 발생했습니다";
|
2330
2337
|
var select_roles = "역할 선택";
|
2331
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자리여야 합니다.";
|
2332
2400
|
var lang_ko = {
|
2333
2401
|
problem_solving: problem_solving,
|
2334
2402
|
my_story: my_story,
|
@@ -2783,7 +2851,7 @@ var lang_ko = {
|
|
2783
2851
|
select_type: select_type,
|
2784
2852
|
no_message: no_message,
|
2785
2853
|
this_is_the_guidance_text: this_is_the_guidance_text,
|
2786
|
-
|
2854
|
+
the_page_you_are_looking_for_was_not_found: the_page_you_are_looking_for_was_not_found,
|
2787
2855
|
oops: oops,
|
2788
2856
|
please_enter: please_enter,
|
2789
2857
|
hint: hint,
|
@@ -2843,7 +2911,68 @@ var lang_ko = {
|
|
2843
2911
|
the_code_has_been_copied_to_your_clipboard: the_code_has_been_copied_to_your_clipboard,
|
2844
2912
|
an_unexpected_error_has_occurred: an_unexpected_error_has_occurred,
|
2845
2913
|
select_roles: select_roles,
|
2846
|
-
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
|
2847
2976
|
};
|
2848
2977
|
|
2849
2978
|
var problem_solving$1 = "Problem Solving";
|
@@ -3257,7 +3386,7 @@ var password$1 = "Password";
|
|
3257
3386
|
var email_address$1 = "Email Address";
|
3258
3387
|
var please_enter_your_question$1 = "Please enter your question.";
|
3259
3388
|
var test_selection$1 = "Test selection";
|
3260
|
-
var half_selection$1 = "
|
3389
|
+
var half_selection$1 = "Selection class";
|
3261
3390
|
var choose_a_problem$1 = "Choose a problem";
|
3262
3391
|
var question_content$1 = "Question content";
|
3263
3392
|
var questions_to_ask$1 = "Questions to ask";
|
@@ -3340,6 +3469,7 @@ var export_csv$1 = "Export csv";
|
|
3340
3469
|
var select_type$1 = "Select type";
|
3341
3470
|
var no_message$1 = "No message";
|
3342
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.";
|
3343
3473
|
var oops$1 = "Oops! You are lost.";
|
3344
3474
|
var please_enter$1 = "Please enter...";
|
3345
3475
|
var notifications$1 = "Notifications";
|
@@ -3392,6 +3522,67 @@ var the_code_has_been_copied_to_your_clipboard$1 = "The code has been copied to
|
|
3392
3522
|
var an_unexpected_error_has_occurred$1 = "An unexpected error has occurred";
|
3393
3523
|
var select_roles$1 = "Select roles";
|
3394
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";
|
3395
3586
|
var lang_en = {
|
3396
3587
|
problem_solving: problem_solving$1,
|
3397
3588
|
my_story: my_story$1,
|
@@ -3880,7 +4071,7 @@ var lang_en = {
|
|
3880
4071
|
select_type: select_type$1,
|
3881
4072
|
no_message: no_message$1,
|
3882
4073
|
this_is_the_guidance_text: this_is_the_guidance_text$1,
|
3883
|
-
|
4074
|
+
the_page_you_are_looking_for_was_not_found: the_page_you_are_looking_for_was_not_found$1,
|
3884
4075
|
oops: oops$1,
|
3885
4076
|
please_enter: please_enter$1,
|
3886
4077
|
notifications: notifications$1,
|
@@ -3933,7 +4124,68 @@ var lang_en = {
|
|
3933
4124
|
the_code_has_been_copied_to_your_clipboard: the_code_has_been_copied_to_your_clipboard$1,
|
3934
4125
|
an_unexpected_error_has_occurred: an_unexpected_error_has_occurred$1,
|
3935
4126
|
select_roles: select_roles$1,
|
3936
|
-
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
|
3937
4189
|
};
|
3938
4190
|
|
3939
4191
|
i18n.use(initReactI18next).init({
|
@@ -4080,8 +4332,7 @@ var useSwitchAcademy = function useSwitchAcademy(role, history, homeAcademyUrl,
|
|
4080
4332
|
if (_temp && _temp.then) return _temp.then(function () {});
|
4081
4333
|
});
|
4082
4334
|
}, function (error) {
|
4083
|
-
|
4084
|
-
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));
|
4085
4336
|
});
|
4086
4337
|
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
4087
4338
|
} catch (e) {
|
@@ -4114,9 +4365,8 @@ var useSwitchAcademy = function useSwitchAcademy(role, history, homeAcademyUrl,
|
|
4114
4365
|
return Promise.resolve(handleLoginAccessToken(requestBody, false, user.academyDomain ? academyDomain : undefined)).then(function () {});
|
4115
4366
|
});
|
4116
4367
|
}, function (error) {
|
4117
|
-
var _error$response2, _error$response2$data;
|
4118
4368
|
academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
|
4119
|
-
toast.error((
|
4369
|
+
toast.error(getErrorMessage(t, error));
|
4120
4370
|
});
|
4121
4371
|
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
4122
4372
|
} catch (e) {
|
@@ -4243,7 +4493,8 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4243
4493
|
xs: 6,
|
4244
4494
|
lg: 2,
|
4245
4495
|
justifyContent: "center",
|
4246
|
-
alignItems: "center"
|
4496
|
+
alignItems: "center",
|
4497
|
+
className: "d-sm-none d-md-flex"
|
4247
4498
|
}, React__default.createElement(Stack, {
|
4248
4499
|
flexDirection: "row",
|
4249
4500
|
width: "100%",
|
@@ -4281,6 +4532,11 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4281
4532
|
}
|
4282
4533
|
}
|
4283
4534
|
}
|
4535
|
+
}, React__default.createElement(MenuList, {
|
4536
|
+
sx: {
|
4537
|
+
maxHeight: 240,
|
4538
|
+
overflowY: "auto"
|
4539
|
+
}
|
4284
4540
|
}, academyList.map(function (option) {
|
4285
4541
|
var _option$name$charAt;
|
4286
4542
|
return React__default.createElement(MenuItemCustom, {
|
@@ -4320,7 +4576,7 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
|
|
4320
4576
|
fontWeight: 600
|
4321
4577
|
}
|
4322
4578
|
}, option.name))));
|
4323
|
-
}), React__default.createElement(MenuItemCustom, {
|
4579
|
+
})), React__default.createElement(MenuItemCustom, {
|
4324
4580
|
sx: {
|
4325
4581
|
whiteSpace: "wrap",
|
4326
4582
|
borderRadius: "6px"
|
@@ -4653,7 +4909,7 @@ var ChatRightItem = function ChatRightItem(_ref) {
|
|
4653
4909
|
disableFocusListener: true,
|
4654
4910
|
disableHoverListener: true,
|
4655
4911
|
disableTouchListener: true,
|
4656
|
-
placement: "top
|
4912
|
+
placement: "top"
|
4657
4913
|
}, React__default.createElement("div", {
|
4658
4914
|
onClick: handleOpenTooltip
|
4659
4915
|
}, React__default.createElement(iconMore, null))))), contentType ? React__default.createElement(Stack, {
|
@@ -4856,8 +5112,8 @@ var useDialog = function useDialog() {
|
|
4856
5112
|
toggleDialog();
|
4857
5113
|
toast.success(t("complete_conversation_successfully"));
|
4858
5114
|
});
|
4859
|
-
}, function () {
|
4860
|
-
toast.error(t("fail_to_complete_conversation"));
|
5115
|
+
}, function (error) {
|
5116
|
+
toast.error(getErrorMessage(t, error, t("fail_to_complete_conversation")));
|
4861
5117
|
});
|
4862
5118
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
4863
5119
|
} catch (e) {
|
@@ -4886,11 +5142,10 @@ var useDialog = function useDialog() {
|
|
4886
5142
|
setSelectedFile({
|
4887
5143
|
content: res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.url
|
4888
5144
|
});
|
4889
|
-
toast.success(
|
5145
|
+
toast.success(t('upload_image_successfully'));
|
4890
5146
|
});
|
4891
5147
|
}, function (error) {
|
4892
|
-
|
4893
|
-
toast.error((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data);
|
5148
|
+
toast.error(getErrorMessage(t, error));
|
4894
5149
|
});
|
4895
5150
|
}, function () {}));
|
4896
5151
|
} catch (e) {
|
@@ -5803,6 +6058,8 @@ var useMessageList = function useMessageList() {
|
|
5803
6058
|
var _useState3 = useState(false),
|
5804
6059
|
isLoading = _useState3[0],
|
5805
6060
|
setLoading = _useState3[1];
|
6061
|
+
var _useTranslation = useTranslation(),
|
6062
|
+
t = _useTranslation.t;
|
5806
6063
|
var getMessageList = function getMessageList(conversationId) {
|
5807
6064
|
try {
|
5808
6065
|
var _temp2 = function _temp2() {
|
@@ -5823,8 +6080,8 @@ var useMessageList = function useMessageList() {
|
|
5823
6080
|
});
|
5824
6081
|
});
|
5825
6082
|
});
|
5826
|
-
}, function () {
|
5827
|
-
toast.error(
|
6083
|
+
}, function (error) {
|
6084
|
+
toast.error(getErrorMessage(t, error));
|
5828
6085
|
});
|
5829
6086
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
5830
6087
|
} catch (e) {
|
@@ -5864,8 +6121,8 @@ var useMessageList = function useMessageList() {
|
|
5864
6121
|
}
|
5865
6122
|
});
|
5866
6123
|
});
|
5867
|
-
}, function () {
|
5868
|
-
toast.error(
|
6124
|
+
}, function (error) {
|
6125
|
+
toast.error(getErrorMessage(t, error));
|
5869
6126
|
_exit = true;
|
5870
6127
|
});
|
5871
6128
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
@@ -5887,8 +6144,8 @@ var useMessageList = function useMessageList() {
|
|
5887
6144
|
if (isLoading) return Promise.resolve();
|
5888
6145
|
var _temp5 = _catch(function () {
|
5889
6146
|
return Promise.resolve(deleteMessage(conversationId, id)).then(function () {});
|
5890
|
-
}, function () {
|
5891
|
-
toast.error(
|
6147
|
+
}, function (error) {
|
6148
|
+
toast.error(getErrorMessage(t, error));
|
5892
6149
|
_exit2 = true;
|
5893
6150
|
});
|
5894
6151
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
@@ -5923,8 +6180,8 @@ var useMessageList = function useMessageList() {
|
|
5923
6180
|
var _exit3 = false;
|
5924
6181
|
var _temp7 = _catch(function () {
|
5925
6182
|
return Promise.resolve(updateMessage(conversationId, id, message)).then(function () {});
|
5926
|
-
}, function () {
|
5927
|
-
toast.error(
|
6183
|
+
}, function (error) {
|
6184
|
+
toast.error(getErrorMessage(t, error));
|
5928
6185
|
_exit3 = true;
|
5929
6186
|
});
|
5930
6187
|
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
@@ -5951,6 +6208,8 @@ var useChatContainer = function useChatContainer(props) {
|
|
5951
6208
|
var _selectedConversation3;
|
5952
6209
|
var conversation = props.conversation,
|
5953
6210
|
student = props.student;
|
6211
|
+
var _useTranslation = useTranslation(),
|
6212
|
+
t = _useTranslation.t;
|
5954
6213
|
var concurrentConnectionPusher = useSelector(function (state) {
|
5955
6214
|
var _state$common;
|
5956
6215
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.concurrentConnectionPusher;
|
@@ -6028,13 +6287,12 @@ var useChatContainer = function useChatContainer(props) {
|
|
6028
6287
|
}();
|
6029
6288
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
6030
6289
|
}, function (error) {
|
6031
|
-
var _error$response;
|
6032
6290
|
setMessages(function (state) {
|
6033
6291
|
return [].concat(state.filter(function (i) {
|
6034
6292
|
return (i === null || i === void 0 ? void 0 : i.id) !== 0;
|
6035
6293
|
}));
|
6036
6294
|
});
|
6037
|
-
toast.error((
|
6295
|
+
toast.error(getErrorMessage(t, error));
|
6038
6296
|
});
|
6039
6297
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
6040
6298
|
} catch (e) {
|
@@ -6053,13 +6311,12 @@ var useChatContainer = function useChatContainer(props) {
|
|
6053
6311
|
});
|
6054
6312
|
});
|
6055
6313
|
}, function (error) {
|
6056
|
-
var _error$response2;
|
6057
6314
|
setMessages(function (state) {
|
6058
6315
|
return [].concat(state.filter(function (i) {
|
6059
6316
|
return (i === null || i === void 0 ? void 0 : i.id) !== 0;
|
6060
6317
|
}));
|
6061
6318
|
});
|
6062
|
-
toast.error((
|
6319
|
+
toast.error(getErrorMessage(t, error));
|
6063
6320
|
});
|
6064
6321
|
}, function () {})) : Promise.resolve();
|
6065
6322
|
};
|
@@ -7219,12 +7476,14 @@ var useExam = function useExam(props) {
|
|
7219
7476
|
callback === null || callback === void 0 ? void 0 : callback();
|
7220
7477
|
};
|
7221
7478
|
var validateExam = function validateExam(exam) {
|
7222
|
-
if (!exam.subjectId) return t("
|
7223
|
-
if (!exam.title.trim().length) return t("
|
7224
|
-
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");
|
7225
7482
|
for (var i = 0; i < exam.questions.length; i++) {
|
7226
7483
|
var question = exam.questions[i];
|
7227
|
-
if (!question.categoryId) return t(
|
7484
|
+
if (!question.categoryId) return t('please_select_category_for_article', {
|
7485
|
+
article: question.article
|
7486
|
+
});
|
7228
7487
|
}
|
7229
7488
|
return false;
|
7230
7489
|
};
|
@@ -7246,20 +7505,19 @@ var useExam = function useExam(props) {
|
|
7246
7505
|
}))).then(function (res) {
|
7247
7506
|
var _temp = function (_res$data, _res$data$data) {
|
7248
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)) {
|
7249
|
-
toast.error(
|
7508
|
+
toast.error(t('create_exam_failed'));
|
7250
7509
|
} else {
|
7251
7510
|
var _res$data2, _res$data2$data;
|
7252
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 () {
|
7253
7512
|
setExamRequest(DEFAULT_EXAM_REQUEST);
|
7254
|
-
toast.success(
|
7513
|
+
toast.success(t('create_exam_successfully'));
|
7255
7514
|
});
|
7256
7515
|
}
|
7257
7516
|
}();
|
7258
7517
|
if (_temp && _temp.then) return _temp.then(function () {});
|
7259
7518
|
});
|
7260
7519
|
}, function (error) {
|
7261
|
-
|
7262
|
-
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));
|
7263
7521
|
});
|
7264
7522
|
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
7265
7523
|
} catch (e) {
|
@@ -7283,12 +7541,11 @@ var useExam = function useExam(props) {
|
|
7283
7541
|
duration: minutesToTimeSpan(examRequest.duration || 0)
|
7284
7542
|
}))).then(function () {
|
7285
7543
|
handleCloseDialog();
|
7286
|
-
toast.success(
|
7544
|
+
toast.success(t('save_exam_successfully'));
|
7287
7545
|
isTeacher ? navigate('/teacher/exam-list') : navigate('/exams');
|
7288
7546
|
});
|
7289
7547
|
}, function (error) {
|
7290
|
-
|
7291
|
-
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));
|
7292
7549
|
});
|
7293
7550
|
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
7294
7551
|
} catch (e) {
|
@@ -7376,8 +7633,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7376
7633
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7377
7634
|
});
|
7378
7635
|
}, function (error) {
|
7379
|
-
|
7380
|
-
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));
|
7381
7637
|
});
|
7382
7638
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
7383
7639
|
} catch (e) {
|
@@ -7411,8 +7667,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7411
7667
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7412
7668
|
});
|
7413
7669
|
}, function (error) {
|
7414
|
-
|
7415
|
-
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));
|
7416
7671
|
});
|
7417
7672
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
7418
7673
|
} catch (e) {
|
@@ -7431,8 +7686,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7431
7686
|
callback === null || callback === void 0 ? void 0 : callback();
|
7432
7687
|
});
|
7433
7688
|
}, function (error) {
|
7434
|
-
|
7435
|
-
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));
|
7436
7690
|
});
|
7437
7691
|
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
7438
7692
|
} catch (e) {
|
@@ -7470,8 +7724,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7470
7724
|
callback === null || callback === void 0 ? void 0 : callback();
|
7471
7725
|
});
|
7472
7726
|
}, function (error) {
|
7473
|
-
|
7474
|
-
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));
|
7475
7728
|
});
|
7476
7729
|
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
|
7477
7730
|
} catch (e) {
|
@@ -7501,8 +7754,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7501
7754
|
callback === null || callback === void 0 ? void 0 : callback(res.data);
|
7502
7755
|
});
|
7503
7756
|
}, function (error) {
|
7504
|
-
|
7505
|
-
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));
|
7506
7758
|
});
|
7507
7759
|
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
7508
7760
|
} catch (e) {
|
@@ -7621,7 +7873,10 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7621
7873
|
articleNumber: articleNumber,
|
7622
7874
|
value: articles,
|
7623
7875
|
name: "" + articleNumber,
|
7624
|
-
confirmText:
|
7876
|
+
confirmText: t('are_you_sure_to_delete_article_from_chapter', {
|
7877
|
+
articleNumber: articleNumber,
|
7878
|
+
chapterName: chapterName
|
7879
|
+
})
|
7625
7880
|
});
|
7626
7881
|
};
|
7627
7882
|
var handleOpenRemoveChapterConfirmDialog = function handleOpenRemoveChapterConfirmDialog(chapterName, chapterId, parentChapterId) {
|
@@ -7633,14 +7888,20 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7633
7888
|
chapterId: chapterId,
|
7634
7889
|
parentChapterId: parentChapterId,
|
7635
7890
|
name: "" + chapterName,
|
7636
|
-
confirmText:
|
7891
|
+
confirmText: t('are_you_sure_to_delete_subchapter_from_chapter', {
|
7892
|
+
subchapter: chapterName,
|
7893
|
+
chapter: textbook.chapters[parentChapterIndex].name
|
7894
|
+
})
|
7637
7895
|
});
|
7638
7896
|
} else {
|
7639
7897
|
setSelectedDeleteItem({
|
7640
7898
|
chapterId: chapterId,
|
7641
7899
|
parentChapterId: parentChapterId,
|
7642
7900
|
name: "" + chapterName,
|
7643
|
-
confirmText:
|
7901
|
+
confirmText: t('are_you_sure_to_delete_chapter_from_textbook', {
|
7902
|
+
chapter: chapterName,
|
7903
|
+
textbook: textbook.name
|
7904
|
+
})
|
7644
7905
|
});
|
7645
7906
|
}
|
7646
7907
|
};
|
@@ -7805,8 +8066,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7805
8066
|
handleCloseChapterNameDialog();
|
7806
8067
|
});
|
7807
8068
|
}, function (error) {
|
7808
|
-
|
7809
|
-
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));
|
7810
8070
|
});
|
7811
8071
|
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10));
|
7812
8072
|
} catch (e) {
|
@@ -7820,11 +8080,11 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7820
8080
|
var validateTextbook = function validateTextbook() {
|
7821
8081
|
var _textbook$subject;
|
7822
8082
|
if (!textbook.name.trim().length) {
|
7823
|
-
toast.error(
|
8083
|
+
toast.error(t('textbook_name_is_required'));
|
7824
8084
|
return false;
|
7825
8085
|
}
|
7826
8086
|
if (!((_textbook$subject = textbook.subject) !== null && _textbook$subject !== void 0 && _textbook$subject.id)) {
|
7827
|
-
toast.error(
|
8087
|
+
toast.error(t('textbook_subject_is_required'));
|
7828
8088
|
return false;
|
7829
8089
|
}
|
7830
8090
|
return true;
|
@@ -7844,7 +8104,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7844
8104
|
dispatch(setLoading(true));
|
7845
8105
|
var _temp14 = _catch(function () {
|
7846
8106
|
function _temp13() {
|
7847
|
-
toast.success((textbook.id ? "
|
8107
|
+
toast.success(t(textbook.id ? "update_the_textbook_successfully" : "create_the_textbook_successfully"));
|
7848
8108
|
}
|
7849
8109
|
var _temp12 = function () {
|
7850
8110
|
if (textbook.id) {
|
@@ -7867,8 +8127,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7867
8127
|
}();
|
7868
8128
|
return _temp12 && _temp12.then ? _temp12.then(_temp13) : _temp13(_temp12);
|
7869
8129
|
}, function (error) {
|
7870
|
-
|
7871
|
-
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));
|
7872
8131
|
});
|
7873
8132
|
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp15) : _temp15(_temp14));
|
7874
8133
|
} catch (e) {
|
@@ -7947,8 +8206,8 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
7947
8206
|
setNotFound(false);
|
7948
8207
|
});
|
7949
8208
|
}, function (error) {
|
7950
|
-
var _error$
|
7951
|
-
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));
|
7952
8211
|
});
|
7953
8212
|
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp17) : _temp17(_temp16));
|
7954
8213
|
} catch (e) {
|
@@ -8191,7 +8450,7 @@ var ArticleDialog = function ArticleDialog(_ref) {
|
|
8191
8450
|
article = _useState[0],
|
8192
8451
|
setArticle = _useState[1];
|
8193
8452
|
var handleSubmit = function handleSubmit() {
|
8194
|
-
if (!article.categoryId) toast.error(
|
8453
|
+
if (!article.categoryId) toast.error(t('category_is_required'));
|
8195
8454
|
onSubmitForm(article);
|
8196
8455
|
};
|
8197
8456
|
var handleChangeQuestionCount = function handleChangeQuestionCount(_ref2) {
|
@@ -8378,6 +8637,8 @@ var SubjectSelector = function SubjectSelector(_ref) {
|
|
8378
8637
|
var _state$common2, _state$common2$user;
|
8379
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) || [];
|
8380
8639
|
}).includes(Role.Admin) && !isDomain;
|
8640
|
+
var _useTranslation = useTranslation(),
|
8641
|
+
t = _useTranslation.t;
|
8381
8642
|
var loadData = useCallback(function () {
|
8382
8643
|
try {
|
8383
8644
|
var _temp2 = function _temp2() {
|
@@ -8395,9 +8656,8 @@ var SubjectSelector = function SubjectSelector(_ref) {
|
|
8395
8656
|
items = _res$data$items === void 0 ? [] : _res$data$items;
|
8396
8657
|
setSubjects(items);
|
8397
8658
|
});
|
8398
|
-
}, function (
|
8399
|
-
|
8400
|
-
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));
|
8401
8661
|
});
|
8402
8662
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
8403
8663
|
} catch (e) {
|
@@ -9114,7 +9374,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
|
|
9114
9374
|
return;
|
9115
9375
|
}
|
9116
9376
|
if (!paramAcademyDomain) {
|
9117
|
-
|
9377
|
+
searchParams.set("domain", academyDomain);
|
9118
9378
|
pushTo(history, _extends({}, window.location, {
|
9119
9379
|
search: searchParams.toString()
|
9120
9380
|
}));
|
@@ -9153,6 +9413,8 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
9153
9413
|
setSelectedItem = _useState4[1];
|
9154
9414
|
var textSearchRef = useRef(null);
|
9155
9415
|
var isFirstLoadRef = useRef(true);
|
9416
|
+
var _useTranslation = useTranslation(),
|
9417
|
+
t = _useTranslation.t;
|
9156
9418
|
var handleChangeSelectedItem = function handleChangeSelectedItem(item) {
|
9157
9419
|
setSelectedItem(item);
|
9158
9420
|
};
|
@@ -9179,10 +9441,9 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
9179
9441
|
setData(items);
|
9180
9442
|
});
|
9181
9443
|
}, function (error) {
|
9182
|
-
var _error$response, _error$response$data;
|
9183
9444
|
setPaging(DEFAULT_PAGING_RESPONSE);
|
9184
9445
|
setData([]);
|
9185
|
-
toast.error((
|
9446
|
+
toast.error(getErrorMessage(t, error));
|
9186
9447
|
});
|
9187
9448
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
9188
9449
|
} catch (e) {
|
@@ -9267,6 +9528,8 @@ var useTextbookList = function useTextbookList(props) {
|
|
9267
9528
|
calcOrderNumber = _useList.calcOrderNumber,
|
9268
9529
|
handleChangeSelectedItem = _useList.handleChangeSelectedItem,
|
9269
9530
|
getData = _useList.getData;
|
9531
|
+
var _useTranslation = useTranslation(),
|
9532
|
+
t = _useTranslation.t;
|
9270
9533
|
var textbookUrl = role === Role.Teacher ? TEXTBOOK_URL$1 : ADMIN_TEXTBOOK_URL;
|
9271
9534
|
var dispatch = useDispatch();
|
9272
9535
|
var handleViewTextbook = function handleViewTextbook(id) {
|
@@ -9304,8 +9567,7 @@ var useTextbookList = function useTextbookList(props) {
|
|
9304
9567
|
});
|
9305
9568
|
});
|
9306
9569
|
}, function (error) {
|
9307
|
-
|
9308
|
-
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));
|
9309
9571
|
});
|
9310
9572
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
9311
9573
|
} catch (e) {
|
@@ -10504,8 +10766,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10504
10766
|
setCategoryResponses(((_result$4$data = result[4].data) === null || _result$4$data === void 0 ? void 0 : _result$4$data.data) || []);
|
10505
10767
|
});
|
10506
10768
|
}, function (error) {
|
10507
|
-
|
10508
|
-
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));
|
10509
10770
|
});
|
10510
10771
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
10511
10772
|
};
|
@@ -10541,8 +10802,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10541
10802
|
setCategoryResponses(((_result$4$data2 = result[4].data) === null || _result$4$data2 === void 0 ? void 0 : _result$4$data2.data) || []);
|
10542
10803
|
});
|
10543
10804
|
}, function (error) {
|
10544
|
-
|
10545
|
-
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));
|
10546
10806
|
});
|
10547
10807
|
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
10548
10808
|
};
|
@@ -10898,7 +11158,7 @@ var useExamResult = function useExamResult(searchParam, history, examSessionId,
|
|
10898
11158
|
console.log({
|
10899
11159
|
error: error
|
10900
11160
|
});
|
10901
|
-
toast.error(
|
11161
|
+
toast.error(getErrorMessage(t, error));
|
10902
11162
|
});
|
10903
11163
|
return Promise.resolve(_temp23 && _temp23.then ? _temp23.then(_temp24) : _temp24(_temp23));
|
10904
11164
|
} catch (e) {
|
@@ -12198,18 +12458,21 @@ var useMyAnswer = function useMyAnswer() {
|
|
12198
12458
|
};
|
12199
12459
|
};
|
12200
12460
|
|
12201
|
-
var useCreateQuestionDialog = function useCreateQuestionDialog() {
|
12461
|
+
var useCreateQuestionDialog = function useCreateQuestionDialog(_ref) {
|
12462
|
+
var questions = _ref.questions;
|
12202
12463
|
var _useState = useState(false),
|
12203
12464
|
openDialog = _useState[0],
|
12204
12465
|
setOpenDialog = _useState[1];
|
12205
12466
|
var dispatch = useDispatch();
|
12467
|
+
var _useTranslation = useTranslation(),
|
12468
|
+
t = _useTranslation.t;
|
12206
12469
|
var toggleDialog = function toggleDialog() {
|
12207
12470
|
setOpenDialog(!openDialog);
|
12208
12471
|
};
|
12209
|
-
var handleCreateQuestion = function handleCreateQuestion(
|
12210
|
-
var content =
|
12211
|
-
examSessionId =
|
12212
|
-
questionId =
|
12472
|
+
var handleCreateQuestion = function handleCreateQuestion(_ref2) {
|
12473
|
+
var content = _ref2.content,
|
12474
|
+
examSessionId = _ref2.examSessionId,
|
12475
|
+
questionId = _ref2.questionId;
|
12213
12476
|
try {
|
12214
12477
|
var _temp2 = function _temp2() {
|
12215
12478
|
dispatch(setLoading(false));
|
@@ -12224,18 +12487,31 @@ var useCreateQuestionDialog = function useCreateQuestionDialog() {
|
|
12224
12487
|
toggleDialog();
|
12225
12488
|
});
|
12226
12489
|
}, function (error) {
|
12227
|
-
|
12228
|
-
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));
|
12229
12491
|
});
|
12230
12492
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
12231
12493
|
} catch (e) {
|
12232
12494
|
return Promise.reject(e);
|
12233
12495
|
}
|
12234
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]);
|
12235
12510
|
return {
|
12236
12511
|
openCreateQuestionDialog: openDialog,
|
12237
12512
|
toggleCreateQuestion: toggleDialog,
|
12238
|
-
handleCreateQuestion: handleCreateQuestion
|
12513
|
+
handleCreateQuestion: handleCreateQuestion,
|
12514
|
+
questionOptions: questionOptions
|
12239
12515
|
};
|
12240
12516
|
};
|
12241
12517
|
|
@@ -12284,7 +12560,7 @@ function CreateNewQuestionDialog(_ref) {
|
|
12284
12560
|
toggleCreateQuestion = _ref.toggleCreateQuestion,
|
12285
12561
|
examSessionId = _ref.examSessionId,
|
12286
12562
|
questionOrderSelected = _ref.questionOrderSelected,
|
12287
|
-
|
12563
|
+
questionOptions = _ref.questionOptions;
|
12288
12564
|
var _useTranslation = useTranslation(),
|
12289
12565
|
t = _useTranslation.t;
|
12290
12566
|
return React__default.createElement(Dialog, {
|
@@ -12330,7 +12606,8 @@ function CreateNewQuestionDialog(_ref) {
|
|
12330
12606
|
}));
|
12331
12607
|
}
|
12332
12608
|
}, function (_ref2) {
|
12333
|
-
var errors = _ref2.errors
|
12609
|
+
var errors = _ref2.errors,
|
12610
|
+
setFieldValue = _ref2.setFieldValue;
|
12334
12611
|
return React__default.createElement(Form, null, React__default.createElement(Box, {
|
12335
12612
|
display: "flex",
|
12336
12613
|
flexDirection: "column",
|
@@ -12340,20 +12617,22 @@ function CreateNewQuestionDialog(_ref) {
|
|
12340
12617
|
htmlFor: "questions",
|
12341
12618
|
className: styles['form-label'] + " " + styles$4['form-label-dialog']
|
12342
12619
|
}, t('questions_to_ask')), React__default.createElement(Field, {
|
12343
|
-
as: "select",
|
12344
12620
|
id: "questions",
|
12345
12621
|
name: "questionId",
|
12346
|
-
|
12347
|
-
|
12348
|
-
|
12349
|
-
|
12350
|
-
|
12351
|
-
|
12352
|
-
|
12353
|
-
|
12354
|
-
|
12355
|
-
|
12356
|
-
|
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", {
|
12357
12636
|
htmlFor: "content-question",
|
12358
12637
|
className: styles['form-label'] + " " + styles$4['form-label-dialog']
|
12359
12638
|
}, t('question_content')), React__default.createElement(Box, {
|
@@ -12421,10 +12700,13 @@ function MyAnswer(_ref) {
|
|
12421
12700
|
categories = _ref.categories,
|
12422
12701
|
isStudent = _ref.isStudent,
|
12423
12702
|
isPrint = _ref.isPrint;
|
12424
|
-
var _useCreateQuestionDia = useCreateQuestionDialog(
|
12703
|
+
var _useCreateQuestionDia = useCreateQuestionDialog({
|
12704
|
+
questions: data.questions
|
12705
|
+
}),
|
12425
12706
|
handleCreateQuestion = _useCreateQuestionDia.handleCreateQuestion,
|
12426
12707
|
openCreateQuestionDialog = _useCreateQuestionDia.openCreateQuestionDialog,
|
12427
|
-
toggleCreateQuestion = _useCreateQuestionDia.toggleCreateQuestion
|
12708
|
+
toggleCreateQuestion = _useCreateQuestionDia.toggleCreateQuestion,
|
12709
|
+
questionOptions = _useCreateQuestionDia.questionOptions;
|
12428
12710
|
var _useMyAnswer = useMyAnswer(),
|
12429
12711
|
isOpenTime = _useMyAnswer.isOpenTime,
|
12430
12712
|
handleSelectQuestionOrder = _useMyAnswer.handleSelectQuestionOrder,
|
@@ -12638,7 +12920,7 @@ function MyAnswer(_ref) {
|
|
12638
12920
|
className: styles$4["contentMyAnswer"]
|
12639
12921
|
}, isPrint ? renderPrintQuestions(item.questions) : renderQuestions(item.questions)));
|
12640
12922
|
}), React__default.createElement(CreateNewQuestionDialog, {
|
12641
|
-
|
12923
|
+
questionOptions: questionOptions,
|
12642
12924
|
questionOrderSelected: questionOrderSelected,
|
12643
12925
|
examSessionId: data === null || data === void 0 ? void 0 : data.examSessionId,
|
12644
12926
|
handleCreateQuestion: handleCreateQuestion,
|
@@ -13181,6 +13463,8 @@ var useCreateQuestionDialog$1 = function useCreateQuestionDialog() {
|
|
13181
13463
|
openDialog = _useState[0],
|
13182
13464
|
setOpenDialog = _useState[1];
|
13183
13465
|
var dispatch = useDispatch();
|
13466
|
+
var _useTranslation = useTranslation(),
|
13467
|
+
t = _useTranslation.t;
|
13184
13468
|
var toggleDialog = function toggleDialog() {
|
13185
13469
|
setOpenDialog(!openDialog);
|
13186
13470
|
};
|
@@ -13200,8 +13484,7 @@ var useCreateQuestionDialog$1 = function useCreateQuestionDialog() {
|
|
13200
13484
|
toggleDialog();
|
13201
13485
|
});
|
13202
13486
|
}, function (error) {
|
13203
|
-
|
13204
|
-
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));
|
13205
13488
|
});
|
13206
13489
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
13207
13490
|
} catch (e) {
|
@@ -13966,7 +14249,7 @@ var useLogin$2 = function useLogin(_ref) {
|
|
13966
14249
|
});
|
13967
14250
|
}, function (error) {
|
13968
14251
|
console.log(error);
|
13969
|
-
toast.error(t('request_login_fail'));
|
14252
|
+
toast.error(getErrorMessage(t, error, t('request_login_fail')));
|
13970
14253
|
}));
|
13971
14254
|
} catch (e) {
|
13972
14255
|
return Promise.reject(e);
|
@@ -13980,7 +14263,7 @@ var useLogin$2 = function useLogin(_ref) {
|
|
13980
14263
|
if (redirectUrl) pushTo(history, redirectUrl);
|
13981
14264
|
};
|
13982
14265
|
useEffect(function () {
|
13983
|
-
var token = getAccessToken
|
14266
|
+
var token = getAccessToken();
|
13984
14267
|
if (!!token) pushTo(history, "/");
|
13985
14268
|
}, []);
|
13986
14269
|
return {
|
@@ -14454,7 +14737,10 @@ var Header = function Header(_ref) {
|
|
14454
14737
|
width: "100%",
|
14455
14738
|
display: "flex",
|
14456
14739
|
flexDirection: "row",
|
14457
|
-
gap:
|
14740
|
+
gap: {
|
14741
|
+
xs: "16",
|
14742
|
+
md: "24"
|
14743
|
+
},
|
14458
14744
|
className: styles["tabBox"] + " " + styles["headers"]
|
14459
14745
|
}, React__default.createElement(Stack, {
|
14460
14746
|
padding: "10px 0",
|
@@ -14515,7 +14801,23 @@ var Header = function Header(_ref) {
|
|
14515
14801
|
})), React__default.createElement(Stack, {
|
14516
14802
|
direction: "row",
|
14517
14803
|
alignItems: "center"
|
14518
|
-
}, 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, {
|
14519
14821
|
"aria-current": "page",
|
14520
14822
|
to: homeRoute.path,
|
14521
14823
|
className: "border-none"
|
@@ -14552,6 +14854,8 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14552
14854
|
var _state$common, _state$common$user;
|
14553
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;
|
14554
14856
|
});
|
14857
|
+
var _useTranslation = useTranslation(),
|
14858
|
+
t = _useTranslation.t;
|
14555
14859
|
var getAcademies = function getAcademies() {
|
14556
14860
|
try {
|
14557
14861
|
var _temp2 = function _temp2() {
|
@@ -14563,8 +14867,7 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14563
14867
|
setAcademyList(res.data.items || []);
|
14564
14868
|
});
|
14565
14869
|
}, function (error) {
|
14566
|
-
|
14567
|
-
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));
|
14568
14871
|
});
|
14569
14872
|
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
14570
14873
|
} catch (e) {
|
@@ -14590,8 +14893,7 @@ var useAcademyList = function useAcademyList(history, role, homeAcademyUrl, home
|
|
14590
14893
|
return Promise.resolve(handleLoginAccessToken(requestBody, false)).then(function () {});
|
14591
14894
|
});
|
14592
14895
|
}, function (error) {
|
14593
|
-
|
14594
|
-
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));
|
14595
14897
|
});
|
14596
14898
|
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
14597
14899
|
} catch (e) {
|
@@ -14683,5 +14985,5 @@ var AcademyList = function AcademyList(_ref) {
|
|
14683
14985
|
}, React__default.createElement("span", null, t("no_academy_available"), "."))))));
|
14684
14986
|
};
|
14685
14987
|
|
14686
|
-
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 };
|
14687
14989
|
//# sourceMappingURL=index.modern.js.map
|