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.
@@ -2,7 +2,8 @@ import React from "react";
2
2
  import { Role } from "../../utils/constants";
3
3
  declare type Props = {
4
4
  role: Role;
5
+ history: any;
5
6
  dataExamSession?: any;
6
7
  };
7
- declare const PrintExamView2: ({ role, dataExamSession }: Props) => React.JSX.Element;
8
+ declare const PrintExamView2: ({ history, role, dataExamSession }: Props) => React.JSX.Element;
8
9
  export default PrintExamView2;
@@ -6,6 +6,7 @@ export declare type ExamSessionData = {
6
6
  export declare type ExamSessionEventData = {
7
7
  message: string;
8
8
  examSessionId?: string;
9
+ studentId?: string;
9
10
  code?: string;
10
11
  };
11
12
  export declare enum PrintState {
package/dist/index.js CHANGED
@@ -834,6 +834,7 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
834
834
  scope: "email"
835
835
  });
836
836
  };
837
+ console.info("GOOGLE_CLIENT_ID: ", GOOGLE_CLIENT_ID);
837
838
  !!gapiScript.gapi && gapiScript.gapi.load("client:auth2", start);
838
839
  }, [gapiScript.gapi]);
839
840
  React.useEffect(function () {
@@ -16714,9 +16715,9 @@ var PrintState$1;
16714
16715
 
16715
16716
  var TOTAL = 3;
16716
16717
  var PrintExamView2 = function PrintExamView2(_ref) {
16717
- var role = _ref.role,
16718
+ var history = _ref.history,
16719
+ role = _ref.role,
16718
16720
  dataExamSession = _ref.dataExamSession;
16719
- var history = reactRouterDom.useHistory();
16720
16721
  var _useTranslation = reactI18next.useTranslation(),
16721
16722
  t = _useTranslation.t;
16722
16723
  var isTeacher = exports.Role.Teacher === role;
@@ -16758,23 +16759,36 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16758
16759
  var examSessionId = _ref2.examSessionId,
16759
16760
  studentId = _ref2.studentId,
16760
16761
  code = _ref2.code;
16762
+ var width = 200;
16763
+ var height = 200;
16764
+ var left = window.screenX + window.outerWidth / 2 - width / 2;
16765
+ var top = window.screenY + window.outerHeight / 2 - height / 2;
16761
16766
  var url = isTeacher ? window.location.origin + "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : window.location.origin + "/student/exam-results/" + code + "/print";
16762
16767
  var windowName = isTeacher ? "popup-" + examSessionId + "-" + studentId : "popup-" + code;
16763
- var windowSpecs = "left=" + (window.innerWidth - 100) + ",top=" + (window.innerHeight - 100) + ",width=100,height=100,location=yes,resizable=yes,scrollbars=yes,status=yes";
16768
+ var windowSpecs = "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",location=yes,resizable=yes,scrollbars=yes,status=yes";
16764
16769
  var childWindow = window.open(url, windowName, windowSpecs);
16765
16770
  if (childWindow == null) {
16766
16771
  setErrorLinks(function (prev) {
16767
16772
  return [].concat(prev, [{
16768
16773
  code: code,
16769
16774
  examSessionId: "" + examSessionId,
16775
+ studentId: "" + studentId,
16770
16776
  message: isTeacher ? "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : "/student/exam-results/" + code + "/print"
16771
16777
  }]);
16772
16778
  });
16773
- setData(function (es) {
16774
- return [].concat(es.filter(function (i) {
16775
- return i.code !== code;
16776
- }));
16777
- });
16779
+ if (!isTeacher) {
16780
+ setData(function (es) {
16781
+ return [].concat(es.filter(function (i) {
16782
+ return i.code !== code;
16783
+ }));
16784
+ });
16785
+ } else {
16786
+ setData(function (es) {
16787
+ return [].concat(es.filter(function (i) {
16788
+ return i.examSessionId !== examSessionId || i.studentId !== studentId;
16789
+ }));
16790
+ });
16791
+ }
16778
16792
  return;
16779
16793
  }
16780
16794
  if (!isTeacher) {
@@ -16845,6 +16859,7 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16845
16859
  return [].concat(prev, [{
16846
16860
  code: (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.code,
16847
16861
  examSessionId: (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.examSessionId,
16862
+ studentId: "" + studentId,
16848
16863
  message: isTeacher ? "/teacher/exam-results/" + event.data.examSessionId + "/students/" + event.data.studentId + "/print" : "/student/exam-results/" + event.data.code + "/print"
16849
16864
  }]);
16850
16865
  });
@@ -16885,16 +16900,18 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16885
16900
  }, t("download_failed"), ":"), Array.from(new Set(errorLinks)).map(function (i) {
16886
16901
  var _info$createdBy;
16887
16902
  var info = isTeacher ? dataExamSession.find(function (exam) {
16888
- return (exam === null || exam === void 0 ? void 0 : exam.examSessionId.toString()) === (i === null || i === void 0 ? void 0 : i.examSessionId);
16889
- }) : dataExamSession.find();
16903
+ 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);
16904
+ }) : dataExamSession.find(function (exam) {
16905
+ return (exam === null || exam === void 0 ? void 0 : exam.code) === (i === null || i === void 0 ? void 0 : i.code);
16906
+ });
16890
16907
  return React__default.createElement(material.Stack, {
16891
16908
  borderBottom: 1,
16892
16909
  borderColor: theme.palette.grey[500]
16893
- }, React__default.createElement(reactRouterDom.Link, {
16894
- to: i.message,
16910
+ }, React__default.createElement("a", {
16911
+ href: i.message,
16895
16912
  target: "_blank",
16896
16913
  rel: "noopener noreferrer"
16897
- }, (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(material.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(material.Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, "YYYY-MM-DD")));
16914
+ }, (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(material.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(material.Typography, null, t("start_time") + ": " + utcToLocalTime(info === null || info === void 0 ? void 0 : info.startTime, t("date_time_format"))));
16898
16915
  })), React__default.createElement(material.Stack, {
16899
16916
  direction: "column",
16900
16917
  className: "mt-3"