touchstudy-core 0.1.88 → 0.1.90

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.
@@ -84,6 +84,7 @@ var PUSHER_CONFIG = {
84
84
  cluster: process.env.REACT_APP_PUSHER_CONFIG_CLUSTER || "",
85
85
  key: process.env.REACT_APP_PUSHER_CONFIG_KEY || ""
86
86
  };
87
+ var RELEASE_DATE = process.env.REACT_APP_RELEASE_VERSION || "";
87
88
  var ACCESS_TOKEN = "ACCESS_TOKEN";
88
89
  var ACADEMY_DOMAIN = "ACADEMY_DOMAIN";
89
90
  var REDIRECT_URL = "REDIRECT_URL";
@@ -1184,6 +1185,7 @@ var LANGUAGES = [{
1184
1185
  momentLangCode: "en-au"
1185
1186
  }];
1186
1187
  var DEFAULT_LANGUAGE = LANGUAGES[0];
1188
+ var LOGIN_URL = "/login";
1187
1189
 
1188
1190
  var getLanguage = (function () {
1189
1191
  try {
@@ -1225,7 +1227,9 @@ var useLanguage = function useLanguage(history) {
1225
1227
  moment.locale(languageItem.momentLangCode);
1226
1228
  localStorage.setItem(LANGUAGE, languageItem.code);
1227
1229
  dispatch(setLanguage(languageItem.code));
1228
- searchParams.set("lang", languageItem.code);
1230
+ if (window.location.pathname === LOGIN_URL) {
1231
+ if (RELEASE_DATE) return;else searchParams["delete"]("lang");
1232
+ } else searchParams.set("lang", languageItem.code);
1229
1233
  pushTo(history, _extends({}, window.location, {
1230
1234
  search: searchParams.toString()
1231
1235
  }), true);
@@ -2948,6 +2952,9 @@ var total_exam = "총 시험 수";
2948
2952
  var total_exam_time = "총 시험 시간";
2949
2953
  var total_question = "총 질문 수";
2950
2954
  var the_exam_code_you_are_looking_for_was_not_found = "찾고 있는 시험 코드를 찾을 수 없습니다";
2955
+ var view_user = "사용자 보기";
2956
+ var exam_code = "시험 코드";
2957
+ var version = "버전";
2951
2958
  var lang_ko = {
2952
2959
  problem_solving: problem_solving,
2953
2960
  my_story: my_story,
@@ -3747,7 +3754,10 @@ var lang_ko = {
3747
3754
  total_exam: total_exam,
3748
3755
  total_exam_time: total_exam_time,
3749
3756
  total_question: total_question,
3750
- the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found
3757
+ the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found,
3758
+ view_user: view_user,
3759
+ exam_code: exam_code,
3760
+ version: version
3751
3761
  };
3752
3762
 
3753
3763
  var problem_solving$1 = "Problem Solving";
@@ -4557,6 +4567,9 @@ var total_exam$1 = "Total Exam";
4557
4567
  var total_exam_time$1 = "Total Exam Time";
4558
4568
  var total_question$1 = "Total Question";
4559
4569
  var the_exam_code_you_are_looking_for_was_not_found$1 = "The exam code you are looking for was not found";
4570
+ var view_user$1 = "View User";
4571
+ var exam_code$1 = "exam code";
4572
+ var version$1 = "Version";
4560
4573
  var lang_en = {
4561
4574
  problem_solving: problem_solving$1,
4562
4575
  my_story: my_story$1,
@@ -5357,7 +5370,10 @@ var lang_en = {
5357
5370
  total_exam: total_exam$1,
5358
5371
  total_exam_time: total_exam_time$1,
5359
5372
  total_question: total_question$1,
5360
- the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1
5373
+ the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1,
5374
+ view_user: view_user$1,
5375
+ exam_code: exam_code$1,
5376
+ version: version$1
5361
5377
  };
5362
5378
 
5363
5379
  i18n.use(initReactI18next).init({
@@ -10696,6 +10712,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10696
10712
  academyDomain = _ref.academyDomain;
10697
10713
  var pathname = window.location.pathname;
10698
10714
  var changeAcademySearchParams = function changeAcademySearchParams() {
10715
+ var isLoginPage = LOGIN_URL === pathname;
10699
10716
  var search = window.location.search;
10700
10717
  var searchParams = new URLSearchParams(search);
10701
10718
  var paramAcademyDomain = searchParams.get("domain");
@@ -10704,6 +10721,9 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10704
10721
  var isSuperUrl = checkSuperUrl(superUrls, pathname);
10705
10722
  if (!academyDomain) {
10706
10723
  if (!isSuperUrl) {
10724
+ if (isLoginPage) {
10725
+ if (RELEASE_DATE) return;else searchParams["delete"]("domain");
10726
+ }
10707
10727
  !paramAcademyDomain && domain && searchParams.set("domain", domain);
10708
10728
  pushTo(history, {
10709
10729
  pathname: homeUrl,
@@ -10732,6 +10752,9 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10732
10752
  return;
10733
10753
  }
10734
10754
  if (!paramAcademyDomain) {
10755
+ if (isLoginPage) {
10756
+ if (RELEASE_DATE) return;else searchParams["delete"]("domain");
10757
+ }
10735
10758
  searchParams.set("domain", academyDomain);
10736
10759
  pushTo(history, _extends({}, window.location, {
10737
10760
  search: searchParams.toString()
@@ -18622,7 +18645,7 @@ var StudentList = function StudentList(_ref) {
18622
18645
  selectedStudent = _ref.selectedStudent,
18623
18646
  t = _ref.t,
18624
18647
  textSearchRef = _ref.textSearchRef,
18625
- disabled = _ref.disabled,
18648
+ isOneRoleExists = _ref.isOneRoleExists,
18626
18649
  handleOpenDeleteClassDialog = _ref.handleOpenDeleteClassDialog,
18627
18650
  handleCloseConfirmDialog = _ref.handleCloseConfirmDialog,
18628
18651
  handleSort = _ref.handleSort,
@@ -18682,7 +18705,7 @@ var StudentList = function StudentList(_ref) {
18682
18705
  },
18683
18706
  placeholder: t("search_for"),
18684
18707
  onChange: handleChangeSearchText
18685
- }))), React__default.createElement(Grid, {
18708
+ }))), isOneRoleExists && React__default.createElement(Grid, {
18686
18709
  item: true,
18687
18710
  xs: 6,
18688
18711
  className: "d-flex align-items-center"
@@ -18718,11 +18741,11 @@ var StudentList = function StudentList(_ref) {
18718
18741
  className: "d-flex"
18719
18742
  }, React__default.createElement(IconButton, {
18720
18743
  color: "default",
18721
- className: (disabled ? "bg-secondary" : "bg-danger") + " text-white",
18744
+ className: (!isOneRoleExists ? "bg-secondary" : "bg-danger") + " text-white",
18722
18745
  onClick: function onClick() {
18723
18746
  return handleOpenDeleteClassDialog(i);
18724
18747
  },
18725
- disabled: disabled
18748
+ disabled: !isOneRoleExists
18726
18749
  }, React__default.createElement(FaTrashCan, {
18727
18750
  size: 12
18728
18751
  })))));
@@ -18769,6 +18792,7 @@ var SelectDialog = function SelectDialog(_ref) {
18769
18792
  onSubmit = _ref.onSubmit;
18770
18793
  var _useTranslation = useTranslation(),
18771
18794
  t = _useTranslation.t;
18795
+ var theme = useTheme();
18772
18796
  var handleSubmit = function handleSubmit() {
18773
18797
  onSubmit(selected);
18774
18798
  handleClear();
@@ -18868,7 +18892,12 @@ var SelectDialog = function SelectDialog(_ref) {
18868
18892
  disabled: !numSelected,
18869
18893
  onClick: handleSubmit
18870
18894
  }, submitText), React__default.createElement(Button, {
18871
- color: "secondary",
18895
+ sx: {
18896
+ background: theme.palette.grey[600],
18897
+ "&:hover": {
18898
+ background: theme.palette.grey[800]
18899
+ }
18900
+ },
18872
18901
  variant: "contained",
18873
18902
  onClick: onClose
18874
18903
  }, t('cancel'))));
@@ -18940,7 +18969,7 @@ var TeacherList = function TeacherList(_ref) {
18940
18969
  "aria-label": "search google maps"
18941
18970
  },
18942
18971
  onChange: handleChangeSearchText
18943
- }))), React__default.createElement(Grid, {
18972
+ }))), !disabled && React__default.createElement(Grid, {
18944
18973
  item: true,
18945
18974
  xs: 6,
18946
18975
  className: "d-flex align-items-center"
@@ -18953,8 +18982,7 @@ var TeacherList = function TeacherList(_ref) {
18953
18982
  }),
18954
18983
  onClick: function onClick() {
18955
18984
  return onAdd === null || onAdd === void 0 ? void 0 : onAdd("Teacher");
18956
- },
18957
- disabled: disabled
18985
+ }
18958
18986
  }, t("add_teachers"))), React__default.createElement(Grid, {
18959
18987
  item: true,
18960
18988
  xs: 12
@@ -19427,11 +19455,21 @@ var _excluded$9 = ["getStudents"],
19427
19455
  _excluded2 = ["getTeachers"],
19428
19456
  _excluded3 = ["getLessons"];
19429
19457
  var PAGE_TITLE$5 = "classes";
19430
- var useClassDetail = function useClassDetail(history, id) {
19458
+ var useClassDetail = function useClassDetail(_ref) {
19459
+ var history = _ref.history,
19460
+ id = _ref.id,
19461
+ role = _ref.role;
19431
19462
  var _useTranslation = useTranslation(),
19432
19463
  t = _useTranslation.t;
19433
19464
  var dispatch = useDispatch();
19434
19465
  var schema = ClassSchema(t);
19466
+ var user = useSelector(function (state) {
19467
+ var _state$common;
19468
+ return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
19469
+ });
19470
+ var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
19471
+ var isOneRoleExists = roles.length === 1;
19472
+ var isAdmin = roles.includes(Role.Admin) && role === Role.Admin;
19435
19473
  var _useState = useState(),
19436
19474
  course = _useState[0],
19437
19475
  setCourse = _useState[1];
@@ -19851,6 +19889,7 @@ var useClassDetail = function useClassDetail(history, id) {
19851
19889
  return {
19852
19890
  id: id,
19853
19891
  schema: schema,
19892
+ isAdmin: isAdmin,
19854
19893
  paging: paging,
19855
19894
  filter: filter,
19856
19895
  listUserSelected: selected,
@@ -19869,6 +19908,7 @@ var useClassDetail = function useClassDetail(history, id) {
19869
19908
  course: course,
19870
19909
  userList: openSelectDialog === "Student" ? students : teachers,
19871
19910
  teacherOptions: teacherOptions,
19911
+ isOneRoleExists: isOneRoleExists,
19872
19912
  studentListProps: studentListProps,
19873
19913
  teacherListProps: teacherListProps,
19874
19914
  lessonListProps: lessonListProps,
@@ -20125,7 +20165,7 @@ var LessonList = function LessonList(_ref) {
20125
20165
  className: "d-flex mb-2"
20126
20166
  }, React__default.createElement(Typography, {
20127
20167
  variant: "h4"
20128
- }, t("lessons"))), React__default.createElement(Grid, {
20168
+ }, t("lessons"))), !disabled && React__default.createElement(Grid, {
20129
20169
  item: true,
20130
20170
  xs: 6,
20131
20171
  className: "d-flex align-items-center"
@@ -20226,10 +20266,14 @@ var ClassDetail = function ClassDetail(_ref) {
20226
20266
  history = _ref.history,
20227
20267
  classListUrl = _ref.classListUrl,
20228
20268
  role = _ref.role;
20229
- var isAdmin = role === Role.Admin;
20230
- var _useClassDetail = useClassDetail(history, id),
20269
+ var _useClassDetail = useClassDetail({
20270
+ history: history,
20271
+ id: id,
20272
+ role: role
20273
+ }),
20231
20274
  schema = _useClassDetail.schema,
20232
20275
  paging = _useClassDetail.paging,
20276
+ isAdmin = _useClassDetail.isAdmin,
20233
20277
  filter = _useClassDetail.filter,
20234
20278
  listUserSelected = _useClassDetail.listUserSelected,
20235
20279
  userList = _useClassDetail.userList,
@@ -20246,6 +20290,7 @@ var ClassDetail = function ClassDetail(_ref) {
20246
20290
  course = _useClassDetail.course,
20247
20291
  classRequest = _useClassDetail.classRequest,
20248
20292
  teacherOptions = _useClassDetail.teacherOptions,
20293
+ isOneRoleExists = _useClassDetail.isOneRoleExists,
20249
20294
  studentListProps = _useClassDetail.studentListProps,
20250
20295
  teacherListProps = _useClassDetail.teacherListProps,
20251
20296
  lessonListProps = _useClassDetail.lessonListProps,
@@ -20333,7 +20378,7 @@ var ClassDetail = function ClassDetail(_ref) {
20333
20378
  value: selected,
20334
20379
  index: TabList$2[1].value
20335
20380
  }, !!id && !Number.isNaN(+id) && selected === TabList$2[1].value && React__default.createElement(StudentList, Object.assign({
20336
- disabled: !isAdmin,
20381
+ isOneRoleExists: isOneRoleExists,
20337
20382
  onAdd: handleOpenSelectDialog
20338
20383
  }, studentListProps))), React__default.createElement(CustomTabPanel, {
20339
20384
  value: selected,
@@ -20588,7 +20633,7 @@ var UserDialog = function UserDialog(_ref) {
20588
20633
  open: open,
20589
20634
  onClose: onClose,
20590
20635
  size: "md",
20591
- title: t(data !== null && data !== void 0 && data.id ? "update_user" : "create_new_user")
20636
+ title: !disabled ? t(data !== null && data !== void 0 && data.id ? "update_user" : "create_new_user") : t('view_user')
20592
20637
  }, React__default.createElement("form", {
20593
20638
  onSubmit: handleSubmit(onSubmit),
20594
20639
  style: {
@@ -20769,11 +20814,10 @@ var UserDialog = function UserDialog(_ref) {
20769
20814
  color: "secondary",
20770
20815
  className: "bg-secondary",
20771
20816
  onClick: onClose
20772
- }, t("cancel")), React__default.createElement(Button, {
20817
+ }, t("cancel")), !disabled && React__default.createElement(Button, {
20773
20818
  variant: "contained",
20774
20819
  color: "primary",
20775
- type: "submit",
20776
- disabled: disabled
20820
+ type: "submit"
20777
20821
  }, data !== null && data !== void 0 && data.id ? t("update") : t("create")))));
20778
20822
  };
20779
20823
 
@@ -21550,7 +21594,7 @@ var UserList = function UserList(_ref) {
21550
21594
  key: i.id
21551
21595
  }, React__default.createElement(TableCell$1, null, (paging.page - 1) * paging.limit + index + 1), React__default.createElement(TableCell$1, null, i.email), React__default.createElement(TableCell$1, null, i.fullName), React__default.createElement(TableCell$1, null, i.phoneNumber), React__default.createElement(TableCell$1, null, i.schoolName), React__default.createElement(TableCell$1, null, i.major), React__default.createElement(TableCell$1, null, i.grade), React__default.createElement(TableCell$1, null, utcToLocalTime(i.createdAt, t("date_time_format"))), React__default.createElement(TableCell$1, null, (_i$classes = i.classes) === null || _i$classes === void 0 ? void 0 : _i$classes.join(", ")), React__default.createElement(TableCell$1, null, !!i.roles && formatRole(i.roles, t)), React__default.createElement(TableCell$1, null, React__default.createElement("div", {
21552
21596
  className: "d-flex"
21553
- }, React__default.createElement(IconButton, {
21597
+ }, isAdmin ? React__default.createElement(IconButton, {
21554
21598
  color: "default",
21555
21599
  className: styles$6["action-btn"] + " bg-warning text-white me-2",
21556
21600
  onClick: function onClick() {
@@ -21559,6 +21603,14 @@ var UserList = function UserList(_ref) {
21559
21603
  }, React__default.createElement(HiOutlinePencilAlt, {
21560
21604
  className: styles$6["action-btn--pencil"],
21561
21605
  size: 16
21606
+ })) : React__default.createElement(IconButton, {
21607
+ color: "default",
21608
+ className: "bg-primary text-white me-1",
21609
+ onClick: function onClick() {
21610
+ return handleOpenUserDialog(i);
21611
+ }
21612
+ }, React__default.createElement(FaEye, {
21613
+ size: 12
21562
21614
  })), isAdmin && React__default.createElement(IconButton, {
21563
21615
  onClick: function onClick() {
21564
21616
  return openDeleteDialog(i);
@@ -22555,5 +22607,33 @@ var NotificationList = function NotificationList(_ref) {
22555
22607
  })));
22556
22608
  };
22557
22609
 
22558
- export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, ClassDetail, ClassList, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, Language, LayoutContext, Loading, LoadingComponent, Login, LoginWithEmail, SignIn as LoginWithPassword, NotFound, NotificationDetail, NotificationList, PUSHER_CONFIG, PassCodeCheck, PrintExamResultView, PrintExamView2, QuestionCountSelector, RecentUserAction, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, UserList, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, createRecentUserActionListApi, diffFromNow, formatRole, formatTime, getAcademyDomain, getAccessToken, getErrorMessage, getOrdinalSuffix, getRecentUserActionListApi, getRole, i18n, minutesToTimeSpan, setAlert, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, times as timeUtils, toISOString, useAutoAcademyDomain, useCategorySelect, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useLoadMore, useLogin, usePusherConversation, useSubjectSelect, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
22610
+ var ReleaseAlert = function ReleaseAlert() {
22611
+ var _useTranslation = useTranslation(),
22612
+ t = _useTranslation.t;
22613
+ var releaseDate = RELEASE_DATE;
22614
+ var isInValidDate = !releaseDate || releaseDate === DATE_MIN_VALUE || releaseDate === DATE_TIME_MIN_VALUE;
22615
+ var isLoginPage = window.location.pathname === LOGIN_URL;
22616
+ if (isInValidDate || !moment.utc(releaseDate).isValid()) return null;else {
22617
+ var version = moment(releaseDate).format("HH.mm.YYYY.MM.DD");
22618
+ return React__default.createElement(Box, {
22619
+ sx: {
22620
+ position: "fixed",
22621
+ right: 10,
22622
+ bottom: isLoginPage ? undefined : 5,
22623
+ top: isLoginPage ? 10 : undefined,
22624
+ userSelect: "none",
22625
+ zIndex: 1
22626
+ }
22627
+ }, React__default.createElement(Typography, {
22628
+ color: "success",
22629
+ sx: {
22630
+ fontSize: 10,
22631
+ color: "#3DC674",
22632
+ opacity: 0.8
22633
+ }
22634
+ }, t("version"), ": ", React__default.createElement("span", null, version)));
22635
+ }
22636
+ };
22637
+
22638
+ export { ACADEMY_DOMAIN, ACCESS_TOKEN, AcademyHeaders, AcademyList, AnswerCountSelector, ArticleCategorySelector, ArticleGroupView, BASE_URL, ChatContainer, ChatItemType, types as ChatTypes, ClassDetail, ClassList, CommonDialog, ConfirmDialog, index$1 as CoreHooks, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_MIN_VALUE, DATE_TIME_MIN_VALUE, DEFAULT_PAGING_RESPONSE, DefaultErrorMessage, EXAM_CHANNEL, EXAM_STUDENT_CHANNEL, index as Enums, ExamDetailView, ExamEvent, ExamResultV2, Header, InputText, LANGUAGES, Language, LayoutContext, Loading, LoadingComponent, Login, LoginWithEmail, SignIn as LoginWithPassword, NotFound, NotificationDetail, NotificationList, PUSHER_CONFIG, PassCodeCheck, PrintExamResultView, PrintExamView2, QuestionCountSelector, RecentUserAction, ReleaseAlert, Role, SUPER_ADMIN_BASE_URL, ScoreSelector, SubjectSelector, index$2 as Textbook, TextbookViewDetail as TextbookDetail, TextbookList, TheAcademyDropdown, TheLanguageDropdown, index$3 as Types, UserList, api, apiUpload, canAccess as canAccessRoute, checkSuperUrl, createRecentUserActionListApi, diffFromNow, formatRole, formatTime, getAcademyDomain, getAccessToken, getErrorMessage, getOrdinalSuffix, getRecentUserActionListApi, getRole, i18n, minutesToTimeSpan, setAlert, setLanguage, setLoading, setReFetchUserAcademies, setReadyRegisterPusher, setUser, store, times as timeUtils, toISOString, useAutoAcademyDomain, useCategorySelect, useChatContainer, useCountDownTimer, useGoogleSignOut, useLanguage, useLoadMore, useLogin, usePusherConversation, useSubjectSelect, useSwitchAcademy, useVirtualizeList, utcToLocalTime };
22559
22639
  //# sourceMappingURL=index.modern.js.map