touchstudy-core 0.1.88 → 0.1.89

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,6 +1227,7 @@ var useLanguage = function useLanguage(history) {
1225
1227
  moment.locale(languageItem.momentLangCode);
1226
1228
  localStorage.setItem(LANGUAGE, languageItem.code);
1227
1229
  dispatch(setLanguage(languageItem.code));
1230
+ if (window.location.pathname === LOGIN_URL) return;
1228
1231
  searchParams.set("lang", languageItem.code);
1229
1232
  pushTo(history, _extends({}, window.location, {
1230
1233
  search: searchParams.toString()
@@ -2948,6 +2951,9 @@ var total_exam = "총 시험 수";
2948
2951
  var total_exam_time = "총 시험 시간";
2949
2952
  var total_question = "총 질문 수";
2950
2953
  var the_exam_code_you_are_looking_for_was_not_found = "찾고 있는 시험 코드를 찾을 수 없습니다";
2954
+ var view_user = "사용자 보기";
2955
+ var exam_code = "시험 코드";
2956
+ var version = "버전";
2951
2957
  var lang_ko = {
2952
2958
  problem_solving: problem_solving,
2953
2959
  my_story: my_story,
@@ -3747,7 +3753,10 @@ var lang_ko = {
3747
3753
  total_exam: total_exam,
3748
3754
  total_exam_time: total_exam_time,
3749
3755
  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
3756
+ the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found,
3757
+ view_user: view_user,
3758
+ exam_code: exam_code,
3759
+ version: version
3751
3760
  };
3752
3761
 
3753
3762
  var problem_solving$1 = "Problem Solving";
@@ -4557,6 +4566,9 @@ var total_exam$1 = "Total Exam";
4557
4566
  var total_exam_time$1 = "Total Exam Time";
4558
4567
  var total_question$1 = "Total Question";
4559
4568
  var the_exam_code_you_are_looking_for_was_not_found$1 = "The exam code you are looking for was not found";
4569
+ var view_user$1 = "View User";
4570
+ var exam_code$1 = "exam code";
4571
+ var version$1 = "Version";
4560
4572
  var lang_en = {
4561
4573
  problem_solving: problem_solving$1,
4562
4574
  my_story: my_story$1,
@@ -5357,7 +5369,10 @@ var lang_en = {
5357
5369
  total_exam: total_exam$1,
5358
5370
  total_exam_time: total_exam_time$1,
5359
5371
  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
5372
+ the_exam_code_you_are_looking_for_was_not_found: the_exam_code_you_are_looking_for_was_not_found$1,
5373
+ view_user: view_user$1,
5374
+ exam_code: exam_code$1,
5375
+ version: version$1
5361
5376
  };
5362
5377
 
5363
5378
  i18n.use(initReactI18next).init({
@@ -10696,6 +10711,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10696
10711
  academyDomain = _ref.academyDomain;
10697
10712
  var pathname = window.location.pathname;
10698
10713
  var changeAcademySearchParams = function changeAcademySearchParams() {
10714
+ var isLoginPage = LOGIN_URL === pathname;
10699
10715
  var search = window.location.search;
10700
10716
  var searchParams = new URLSearchParams(search);
10701
10717
  var paramAcademyDomain = searchParams.get("domain");
@@ -10704,6 +10720,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10704
10720
  var isSuperUrl = checkSuperUrl(superUrls, pathname);
10705
10721
  if (!academyDomain) {
10706
10722
  if (!isSuperUrl) {
10723
+ if (isLoginPage) return;
10707
10724
  !paramAcademyDomain && domain && searchParams.set("domain", domain);
10708
10725
  pushTo(history, {
10709
10726
  pathname: homeUrl,
@@ -10732,6 +10749,7 @@ var useAutoAcademyDomain = function useAutoAcademyDomain(logout, history, superU
10732
10749
  return;
10733
10750
  }
10734
10751
  if (!paramAcademyDomain) {
10752
+ if (isLoginPage) return;
10735
10753
  searchParams.set("domain", academyDomain);
10736
10754
  pushTo(history, _extends({}, window.location, {
10737
10755
  search: searchParams.toString()
@@ -18622,7 +18640,7 @@ var StudentList = function StudentList(_ref) {
18622
18640
  selectedStudent = _ref.selectedStudent,
18623
18641
  t = _ref.t,
18624
18642
  textSearchRef = _ref.textSearchRef,
18625
- disabled = _ref.disabled,
18643
+ isOneRoleExists = _ref.isOneRoleExists,
18626
18644
  handleOpenDeleteClassDialog = _ref.handleOpenDeleteClassDialog,
18627
18645
  handleCloseConfirmDialog = _ref.handleCloseConfirmDialog,
18628
18646
  handleSort = _ref.handleSort,
@@ -18682,7 +18700,7 @@ var StudentList = function StudentList(_ref) {
18682
18700
  },
18683
18701
  placeholder: t("search_for"),
18684
18702
  onChange: handleChangeSearchText
18685
- }))), React__default.createElement(Grid, {
18703
+ }))), isOneRoleExists && React__default.createElement(Grid, {
18686
18704
  item: true,
18687
18705
  xs: 6,
18688
18706
  className: "d-flex align-items-center"
@@ -18718,11 +18736,11 @@ var StudentList = function StudentList(_ref) {
18718
18736
  className: "d-flex"
18719
18737
  }, React__default.createElement(IconButton, {
18720
18738
  color: "default",
18721
- className: (disabled ? "bg-secondary" : "bg-danger") + " text-white",
18739
+ className: (!isOneRoleExists ? "bg-secondary" : "bg-danger") + " text-white",
18722
18740
  onClick: function onClick() {
18723
18741
  return handleOpenDeleteClassDialog(i);
18724
18742
  },
18725
- disabled: disabled
18743
+ disabled: !isOneRoleExists
18726
18744
  }, React__default.createElement(FaTrashCan, {
18727
18745
  size: 12
18728
18746
  })))));
@@ -18769,6 +18787,7 @@ var SelectDialog = function SelectDialog(_ref) {
18769
18787
  onSubmit = _ref.onSubmit;
18770
18788
  var _useTranslation = useTranslation(),
18771
18789
  t = _useTranslation.t;
18790
+ var theme = useTheme();
18772
18791
  var handleSubmit = function handleSubmit() {
18773
18792
  onSubmit(selected);
18774
18793
  handleClear();
@@ -18868,7 +18887,12 @@ var SelectDialog = function SelectDialog(_ref) {
18868
18887
  disabled: !numSelected,
18869
18888
  onClick: handleSubmit
18870
18889
  }, submitText), React__default.createElement(Button, {
18871
- color: "secondary",
18890
+ sx: {
18891
+ background: theme.palette.grey[600],
18892
+ "&:hover": {
18893
+ background: theme.palette.grey[800]
18894
+ }
18895
+ },
18872
18896
  variant: "contained",
18873
18897
  onClick: onClose
18874
18898
  }, t('cancel'))));
@@ -18940,7 +18964,7 @@ var TeacherList = function TeacherList(_ref) {
18940
18964
  "aria-label": "search google maps"
18941
18965
  },
18942
18966
  onChange: handleChangeSearchText
18943
- }))), React__default.createElement(Grid, {
18967
+ }))), !disabled && React__default.createElement(Grid, {
18944
18968
  item: true,
18945
18969
  xs: 6,
18946
18970
  className: "d-flex align-items-center"
@@ -18953,8 +18977,7 @@ var TeacherList = function TeacherList(_ref) {
18953
18977
  }),
18954
18978
  onClick: function onClick() {
18955
18979
  return onAdd === null || onAdd === void 0 ? void 0 : onAdd("Teacher");
18956
- },
18957
- disabled: disabled
18980
+ }
18958
18981
  }, t("add_teachers"))), React__default.createElement(Grid, {
18959
18982
  item: true,
18960
18983
  xs: 12
@@ -19427,11 +19450,21 @@ var _excluded$9 = ["getStudents"],
19427
19450
  _excluded2 = ["getTeachers"],
19428
19451
  _excluded3 = ["getLessons"];
19429
19452
  var PAGE_TITLE$5 = "classes";
19430
- var useClassDetail = function useClassDetail(history, id) {
19453
+ var useClassDetail = function useClassDetail(_ref) {
19454
+ var history = _ref.history,
19455
+ id = _ref.id,
19456
+ role = _ref.role;
19431
19457
  var _useTranslation = useTranslation(),
19432
19458
  t = _useTranslation.t;
19433
19459
  var dispatch = useDispatch();
19434
19460
  var schema = ClassSchema(t);
19461
+ var user = useSelector(function (state) {
19462
+ var _state$common;
19463
+ return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
19464
+ });
19465
+ var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
19466
+ var isOneRoleExists = roles.length === 1;
19467
+ var isAdmin = roles.includes(Role.Admin) && role === Role.Admin;
19435
19468
  var _useState = useState(),
19436
19469
  course = _useState[0],
19437
19470
  setCourse = _useState[1];
@@ -19851,6 +19884,7 @@ var useClassDetail = function useClassDetail(history, id) {
19851
19884
  return {
19852
19885
  id: id,
19853
19886
  schema: schema,
19887
+ isAdmin: isAdmin,
19854
19888
  paging: paging,
19855
19889
  filter: filter,
19856
19890
  listUserSelected: selected,
@@ -19869,6 +19903,7 @@ var useClassDetail = function useClassDetail(history, id) {
19869
19903
  course: course,
19870
19904
  userList: openSelectDialog === "Student" ? students : teachers,
19871
19905
  teacherOptions: teacherOptions,
19906
+ isOneRoleExists: isOneRoleExists,
19872
19907
  studentListProps: studentListProps,
19873
19908
  teacherListProps: teacherListProps,
19874
19909
  lessonListProps: lessonListProps,
@@ -20125,7 +20160,7 @@ var LessonList = function LessonList(_ref) {
20125
20160
  className: "d-flex mb-2"
20126
20161
  }, React__default.createElement(Typography, {
20127
20162
  variant: "h4"
20128
- }, t("lessons"))), React__default.createElement(Grid, {
20163
+ }, t("lessons"))), !disabled && React__default.createElement(Grid, {
20129
20164
  item: true,
20130
20165
  xs: 6,
20131
20166
  className: "d-flex align-items-center"
@@ -20226,10 +20261,14 @@ var ClassDetail = function ClassDetail(_ref) {
20226
20261
  history = _ref.history,
20227
20262
  classListUrl = _ref.classListUrl,
20228
20263
  role = _ref.role;
20229
- var isAdmin = role === Role.Admin;
20230
- var _useClassDetail = useClassDetail(history, id),
20264
+ var _useClassDetail = useClassDetail({
20265
+ history: history,
20266
+ id: id,
20267
+ role: role
20268
+ }),
20231
20269
  schema = _useClassDetail.schema,
20232
20270
  paging = _useClassDetail.paging,
20271
+ isAdmin = _useClassDetail.isAdmin,
20233
20272
  filter = _useClassDetail.filter,
20234
20273
  listUserSelected = _useClassDetail.listUserSelected,
20235
20274
  userList = _useClassDetail.userList,
@@ -20246,6 +20285,7 @@ var ClassDetail = function ClassDetail(_ref) {
20246
20285
  course = _useClassDetail.course,
20247
20286
  classRequest = _useClassDetail.classRequest,
20248
20287
  teacherOptions = _useClassDetail.teacherOptions,
20288
+ isOneRoleExists = _useClassDetail.isOneRoleExists,
20249
20289
  studentListProps = _useClassDetail.studentListProps,
20250
20290
  teacherListProps = _useClassDetail.teacherListProps,
20251
20291
  lessonListProps = _useClassDetail.lessonListProps,
@@ -20333,7 +20373,7 @@ var ClassDetail = function ClassDetail(_ref) {
20333
20373
  value: selected,
20334
20374
  index: TabList$2[1].value
20335
20375
  }, !!id && !Number.isNaN(+id) && selected === TabList$2[1].value && React__default.createElement(StudentList, Object.assign({
20336
- disabled: !isAdmin,
20376
+ isOneRoleExists: isOneRoleExists,
20337
20377
  onAdd: handleOpenSelectDialog
20338
20378
  }, studentListProps))), React__default.createElement(CustomTabPanel, {
20339
20379
  value: selected,
@@ -20588,7 +20628,7 @@ var UserDialog = function UserDialog(_ref) {
20588
20628
  open: open,
20589
20629
  onClose: onClose,
20590
20630
  size: "md",
20591
- title: t(data !== null && data !== void 0 && data.id ? "update_user" : "create_new_user")
20631
+ title: !disabled ? t(data !== null && data !== void 0 && data.id ? "update_user" : "create_new_user") : t('view_user')
20592
20632
  }, React__default.createElement("form", {
20593
20633
  onSubmit: handleSubmit(onSubmit),
20594
20634
  style: {
@@ -20769,11 +20809,10 @@ var UserDialog = function UserDialog(_ref) {
20769
20809
  color: "secondary",
20770
20810
  className: "bg-secondary",
20771
20811
  onClick: onClose
20772
- }, t("cancel")), React__default.createElement(Button, {
20812
+ }, t("cancel")), !disabled && React__default.createElement(Button, {
20773
20813
  variant: "contained",
20774
20814
  color: "primary",
20775
- type: "submit",
20776
- disabled: disabled
20815
+ type: "submit"
20777
20816
  }, data !== null && data !== void 0 && data.id ? t("update") : t("create")))));
20778
20817
  };
20779
20818
 
@@ -21550,7 +21589,7 @@ var UserList = function UserList(_ref) {
21550
21589
  key: i.id
21551
21590
  }, 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
21591
  className: "d-flex"
21553
- }, React__default.createElement(IconButton, {
21592
+ }, isAdmin ? React__default.createElement(IconButton, {
21554
21593
  color: "default",
21555
21594
  className: styles$6["action-btn"] + " bg-warning text-white me-2",
21556
21595
  onClick: function onClick() {
@@ -21559,6 +21598,14 @@ var UserList = function UserList(_ref) {
21559
21598
  }, React__default.createElement(HiOutlinePencilAlt, {
21560
21599
  className: styles$6["action-btn--pencil"],
21561
21600
  size: 16
21601
+ })) : React__default.createElement(IconButton, {
21602
+ color: "default",
21603
+ className: "bg-primary text-white me-1",
21604
+ onClick: function onClick() {
21605
+ return handleOpenUserDialog(i);
21606
+ }
21607
+ }, React__default.createElement(FaEye, {
21608
+ size: 12
21562
21609
  })), isAdmin && React__default.createElement(IconButton, {
21563
21610
  onClick: function onClick() {
21564
21611
  return openDeleteDialog(i);
@@ -22555,5 +22602,33 @@ var NotificationList = function NotificationList(_ref) {
22555
22602
  })));
22556
22603
  };
22557
22604
 
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 };
22605
+ var ReleaseAlert = function ReleaseAlert() {
22606
+ var _useTranslation = useTranslation(),
22607
+ t = _useTranslation.t;
22608
+ var releaseDate = RELEASE_DATE;
22609
+ var isInValidDate = !releaseDate || releaseDate === DATE_MIN_VALUE || releaseDate === DATE_TIME_MIN_VALUE;
22610
+ var isLoginPage = window.location.pathname === LOGIN_URL;
22611
+ if (isInValidDate || !moment.utc(releaseDate).isValid()) return null;else {
22612
+ var version = moment(releaseDate).format("HH.mm.YYYY.MM.DD");
22613
+ return React__default.createElement(Box, {
22614
+ sx: {
22615
+ position: "fixed",
22616
+ right: 10,
22617
+ bottom: isLoginPage ? undefined : 5,
22618
+ top: isLoginPage ? 10 : undefined,
22619
+ userSelect: "none",
22620
+ zIndex: 1
22621
+ }
22622
+ }, React__default.createElement(Typography, {
22623
+ color: "success",
22624
+ sx: {
22625
+ fontSize: 10,
22626
+ color: "#3DC674",
22627
+ opacity: 0.8
22628
+ }
22629
+ }, t("version"), ": ", React__default.createElement("span", null, version)));
22630
+ }
22631
+ };
22632
+
22633
+ 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
22634
  //# sourceMappingURL=index.modern.js.map