touchstudy-core 0.1.138 → 0.1.140

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.
@@ -6,7 +6,8 @@ declare type Props = {
6
6
  theme: Theme;
7
7
  isEnglish: boolean;
8
8
  chapter: ChapterResponse;
9
+ isStudying: boolean;
9
10
  handleOpenChapterDialog: (chapter: ChapterResponse) => void;
10
11
  };
11
- declare const ChapterDetail: ({ t, theme, isEnglish, chapter, handleOpenChapterDialog }: Props) => React.JSX.Element;
12
+ declare const ChapterDetail: ({ t, theme, isEnglish, chapter, isStudying, handleOpenChapterDialog }: Props) => React.JSX.Element;
12
13
  export default ChapterDetail;
package/dist/index.js CHANGED
@@ -21690,9 +21690,6 @@ var UserDialog = function UserDialog(_ref) {
21690
21690
  });
21691
21691
  return [];
21692
21692
  }, [t, watch("schoolName")]);
21693
- console.log({
21694
- bang: watch("grade")
21695
- });
21696
21693
  var handleChangeRole = function handleChangeRole(role) {
21697
21694
  setRoles([role]);
21698
21695
  setValue("role", role);
@@ -23792,9 +23789,6 @@ var useExamDetailView = function useExamDetailView(props) {
23792
23789
  React.useEffect(function () {
23793
23790
  getCategoryList();
23794
23791
  }, [exam.subjectId]);
23795
- console.log({
23796
- exam: exam
23797
- });
23798
23792
  var examGroupByArticle = React.useMemo(function () {
23799
23793
  if (!exam) return [];
23800
23794
  var articles = [];
@@ -28831,17 +28825,22 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
28831
28825
  setOpen(groupIndex === open ? undefined : groupIndex);
28832
28826
  };
28833
28827
  var handleGetNewQuestionGroup = function handleGetNewQuestionGroup() {
28834
- var questionGroup = isMath ? DEFAULT_MATH_QUESTION_GROUP : DEFAULT_QUESTION_GROUP;
28828
+ var newQuestionGroup = isMath ? DEFAULT_MATH_QUESTION_GROUP : DEFAULT_QUESTION_GROUP;
28835
28829
  var lastQuestionGroups = questionGroups.length ? questionGroups[questionGroups.length - 1] : undefined;
28836
- if (!lastQuestionGroups) return questionGroup;else {
28830
+ newQuestionGroup.questions = newQuestionGroup.questions.map(function (i, index) {
28831
+ return _extends({}, i, {
28832
+ questionOrder: index
28833
+ });
28834
+ });
28835
+ if (!lastQuestionGroups) return newQuestionGroup;else {
28837
28836
  var _lastQuestionGroups$q, _lastQuestionGroups$q2, _lastQuestionGroups$q3;
28838
28837
  var lastOrder = (_lastQuestionGroups$q = (_lastQuestionGroups$q2 = lastQuestionGroups.questions) === null || _lastQuestionGroups$q2 === void 0 ? void 0 : (_lastQuestionGroups$q3 = _lastQuestionGroups$q2[lastQuestionGroups.questions.length - 1]) === null || _lastQuestionGroups$q3 === void 0 ? void 0 : _lastQuestionGroups$q3.questionOrder) != null ? _lastQuestionGroups$q : 0;
28839
- questionGroup.questions = questionGroup.questions.map(function (q, index) {
28838
+ newQuestionGroup.questions = newQuestionGroup.questions.map(function (q, index) {
28840
28839
  return _extends({}, q, {
28841
28840
  questionOrder: lastOrder + index + 1
28842
28841
  });
28843
28842
  });
28844
- return questionGroup;
28843
+ return newQuestionGroup;
28845
28844
  }
28846
28845
  };
28847
28846
  var handelChanngeQuestionCount = function handelChanngeQuestionCount(questionCount, index) {
@@ -28980,7 +28979,8 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
28980
28979
  startIcon: React__default.createElement(io.IoIosAdd, null),
28981
28980
  onClick: function onClick() {
28982
28981
  var length = questionGroups.length;
28983
- arrayHelpers.push(handleGetNewQuestionGroup());
28982
+ var addedGroup = handleGetNewQuestionGroup();
28983
+ arrayHelpers.push(addedGroup);
28984
28984
  handleToggle(length);
28985
28985
  }
28986
28986
  }, t("question_group"))));
@@ -30409,10 +30409,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
30409
30409
  dirty = formikProps.dirty,
30410
30410
  submitCount = formikProps.submitCount,
30411
30411
  setValues = formikProps.setValues;
30412
- console.log({
30413
- values: values,
30414
- errors: errors
30415
- });
30416
30412
  React.useEffect(function () {
30417
30413
  var handleBeforeUnload = function handleBeforeUnload(event) {
30418
30414
  var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
@@ -31672,6 +31668,7 @@ var ChapterDetail = function ChapterDetail(_ref) {
31672
31668
  theme = _ref.theme,
31673
31669
  isEnglish = _ref.isEnglish,
31674
31670
  chapter = _ref.chapter,
31671
+ isStudying = _ref.isStudying,
31675
31672
  handleOpenChapterDialog = _ref.handleOpenChapterDialog;
31676
31673
  var _useExpand = useExpand(),
31677
31674
  expanded = _useExpand.expanded,
@@ -31786,6 +31783,7 @@ var ChapterDetail = function ChapterDetail(_ref) {
31786
31783
  },
31787
31784
  variant: "contained",
31788
31785
  startIcon: React__default.createElement(io5.IoReceiptSharp, null),
31786
+ disabled: !isStudying,
31789
31787
  onClick: function onClick() {
31790
31788
  return handleOpenChapterDialog(chapter);
31791
31789
  }
@@ -32100,6 +32098,7 @@ var Statistic = function Statistic(_ref) {
32100
32098
  };
32101
32099
 
32102
32100
  var TextbookDrawer = function TextbookDrawer(_ref) {
32101
+ var _textbook$chapters, _textbook$chapters2;
32103
32102
  var isOpen = _ref.isOpen,
32104
32103
  onClose = _ref.onClose,
32105
32104
  textbookId = _ref.textbookId,
@@ -32338,12 +32337,13 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
32338
32337
  sx: {
32339
32338
  gap: "16px"
32340
32339
  }
32341
- }, textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
32340
+ }, textbook === null || textbook === void 0 ? void 0 : (_textbook$chapters = textbook.chapters) === null || _textbook$chapters === void 0 ? void 0 : _textbook$chapters.map(function (chapter) {
32342
32341
  return React__default.createElement(ChapterDetail, {
32343
32342
  t: t,
32344
32343
  isEnglish: isEnglish,
32345
32344
  theme: theme,
32346
32345
  chapter: chapter,
32346
+ isStudying: !!(textbook !== null && textbook !== void 0 && textbook.isStudying),
32347
32347
  handleOpenChapterDialog: handleOpenChapterDialog
32348
32348
  });
32349
32349
  })))), React__default.createElement(CustomTabPanel, {
@@ -32359,7 +32359,7 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
32359
32359
  m: "24px",
32360
32360
  gap: "8px"
32361
32361
  }
32362
- }, textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
32362
+ }, textbook === null || textbook === void 0 ? void 0 : (_textbook$chapters2 = textbook.chapters) === null || _textbook$chapters2 === void 0 ? void 0 : _textbook$chapters2.map(function (chapter) {
32363
32363
  return React__default.createElement(Statistic, {
32364
32364
  t: t,
32365
32365
  isEnglish: isEnglish,