touchstudy-core 0.1.99 → 0.1.100

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.
@@ -2962,6 +2962,12 @@ var notify_share_textbook = {
2962
2962
  update_success: "공유 교과서가 성공적으로 업데이트되었습니다!",
2963
2963
  update_fail: "업데이트 실패!"
2964
2964
  };
2965
+ var notify_share_exam = {
2966
+ share_success: "시험 공유 성공!",
2967
+ share_fail: "시험 또는 교사가 존재하지 않습니다!",
2968
+ update_success: "공유 시험을 성공적으로 업데이트했습니다!",
2969
+ update_fail: "업데이트 실패!"
2970
+ };
2965
2971
  var academyadminteacher = "아카데미 관리자/선생님";
2966
2972
  var total_student = "총 학생 수";
2967
2973
  var total_teacher = "총 교사 수";
@@ -2972,6 +2978,7 @@ var the_exam_code_you_are_looking_for_was_not_found = "찾고 있는 시험 코
2972
2978
  var view_user = "사용자 보기";
2973
2979
  var exam_code = "시험 코드";
2974
2980
  var version = "버전";
2981
+ var exam_sessions = "시험 세션";
2975
2982
  var lang_ko = {
2976
2983
  problem_solving: problem_solving,
2977
2984
  my_story: my_story,
@@ -3776,6 +3783,7 @@ var lang_ko = {
3776
3783
  authority: authority,
3777
3784
  share_textbook: share_textbook,
3778
3785
  notify_share_textbook: notify_share_textbook,
3786
+ notify_share_exam: notify_share_exam,
3779
3787
  academyadminteacher: academyadminteacher,
3780
3788
  total_student: total_student,
3781
3789
  total_teacher: total_teacher,
@@ -3785,7 +3793,8 @@ var lang_ko = {
3785
3793
  the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found,
3786
3794
  view_user: view_user,
3787
3795
  exam_code: exam_code,
3788
- version: version
3796
+ version: version,
3797
+ exam_sessions: exam_sessions
3789
3798
  };
3790
3799
 
3791
3800
  var problem_solving$1 = "Problem Solving";
@@ -4605,6 +4614,12 @@ var notify_share_textbook$1 = {
4605
4614
  update_success: "Update shared textbook successfully!",
4606
4615
  update_fail: "Update fail!"
4607
4616
  };
4617
+ var notify_share_exam$1 = {
4618
+ share_success: "Share exam successfully!",
4619
+ share_fail: "Exam or teacher not exists!",
4620
+ update_success: "Update shared exam successfully!",
4621
+ update_fail: "Update fail!"
4622
+ };
4608
4623
  var academyadminteacher$1 = "AcademyAdmin / Teacher";
4609
4624
  var total_student$1 = "Total Student";
4610
4625
  var total_teacher$1 = "Total Teacher";
@@ -4615,6 +4630,7 @@ var the_exam_code_you_are_looking_for_was_not_found$1 = "The exam code you are l
4615
4630
  var view_user$1 = "View User";
4616
4631
  var exam_code$1 = "exam code";
4617
4632
  var version$1 = "Version";
4633
+ var exam_sessions$1 = "Exam sessions";
4618
4634
  var lang_en = {
4619
4635
  problem_solving: problem_solving$1,
4620
4636
  my_story: my_story$1,
@@ -5421,6 +5437,7 @@ var lang_en = {
5421
5437
  authority: authority$1,
5422
5438
  share_textbook: share_textbook$1,
5423
5439
  notify_share_textbook: notify_share_textbook$1,
5440
+ notify_share_exam: notify_share_exam$1,
5424
5441
  academyadminteacher: academyadminteacher$1,
5425
5442
  total_student: total_student$1,
5426
5443
  total_teacher: total_teacher$1,
@@ -5430,7 +5447,8 @@ var lang_en = {
5430
5447
  the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1,
5431
5448
  view_user: view_user$1,
5432
5449
  exam_code: exam_code$1,
5433
- version: version$1
5450
+ version: version$1,
5451
+ exam_sessions: exam_sessions$1
5434
5452
  };
5435
5453
 
5436
5454
  i18n.use(initReactI18next).init({
@@ -8944,7 +8962,7 @@ var getCategoryListApi = function getCategoryListApi(data) {
8944
8962
  var PAGE_TITLE_DETAIL = "textbook_detail";
8945
8963
  var PAGE_TITLE_CREATE = "create_textbook";
8946
8964
  var useTextbookDetail = function useTextbookDetail(props) {
8947
- var _textbook$subject3;
8965
+ var _user$roles, _textbook$subject3, _textbook$createdBy2;
8948
8966
  var role = props.role,
8949
8967
  isReadonlyParam = props.isReadonlyParam,
8950
8968
  navigate = props.navigate,
@@ -8952,39 +8970,42 @@ var useTextbookDetail = function useTextbookDetail(props) {
8952
8970
  var _useTranslation = useTranslation(),
8953
8971
  t = _useTranslation.t;
8954
8972
  var dispatch = useDispatch();
8955
- var _useState = useState(false),
8956
- isReadonly = _useState[0],
8957
- setReadonly = _useState[1];
8958
- var _useState2 = useState(DEFAULT_TEXTBOOK),
8959
- textbook = _useState2[0],
8960
- setTextbook = _useState2[1];
8961
- var _useState3 = useState(false),
8962
- isNotFound = _useState3[0],
8963
- setNotFound = _useState3[1];
8973
+ var _useState = useState(DEFAULT_TEXTBOOK),
8974
+ textbook = _useState[0],
8975
+ setTextbook = _useState[1];
8976
+ var _useState2 = useState(false),
8977
+ isNotFound = _useState2[0],
8978
+ setNotFound = _useState2[1];
8979
+ var _useState3 = useState(),
8980
+ textbookId = _useState3[0],
8981
+ setTextbookId = _useState3[1];
8964
8982
  var _useState4 = useState(),
8965
- textbookId = _useState4[0],
8966
- setTextbookId = _useState4[1];
8967
- var _useState5 = useState(),
8968
- parentChapter = _useState5[0],
8969
- setParentChapter = _useState5[1];
8970
- var _useState6 = useState([]),
8971
- articlesSelected = _useState6[0],
8972
- setArticlesSelected = _useState6[1];
8983
+ parentChapter = _useState4[0],
8984
+ setParentChapter = _useState4[1];
8985
+ var _useState5 = useState([]),
8986
+ articlesSelected = _useState5[0],
8987
+ setArticlesSelected = _useState5[1];
8988
+ var _useState6 = useState(),
8989
+ selectedChapter = _useState6[0],
8990
+ setSelectedChapter = _useState6[1];
8973
8991
  var _useState7 = useState(),
8974
- selectedChapter = _useState7[0],
8975
- setSelectedChapter = _useState7[1];
8976
- var _useState8 = useState(),
8977
- selectedDeleteItem = _useState8[0],
8978
- setSelectedDeleteItem = _useState8[1];
8992
+ selectedDeleteItem = _useState7[0],
8993
+ setSelectedDeleteItem = _useState7[1];
8979
8994
  var updateChapterRef = useRef();
8980
8995
  var updateArticleRef = useRef();
8981
- var _useState9 = useState(false),
8982
- isEditedTitle = _useState9[0],
8983
- setEditedTitle = _useState9[1];
8984
- var _useState10 = useState([]),
8985
- categoryList = _useState10[0],
8986
- setCategoryList = _useState10[1];
8996
+ var _useState8 = useState(false),
8997
+ isEditedTitle = _useState8[0],
8998
+ setEditedTitle = _useState8[1];
8999
+ var _useState9 = useState([]),
9000
+ categoryList = _useState9[0],
9001
+ setCategoryList = _useState9[1];
8987
9002
  var textbookUrl = role === Role.Teacher ? TEXTBOOK_URL$1 : ADMIN_TEXTBOOK_URL;
9003
+ var isAdminSite = role === Role.Admin;
9004
+ var user = useSelector(function (state) {
9005
+ var _state$common;
9006
+ return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
9007
+ });
9008
+ var isAdmin = user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Admin);
8988
9009
  var _useExam = useExam({
8989
9010
  navigate: navigate
8990
9011
  }),
@@ -9684,9 +9705,14 @@ var useTextbookDetail = function useTextbookDetail(props) {
9684
9705
  useEffect(function () {
9685
9706
  document.title = t("study_peak") + " | " + t(id ? PAGE_TITLE_DETAIL : PAGE_TITLE_CREATE);
9686
9707
  }, [id, t]);
9687
- useEffect(function () {
9688
- setReadonly(textbook.isCreatedByAdmin || !!isReadonlyParam);
9689
- }, [isReadonlyParam, textbook.isCreatedByAdmin]);
9708
+ var isReadonly = useMemo(function () {
9709
+ var _textbook$createdBy;
9710
+ if (!user.id) return true;
9711
+ if (!textbook.id) return false;
9712
+ if (isReadonlyParam) return true;
9713
+ if (isAdminSite && isAdmin || !textbook.isCreatedByAdmin && !isAdmin && !isAdminSite && (textbook === null || textbook === void 0 ? void 0 : (_textbook$createdBy = textbook.createdBy) === null || _textbook$createdBy === void 0 ? void 0 : _textbook$createdBy.id) === (user === null || user === void 0 ? void 0 : user.id)) return false;
9714
+ return true;
9715
+ }, [isReadonlyParam, textbook.isCreatedByAdmin, isAdminSite, isAdmin, textbook.id, textbook === null || textbook === void 0 ? void 0 : (_textbook$createdBy2 = textbook.createdBy) === null || _textbook$createdBy2 === void 0 ? void 0 : _textbook$createdBy2.id, user === null || user === void 0 ? void 0 : user.id]);
9690
9716
  return {
9691
9717
  id: id,
9692
9718
  t: t,