touchstudy-core 0.1.30 → 0.1.32

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.
@@ -2,7 +2,7 @@ import { FC, PropsWithChildren } from "react";
2
2
  import { DialogProps } from "@mui/material";
3
3
  interface Props {
4
4
  open: boolean;
5
- onClose: () => void;
5
+ onClose: (event?: any, reason?: "backdropClick" | "escapeKeyDown") => void;
6
6
  title: string;
7
7
  size?: DialogProps["maxWidth"];
8
8
  isShowHeader?: boolean;
@@ -3,10 +3,10 @@ export declare const getResultsLongTimeSpend: (code: string) => Promise<import("
3
3
  export declare const getResultsEffectSize: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
4
4
  export declare const getResultsTimeOrderQuestion: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
5
5
  export declare const getResultsCategories: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
6
- export declare const getResultsTeacher: (id: string, studentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
7
- export declare const getResultsLongTimeSpendTeacher: (id: string, studentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
8
- export declare const getResultsEffectSizeTeacher: (id: string, studentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
9
- export declare const getResultsTimeOrderQuestionTeacher: (id: string, studentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
10
- export declare const getResultsCategoriesTeacher: (id: string, studentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
6
+ export declare const getResultsTeacher: (id: number, studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
7
+ export declare const getResultsLongTimeSpendTeacher: (id: number, studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
8
+ export declare const getResultsEffectSizeTeacher: (id: number, studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
9
+ export declare const getResultsTimeOrderQuestionTeacher: (id: number, studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
10
+ export declare const getResultsCategoriesTeacher: (id: number, studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
11
11
  export declare const createConversationApi: (data: any) => Promise<import("axios").AxiosResponse<any, any>>;
12
12
  export declare const getCheckStatusExam: (examCode?: string | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CategoryResponse, EffectSize, ExamResult, LongTimeSpendQuestion, TimelyOrderQuestion } from "../configs/types";
3
- declare const useExamResult: (searchParam: string, navigate: Function) => {
3
+ declare const useExamResult: (searchParam: string, navigate: Function, examSessionId?: number, studentId?: number, code?: string) => {
4
4
  series: {
5
5
  name: string;
6
6
  data: (number | null)[];
@@ -2,6 +2,9 @@ import { FC } from "react";
2
2
  declare type Props = {
3
3
  searchParams: string;
4
4
  onNavigate: Function;
5
+ examSessionId?: number;
6
+ studentId?: number;
7
+ code?: string;
5
8
  };
6
9
  declare const ExamResultV2: FC<Props>;
7
10
  export default ExamResultV2;
package/dist/index.js CHANGED
@@ -1355,6 +1355,7 @@ var duration = "시험 시간";
1355
1355
  var answer_count = "답변 수";
1356
1356
  var question_count = "문제 갯수";
1357
1357
  var category = "문항 카테고리";
1358
+ var _category = "카테고리";
1358
1359
  var save_and_exit = "저장 및 종료";
1359
1360
  var update_exam = "시험 업데이트";
1360
1361
  var create_exam = "새 시험 만들기";
@@ -1546,6 +1547,7 @@ var users = "사용자";
1546
1547
  var new_user = "새로운 사용자";
1547
1548
  var academy_admin = "아카데미 관리자";
1548
1549
  var switch_academy_admin = "스위치 아카데미 관리자";
1550
+ var switch_academy = "스위치 아카데미";
1549
1551
  var there_are_no_lessons_this_week = "이번주는 수업이 없습니다";
1550
1552
  var update_message = "업데이트 메시지";
1551
1553
  var attachment = "첨부 파일";
@@ -1564,6 +1566,16 @@ var number_of_classes = "{{ number }} 개";
1564
1566
  var complete_conversation_successfully = "대화를 성공적으로 완료했습니다";
1565
1567
  var fail_to_complete_conversation = "대화를 완료하지 못했습니다";
1566
1568
  var are_you_sure_you_want_to_complete_this_conversation = "정말로 이 채팅 베팅을 완료하시겠습니까?";
1569
+ var switch_academy_fail = "아카데미 전환 실패";
1570
+ var no_academy_available = "이용 가능한 아카데미가 없습니다";
1571
+ var my_classes_calendar = "내 수업 캘린더";
1572
+ var enter_exam_code = "시험 코드 입력";
1573
+ var my_score = "내 점수";
1574
+ var exam_date = "시험 날짜";
1575
+ var my_problem_solving_order = "내 순서";
1576
+ var top_rankings_problem_solving_order = "상위권 학생의 순서";
1577
+ var comparison_of_top_rankings_and_problem_solving_order = "상위권과 문제 푸는 순서 비교";
1578
+ var my_answers = "내 해답";
1567
1579
  var lang_ko = {
1568
1580
  problem_solving: problem_solving,
1569
1581
  my_story: my_story,
@@ -1634,6 +1646,7 @@ var lang_ko = {
1634
1646
  answer_count: answer_count,
1635
1647
  question_count: question_count,
1636
1648
  category: category,
1649
+ _category: _category,
1637
1650
  save_and_exit: save_and_exit,
1638
1651
  update_exam: update_exam,
1639
1652
  create_exam: create_exam,
@@ -1822,6 +1835,7 @@ var lang_ko = {
1822
1835
  new_user: new_user,
1823
1836
  academy_admin: academy_admin,
1824
1837
  switch_academy_admin: switch_academy_admin,
1838
+ switch_academy: switch_academy,
1825
1839
  there_are_no_lessons_this_week: there_are_no_lessons_this_week,
1826
1840
  update_message: update_message,
1827
1841
  attachment: attachment,
@@ -1839,7 +1853,17 @@ var lang_ko = {
1839
1853
  number_of_classes: number_of_classes,
1840
1854
  complete_conversation_successfully: complete_conversation_successfully,
1841
1855
  fail_to_complete_conversation: fail_to_complete_conversation,
1842
- are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation
1856
+ are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation,
1857
+ switch_academy_fail: switch_academy_fail,
1858
+ no_academy_available: no_academy_available,
1859
+ my_classes_calendar: my_classes_calendar,
1860
+ enter_exam_code: enter_exam_code,
1861
+ my_score: my_score,
1862
+ exam_date: exam_date,
1863
+ my_problem_solving_order: my_problem_solving_order,
1864
+ top_rankings_problem_solving_order: top_rankings_problem_solving_order,
1865
+ comparison_of_top_rankings_and_problem_solving_order: comparison_of_top_rankings_and_problem_solving_order,
1866
+ my_answers: my_answers
1843
1867
  };
1844
1868
 
1845
1869
  var problem_solving$1 = "Problem Solving";
@@ -1931,6 +1955,7 @@ var update_question_success = "Question is updated successfully";
1931
1955
  var number_of_answers = "Number of answers";
1932
1956
  var correct_answers = "Correct answers";
1933
1957
  var category$1 = "Category";
1958
+ var _category$1 = "Category";
1934
1959
  var score = "Score";
1935
1960
  var enter_title$1 = "Enter title";
1936
1961
  var enter_score = "Enter score";
@@ -2135,6 +2160,7 @@ var users$1 = "Users";
2135
2160
  var new_user$1 = "New user";
2136
2161
  var academy_admin$1 = "Academy Admin";
2137
2162
  var switch_academy_admin$1 = "Switch Academy Admin";
2163
+ var switch_academy$1 = "Switch Academy";
2138
2164
  var there_are_no_lessons_this_week$1 = "There are no lessons this week";
2139
2165
  var today_lessons$1 = "Today lessons";
2140
2166
  var update_message$1 = "Update message";
@@ -2153,6 +2179,16 @@ var number_of_classes$1 = "{{ number }} classes";
2153
2179
  var complete_conversation_successfully$1 = "Complete conversation successfully";
2154
2180
  var fail_to_complete_conversation$1 = "Fail to complete conversation";
2155
2181
  var are_you_sure_you_want_to_complete_this_conversation$1 = "Are you sure you want to complete this conversation?";
2182
+ var switch_academy_fail$1 = "Academy conversion failed";
2183
+ var no_academy_available$1 = "No academy available";
2184
+ var my_classes_calendar$1 = "My classes calendar";
2185
+ var enter_exam_code$1 = "Enter exam code";
2186
+ var my_score$1 = "My score";
2187
+ var exam_date$1 = "Exam date";
2188
+ var my_problem_solving_order$1 = "My problem solving order";
2189
+ var top_rankings_problem_solving_order$1 = "Top rankings problem solving order";
2190
+ var comparison_of_top_rankings_and_problem_solving_order$1 = "Comparison of top rankings and problem-solving order";
2191
+ var my_answers$1 = "My answers";
2156
2192
  var lang_en = {
2157
2193
  problem_solving: problem_solving$1,
2158
2194
  my_story: my_story$1,
@@ -2246,6 +2282,7 @@ var lang_en = {
2246
2282
  number_of_answers: number_of_answers,
2247
2283
  correct_answers: correct_answers,
2248
2284
  category: category$1,
2285
+ _category: _category$1,
2249
2286
  score: score,
2250
2287
  enter_title: enter_title$1,
2251
2288
  enter_score: enter_score,
@@ -2446,6 +2483,7 @@ var lang_en = {
2446
2483
  new_user: new_user$1,
2447
2484
  academy_admin: academy_admin$1,
2448
2485
  switch_academy_admin: switch_academy_admin$1,
2486
+ switch_academy: switch_academy$1,
2449
2487
  there_are_no_lessons_this_week: there_are_no_lessons_this_week$1,
2450
2488
  today_lessons: today_lessons$1,
2451
2489
  update_message: update_message$1,
@@ -2463,7 +2501,17 @@ var lang_en = {
2463
2501
  number_of_classes: number_of_classes$1,
2464
2502
  complete_conversation_successfully: complete_conversation_successfully$1,
2465
2503
  fail_to_complete_conversation: fail_to_complete_conversation$1,
2466
- are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation$1
2504
+ are_you_sure_you_want_to_complete_this_conversation: are_you_sure_you_want_to_complete_this_conversation$1,
2505
+ switch_academy_fail: switch_academy_fail$1,
2506
+ no_academy_available: no_academy_available$1,
2507
+ my_classes_calendar: my_classes_calendar$1,
2508
+ enter_exam_code: enter_exam_code$1,
2509
+ my_score: my_score$1,
2510
+ exam_date: exam_date$1,
2511
+ my_problem_solving_order: my_problem_solving_order$1,
2512
+ top_rankings_problem_solving_order: top_rankings_problem_solving_order$1,
2513
+ comparison_of_top_rankings_and_problem_solving_order: comparison_of_top_rankings_and_problem_solving_order$1,
2514
+ my_answers: my_answers$1
2467
2515
  };
2468
2516
 
2469
2517
  i18n.use(reactI18next.initReactI18next).init({
@@ -2710,7 +2758,8 @@ var useSwitchAcademy = function useSwitchAcademy(role, navigate, homeAcademyUrl,
2710
2758
  });
2711
2759
  }, function (error) {
2712
2760
  var _error$response2, _error$response2$data;
2713
- reactToastify.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) || t("switch_academy_admin"));
2761
+ academyDomain && localStorage.removeItem(ACADEMY_DOMAIN);
2762
+ reactToastify.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) || t("switch_academy_fail"));
2714
2763
  });
2715
2764
  return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
2716
2765
  } catch (e) {
@@ -2792,7 +2841,7 @@ var TheAcademyDropdown = function TheAcademyDropdown(_ref) {
2792
2841
  color: "#5458D5",
2793
2842
  minWidth: 150
2794
2843
  }
2795
- }, (selectedAcademy === null || selectedAcademy === void 0 ? void 0 : selectedAcademy.name) || t("switch_academy_admin")), React__default.createElement("div", {
2844
+ }, (selectedAcademy === null || selectedAcademy === void 0 ? void 0 : selectedAcademy.name) || t(role === exports.Role.Admin ? "switch_academy_admin" : "switch_academy")), React__default.createElement("div", {
2796
2845
  className: "" + stylesGlobal["switch-icon"]
2797
2846
  }, React__default.createElement(go.GoArrowSwitch, {
2798
2847
  size: 14
@@ -8324,7 +8373,16 @@ var CATEGORY_RESPONSES = [{
8324
8373
  "percentageAmongStudents": 40
8325
8374
  }];
8326
8375
 
8327
- var useExamResult = function useExamResult(searchParam, navigate) {
8376
+ var useExamResult = function useExamResult(searchParam, navigate, examSessionId, studentId, code) {
8377
+ if (examSessionId === void 0) {
8378
+ examSessionId = 0;
8379
+ }
8380
+ if (studentId === void 0) {
8381
+ studentId = 0;
8382
+ }
8383
+ if (code === void 0) {
8384
+ code = "";
8385
+ }
8328
8386
  var query = new URLSearchParams(searchParam);
8329
8387
  var dispatch = reactRedux.useDispatch();
8330
8388
  var roles = reactRedux.useSelector(function (state) {
@@ -8333,7 +8391,6 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8333
8391
  });
8334
8392
  var isStudent = roles === null || roles === void 0 ? void 0 : roles.includes(Roles$2.Student);
8335
8393
  var examCode = query.get("examCode") || "";
8336
- var studentId = query.get("studentId") || "";
8337
8394
  var language = reactRedux.useSelector(function (state) {
8338
8395
  var _state$common2;
8339
8396
  return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.language;
@@ -8366,14 +8423,14 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8366
8423
  setOpenProblem = _useState7[1];
8367
8424
  var _useTranslation = reactI18next.useTranslation(),
8368
8425
  t = _useTranslation.t;
8369
- var getData = function getData(examCode) {
8426
+ var getStudentData = function getStudentData(examCode) {
8370
8427
  try {
8371
8428
  var _temp4 = function _temp4() {
8372
8429
  function _temp2() {
8373
8430
  dispatch(setLoading(false));
8374
8431
  }
8375
8432
  var _temp = _catch(function () {
8376
- return Promise.resolve(isStudent ? Promise.all([getResults(examCode), getResultsLongTimeSpend(examCode), getResultsEffectSize(examCode), getResultsTimeOrderQuestion(examCode), getResultsCategories(examCode)]) : Promise.all([getResultsTeacher(examCode, studentId), getResultsLongTimeSpendTeacher(examCode, studentId), getResultsEffectSizeTeacher(examCode, studentId), getResultsTimeOrderQuestionTeacher(examCode, studentId), getResultsCategoriesTeacher(examCode, studentId)])).then(function (result) {
8433
+ return Promise.resolve(Promise.all([getResults(examCode), getResultsLongTimeSpend(examCode), getResultsEffectSize(examCode), getResultsTimeOrderQuestion(examCode), getResultsCategories(examCode)])).then(function (result) {
8377
8434
  var _result$0$data, _result$1$data, _result$2$data, _result$3$data, _result$4$data;
8378
8435
  setResultDatas((_result$0$data = result[0].data) === null || _result$0$data === void 0 ? void 0 : _result$0$data.data);
8379
8436
  setLongTimeSpend((_result$1$data = result[1].data) === null || _result$1$data === void 0 ? void 0 : _result$1$data.data);
@@ -8400,6 +8457,40 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8400
8457
  return Promise.reject(e);
8401
8458
  }
8402
8459
  };
8460
+ var getStudentDataByTeacher = function getStudentDataByTeacher(examCode, examSessionId, studentId) {
8461
+ try {
8462
+ var _temp8 = function _temp8() {
8463
+ function _temp6() {
8464
+ dispatch(setLoading(false));
8465
+ }
8466
+ var _temp5 = _catch(function () {
8467
+ return Promise.resolve(Promise.all([getResultsTeacher(examSessionId, studentId), getResultsLongTimeSpendTeacher(examSessionId, studentId), getResultsEffectSizeTeacher(examSessionId, studentId), getResultsTimeOrderQuestionTeacher(examSessionId, studentId), getResultsCategoriesTeacher(examSessionId, studentId)])).then(function (result) {
8468
+ var _result$0$data2, _result$1$data2, _result$2$data2, _result$3$data2, _result$4$data2;
8469
+ setResultDatas((_result$0$data2 = result[0].data) === null || _result$0$data2 === void 0 ? void 0 : _result$0$data2.data);
8470
+ setLongTimeSpend((_result$1$data2 = result[1].data) === null || _result$1$data2 === void 0 ? void 0 : _result$1$data2.data);
8471
+ setEffectSize((_result$2$data2 = result[2].data) === null || _result$2$data2 === void 0 ? void 0 : _result$2$data2.data);
8472
+ setTimelyOrderQuestion((_result$3$data2 = result[3].data) === null || _result$3$data2 === void 0 ? void 0 : _result$3$data2.data);
8473
+ setCategoryResponses(((_result$4$data2 = result[4].data) === null || _result$4$data2 === void 0 ? void 0 : _result$4$data2.data) || []);
8474
+ });
8475
+ }, function (error) {
8476
+ var _error$response2;
8477
+ reactToastify.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);
8478
+ });
8479
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
8480
+ };
8481
+ dispatch(setLoading(true));
8482
+ var _temp7 = _catch(function () {
8483
+ return Promise.resolve(getCheckStatusExam(examCode)).then(function () {});
8484
+ }, function (error) {
8485
+ console.log({
8486
+ error: error
8487
+ });
8488
+ });
8489
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7));
8490
+ } catch (e) {
8491
+ return Promise.reject(e);
8492
+ }
8493
+ };
8403
8494
  var setExampleData = function setExampleData() {
8404
8495
  setResultDatas(EXAM_RESULT);
8405
8496
  setLongTimeSpend(LONGTIME_SPEND_QUESTIONS);
@@ -8408,8 +8499,12 @@ var useExamResult = function useExamResult(searchParam, navigate) {
8408
8499
  setCategoryResponses(CATEGORY_RESPONSES);
8409
8500
  };
8410
8501
  React.useEffect(function () {
8411
- examCode === "example-code" ? setExampleData() : getData(examCode || "");
8412
- }, [examCode]);
8502
+ var getData = function getData() {
8503
+ isStudent && getStudentData(examCode);
8504
+ !isStudent && getStudentDataByTeacher(code, examSessionId, studentId);
8505
+ };
8506
+ examCode === "example-code" ? setExampleData() : getData();
8507
+ }, [examCode, isStudent, code, examSessionId, studentId]);
8413
8508
  var handlePrevChart = function handlePrevChart() {
8414
8509
  if (dataChartIndex > 0) {
8415
8510
  setDataChartIndex(dataChartIndex - 1);
@@ -10920,8 +11015,11 @@ var useTab = function useTab() {
10920
11015
 
10921
11016
  var ExamResultV2 = function ExamResultV2(_ref) {
10922
11017
  var searchParams = _ref.searchParams,
10923
- onNavigate = _ref.onNavigate;
10924
- var _useExamResult = useExamResult(searchParams, onNavigate),
11018
+ onNavigate = _ref.onNavigate,
11019
+ examSessionId = _ref.examSessionId,
11020
+ studentId = _ref.studentId,
11021
+ code = _ref.code;
11022
+ var _useExamResult = useExamResult(searchParams, onNavigate, examSessionId, studentId, code),
10925
11023
  series = _useExamResult.series,
10926
11024
  chartOptions = _useExamResult.chartOptions,
10927
11025
  dataChartIndex = _useExamResult.dataChartIndex,
@@ -10980,7 +11078,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
10980
11078
  fontWeight: 600,
10981
11079
  color: "#97A1AF"
10982
11080
  }
10983
- }, "\uB0B4 \uC810\uC218"), React__default.createElement(material.Typography, {
11081
+ }, t("my_score")), React__default.createElement(material.Typography, {
10984
11082
  sx: {
10985
11083
  fontSize: "14px",
10986
11084
  fontWeight: 600,
@@ -10994,7 +11092,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
10994
11092
  fontWeight: 600,
10995
11093
  color: "#97A1AF"
10996
11094
  }
10997
- }, "\uC2DC\uD5D8 \uB0A0\uC9DC"), React__default.createElement(material.Typography, {
11095
+ }, t("exam_date")), React__default.createElement(material.Typography, {
10998
11096
  sx: {
10999
11097
  fontSize: "14px",
11000
11098
  fontWeight: 600,
@@ -11006,7 +11104,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11006
11104
  fontWeight: 600,
11007
11105
  color: "#97A1AF"
11008
11106
  }
11009
- }, "\uC2DC\uD5D8 \uC2DC\uAC04"), React__default.createElement(material.Typography, {
11107
+ }, t("exam_time")), React__default.createElement(material.Typography, {
11010
11108
  sx: {
11011
11109
  fontSize: "14px",
11012
11110
  fontWeight: 600,
@@ -11018,7 +11116,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11018
11116
  fontWeight: 600,
11019
11117
  color: "#97A1AF"
11020
11118
  }
11021
- }, "\uCD1D \uD559\uC0DD\uC218"), React__default.createElement(material.Typography, {
11119
+ }, t("total_students")), React__default.createElement(material.Typography, {
11022
11120
  sx: {
11023
11121
  fontSize: "14px",
11024
11122
  fontWeight: 600,
@@ -11032,7 +11130,7 @@ var ExamResultV2 = function ExamResultV2(_ref) {
11032
11130
  fontWeight: 600,
11033
11131
  color: "#97A1AF"
11034
11132
  }
11035
- }, "\uB2F4\uB2F9 \uC120\uC0DD\uB2D8"), React__default.createElement(material.Typography, {
11133
+ }, t("teacher_in_charge")), React__default.createElement(material.Typography, {
11036
11134
  sx: {
11037
11135
  fontSize: "14px",
11038
11136
  fontWeight: 600,