touchstudy-core 0.1.98 → 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.
- package/dist/containers/Textbooks/configs/types.d.ts +1 -0
- package/dist/index.js +71 -43
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +71 -43
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -252,6 +252,14 @@ var getAccessToken = (function () {
|
|
252
252
|
}
|
253
253
|
});
|
254
254
|
|
255
|
+
var getLanguage = (function () {
|
256
|
+
try {
|
257
|
+
return localStorage.getItem(LANGUAGE);
|
258
|
+
} catch (err) {
|
259
|
+
return null;
|
260
|
+
}
|
261
|
+
});
|
262
|
+
|
255
263
|
var api = axios.create({
|
256
264
|
baseURL: BASE_URL,
|
257
265
|
timeout: 0,
|
@@ -276,13 +284,15 @@ var apiUpload = axios.create({
|
|
276
284
|
var paramDomain = searchParams.get('domain');
|
277
285
|
var paramLang = searchParams.get('lang');
|
278
286
|
var academyDomainStorage = getAcademyDomain();
|
287
|
+
var langStorage = getLanguage();
|
279
288
|
var academyDomain = paramDomain || academyDomainStorage;
|
289
|
+
var language = paramLang || langStorage;
|
280
290
|
if (token) {
|
281
291
|
config.headers.Authorization = "Bearer " + token;
|
282
292
|
localStorage.setItem("LAST_TIME_REQUEST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
283
293
|
}
|
284
294
|
if (academyDomain && !config.headers[AcademyHeaders]) config.headers[AcademyHeaders] = "" + academyDomain;
|
285
|
-
if (
|
295
|
+
if (language) config.headers[LanguageHeaders] = "" + language;
|
286
296
|
return config;
|
287
297
|
}, function (error) {
|
288
298
|
return Promise.reject(error);
|
@@ -1189,14 +1199,6 @@ var LANGUAGES = [{
|
|
1189
1199
|
var DEFAULT_LANGUAGE = LANGUAGES[0];
|
1190
1200
|
var LOGIN_URL = "/login";
|
1191
1201
|
|
1192
|
-
var getLanguage = (function () {
|
1193
|
-
try {
|
1194
|
-
return localStorage.getItem(LANGUAGE);
|
1195
|
-
} catch (err) {
|
1196
|
-
return null;
|
1197
|
-
}
|
1198
|
-
});
|
1199
|
-
|
1200
1202
|
var useLanguage = function useLanguage(history) {
|
1201
1203
|
var dispatch = reactRedux.useDispatch();
|
1202
1204
|
var _useTranslation = reactI18next.useTranslation(),
|
@@ -2959,6 +2961,12 @@ var notify_share_textbook = {
|
|
2959
2961
|
update_success: "공유 교과서가 성공적으로 업데이트되었습니다!",
|
2960
2962
|
update_fail: "업데이트 실패!"
|
2961
2963
|
};
|
2964
|
+
var notify_share_exam = {
|
2965
|
+
share_success: "시험 공유 성공!",
|
2966
|
+
share_fail: "시험 또는 교사가 존재하지 않습니다!",
|
2967
|
+
update_success: "공유 시험을 성공적으로 업데이트했습니다!",
|
2968
|
+
update_fail: "업데이트 실패!"
|
2969
|
+
};
|
2962
2970
|
var academyadminteacher = "아카데미 관리자/선생님";
|
2963
2971
|
var total_student = "총 학생 수";
|
2964
2972
|
var total_teacher = "총 교사 수";
|
@@ -2969,6 +2977,7 @@ var the_exam_code_you_are_looking_for_was_not_found = "찾고 있는 시험 코
|
|
2969
2977
|
var view_user = "사용자 보기";
|
2970
2978
|
var exam_code = "시험 코드";
|
2971
2979
|
var version = "버전";
|
2980
|
+
var exam_sessions = "시험 세션";
|
2972
2981
|
var lang_ko = {
|
2973
2982
|
problem_solving: problem_solving,
|
2974
2983
|
my_story: my_story,
|
@@ -3773,6 +3782,7 @@ var lang_ko = {
|
|
3773
3782
|
authority: authority,
|
3774
3783
|
share_textbook: share_textbook,
|
3775
3784
|
notify_share_textbook: notify_share_textbook,
|
3785
|
+
notify_share_exam: notify_share_exam,
|
3776
3786
|
academyadminteacher: academyadminteacher,
|
3777
3787
|
total_student: total_student,
|
3778
3788
|
total_teacher: total_teacher,
|
@@ -3782,7 +3792,8 @@ var lang_ko = {
|
|
3782
3792
|
the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found,
|
3783
3793
|
view_user: view_user,
|
3784
3794
|
exam_code: exam_code,
|
3785
|
-
version: version
|
3795
|
+
version: version,
|
3796
|
+
exam_sessions: exam_sessions
|
3786
3797
|
};
|
3787
3798
|
|
3788
3799
|
var problem_solving$1 = "Problem Solving";
|
@@ -4602,6 +4613,12 @@ var notify_share_textbook$1 = {
|
|
4602
4613
|
update_success: "Update shared textbook successfully!",
|
4603
4614
|
update_fail: "Update fail!"
|
4604
4615
|
};
|
4616
|
+
var notify_share_exam$1 = {
|
4617
|
+
share_success: "Share exam successfully!",
|
4618
|
+
share_fail: "Exam or teacher not exists!",
|
4619
|
+
update_success: "Update shared exam successfully!",
|
4620
|
+
update_fail: "Update fail!"
|
4621
|
+
};
|
4605
4622
|
var academyadminteacher$1 = "AcademyAdmin / Teacher";
|
4606
4623
|
var total_student$1 = "Total Student";
|
4607
4624
|
var total_teacher$1 = "Total Teacher";
|
@@ -4612,6 +4629,7 @@ var the_exam_code_you_are_looking_for_was_not_found$1 = "The exam code you are l
|
|
4612
4629
|
var view_user$1 = "View User";
|
4613
4630
|
var exam_code$1 = "exam code";
|
4614
4631
|
var version$1 = "Version";
|
4632
|
+
var exam_sessions$1 = "Exam sessions";
|
4615
4633
|
var lang_en = {
|
4616
4634
|
problem_solving: problem_solving$1,
|
4617
4635
|
my_story: my_story$1,
|
@@ -5418,6 +5436,7 @@ var lang_en = {
|
|
5418
5436
|
authority: authority$1,
|
5419
5437
|
share_textbook: share_textbook$1,
|
5420
5438
|
notify_share_textbook: notify_share_textbook$1,
|
5439
|
+
notify_share_exam: notify_share_exam$1,
|
5421
5440
|
academyadminteacher: academyadminteacher$1,
|
5422
5441
|
total_student: total_student$1,
|
5423
5442
|
total_teacher: total_teacher$1,
|
@@ -5427,7 +5446,8 @@ var lang_en = {
|
|
5427
5446
|
the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1,
|
5428
5447
|
view_user: view_user$1,
|
5429
5448
|
exam_code: exam_code$1,
|
5430
|
-
version: version$1
|
5449
|
+
version: version$1,
|
5450
|
+
exam_sessions: exam_sessions$1
|
5431
5451
|
};
|
5432
5452
|
|
5433
5453
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -8940,7 +8960,7 @@ var getCategoryListApi = function getCategoryListApi(data) {
|
|
8940
8960
|
var PAGE_TITLE_DETAIL = "textbook_detail";
|
8941
8961
|
var PAGE_TITLE_CREATE = "create_textbook";
|
8942
8962
|
var useTextbookDetail = function useTextbookDetail(props) {
|
8943
|
-
var _textbook$subject3;
|
8963
|
+
var _user$roles, _textbook$subject3, _textbook$createdBy2;
|
8944
8964
|
var role = props.role,
|
8945
8965
|
isReadonlyParam = props.isReadonlyParam,
|
8946
8966
|
navigate = props.navigate,
|
@@ -8948,39 +8968,42 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
8948
8968
|
var _useTranslation = reactI18next.useTranslation(),
|
8949
8969
|
t = _useTranslation.t;
|
8950
8970
|
var dispatch = reactRedux.useDispatch();
|
8951
|
-
var _useState = React.useState(
|
8952
|
-
|
8953
|
-
|
8954
|
-
var _useState2 = React.useState(
|
8955
|
-
|
8956
|
-
|
8957
|
-
var _useState3 = React.useState(
|
8958
|
-
|
8959
|
-
|
8971
|
+
var _useState = React.useState(DEFAULT_TEXTBOOK),
|
8972
|
+
textbook = _useState[0],
|
8973
|
+
setTextbook = _useState[1];
|
8974
|
+
var _useState2 = React.useState(false),
|
8975
|
+
isNotFound = _useState2[0],
|
8976
|
+
setNotFound = _useState2[1];
|
8977
|
+
var _useState3 = React.useState(),
|
8978
|
+
textbookId = _useState3[0],
|
8979
|
+
setTextbookId = _useState3[1];
|
8960
8980
|
var _useState4 = React.useState(),
|
8961
|
-
|
8962
|
-
|
8963
|
-
var _useState5 = React.useState(),
|
8964
|
-
|
8965
|
-
|
8966
|
-
var _useState6 = React.useState(
|
8967
|
-
|
8968
|
-
|
8981
|
+
parentChapter = _useState4[0],
|
8982
|
+
setParentChapter = _useState4[1];
|
8983
|
+
var _useState5 = React.useState([]),
|
8984
|
+
articlesSelected = _useState5[0],
|
8985
|
+
setArticlesSelected = _useState5[1];
|
8986
|
+
var _useState6 = React.useState(),
|
8987
|
+
selectedChapter = _useState6[0],
|
8988
|
+
setSelectedChapter = _useState6[1];
|
8969
8989
|
var _useState7 = React.useState(),
|
8970
|
-
|
8971
|
-
|
8972
|
-
var _useState8 = React.useState(),
|
8973
|
-
selectedDeleteItem = _useState8[0],
|
8974
|
-
setSelectedDeleteItem = _useState8[1];
|
8990
|
+
selectedDeleteItem = _useState7[0],
|
8991
|
+
setSelectedDeleteItem = _useState7[1];
|
8975
8992
|
var updateChapterRef = React.useRef();
|
8976
8993
|
var updateArticleRef = React.useRef();
|
8977
|
-
var
|
8978
|
-
isEditedTitle =
|
8979
|
-
setEditedTitle =
|
8980
|
-
var
|
8981
|
-
categoryList =
|
8982
|
-
setCategoryList =
|
8994
|
+
var _useState8 = React.useState(false),
|
8995
|
+
isEditedTitle = _useState8[0],
|
8996
|
+
setEditedTitle = _useState8[1];
|
8997
|
+
var _useState9 = React.useState([]),
|
8998
|
+
categoryList = _useState9[0],
|
8999
|
+
setCategoryList = _useState9[1];
|
8983
9000
|
var textbookUrl = role === exports.Role.Teacher ? TEXTBOOK_URL$1 : ADMIN_TEXTBOOK_URL;
|
9001
|
+
var isAdminSite = role === exports.Role.Admin;
|
9002
|
+
var user = reactRedux.useSelector(function (state) {
|
9003
|
+
var _state$common;
|
9004
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
9005
|
+
});
|
9006
|
+
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);
|
8984
9007
|
var _useExam = useExam({
|
8985
9008
|
navigate: navigate
|
8986
9009
|
}),
|
@@ -9680,9 +9703,14 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
9680
9703
|
React.useEffect(function () {
|
9681
9704
|
document.title = t("study_peak") + " | " + t(id ? PAGE_TITLE_DETAIL : PAGE_TITLE_CREATE);
|
9682
9705
|
}, [id, t]);
|
9683
|
-
React.
|
9684
|
-
|
9685
|
-
|
9706
|
+
var isReadonly = React.useMemo(function () {
|
9707
|
+
var _textbook$createdBy;
|
9708
|
+
if (!user.id) return true;
|
9709
|
+
if (!textbook.id) return false;
|
9710
|
+
if (isReadonlyParam) return true;
|
9711
|
+
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;
|
9712
|
+
return true;
|
9713
|
+
}, [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]);
|
9686
9714
|
return {
|
9687
9715
|
id: id,
|
9688
9716
|
t: t,
|