touchstudy-core 0.1.99 → 0.1.101
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
@@ -116,7 +116,6 @@ var encodeParams = function encodeParams(params) {
|
|
116
116
|
Role["Teacher"] = "Teacher";
|
117
117
|
Role["Admin"] = "Admin";
|
118
118
|
Role["AcademyAdmin"] = "AcademyAdmin";
|
119
|
-
Role["AcademyAdminTeacher"] = "AcademyAdminTeacher";
|
120
119
|
})(exports.Role || (exports.Role = {}));
|
121
120
|
(function (Language) {
|
122
121
|
Language["ko"] = "ko";
|
@@ -2961,7 +2960,12 @@ var notify_share_textbook = {
|
|
2961
2960
|
update_success: "공유 교과서가 성공적으로 업데이트되었습니다!",
|
2962
2961
|
update_fail: "업데이트 실패!"
|
2963
2962
|
};
|
2964
|
-
var
|
2963
|
+
var notify_share_exam = {
|
2964
|
+
share_success: "시험 공유 성공!",
|
2965
|
+
share_fail: "시험 또는 교사가 존재하지 않습니다!",
|
2966
|
+
update_success: "공유 시험을 성공적으로 업데이트했습니다!",
|
2967
|
+
update_fail: "업데이트 실패!"
|
2968
|
+
};
|
2965
2969
|
var total_student = "총 학생 수";
|
2966
2970
|
var total_teacher = "총 교사 수";
|
2967
2971
|
var total_exam = "총 시험 수";
|
@@ -2971,6 +2975,7 @@ var the_exam_code_you_are_looking_for_was_not_found = "찾고 있는 시험 코
|
|
2971
2975
|
var view_user = "사용자 보기";
|
2972
2976
|
var exam_code = "시험 코드";
|
2973
2977
|
var version = "버전";
|
2978
|
+
var exam_sessions = "시험 세션";
|
2974
2979
|
var lang_ko = {
|
2975
2980
|
problem_solving: problem_solving,
|
2976
2981
|
my_story: my_story,
|
@@ -3775,7 +3780,7 @@ var lang_ko = {
|
|
3775
3780
|
authority: authority,
|
3776
3781
|
share_textbook: share_textbook,
|
3777
3782
|
notify_share_textbook: notify_share_textbook,
|
3778
|
-
|
3783
|
+
notify_share_exam: notify_share_exam,
|
3779
3784
|
total_student: total_student,
|
3780
3785
|
total_teacher: total_teacher,
|
3781
3786
|
total_exam: total_exam,
|
@@ -3784,7 +3789,8 @@ var lang_ko = {
|
|
3784
3789
|
the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found,
|
3785
3790
|
view_user: view_user,
|
3786
3791
|
exam_code: exam_code,
|
3787
|
-
version: version
|
3792
|
+
version: version,
|
3793
|
+
exam_sessions: exam_sessions
|
3788
3794
|
};
|
3789
3795
|
|
3790
3796
|
var problem_solving$1 = "Problem Solving";
|
@@ -4095,7 +4101,6 @@ var parent_name$1 = "Parent name";
|
|
4095
4101
|
var users$1 = "Users";
|
4096
4102
|
var new_user$1 = "New user";
|
4097
4103
|
var academy_admin$1 = "Academy Admin";
|
4098
|
-
var academy_admin_teacher = "Academy Admin / Teacher";
|
4099
4104
|
var super_admin$1 = "Super Admin";
|
4100
4105
|
var switch_academy_admin$1 = "Switch Academy Admin";
|
4101
4106
|
var switch_academy$1 = "Switch Academy";
|
@@ -4604,7 +4609,12 @@ var notify_share_textbook$1 = {
|
|
4604
4609
|
update_success: "Update shared textbook successfully!",
|
4605
4610
|
update_fail: "Update fail!"
|
4606
4611
|
};
|
4607
|
-
var
|
4612
|
+
var notify_share_exam$1 = {
|
4613
|
+
share_success: "Share exam successfully!",
|
4614
|
+
share_fail: "Exam or teacher not exists!",
|
4615
|
+
update_success: "Update shared exam successfully!",
|
4616
|
+
update_fail: "Update fail!"
|
4617
|
+
};
|
4608
4618
|
var total_student$1 = "Total Student";
|
4609
4619
|
var total_teacher$1 = "Total Teacher";
|
4610
4620
|
var total_exam$1 = "Total Exam";
|
@@ -4614,6 +4624,7 @@ var the_exam_code_you_are_looking_for_was_not_found$1 = "The exam code you are l
|
|
4614
4624
|
var view_user$1 = "View User";
|
4615
4625
|
var exam_code$1 = "exam code";
|
4616
4626
|
var version$1 = "Version";
|
4627
|
+
var exam_sessions$1 = "Exam sessions";
|
4617
4628
|
var lang_en = {
|
4618
4629
|
problem_solving: problem_solving$1,
|
4619
4630
|
my_story: my_story$1,
|
@@ -4922,7 +4933,6 @@ var lang_en = {
|
|
4922
4933
|
users: users$1,
|
4923
4934
|
new_user: new_user$1,
|
4924
4935
|
academy_admin: academy_admin$1,
|
4925
|
-
academy_admin_teacher: academy_admin_teacher,
|
4926
4936
|
super_admin: super_admin$1,
|
4927
4937
|
switch_academy_admin: switch_academy_admin$1,
|
4928
4938
|
switch_academy: switch_academy$1,
|
@@ -5420,7 +5430,7 @@ var lang_en = {
|
|
5420
5430
|
authority: authority$1,
|
5421
5431
|
share_textbook: share_textbook$1,
|
5422
5432
|
notify_share_textbook: notify_share_textbook$1,
|
5423
|
-
|
5433
|
+
notify_share_exam: notify_share_exam$1,
|
5424
5434
|
total_student: total_student$1,
|
5425
5435
|
total_teacher: total_teacher$1,
|
5426
5436
|
total_exam: total_exam$1,
|
@@ -5429,7 +5439,8 @@ var lang_en = {
|
|
5429
5439
|
the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1,
|
5430
5440
|
view_user: view_user$1,
|
5431
5441
|
exam_code: exam_code$1,
|
5432
|
-
version: version$1
|
5442
|
+
version: version$1,
|
5443
|
+
exam_sessions: exam_sessions$1
|
5433
5444
|
};
|
5434
5445
|
|
5435
5446
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -7000,13 +7011,11 @@ var formatRole = function formatRole(roles, t) {
|
|
7000
7011
|
if (roles.includes(exports.Role.AcademyAdmin)) return t("academy_admin");
|
7001
7012
|
if (roles.includes(exports.Role.Teacher)) return t("teacher");
|
7002
7013
|
if (roles.includes(exports.Role.Student)) return t("student");
|
7003
|
-
if (roles.includes(exports.Role.AcademyAdminTeacher)) return t("academy_admin_teacher");
|
7004
7014
|
return "";
|
7005
7015
|
};
|
7006
7016
|
var getRole = function getRole(roles) {
|
7007
7017
|
if (roles.includes(exports.Role.Admin)) return exports.Role.Admin;
|
7008
7018
|
if (roles.includes(exports.Role.AcademyAdmin)) return exports.Role.AcademyAdmin;
|
7009
|
-
if (roles.includes(exports.Role.AcademyAdminTeacher)) return exports.Role.AcademyAdminTeacher;
|
7010
7019
|
if (roles.includes(exports.Role.Teacher)) return exports.Role.Teacher;
|
7011
7020
|
if (roles.includes(exports.Role.Student)) return exports.Role.Student;
|
7012
7021
|
return null;
|
@@ -8942,7 +8951,7 @@ var getCategoryListApi = function getCategoryListApi(data) {
|
|
8942
8951
|
var PAGE_TITLE_DETAIL = "textbook_detail";
|
8943
8952
|
var PAGE_TITLE_CREATE = "create_textbook";
|
8944
8953
|
var useTextbookDetail = function useTextbookDetail(props) {
|
8945
|
-
var _textbook$subject3;
|
8954
|
+
var _user$roles, _textbook$subject3, _textbook$createdBy2;
|
8946
8955
|
var role = props.role,
|
8947
8956
|
isReadonlyParam = props.isReadonlyParam,
|
8948
8957
|
navigate = props.navigate,
|
@@ -8950,39 +8959,42 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
8950
8959
|
var _useTranslation = reactI18next.useTranslation(),
|
8951
8960
|
t = _useTranslation.t;
|
8952
8961
|
var dispatch = reactRedux.useDispatch();
|
8953
|
-
var _useState = React.useState(
|
8954
|
-
|
8955
|
-
|
8956
|
-
var _useState2 = React.useState(
|
8957
|
-
|
8958
|
-
|
8959
|
-
var _useState3 = React.useState(
|
8960
|
-
|
8961
|
-
|
8962
|
+
var _useState = React.useState(DEFAULT_TEXTBOOK),
|
8963
|
+
textbook = _useState[0],
|
8964
|
+
setTextbook = _useState[1];
|
8965
|
+
var _useState2 = React.useState(false),
|
8966
|
+
isNotFound = _useState2[0],
|
8967
|
+
setNotFound = _useState2[1];
|
8968
|
+
var _useState3 = React.useState(),
|
8969
|
+
textbookId = _useState3[0],
|
8970
|
+
setTextbookId = _useState3[1];
|
8962
8971
|
var _useState4 = React.useState(),
|
8963
|
-
|
8964
|
-
|
8965
|
-
var _useState5 = React.useState(),
|
8966
|
-
|
8967
|
-
|
8968
|
-
var _useState6 = React.useState(
|
8969
|
-
|
8970
|
-
|
8972
|
+
parentChapter = _useState4[0],
|
8973
|
+
setParentChapter = _useState4[1];
|
8974
|
+
var _useState5 = React.useState([]),
|
8975
|
+
articlesSelected = _useState5[0],
|
8976
|
+
setArticlesSelected = _useState5[1];
|
8977
|
+
var _useState6 = React.useState(),
|
8978
|
+
selectedChapter = _useState6[0],
|
8979
|
+
setSelectedChapter = _useState6[1];
|
8971
8980
|
var _useState7 = React.useState(),
|
8972
|
-
|
8973
|
-
|
8974
|
-
var _useState8 = React.useState(),
|
8975
|
-
selectedDeleteItem = _useState8[0],
|
8976
|
-
setSelectedDeleteItem = _useState8[1];
|
8981
|
+
selectedDeleteItem = _useState7[0],
|
8982
|
+
setSelectedDeleteItem = _useState7[1];
|
8977
8983
|
var updateChapterRef = React.useRef();
|
8978
8984
|
var updateArticleRef = React.useRef();
|
8979
|
-
var
|
8980
|
-
isEditedTitle =
|
8981
|
-
setEditedTitle =
|
8982
|
-
var
|
8983
|
-
categoryList =
|
8984
|
-
setCategoryList =
|
8985
|
+
var _useState8 = React.useState(false),
|
8986
|
+
isEditedTitle = _useState8[0],
|
8987
|
+
setEditedTitle = _useState8[1];
|
8988
|
+
var _useState9 = React.useState([]),
|
8989
|
+
categoryList = _useState9[0],
|
8990
|
+
setCategoryList = _useState9[1];
|
8985
8991
|
var textbookUrl = role === exports.Role.Teacher ? TEXTBOOK_URL$1 : ADMIN_TEXTBOOK_URL;
|
8992
|
+
var isAdminSite = role === exports.Role.Admin;
|
8993
|
+
var user = reactRedux.useSelector(function (state) {
|
8994
|
+
var _state$common;
|
8995
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
8996
|
+
});
|
8997
|
+
var isAdmin = user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin);
|
8986
8998
|
var _useExam = useExam({
|
8987
8999
|
navigate: navigate
|
8988
9000
|
}),
|
@@ -9682,9 +9694,14 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
9682
9694
|
React.useEffect(function () {
|
9683
9695
|
document.title = t("study_peak") + " | " + t(id ? PAGE_TITLE_DETAIL : PAGE_TITLE_CREATE);
|
9684
9696
|
}, [id, t]);
|
9685
|
-
React.
|
9686
|
-
|
9687
|
-
|
9697
|
+
var isReadonly = React.useMemo(function () {
|
9698
|
+
var _textbook$createdBy;
|
9699
|
+
if (!user.id) return true;
|
9700
|
+
if (!textbook.id) return false;
|
9701
|
+
if (isReadonlyParam) return true;
|
9702
|
+
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;
|
9703
|
+
return true;
|
9704
|
+
}, [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]);
|
9688
9705
|
return {
|
9689
9706
|
id: id,
|
9690
9707
|
t: t,
|
@@ -10594,7 +10611,6 @@ var TextbookViewDetail = function TextbookViewDetail(props) {
|
|
10594
10611
|
selectedChapter = _useTextbookDetail.selectedChapter,
|
10595
10612
|
articlesSelected = _useTextbookDetail.articlesSelected,
|
10596
10613
|
selectedDeleteItem = _useTextbookDetail.selectedDeleteItem,
|
10597
|
-
isEditedTitle = _useTextbookDetail.isEditedTitle,
|
10598
10614
|
isOpenDialog = _useTextbookDetail.isOpenDialog,
|
10599
10615
|
examRequest = _useTextbookDetail.examRequest,
|
10600
10616
|
categoryList = _useTextbookDetail.categoryList,
|
@@ -10710,7 +10726,7 @@ var TextbookViewDetail = function TextbookViewDetail(props) {
|
|
10710
10726
|
textbook: textbook,
|
10711
10727
|
onBack: handleGoToTextbookList,
|
10712
10728
|
onSave: handleCreateOrUpdateTextbook,
|
10713
|
-
hideSave:
|
10729
|
+
hideSave: !!id && isReadonly
|
10714
10730
|
}))), React__default.createElement(material.Grid, {
|
10715
10731
|
item: true,
|
10716
10732
|
xs: 12,
|