touchstudy-core 0.1.77 → 0.1.79

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.
@@ -40,7 +40,7 @@ import Avatar from '@mui/material/Avatar';
40
40
  import TextField$1 from '@mui/material/TextField';
41
41
  import Paper$1 from '@mui/material/Paper';
42
42
  import Grid$1 from '@mui/material/Grid';
43
- import { useLocation, Link, useHistory } from 'react-router-dom';
43
+ import { useLocation, Link } from 'react-router-dom';
44
44
  import Card$1 from '@mui/material/Card';
45
45
  import CardActions from '@mui/material/CardActions';
46
46
  import CardContent from '@mui/material/CardContent';
@@ -833,6 +833,7 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
833
833
  scope: "email"
834
834
  });
835
835
  };
836
+ console.info("GOOGLE_CLIENT_ID: ", GOOGLE_CLIENT_ID);
836
837
  !!gapi && gapi.load("client:auth2", start);
837
838
  }, [gapi]);
838
839
  useEffect(function () {
@@ -16716,9 +16717,9 @@ var PrintState$1;
16716
16717
 
16717
16718
  var TOTAL = 3;
16718
16719
  var PrintExamView2 = function PrintExamView2(_ref) {
16719
- var role = _ref.role,
16720
+ var history = _ref.history,
16721
+ role = _ref.role,
16720
16722
  dataExamSession = _ref.dataExamSession;
16721
- var history = useHistory();
16722
16723
  var _useTranslation = useTranslation(),
16723
16724
  t = _useTranslation.t;
16724
16725
  var isTeacher = Role.Teacher === role;
@@ -16760,23 +16761,36 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16760
16761
  var examSessionId = _ref2.examSessionId,
16761
16762
  studentId = _ref2.studentId,
16762
16763
  code = _ref2.code;
16764
+ var width = 200;
16765
+ var height = 200;
16766
+ var left = window.screenX + window.outerWidth / 2 - width / 2;
16767
+ var top = window.screenY + window.outerHeight / 2 - height / 2;
16763
16768
  var url = isTeacher ? window.location.origin + "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : window.location.origin + "/student/exam-results/" + code + "/print";
16764
16769
  var windowName = isTeacher ? "popup-" + examSessionId + "-" + studentId : "popup-" + code;
16765
- var windowSpecs = "left=" + (window.innerWidth - 100) + ",top=" + (window.innerHeight - 100) + ",width=100,height=100,location=yes,resizable=yes,scrollbars=yes,status=yes";
16770
+ var windowSpecs = "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",location=yes,resizable=yes,scrollbars=yes,status=yes";
16766
16771
  var childWindow = window.open(url, windowName, windowSpecs);
16767
16772
  if (childWindow == null) {
16768
16773
  setErrorLinks(function (prev) {
16769
16774
  return [].concat(prev, [{
16770
16775
  code: code,
16771
16776
  examSessionId: "" + examSessionId,
16777
+ studentId: "" + studentId,
16772
16778
  message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
16773
16779
  }]);
16774
16780
  });
16775
- setData(function (es) {
16776
- return [].concat(es.filter(function (i) {
16777
- return i.code !== code;
16778
- }));
16779
- });
16781
+ if (!isTeacher) {
16782
+ setData(function (es) {
16783
+ return [].concat(es.filter(function (i) {
16784
+ return i.code !== code;
16785
+ }));
16786
+ });
16787
+ } else {
16788
+ setData(function (es) {
16789
+ return [].concat(es.filter(function (i) {
16790
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16791
+ }));
16792
+ });
16793
+ }
16780
16794
  return;
16781
16795
  }
16782
16796
  if (!isTeacher) {
@@ -16847,6 +16861,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16847
16861
  return [].concat(prev, [{
16848
16862
  code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
16849
16863
  examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
16864
+ studentId: "" + studentId,
16850
16865
  message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
16851
16866
  }]);
16852
16867
  });
@@ -16887,16 +16902,18 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16887
16902
  }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
16888
16903
  var _info$createdBy;
16889
16904
  var info = isTeacher ? dataExamSession.find(function (exam) {
16890
- return (exam === null || exam === void 0 ? void 0 : exam.examSessionId.toString()) === (i === null || i === void 0 ? void 0 : i.examSessionId);
16891
- }) : dataExamSession.find();
16905
+ return "" + (exam === null || exam === void 0 ? void 0 : exam.examSessionId) === "" + (i === null || i === void 0 ? void 0 : i.examSessionId) && "" + (exam === null || exam === void 0 ? void 0 : exam.studentId) === "" + (i === null || i === void 0 ? void 0 : i.studentId);
16906
+ }) : dataExamSession.find(function (exam) {
16907
+ return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
16908
+ });
16892
16909
  return React__default.createElement(Stack, {
16893
16910
  borderBottom: 1,
16894
16911
  borderColor: theme.palette.grey[500]
16895
- }, React__default.createElement(Link, {
16896
- to: i.message,
16912
+ }, React__default.createElement("a", {
16913
+ href: i.message,
16897
16914
  target: "_blank",
16898
16915
  rel: "noopener noreferrer"
16899
- }, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, "YYYY-MM-DD")));
16916
+ }, (info === null || info === void 0 ? void 0 : info.studentName) || (info === null || info === void 0 ? void 0 : (_info$createdBy = info.createdBy) === null || _info$createdBy === void 0 ? void 0 : _info$createdBy.fullName)), (info === null || info === void 0 ? void 0 : info.title) && React__default.createElement(Typography, null, t("exam") + ": " + (info === null || info === void 0 ? void 0 : info.title)), (info === null || info === void 0 ? void 0 : info.startTime) && React__default.createElement(Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
16900
16917
  })), React__default.createElement(Stack, {
16901
16918
  direction: "column",
16902
16919
  className: "mt-3"