touchstudy-core 0.1.10 → 0.1.11

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/index.js CHANGED
@@ -16,11 +16,16 @@ var gapiScript = require('gapi-script');
16
16
  var i18n = _interopDefault(require('i18next'));
17
17
  var reactI18next = require('react-i18next');
18
18
  var io5 = require('react-icons/io5');
19
- var Select = _interopDefault(require('react-select'));
19
+ var Select = require('react-select');
20
+ var Select__default = _interopDefault(Select);
21
+ var fa = require('react-icons/fa');
20
22
  var reactRouterDom = require('react-router-dom');
21
23
  var io = require('react-icons/io');
22
- var reactToastify = require('react-toastify');
23
24
  var Pusher = _interopDefault(require('pusher-js'));
25
+ var reactToastify = require('react-toastify');
26
+ var CreatableSelect = _interopDefault(require('react-select/creatable'));
27
+ var pi = require('react-icons/pi');
28
+ var _ = _interopDefault(require('lodash'));
24
29
 
25
30
  var setLoading = toolkit.createAction("common/setLoading");
26
31
  var setAlert = toolkit.createAction("common/setAlert");
@@ -150,6 +155,11 @@ var AuthenticationMessage;
150
155
  AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
151
156
  AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
152
157
  })(AuthenticationMessage || (AuthenticationMessage = {}));
158
+ (function (Role) {
159
+ Role["Student"] = "Student";
160
+ Role["Teacher"] = "Teacher";
161
+ Role["Admin"] = "Admin";
162
+ })(exports.Role || (exports.Role = {}));
153
163
 
154
164
  var useGoogleSignOut = function useGoogleSignOut(props) {
155
165
  var dispatch = reactRedux.useDispatch();
@@ -196,7 +206,8 @@ var schema = yup.object({
196
206
  var BlockLogin = function BlockLogin(_ref) {
197
207
  var defaultInfo = _ref.defaultInfo,
198
208
  onNavigate = _ref.onNavigate,
199
- isTeacher = _ref.isTeacher;
209
+ _ref$role = _ref.role,
210
+ role = _ref$role === void 0 ? exports.Role.Student : _ref$role;
200
211
  var dispatch = reactRedux.useDispatch();
201
212
  var _useGoogleSignOut = useGoogleSignOut({
202
213
  onNavigate: onNavigate
@@ -222,7 +233,6 @@ var BlockLogin = function BlockLogin(_ref) {
222
233
  token: accessToken,
223
234
  googleId: googleId
224
235
  };
225
- var role = isTeacher ? "Teacher" : "Student";
226
236
  dispatch(setLoading(true));
227
237
  var _temp = _catch(function () {
228
238
  return Promise.resolve(apiLoginGoogle(infoLogin, role)).then(function (res1) {
@@ -230,7 +240,7 @@ var BlockLogin = function BlockLogin(_ref) {
230
240
  var tokenJWT = res1.data.token;
231
241
  localStorage.setItem("USER_INFORMATION", JSON.stringify(infoLogin));
232
242
  localStorage.setItem(ACCESS_TOKEN, tokenJWT);
233
- if (!isTeacher && isFirstLogin) {
243
+ if (role === exports.Role.Student && isFirstLogin) {
234
244
  onNavigate("/register/info");
235
245
  } else {
236
246
  onNavigate("/");
@@ -349,7 +359,7 @@ var useLogin = function useLogin(onNavigate) {
349
359
 
350
360
  var Login = function Login(_ref) {
351
361
  var onNavigate = _ref.onNavigate,
352
- isTeacher = _ref.isTeacher;
362
+ role = _ref.role;
353
363
  var _useLogin = useLogin(onNavigate),
354
364
  defaultInfo = _useLogin.defaultInfo;
355
365
  return React__default.createElement("div", {
@@ -364,7 +374,7 @@ var Login = function Login(_ref) {
364
374
  }, React__default.createElement(BlockLogin, {
365
375
  defaultInfo: defaultInfo,
366
376
  onNavigate: onNavigate,
367
- isTeacher: isTeacher
377
+ role: role
368
378
  }))));
369
379
  };
370
380
 
@@ -604,11 +614,11 @@ var NotFound = function NotFound() {
604
614
  document.title = TITLE;
605
615
  });
606
616
  return React__default.createElement("div", {
607
- className: "not-found"
617
+ className: "not-found d-flex justify-content-center"
608
618
  }, React__default.createElement("div", {
609
- className: "clearfix"
619
+ className: "clearfix pt-5"
610
620
  }, React__default.createElement("h1", {
611
- className: "float-left display-3 mr-4"
621
+ className: "float-left display-3 fw-bold mr-4 text-center"
612
622
  }, "404"), React__default.createElement("div", {
613
623
  className: "float-left"
614
624
  }, React__default.createElement("h4", {
@@ -663,16 +673,13 @@ var LayoutContext = function LayoutContext(_ref) {
663
673
  var _state$common;
664
674
  return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
665
675
  });
676
+ var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
666
677
  var resetAuth = function resetAuth() {
667
678
  handleSignOut();
668
679
  };
669
680
  var checkRoleUser = React.useCallback(function () {
670
- var _user$roles, _user$roles2;
671
681
  if (!user) return;
672
- var isAdmin = (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes("Admin");
673
- if (isAdmin && role !== "Teacher") alert(user.email + " not allow to register " + role);
674
- if (isAdmin) return;
675
- if (!((_user$roles2 = user.roles) !== null && _user$roles2 !== void 0 && _user$roles2.includes(role))) {
682
+ if (!roles.includes(role)) {
676
683
  alert(user.email + " not allow to register " + role);
677
684
  resetAuth();
678
685
  }
@@ -725,19 +732,47 @@ var ConfirmDialog = function ConfirmDialog(_ref) {
725
732
  _ref$title = _ref.title,
726
733
  title = _ref$title === void 0 ? "Confirmation" : _ref$title,
727
734
  toggle = _ref.toggle,
728
- onConfirm = _ref.onConfirm;
735
+ onConfirm = _ref.onConfirm,
736
+ confirmText = _ref.confirmText;
737
+ var _useState = React.useState(),
738
+ confirmTextValue = _useState[0],
739
+ setConfirmTextValue = _useState[1];
740
+ var handleConfirm = function handleConfirm() {
741
+ onConfirm();
742
+ };
743
+ var handleChangeConfirmText = function handleChangeConfirmText(e) {
744
+ setConfirmTextValue(e.target.value);
745
+ };
746
+ var handlePaste = function handlePaste(e) {
747
+ e.preventDefault();
748
+ };
749
+ React.useEffect(function () {
750
+ !open && setConfirmTextValue(undefined);
751
+ }, [open]);
752
+ var isValid = !!confirmText && !!confirmTextValue && confirmTextValue.trim() === confirmText.trim();
729
753
  return React__default.createElement(reactstrap.Modal, {
730
754
  isOpen: open,
731
755
  toggle: toggle,
732
- centered: true
756
+ centered: true,
757
+ zIndex: 1102
733
758
  }, React__default.createElement(reactstrap.ModalHeader, {
734
759
  toggle: toggle
735
- }, title), React__default.createElement(reactstrap.ModalBody, null, text), React__default.createElement(reactstrap.ModalFooter, null, React__default.createElement(reactstrap.Button, {
760
+ }, title), React__default.createElement(reactstrap.ModalBody, null, React__default.createElement("p", null, React__default.createElement("strong", null, text)), !!confirmText && React__default.createElement("div", null, React__default.createElement("p", null, "Enter \"", React__default.createElement("strong", null, confirmText), "\" to confirm delete"), React__default.createElement(reactstrap.Input, {
761
+ value: confirmTextValue,
762
+ onChange: handleChangeConfirmText,
763
+ placeholder: "Please enter...",
764
+ onPaste: handlePaste,
765
+ invalid: !isValid && confirmTextValue !== undefined,
766
+ valid: isValid
767
+ }))), React__default.createElement(reactstrap.ModalFooter, null, React__default.createElement(reactstrap.Button, {
736
768
  color: "secondary",
769
+ className: "px-3",
737
770
  onClick: toggle
738
771
  }, cancelText), React__default.createElement(reactstrap.Button, {
739
772
  color: isDelete ? "danger" : "primary",
740
- onClick: onConfirm
773
+ className: "px-3",
774
+ disabled: !!confirmText && (confirmTextValue === null || confirmTextValue === void 0 ? void 0 : confirmTextValue.trim()) !== confirmText.trim(),
775
+ onClick: handleConfirm
741
776
  }, okText)));
742
777
  };
743
778
 
@@ -755,7 +790,8 @@ var CommonDialog = function CommonDialog(_ref) {
755
790
  isOpen: open,
756
791
  toggle: onClose,
757
792
  centered: centered,
758
- size: size
793
+ size: size,
794
+ zIndex: 1102
759
795
  }, React__default.createElement(reactstrap.ModalHeader, {
760
796
  toggle: onClose
761
797
  }, title), children);
@@ -971,6 +1007,18 @@ var problem = "문제";
971
1007
  var problem_solving_time = "문제풀이 시간";
972
1008
  var minutes = "분";
973
1009
  var correct_rate = "정확한 비율";
1010
+ var title = "시험명";
1011
+ var duration = "시험 시간";
1012
+ var answer_count = "답변 수";
1013
+ var question_count = "문제 갯수";
1014
+ var category = "문항 카테고리";
1015
+ var save_and_exit = "저장 및 종료";
1016
+ var update_exam = "시험 업데이트";
1017
+ var create_exam = "새 시험 만들기";
1018
+ var enter_title = "시험 제목을 입력하세요";
1019
+ var select_placeholder = "선택하다...";
1020
+ var view_exam = "시험 보기";
1021
+ var back = "뒤쪽에";
974
1022
  var lang_ko = {
975
1023
  problem_solving: problem_solving,
976
1024
  my_story: my_story,
@@ -1028,7 +1076,19 @@ var lang_ko = {
1028
1076
  problem: problem,
1029
1077
  problem_solving_time: problem_solving_time,
1030
1078
  minutes: minutes,
1031
- correct_rate: correct_rate
1079
+ correct_rate: correct_rate,
1080
+ title: title,
1081
+ duration: duration,
1082
+ answer_count: answer_count,
1083
+ question_count: question_count,
1084
+ category: category,
1085
+ save_and_exit: save_and_exit,
1086
+ update_exam: update_exam,
1087
+ create_exam: create_exam,
1088
+ enter_title: enter_title,
1089
+ select_placeholder: select_placeholder,
1090
+ view_exam: view_exam,
1091
+ back: back
1032
1092
  };
1033
1093
 
1034
1094
  var problem_solving$1 = "Problem Solving";
@@ -1088,6 +1148,58 @@ var problem$1 = "Problem ";
1088
1148
  var problem_solving_time$1 = "Problem solving time";
1089
1149
  var minutes$1 = "m";
1090
1150
  var correct_rate$1 = "Correct rate";
1151
+ var difficult_level = "Difficult level";
1152
+ var difficulty_explain = "(The Difficulty Level provides an indication of the difficulty level of each test question)";
1153
+ var explain_your_answer = "Explain your answer";
1154
+ var hint = "Hint";
1155
+ var save_and_add_next_question = "Save and add next question";
1156
+ var save_and_exit$1 = "Save and exit";
1157
+ var question_text = "Question text";
1158
+ var title$1 = "Title";
1159
+ var create_question = "Create question";
1160
+ var parent_question = "Parent question";
1161
+ var edit_question = "Edit question";
1162
+ var easy = "Easy";
1163
+ var intermediate = "Intermediate";
1164
+ var difficult = "Difficult";
1165
+ var article = "Article";
1166
+ var correct_answer = "Correct answer";
1167
+ var mark = "Mark";
1168
+ var answer = "Answer";
1169
+ var add_new_row = "Add new row";
1170
+ var question_text_required = "Question text is required";
1171
+ var create_question_success = "Question is created successfully";
1172
+ var update_question_success = "Question is updated successfully";
1173
+ var number_of_answers = "Number of answers";
1174
+ var correct_answers = "Correct answers";
1175
+ var category$1 = "Category";
1176
+ var score = "Score";
1177
+ var enter_title$1 = "Enter title";
1178
+ var enter_score = "Enter score";
1179
+ var exam_title_required = "Exam title is required";
1180
+ var question_category_required = "Question category is required";
1181
+ var start_time = "Start time";
1182
+ var end_time = "End time";
1183
+ var enter_class_name = "Enter class name";
1184
+ var class_required = "Class name is required";
1185
+ var total_teachers = "Total teachers";
1186
+ var start_time_required = "Start time is required";
1187
+ var end_time_required = "End time is required";
1188
+ var full_name = "Full name";
1189
+ var email = "Email";
1190
+ var is_paid = "Is paid";
1191
+ var payment_time = "Payment time";
1192
+ var create_and_continue = "Create and continue";
1193
+ var payments = "Payments";
1194
+ var duration$1 = "Duration";
1195
+ var answer_count$1 = "Answer count";
1196
+ var question_count$1 = "Question count";
1197
+ var multi_choice = "Is multiple";
1198
+ var select_placeholder$1 = "Select...";
1199
+ var view_exam$1 = "View exam";
1200
+ var update_exam$1 = "Update exam";
1201
+ var create_exam$1 = "Create exam";
1202
+ var back$1 = "Back";
1091
1203
  var lang_en = {
1092
1204
  problem_solving: problem_solving$1,
1093
1205
  my_story: my_story$1,
@@ -1145,7 +1257,59 @@ var lang_en = {
1145
1257
  problem: problem$1,
1146
1258
  problem_solving_time: problem_solving_time$1,
1147
1259
  minutes: minutes$1,
1148
- correct_rate: correct_rate$1
1260
+ correct_rate: correct_rate$1,
1261
+ difficult_level: difficult_level,
1262
+ difficulty_explain: difficulty_explain,
1263
+ explain_your_answer: explain_your_answer,
1264
+ hint: hint,
1265
+ save_and_add_next_question: save_and_add_next_question,
1266
+ save_and_exit: save_and_exit$1,
1267
+ question_text: question_text,
1268
+ title: title$1,
1269
+ create_question: create_question,
1270
+ parent_question: parent_question,
1271
+ edit_question: edit_question,
1272
+ easy: easy,
1273
+ intermediate: intermediate,
1274
+ difficult: difficult,
1275
+ article: article,
1276
+ correct_answer: correct_answer,
1277
+ mark: mark,
1278
+ answer: answer,
1279
+ add_new_row: add_new_row,
1280
+ question_text_required: question_text_required,
1281
+ create_question_success: create_question_success,
1282
+ update_question_success: update_question_success,
1283
+ number_of_answers: number_of_answers,
1284
+ correct_answers: correct_answers,
1285
+ category: category$1,
1286
+ score: score,
1287
+ enter_title: enter_title$1,
1288
+ enter_score: enter_score,
1289
+ exam_title_required: exam_title_required,
1290
+ question_category_required: question_category_required,
1291
+ start_time: start_time,
1292
+ end_time: end_time,
1293
+ enter_class_name: enter_class_name,
1294
+ class_required: class_required,
1295
+ total_teachers: total_teachers,
1296
+ start_time_required: start_time_required,
1297
+ end_time_required: end_time_required,
1298
+ full_name: full_name,
1299
+ email: email,
1300
+ is_paid: is_paid,
1301
+ payment_time: payment_time,
1302
+ create_and_continue: create_and_continue,
1303
+ payments: payments,
1304
+ duration: duration$1,
1305
+ answer_count: answer_count$1,
1306
+ question_count: question_count$1,
1307
+ multi_choice: multi_choice,
1308
+ select_placeholder: select_placeholder$1,
1309
+ view_exam: view_exam$1,
1310
+ update_exam: update_exam$1,
1311
+ create_exam: create_exam$1,
1312
+ back: back$1
1149
1313
  };
1150
1314
 
1151
1315
  i18n.use(reactI18next.initReactI18next).init({
@@ -1184,7 +1348,7 @@ var SUPPORTED_LANGUAGES_CODE = LANGUAGES.map(function (i) {
1184
1348
  return i.code;
1185
1349
  });
1186
1350
 
1187
- var TheLanguageDropdown = function TheLanguageDropdown() {
1351
+ var useLanguage = function useLanguage() {
1188
1352
  var defaultLanguage = !!localStorage.getItem("language") ? localStorage.getItem("language") : navigator.language || DEFAULT_LANGUAGE_CODE;
1189
1353
  var dispatch = reactRedux.useDispatch();
1190
1354
  var _useTranslation = reactI18next.useTranslation(),
@@ -1207,19 +1371,32 @@ var TheLanguageDropdown = function TheLanguageDropdown() {
1207
1371
  setItemLanguage(lang);
1208
1372
  dispatch(setLanguage(lang));
1209
1373
  };
1374
+ React.useEffect(function () {
1375
+ changeLanguageApp(language);
1376
+ }, [language]);
1210
1377
  var currentLanguage = React.useMemo(function () {
1211
1378
  var currentLang = LANGUAGES.find(function (i) {
1212
1379
  return i.code === language;
1213
1380
  });
1214
1381
  if (!currentLang) return null;
1215
- return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
1216
- className: "mr-2 " + styles['dropdown-menu-flag'],
1217
- src: currentLang.image
1218
- }), " ", currentLang.shortName);
1219
- }, [language]);
1220
- React.useEffect(function () {
1221
- changeLanguageApp(language);
1382
+ return currentLang;
1222
1383
  }, [language]);
1384
+ return {
1385
+ language: language,
1386
+ dropdownOpen: dropdownOpen,
1387
+ currentLanguage: currentLanguage,
1388
+ toggle: toggle,
1389
+ setItemLanguage: setItemLanguage
1390
+ };
1391
+ };
1392
+
1393
+ var TheLanguageDropdown = function TheLanguageDropdown() {
1394
+ var _useLanguage = useLanguage(),
1395
+ currentLanguage = _useLanguage.currentLanguage,
1396
+ language = _useLanguage.language,
1397
+ dropdownOpen = _useLanguage.dropdownOpen,
1398
+ toggle = _useLanguage.toggle,
1399
+ setItemLanguage = _useLanguage.setItemLanguage;
1223
1400
  return React__default.createElement(reactstrap.Dropdown, {
1224
1401
  isOpen: dropdownOpen,
1225
1402
  toggle: toggle,
@@ -1233,7 +1410,10 @@ var TheLanguageDropdown = function TheLanguageDropdown() {
1233
1410
  display: 'flex',
1234
1411
  alignItems: 'center'
1235
1412
  }
1236
- }, currentLanguage, React__default.createElement(io5.IoChevronDown, {
1413
+ }, !!currentLanguage && React__default.createElement("img", {
1414
+ className: "mr-2 " + styles['dropdown-menu-flag'],
1415
+ src: currentLanguage.image
1416
+ }), !!currentLanguage && currentLanguage.shortName, React__default.createElement(io5.IoChevronDown, {
1237
1417
  className: "ml-2",
1238
1418
  style: {
1239
1419
  fontSize: '15px',
@@ -1317,14 +1497,54 @@ function _objectWithoutPropertiesLoose(source, excluded) {
1317
1497
  return target;
1318
1498
  }
1319
1499
 
1320
- var _excluded = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1500
+ var _excluded = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1501
+ var DropdownIndicator = function DropdownIndicator(props) {
1502
+ return React__default.createElement(Select.components.DropdownIndicator, Object.assign({}, props), React__default.createElement(fa.FaCaretDown, {
1503
+ color: "#5458D5"
1504
+ }));
1505
+ };
1506
+ var CustomOption = function CustomOption(props) {
1507
+ return React__default.createElement(Select.components.Option, Object.assign({}, props), React__default.createElement("div", {
1508
+ style: {
1509
+ fontSize: "14px",
1510
+ fontWeight: 500
1511
+ }
1512
+ }, props.data.label));
1513
+ };
1514
+ var customStyles = {
1515
+ control: function control(baseStyles, state) {
1516
+ return _extends({}, baseStyles, {
1517
+ fontSize: "14px",
1518
+ fontWeight: 700,
1519
+ color: "#5458D5",
1520
+ borderColor: state.isFocused ? '#5458D5' : '#C3C5FE'
1521
+ });
1522
+ },
1523
+ input: function input(baseStyles, _) {
1524
+ return _extends({}, baseStyles, {
1525
+ fontSize: "14px",
1526
+ fontWeight: 700,
1527
+ color: "#5458D5"
1528
+ });
1529
+ },
1530
+ singleValue: function singleValue(baseStyles) {
1531
+ return _extends({}, baseStyles, {
1532
+ fontSize: "14px",
1533
+ fontWeight: 700,
1534
+ color: "#5458D5"
1535
+ });
1536
+ }
1537
+ };
1321
1538
  var CustomSelect = function CustomSelect(_ref) {
1322
- var options = _ref.options,
1539
+ var isDefault = _ref.isDefault,
1540
+ options = _ref.options,
1323
1541
  isDisabled = _ref.isDisabled,
1324
1542
  scrollBottom = _ref.scrollBottom,
1325
1543
  value = _ref.value,
1326
1544
  isMulti = _ref.isMulti,
1327
1545
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1546
+ var _useTranslation = reactI18next.useTranslation(),
1547
+ t = _useTranslation.t;
1328
1548
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1329
1549
  return value.includes(i.value);
1330
1550
  }) : isMulti ? options.filter(function (i) {
@@ -1332,12 +1552,22 @@ var CustomSelect = function CustomSelect(_ref) {
1332
1552
  }) : options.find(function (i) {
1333
1553
  return i.value == value;
1334
1554
  });
1335
- return React__default.createElement(Select, Object.assign({
1555
+ return React__default.createElement(Select__default, Object.assign({
1336
1556
  isDisabled: isDisabled,
1337
1557
  options: options,
1338
- value: initialValues,
1558
+ value: !isDefault ? initialValues != null ? initialValues : null : undefined,
1559
+ defaultValue: isDefault ? initialValues : undefined,
1339
1560
  menuPlacement: scrollBottom ? "top" : "auto",
1340
- isMulti: isMulti
1561
+ isMulti: isMulti,
1562
+ components: {
1563
+ IndicatorSeparator: function IndicatorSeparator() {
1564
+ return null;
1565
+ },
1566
+ DropdownIndicator: DropdownIndicator,
1567
+ Option: CustomOption
1568
+ },
1569
+ styles: customStyles,
1570
+ placeholder: t("select_placeholder")
1341
1571
  }, rest));
1342
1572
  };
1343
1573
 
@@ -1688,6 +1918,7 @@ var ChatHeader = function ChatHeader(_ref) {
1688
1918
  var name = _ref.name,
1689
1919
  avatar = _ref.avatar,
1690
1920
  options = _ref.options,
1921
+ selectedOption = _ref.selectedOption,
1691
1922
  onChangeOption = _ref.onChangeOption;
1692
1923
  var wrapperRef = React.useRef(null);
1693
1924
  var actionRef = React.useRef(null);
@@ -1726,6 +1957,7 @@ var ChatHeader = function ChatHeader(_ref) {
1726
1957
  }, selectOptions !== undefined && React__default.createElement("div", {
1727
1958
  className: styles$1["header__select"] + " mx-3"
1728
1959
  }, React__default.createElement(CustomSelect, {
1960
+ value: selectedOption,
1729
1961
  options: selectOptions,
1730
1962
  onChange: handleChangeOption,
1731
1963
  isClearable: true
@@ -1843,7 +2075,7 @@ var ChatContainer = function ChatContainer(_ref) {
1843
2075
  onAddExamMessage: handleAddExamMessage
1844
2076
  }))), React__default.createElement("div", null, React__default.createElement(InputChat, Object.assign({}, inputProps, {
1845
2077
  inputRef: inputRef
1846
- }))), React__default.createElement(reactToastify.ToastContainer, null));
2078
+ }))));
1847
2079
  };
1848
2080
 
1849
2081
  var CONVERSATION_URL = BASE_URL + "/api/conversation";
@@ -1960,13 +2192,14 @@ var useMessageList = function useMessageList(userId, getListExamOptions) {
1960
2192
  examId: !examId ? messageFilter.examId : examId
1961
2193
  });
1962
2194
  return Promise.resolve(getMessagesByConversation(conversationId, filter)).then(function (res) {
2195
+ var _res$data$items2;
1963
2196
  function _temp(_getListExamOptions) {
1964
2197
  _getListExamOptions;
1965
2198
  }
1966
- setMessages(function (state) {
2199
+ if (messageFilter.beforeDate) setMessages(function (state) {
1967
2200
  var _res$data$items;
1968
2201
  return [].concat(((_res$data$items = res.data.items) === null || _res$data$items === void 0 ? void 0 : _res$data$items.reverse()) || [], state);
1969
- });
2202
+ });else setMessages((_res$data$items2 = res.data.items) === null || _res$data$items2 === void 0 ? void 0 : _res$data$items2.reverse());
1970
2203
  return getListExamOptions ? Promise.resolve(!!getListExamOptions && getListExamOptions(userId)).then(_temp) : _temp(!!getListExamOptions && getListExamOptions(userId));
1971
2204
  });
1972
2205
  }, function (error) {
@@ -2398,6 +2631,7 @@ var useChatContainer = function useChatContainer(props) {
2398
2631
  name: userName,
2399
2632
  avatar: userAvatar,
2400
2633
  options: exams,
2634
+ selectedOption: messageFilter.examId,
2401
2635
  onChangeOption: handleFilterExam
2402
2636
  },
2403
2637
  chatListProps: {
@@ -2563,9 +2797,12 @@ var useConversationList = function useConversationList() {
2563
2797
  return i.id === lastMessage.conversationId;
2564
2798
  });
2565
2799
  if (updateIndex < 0) return state;
2566
- return [].concat(state.slice(0, updateIndex), [_extends({}, state[updateIndex], {
2800
+ console.log({
2567
2801
  lastMessage: lastMessage
2568
- })], state.slice(updateIndex + 1));
2802
+ });
2803
+ return [_extends({}, state[updateIndex], {
2804
+ lastMessage: lastMessage
2805
+ })].concat(state.slice(0, updateIndex), state.slice(updateIndex + 1));
2569
2806
  });
2570
2807
  };
2571
2808
  var handleCreateConversationSuccess = function handleCreateConversationSuccess(id) {
@@ -2654,8 +2891,538 @@ var usePusherConversation = function usePusherConversation(onNewMessageConversat
2654
2891
  return {};
2655
2892
  };
2656
2893
 
2894
+ var _excluded$1 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2895
+ var CustomCreatable = function CustomCreatable(_ref) {
2896
+ var options = _ref.options,
2897
+ isDisabled = _ref.isDisabled,
2898
+ scrollBottom = _ref.scrollBottom,
2899
+ value = _ref.value,
2900
+ isMulti = _ref.isMulti,
2901
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2902
+ var initialValues = Array.isArray(value) ? options.filter(function (i) {
2903
+ return value.includes(i.value);
2904
+ }) : isMulti ? options.filter(function (i) {
2905
+ return i.value == value;
2906
+ }) : options.find(function (i) {
2907
+ return i.value == value;
2908
+ });
2909
+ return React__default.createElement(CreatableSelect, Object.assign({
2910
+ isClearable: true,
2911
+ isDisabled: isDisabled,
2912
+ options: options,
2913
+ value: initialValues,
2914
+ menuPlacement: scrollBottom ? "top" : "auto",
2915
+ isMulti: isMulti
2916
+ }, rest));
2917
+ };
2918
+
2919
+ var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2920
+ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
2921
+ var isDefault = _ref.isDefault,
2922
+ options = _ref.options,
2923
+ isDisabled = _ref.isDisabled,
2924
+ scrollBottom = _ref.scrollBottom,
2925
+ value = _ref.value,
2926
+ isMulti = _ref.isMulti,
2927
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2928
+ var initialValues = Array.isArray(value) ? options.filter(function (i) {
2929
+ return value.includes(i.value);
2930
+ }) : isMulti ? options.filter(function (i) {
2931
+ return i.value == value;
2932
+ }) : options.find(function (i) {
2933
+ return i.value == value;
2934
+ });
2935
+ return React__default.createElement(Select__default, Object.assign({
2936
+ isDisabled: isDisabled,
2937
+ options: options,
2938
+ value: !isDefault ? initialValues : undefined,
2939
+ defaultValue: isDefault ? initialValues : undefined,
2940
+ menuPlacement: scrollBottom ? "top" : "auto",
2941
+ isMulti: isMulti
2942
+ }, rest));
2943
+ };
2944
+
2945
+ var styles$2 = {"question":"_2uc_W","question-article":"_2p7kY","question-title":"_2tHmc","question--active":"_3IHYm","question-label":"_26ATj","question-input":"_3R8PR","question-btn":"_1VZac"};
2946
+
2947
+ var DURATION_OPTIONS = Array.from({
2948
+ length: 120
2949
+ }, function (_, i) {
2950
+ return i + 1;
2951
+ });
2952
+ var SCORE_OPTIONS = Array.from({
2953
+ length: 10
2954
+ }, function (_, i) {
2955
+ return i + 1;
2956
+ });
2957
+ var QUESTION_OPTIONS = Array.from({
2958
+ length: 40
2959
+ }, function (_, i) {
2960
+ return i + 1;
2961
+ });
2962
+ var ANSWER_OPTIONS = Array.from({
2963
+ length: 9
2964
+ }, function (_, i) {
2965
+ return i + 2;
2966
+ });
2967
+ var DEFAULT_SCORE = 2;
2968
+ var DEFAULT_ANSWER_COUNT = 5;
2969
+
2970
+ var QuestionView = function QuestionView(_ref) {
2971
+ var index = _ref.index,
2972
+ question = _ref.question,
2973
+ answerCount = _ref.answerCount,
2974
+ isDisabled = _ref.isDisabled,
2975
+ onChangeCorrectAnswers = _ref.onChangeCorrectAnswers,
2976
+ onChangeScoreAnswer = _ref.onChangeScoreAnswer;
2977
+ var scoreOptions = SCORE_OPTIONS.map(function (i) {
2978
+ return {
2979
+ label: DEFAULT_SCORE === i ? i + "\uC810 (\uAE30\uBCF8\uAC12)" : i + "\uC810",
2980
+ value: i
2981
+ };
2982
+ });
2983
+ return React__default.createElement("div", {
2984
+ className: "d-flex justify-content-between"
2985
+ }, React__default.createElement("div", {
2986
+ className: "d-flex flex-grow-1"
2987
+ }, React__default.createElement("div", {
2988
+ className: styles$2["question-title"] + " me-2"
2989
+ }, "\uBB38\uC81C ", question.questionOrder + 1, "\uBC88"), React__default.createElement("div", {
2990
+ className: "d-flex flex-grow-1"
2991
+ }, Array.from({
2992
+ length: answerCount
2993
+ }, function (_, i) {
2994
+ return i + 1;
2995
+ }).map(function (i) {
2996
+ return React__default.createElement(reactstrap.FormGroup, {
2997
+ className: "d-flex flex-column px-4"
2998
+ }, React__default.createElement(reactstrap.Label, {
2999
+ htmlFor: "answer-" + i,
3000
+ className: "" + styles$2["question-label"]
3001
+ }, i, "\uBC88"), React__default.createElement(reactstrap.Input, {
3002
+ id: "answer-" + i,
3003
+ type: "radio",
3004
+ checked: question.correctAnswers.includes(i),
3005
+ onClick: function onClick() {
3006
+ return onChangeCorrectAnswers(i, index);
3007
+ },
3008
+ disabled: isDisabled
3009
+ }));
3010
+ }))), React__default.createElement("div", {
3011
+ className: "d-flex align-items-center"
3012
+ }, React__default.createElement(reactstrap.FormGroup, {
3013
+ className: "mx-3",
3014
+ style: {
3015
+ width: "140px"
3016
+ }
3017
+ }, React__default.createElement(CustomSelect, {
3018
+ value: question.score,
3019
+ options: scoreOptions,
3020
+ onChange: function onChange(value) {
3021
+ return onChangeScoreAnswer(value.value, index);
3022
+ },
3023
+ isDisabled: isDisabled
3024
+ }))));
3025
+ };
3026
+
3027
+ var ArticleGroupView = function ArticleGroupView(_ref) {
3028
+ var categoryOptions = _ref.categoryOptions,
3029
+ article = _ref.article,
3030
+ questions = _ref.questions,
3031
+ answerCount = _ref.answerCount,
3032
+ questionCount = _ref.questionCount,
3033
+ categoryId = _ref.categoryId,
3034
+ isActive = _ref.isActive,
3035
+ isDisabled = _ref.isDisabled,
3036
+ onChangeQuestionCount = _ref.onChangeQuestionCount,
3037
+ onChangeCategory = _ref.onChangeCategory,
3038
+ onChangeAnswerCount = _ref.onChangeAnswerCount,
3039
+ onChangeCorrectAnswers = _ref.onChangeCorrectAnswers,
3040
+ onChangeScoreAnswer = _ref.onChangeScoreAnswer;
3041
+ var _useTranslation = reactI18next.useTranslation(),
3042
+ t = _useTranslation.t;
3043
+ var handleChangeQuestionCount = function handleChangeQuestionCount(value) {
3044
+ onChangeQuestionCount(article, value === null || value === void 0 ? void 0 : value.value, answerCount);
3045
+ };
3046
+ var handleChangeCategory = function handleChangeCategory(value) {
3047
+ onChangeCategory(article, value === null || value === void 0 ? void 0 : value.value);
3048
+ };
3049
+ var handleChangeAnswerCount = function handleChangeAnswerCount(value) {
3050
+ onChangeAnswerCount(article, value === null || value === void 0 ? void 0 : value.value, answerCount);
3051
+ };
3052
+ var handleChangeCorrectAnswers = function handleChangeCorrectAnswers(value, index) {
3053
+ onChangeCorrectAnswers(article, index, value);
3054
+ };
3055
+ var handleChangeScoreAnswer = function handleChangeScoreAnswer(value, index) {
3056
+ onChangeScoreAnswer(article, index, value);
3057
+ };
3058
+ var questionOptions = QUESTION_OPTIONS.map(function (i) {
3059
+ return {
3060
+ label: i + "\uAC1C",
3061
+ value: i
3062
+ };
3063
+ });
3064
+ var answerOptions = ANSWER_OPTIONS.map(function (i) {
3065
+ return {
3066
+ label: i + "\uBC88",
3067
+ value: i
3068
+ };
3069
+ });
3070
+ return React__default.createElement("div", {
3071
+ className: "d-flex " + styles$2["question"] + " " + (isActive ? styles$2["question--active"] : "")
3072
+ }, React__default.createElement("div", {
3073
+ className: "py-1"
3074
+ }, React__default.createElement(pi.PiDotsNineLight, {
3075
+ size: 18
3076
+ })), React__default.createElement("div", {
3077
+ className: "px-4"
3078
+ }, React__default.createElement(reactstrap.Row, null, React__default.createElement(reactstrap.Col, {
3079
+ xs: 12
3080
+ }, React__default.createElement("p", {
3081
+ className: "mb-0 " + styles$2["question-article"]
3082
+ }, "\uBB38\uD56D"), React__default.createElement("p", {
3083
+ className: "text-center " + styles$2["question-article"]
3084
+ }, article)))), React__default.createElement("div", {
3085
+ className: "flex-grow-1"
3086
+ }, React__default.createElement(reactstrap.Row, null, React__default.createElement(reactstrap.Col, {
3087
+ xs: 3
3088
+ }, React__default.createElement(reactstrap.FormGroup, null, React__default.createElement(reactstrap.Label, {
3089
+ htmlFor: "question_count",
3090
+ className: "" + styles$2["question-label"]
3091
+ }, t("question_count")), React__default.createElement(CustomSelect, {
3092
+ inputId: "question_count",
3093
+ value: questionCount,
3094
+ options: questionOptions,
3095
+ onChange: handleChangeQuestionCount,
3096
+ isDisabled: isDisabled
3097
+ }))), React__default.createElement(reactstrap.Col, {
3098
+ xs: 3
3099
+ }, React__default.createElement(reactstrap.FormGroup, null, React__default.createElement(reactstrap.Label, {
3100
+ htmlFor: "category",
3101
+ className: "" + styles$2["question-label"]
3102
+ }, t("category")), React__default.createElement(CustomSelect, {
3103
+ inputId: "category",
3104
+ value: categoryId,
3105
+ options: categoryOptions,
3106
+ onChange: handleChangeCategory,
3107
+ isDisabled: isDisabled
3108
+ }))), React__default.createElement(reactstrap.Col, {
3109
+ xs: 3
3110
+ }, React__default.createElement(reactstrap.FormGroup, null, React__default.createElement(reactstrap.Label, {
3111
+ htmlFor: "answer_count",
3112
+ className: "" + styles$2["question-label"]
3113
+ }, t("answer_count")), React__default.createElement(CustomSelect, {
3114
+ inputId: "answer_count",
3115
+ value: answerCount,
3116
+ options: answerOptions,
3117
+ onChange: handleChangeAnswerCount,
3118
+ isDisabled: isDisabled
3119
+ }))), React__default.createElement(reactstrap.Col, {
3120
+ xs: 3
3121
+ })), React__default.createElement("div", null, questions.map(function (q, index) {
3122
+ return React__default.createElement(QuestionView, {
3123
+ key: index,
3124
+ question: q,
3125
+ answerCount: answerCount,
3126
+ index: index,
3127
+ onChangeCorrectAnswers: handleChangeCorrectAnswers,
3128
+ onChangeScoreAnswer: handleChangeScoreAnswer,
3129
+ isDisabled: isDisabled
3130
+ });
3131
+ }))));
3132
+ };
3133
+
3134
+ var useExamDetailView = function useExamDetailView(props) {
3135
+ var exam = props.exam,
3136
+ onChangeExam = props.onChangeExam;
3137
+ var _useTranslation = reactI18next.useTranslation(),
3138
+ t = _useTranslation.t;
3139
+ var handleChangeQuestionCount = function handleChangeQuestionCount(article, questionCount, answerCount) {
3140
+ if (!exam) return;
3141
+ var examQuestions = exam.questions;
3142
+ var questions = examQuestions.filter(function (i) {
3143
+ return i.article === +article;
3144
+ });
3145
+ var prevQuestions = examQuestions.filter(function (i) {
3146
+ return i.article < +article;
3147
+ });
3148
+ var nextQuestions = examQuestions.filter(function (i) {
3149
+ return i.article > +article;
3150
+ });
3151
+ var lastOrder = questions[questions.length - 1].questionOrder;
3152
+ if (questions.length === questionCount) return;
3153
+ if (questions.length < questionCount) {
3154
+ var additionalQuestions = Array.from({
3155
+ length: questionCount - questions.length
3156
+ }).map(function (_, index) {
3157
+ var _questions$;
3158
+ return {
3159
+ article: +article,
3160
+ correctAnswers: [1],
3161
+ numberOfAnswers: answerCount,
3162
+ categoryId: (_questions$ = questions[0]) === null || _questions$ === void 0 ? void 0 : _questions$.categoryId,
3163
+ score: DEFAULT_SCORE,
3164
+ questionOrder: lastOrder + index + 1
3165
+ };
3166
+ });
3167
+ var newQuestions = [].concat(prevQuestions, questions, additionalQuestions, nextQuestions.map(function (i) {
3168
+ return _extends({}, i, {
3169
+ questionOrder: i.questionOrder + questionCount - questions.length
3170
+ });
3171
+ }));
3172
+ onChangeExam(_extends({}, exam, {
3173
+ questions: [].concat(newQuestions)
3174
+ }));
3175
+ } else {
3176
+ var remainQuestions = questions.slice(0, questionCount);
3177
+ var _newQuestions = [].concat(prevQuestions, remainQuestions, nextQuestions.map(function (i) {
3178
+ return _extends({}, i, {
3179
+ questionOrder: i.questionOrder - questions.length + questionCount
3180
+ });
3181
+ }));
3182
+ onChangeExam(_extends({}, exam, {
3183
+ questions: [].concat(_newQuestions)
3184
+ }));
3185
+ }
3186
+ };
3187
+ var handleChangeCategory = function handleChangeCategory(article, categoryId) {
3188
+ if (!exam) return;
3189
+ var examQuestions = exam.questions;
3190
+ var questions = examQuestions.filter(function (i) {
3191
+ return i.article === +article;
3192
+ });
3193
+ var otherQuestions = examQuestions.filter(function (i) {
3194
+ return i.article !== +article;
3195
+ });
3196
+ onChangeExam(_extends({}, exam, {
3197
+ questions: [].concat(otherQuestions, questions.map(function (q) {
3198
+ return _extends({}, q, {
3199
+ categoryId: categoryId
3200
+ });
3201
+ }))
3202
+ }));
3203
+ };
3204
+ var handleChangeAnswerCount = function handleChangeAnswerCount(article, newAnswerCount, answerCount) {
3205
+ if (!exam) return;
3206
+ if (newAnswerCount === answerCount) return;
3207
+ var examQuestions = exam.questions;
3208
+ var questions = examQuestions.filter(function (i) {
3209
+ return i.article === +article;
3210
+ });
3211
+ var otherQuestions = examQuestions.filter(function (i) {
3212
+ return i.article !== +article;
3213
+ });
3214
+ if (answerCount < newAnswerCount) {
3215
+ onChangeExam(_extends({}, exam, {
3216
+ questions: [].concat(otherQuestions, questions.map(function (q) {
3217
+ return _extends({}, q, {
3218
+ numberOfAnswers: newAnswerCount
3219
+ });
3220
+ }))
3221
+ }));
3222
+ } else {
3223
+ onChangeExam(_extends({}, exam, {
3224
+ questions: [].concat(otherQuestions, questions.map(function (q) {
3225
+ return _extends({}, q, {
3226
+ numberOfAnswers: newAnswerCount,
3227
+ correctAnswers: q.correctAnswers.filter(function (i) {
3228
+ return i <= newAnswerCount;
3229
+ })
3230
+ });
3231
+ }))
3232
+ }));
3233
+ }
3234
+ };
3235
+ var handleChangeCorrectAnswers = function handleChangeCorrectAnswers(article, index, answer) {
3236
+ if (!exam) return;
3237
+ var examQuestions = exam.questions;
3238
+ var questions = examQuestions.filter(function (i) {
3239
+ return i.article === +article;
3240
+ });
3241
+ var otherQuestions = examQuestions.filter(function (i) {
3242
+ return i.article !== +article;
3243
+ });
3244
+ var selectedQuestion = questions[index];
3245
+ onChangeExam(_extends({}, exam, {
3246
+ questions: [].concat(otherQuestions, questions.slice(0, index), [_extends({}, selectedQuestion, {
3247
+ correctAnswers: [answer]
3248
+ })], questions.slice(index + 1))
3249
+ }));
3250
+ };
3251
+ var handleChangeScoreAnswer = function handleChangeScoreAnswer(article, index, score) {
3252
+ if (!exam) return;
3253
+ var examQuestions = exam.questions;
3254
+ var questions = examQuestions.filter(function (i) {
3255
+ return i.article === +article;
3256
+ });
3257
+ var otherQuestions = examQuestions.filter(function (i) {
3258
+ return i.article !== +article;
3259
+ });
3260
+ var selectedQuestion = questions[index];
3261
+ if (score === selectedQuestion.score) return;
3262
+ onChangeExam(_extends({}, exam, {
3263
+ questions: [].concat(otherQuestions, questions.slice(0, index), [_extends({}, selectedQuestion, {
3264
+ score: score
3265
+ })], questions.slice(index + 1))
3266
+ }));
3267
+ };
3268
+ var handleChangeDuration = function handleChangeDuration(value) {
3269
+ if (!exam) return;
3270
+ onChangeExam(_extends({}, exam, {
3271
+ duration: value === null || value === void 0 ? void 0 : value.value
3272
+ }));
3273
+ };
3274
+ var handleChangeTitle = function handleChangeTitle(e) {
3275
+ if (!exam) return;
3276
+ onChangeExam(_extends({}, exam, {
3277
+ title: e.target.value
3278
+ }));
3279
+ };
3280
+ var handleAddArticle = function handleAddArticle() {
3281
+ var _$maxBy, _$maxBy2;
3282
+ if (!exam) return;
3283
+ var maxArticle = ((_$maxBy = _.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
3284
+ var maxOrder = ((_$maxBy2 = _.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
3285
+ onChangeExam(_extends({}, exam, {
3286
+ questions: [].concat(exam.questions, [{
3287
+ article: maxArticle + 1,
3288
+ correctAnswers: [1],
3289
+ numberOfAnswers: DEFAULT_ANSWER_COUNT,
3290
+ score: DEFAULT_SCORE,
3291
+ questionOrder: maxOrder + 1
3292
+ }])
3293
+ }));
3294
+ };
3295
+ var examGroupByArticle = React.useMemo(function () {
3296
+ if (!exam) return [];
3297
+ var articles = [];
3298
+ var groupedArticle = _.groupBy(exam.questions, "article");
3299
+ for (var key in groupedArticle) {
3300
+ if (Object.prototype.hasOwnProperty.call(groupedArticle, key)) {
3301
+ var _questions$find, _$maxBy3;
3302
+ var questions = groupedArticle[key];
3303
+ articles.push({
3304
+ article: +key,
3305
+ categoryId: (_questions$find = questions.find(function (i) {
3306
+ return !!i.categoryId;
3307
+ })) === null || _questions$find === void 0 ? void 0 : _questions$find.categoryId,
3308
+ answerCount: ((_$maxBy3 = _.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
3309
+ questionCount: questions.length,
3310
+ questions: questions
3311
+ });
3312
+ }
3313
+ }
3314
+ return _.sortBy(articles, "article");
3315
+ }, [JSON.stringify(exam)]);
3316
+ var durationOptions = React.useMemo(function () {
3317
+ var options = DURATION_OPTIONS.map(function (i) {
3318
+ return {
3319
+ label: i + "\uBD84",
3320
+ value: i
3321
+ };
3322
+ });
3323
+ if (!!exam.duration && exam.duration > DURATION_OPTIONS[DURATION_OPTIONS.length - 1]) return [].concat(options, [{
3324
+ label: exam.duration + "\uBD84",
3325
+ value: exam.duration
3326
+ }]);
3327
+ return options;
3328
+ }, [exam.duration]);
3329
+ return {
3330
+ t: t,
3331
+ durationOptions: durationOptions,
3332
+ examGroupByArticle: examGroupByArticle,
3333
+ handleAddArticle: handleAddArticle,
3334
+ handleChangeScoreAnswer: handleChangeScoreAnswer,
3335
+ handleChangeTitle: handleChangeTitle,
3336
+ handleChangeDuration: handleChangeDuration,
3337
+ handleChangeCorrectAnswers: handleChangeCorrectAnswers,
3338
+ handleChangeAnswerCount: handleChangeAnswerCount,
3339
+ handleChangeQuestionCount: handleChangeQuestionCount,
3340
+ handleChangeCategory: handleChangeCategory
3341
+ };
3342
+ };
3343
+
3344
+ var ExamDetailView = function ExamDetailView(_ref) {
3345
+ var _ref$className = _ref.className,
3346
+ className = _ref$className === void 0 ? "" : _ref$className,
3347
+ categoryOptions = _ref.categoryOptions,
3348
+ exam = _ref.exam,
3349
+ _ref$isUsingMui = _ref.isUsingMui,
3350
+ isUsingMui = _ref$isUsingMui === void 0 ? true : _ref$isUsingMui,
3351
+ isDisabled = _ref.isDisabled,
3352
+ onChangeExam = _ref.onChangeExam;
3353
+ var _useExamDetailView = useExamDetailView({
3354
+ exam: exam,
3355
+ onChangeExam: onChangeExam
3356
+ }),
3357
+ t = _useExamDetailView.t,
3358
+ durationOptions = _useExamDetailView.durationOptions,
3359
+ examGroupByArticle = _useExamDetailView.examGroupByArticle,
3360
+ handleAddArticle = _useExamDetailView.handleAddArticle,
3361
+ handleChangeScoreAnswer = _useExamDetailView.handleChangeScoreAnswer,
3362
+ handleChangeTitle = _useExamDetailView.handleChangeTitle,
3363
+ handleChangeDuration = _useExamDetailView.handleChangeDuration,
3364
+ handleChangeCorrectAnswers = _useExamDetailView.handleChangeCorrectAnswers,
3365
+ handleChangeAnswerCount = _useExamDetailView.handleChangeAnswerCount,
3366
+ handleChangeQuestionCount = _useExamDetailView.handleChangeQuestionCount,
3367
+ handleChangeCategory = _useExamDetailView.handleChangeCategory;
3368
+ return React__default.createElement(reactstrap.Row, {
3369
+ className: "" + className
3370
+ }, React__default.createElement(reactstrap.Col, {
3371
+ xs: 5
3372
+ }, React__default.createElement(reactstrap.FormGroup, null, React__default.createElement(reactstrap.Label, {
3373
+ className: "" + styles$2["question-label"],
3374
+ htmlFor: "title"
3375
+ }, t("title")), React__default.createElement(reactstrap.Input, {
3376
+ disabled: isDisabled,
3377
+ className: "w-100 rounded-2 " + styles$2["question-input"],
3378
+ value: exam.title,
3379
+ id: "title",
3380
+ placeholder: t("enter_title"),
3381
+ onChange: handleChangeTitle
3382
+ }))), React__default.createElement(reactstrap.Col, {
3383
+ xs: 3
3384
+ }, React__default.createElement(reactstrap.FormGroup, null, React__default.createElement(reactstrap.Label, {
3385
+ className: "" + styles$2["question-label"],
3386
+ htmlFor: "duration"
3387
+ }, t("duration")), React__default.createElement(CustomSelect, {
3388
+ inputId: "duration",
3389
+ value: exam.duration,
3390
+ options: durationOptions,
3391
+ onChange: handleChangeDuration,
3392
+ isDisabled: isDisabled
3393
+ }))), React__default.createElement(reactstrap.Col, {
3394
+ xs: 4
3395
+ }), examGroupByArticle.map(function (i, index) {
3396
+ return React__default.createElement(reactstrap.Col, {
3397
+ xs: 12,
3398
+ key: i.article,
3399
+ className: (index === 0 && !isUsingMui ? "mt-3" : "") + " " + (!isUsingMui ? "mb-4" : "")
3400
+ }, React__default.createElement(ArticleGroupView, Object.assign({}, i, {
3401
+ categoryOptions: categoryOptions,
3402
+ isActive: index === examGroupByArticle.length - 1,
3403
+ onChangeQuestionCount: handleChangeQuestionCount,
3404
+ onChangeCategory: handleChangeCategory,
3405
+ onChangeAnswerCount: handleChangeAnswerCount,
3406
+ onChangeCorrectAnswers: handleChangeCorrectAnswers,
3407
+ onChangeScoreAnswer: handleChangeScoreAnswer,
3408
+ isDisabled: isDisabled
3409
+ })));
3410
+ }), React__default.createElement(reactstrap.Col, {
3411
+ xs: 12
3412
+ }, React__default.createElement(reactstrap.Button, {
3413
+ disabled: isDisabled,
3414
+ className: "w-100 d-flex justify-content-center align-items-center " + styles$2["question-btn"],
3415
+ color: "primary",
3416
+ outline: true,
3417
+ onClick: handleAddArticle
3418
+ }, React__default.createElement(fa.FaPlusCircle, {
3419
+ className: "me-2"
3420
+ }), "\uBB38\uD56D \uCD94\uAC00\uD558\uAE30")));
3421
+ };
3422
+
2657
3423
  var historyCore = history.createBrowserHistory();
2658
3424
 
3425
+ exports.moment = moment;
2659
3426
  Object.defineProperty(exports, 'I18nextProvider', {
2660
3427
  enumerable: true,
2661
3428
  get: function () {
@@ -2668,17 +3435,33 @@ Object.defineProperty(exports, 'useTranslation', {
2668
3435
  return reactI18next.useTranslation;
2669
3436
  }
2670
3437
  });
3438
+ Object.defineProperty(exports, 'ToastContainer', {
3439
+ enumerable: true,
3440
+ get: function () {
3441
+ return reactToastify.ToastContainer;
3442
+ }
3443
+ });
3444
+ Object.defineProperty(exports, 'toast', {
3445
+ enumerable: true,
3446
+ get: function () {
3447
+ return reactToastify.toast;
3448
+ }
3449
+ });
2671
3450
  exports.ACCESS_TOKEN = ACCESS_TOKEN;
2672
3451
  exports.BASE_URL = BASE_URL;
2673
3452
  exports.ChatContainer = ChatContainer;
2674
3453
  exports.CommonAlert = CommonAlert;
2675
3454
  exports.CommonDialog = CommonDialog;
2676
3455
  exports.ConfirmDialog = ConfirmDialog;
3456
+ exports.CustomAsyncSelect = CustomAsyncSelect;
3457
+ exports.CustomCreatable = CustomCreatable;
2677
3458
  exports.CustomPagination = CustomPagination;
2678
3459
  exports.CustomSelect = CustomSelect;
2679
3460
  exports.DATE_MIN_VALUE = DATE_MIN_VALUE;
2680
3461
  exports.EXAM_CHANNEL = EXAM_CHANNEL;
2681
3462
  exports.EXAM_STUDENT_CHANNEL = EXAM_STUDENT_CHANNEL;
3463
+ exports.ExamDetailView = ExamDetailView;
3464
+ exports.LANGUAGES = LANGUAGES;
2682
3465
  exports.LayoutContext = LayoutContext;
2683
3466
  exports.Loading = Loading;
2684
3467
  exports.Login = Login;
@@ -2702,6 +3485,7 @@ exports.toISOString = toISOString;
2702
3485
  exports.useChatContainer = useChatContainer;
2703
3486
  exports.useConversationList = useConversationList;
2704
3487
  exports.useGoogleSignOut = useGoogleSignOut;
3488
+ exports.useLanguage = useLanguage;
2705
3489
  exports.usePusherConversation = usePusherConversation;
2706
3490
  exports.utcToLocalTime = utcToLocalTime;
2707
3491
  //# sourceMappingURL=index.js.map