touchstudy-core 0.1.138 → 0.1.139

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
@@ -23792,9 +23792,6 @@ var useExamDetailView = function useExamDetailView(props) {
23792
23792
  React.useEffect(function () {
23793
23793
  getCategoryList();
23794
23794
  }, [exam.subjectId]);
23795
- console.log({
23796
- exam: exam
23797
- });
23798
23795
  var examGroupByArticle = React.useMemo(function () {
23799
23796
  if (!exam) return [];
23800
23797
  var articles = [];
@@ -28831,17 +28828,22 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
28831
28828
  setOpen(groupIndex === open ? undefined : groupIndex);
28832
28829
  };
28833
28830
  var handleGetNewQuestionGroup = function handleGetNewQuestionGroup() {
28834
- var questionGroup = isMath ? DEFAULT_MATH_QUESTION_GROUP : DEFAULT_QUESTION_GROUP;
28831
+ var newQuestionGroup = isMath ? DEFAULT_MATH_QUESTION_GROUP : DEFAULT_QUESTION_GROUP;
28835
28832
  var lastQuestionGroups = questionGroups.length ? questionGroups[questionGroups.length - 1] : undefined;
28836
- if (!lastQuestionGroups) return questionGroup;else {
28833
+ newQuestionGroup.questions = newQuestionGroup.questions.map(function (i, index) {
28834
+ return _extends({}, i, {
28835
+ questionOrder: index
28836
+ });
28837
+ });
28838
+ if (!lastQuestionGroups) return newQuestionGroup;else {
28837
28839
  var _lastQuestionGroups$q, _lastQuestionGroups$q2, _lastQuestionGroups$q3;
28838
28840
  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) {
28841
+ newQuestionGroup.questions = newQuestionGroup.questions.map(function (q, index) {
28840
28842
  return _extends({}, q, {
28841
28843
  questionOrder: lastOrder + index + 1
28842
28844
  });
28843
28845
  });
28844
- return questionGroup;
28846
+ return newQuestionGroup;
28845
28847
  }
28846
28848
  };
28847
28849
  var handelChanngeQuestionCount = function handelChanngeQuestionCount(questionCount, index) {
@@ -28980,7 +28982,8 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
28980
28982
  startIcon: React__default.createElement(io.IoIosAdd, null),
28981
28983
  onClick: function onClick() {
28982
28984
  var length = questionGroups.length;
28983
- arrayHelpers.push(handleGetNewQuestionGroup());
28985
+ var addedGroup = handleGetNewQuestionGroup();
28986
+ arrayHelpers.push(addedGroup);
28984
28987
  handleToggle(length);
28985
28988
  }
28986
28989
  }, t("question_group"))));
@@ -30409,10 +30412,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
30409
30412
  dirty = formikProps.dirty,
30410
30413
  submitCount = formikProps.submitCount,
30411
30414
  setValues = formikProps.setValues;
30412
- console.log({
30413
- values: values,
30414
- errors: errors
30415
- });
30416
30415
  React.useEffect(function () {
30417
30416
  var handleBeforeUnload = function handleBeforeUnload(event) {
30418
30417
  var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
@@ -31672,6 +31671,7 @@ var ChapterDetail = function ChapterDetail(_ref) {
31672
31671
  theme = _ref.theme,
31673
31672
  isEnglish = _ref.isEnglish,
31674
31673
  chapter = _ref.chapter,
31674
+ isStudying = _ref.isStudying,
31675
31675
  handleOpenChapterDialog = _ref.handleOpenChapterDialog;
31676
31676
  var _useExpand = useExpand(),
31677
31677
  expanded = _useExpand.expanded,
@@ -31786,6 +31786,7 @@ var ChapterDetail = function ChapterDetail(_ref) {
31786
31786
  },
31787
31787
  variant: "contained",
31788
31788
  startIcon: React__default.createElement(io5.IoReceiptSharp, null),
31789
+ disabled: !isStudying,
31789
31790
  onClick: function onClick() {
31790
31791
  return handleOpenChapterDialog(chapter);
31791
31792
  }
@@ -32100,6 +32101,7 @@ var Statistic = function Statistic(_ref) {
32100
32101
  };
32101
32102
 
32102
32103
  var TextbookDrawer = function TextbookDrawer(_ref) {
32104
+ var _textbook$chapters, _textbook$chapters2;
32103
32105
  var isOpen = _ref.isOpen,
32104
32106
  onClose = _ref.onClose,
32105
32107
  textbookId = _ref.textbookId,
@@ -32338,12 +32340,13 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
32338
32340
  sx: {
32339
32341
  gap: "16px"
32340
32342
  }
32341
- }, textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
32343
+ }, textbook === null || textbook === void 0 ? void 0 : (_textbook$chapters = textbook.chapters) === null || _textbook$chapters === void 0 ? void 0 : _textbook$chapters.map(function (chapter) {
32342
32344
  return React__default.createElement(ChapterDetail, {
32343
32345
  t: t,
32344
32346
  isEnglish: isEnglish,
32345
32347
  theme: theme,
32346
32348
  chapter: chapter,
32349
+ isStudying: !!(textbook !== null && textbook !== void 0 && textbook.isStudying),
32347
32350
  handleOpenChapterDialog: handleOpenChapterDialog
32348
32351
  });
32349
32352
  })))), React__default.createElement(CustomTabPanel, {
@@ -32359,7 +32362,7 @@ var TextbookDrawer = function TextbookDrawer(_ref) {
32359
32362
  m: "24px",
32360
32363
  gap: "8px"
32361
32364
  }
32362
- }, textbook === null || textbook === void 0 ? void 0 : textbook.chapters.map(function (chapter) {
32365
+ }, textbook === null || textbook === void 0 ? void 0 : (_textbook$chapters2 = textbook.chapters) === null || _textbook$chapters2 === void 0 ? void 0 : _textbook$chapters2.map(function (chapter) {
32363
32366
  return React__default.createElement(Statistic, {
32364
32367
  t: t,
32365
32368
  isEnglish: isEnglish,