@itutoring/itutoring_application_js_api 1.2.21 → 1.2.23

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.
@@ -50,7 +50,7 @@ class AttendanceManager
50
50
  {
51
51
  if (data.includes("error: "))
52
52
  {
53
- data.replace("error: ", "");
53
+ data = data.replace("error: ", "");
54
54
  location.href = data
55
55
  }
56
56
  }
@@ -93,7 +93,7 @@ class LessonManager
93
93
  {
94
94
  if (data.includes("error: "))
95
95
  {
96
- data.replace("error: ", "");
96
+ data = data.replace("error: ", "");
97
97
  location.href = data;
98
98
  }
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,85 @@
1
+ import APIController from "../apiController";
2
+ import './ToolkitStyles.css';
3
+
4
+ class Toolkit
5
+ {
6
+ static ModuleInfo = null;
7
+ static UserDataLoaded = false;
8
+
9
+ /**
10
+ * Main function to initialize any toolkit module.
11
+ * It will handle all important authorizations
12
+ *
13
+ * uiChangedCallback(jsx variable with actual UI)
14
+ */
15
+ static async Initialize(moduleUid, uiChangedCallback)
16
+ {
17
+ uiChangedCallback(
18
+ <div id="welcome-screen" className="w-screen">
19
+ <div className="w-logo-wrap">
20
+ <img src="https://itutoring.cz/client/static/img/logos/logo_landscape_trans_w.png"></img>
21
+ <p className="w-toolkit"><i class="fa-solid fa-toolbox"></i> Toolkit</p>
22
+ </div>
23
+ <h2 className="w-em">Načítání...</h2>
24
+ </div>
25
+ )
26
+
27
+ this.ModuleInfo = await this.GetModuleProperties(moduleUid);
28
+
29
+ uiChangedCallback(
30
+ <div id="welcome-screen" className="w-screen">
31
+ <div className="w-logo-wrap">
32
+ <img src="https://itutoring.cz/client/static/img/logos/logo_landscape_trans_w.png"></img>
33
+ <p className="w-toolkit"><i class="fa-solid fa-toolbox"></i> Toolkit</p>
34
+ </div>
35
+ <h2 className="w-em">{this.ModuleInfo['Name']}</h2>
36
+ </div>
37
+ )
38
+
39
+ await this.RequestAccess();
40
+
41
+ while (!this.UserDataLoaded)
42
+ await new Promise(t => setInterval(t, 250));
43
+ }
44
+
45
+ /***** API Methods ******/
46
+
47
+ static #MODULE = "Toolkit";
48
+
49
+ static #REQUEST_ACCESS = "RequestAccess";
50
+ static #GET_MODULE_INFO = "GetModuleInfo";
51
+
52
+ static async RequestAccess(moduleUid)
53
+ {
54
+ var data = await APIController.Post(this.#MODULE, this.#REQUEST_ACCESS, {
55
+ 'uid': moduleUid
56
+ });
57
+
58
+ this.CheckForError(data);
59
+ }
60
+
61
+ /**
62
+ * Will be returned as array (parsed JSON).
63
+ * @param {*} moduleUid
64
+ * @returns
65
+ */
66
+ static async GetModuleProperties(moduleUid)
67
+ {
68
+ var info = await APIController.Get(this.#MODULE, this.#GET_MODULE_INFO, {
69
+ 'uid': moduleUid
70
+ });
71
+
72
+ this.CheckForError(data);
73
+
74
+ return JSON.parse(info);
75
+ }
76
+
77
+ static async CheckForError(data)
78
+ {
79
+ if (data.includes("error: "))
80
+ {
81
+ data = data.replace("error: ", "");
82
+ location.href = data
83
+ }
84
+ }
85
+ }
@@ -0,0 +1,94 @@
1
+ .w-screen {
2
+ position: fixed;
3
+ top: 0;
4
+ width: 100%;
5
+ height: 100%;
6
+ z-index: 1011;
7
+ display: flex;
8
+
9
+ align-items: center;
10
+ justify-content: center;
11
+ flex-direction: column;
12
+
13
+ background-color: rgb(0, 0, 0);
14
+
15
+ z-index: 999;
16
+ }
17
+
18
+ .w-hide{
19
+ animation: hide-w 0.5s forwards;
20
+ }
21
+
22
+ .w-logo-wrap {
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ flex-direction: column;
27
+ }
28
+
29
+ .w-screen img {
30
+ width: 20%;
31
+
32
+ animation: logo-show 0.8s forwards;
33
+ }
34
+
35
+ .w-toolkit {
36
+ font-family: Montserrat, sans-serif;
37
+ font-weight: 600;
38
+ font-size: 4vh;
39
+ scale: 0;
40
+ color: white !important;
41
+
42
+ animation: 0.1s tk-show 0.5s forwards;
43
+ }
44
+
45
+ .w-em {
46
+ font-family: Montserrat, sans-serif;
47
+ font-weight: 300;
48
+ font-size: 5vh;
49
+ opacity: 0;
50
+ animation: 0.5s module-show 0.7s forwards;
51
+ color: white !important;
52
+ }
53
+
54
+ @keyframes hide-w {
55
+ 0%{
56
+ opacity: 1;
57
+ }
58
+
59
+ 100%{
60
+ opacity: 0;
61
+ }
62
+ }
63
+
64
+ @keyframes logo-show {
65
+ 0% {
66
+ opacity: 0;
67
+ }
68
+
69
+ 100% {
70
+ opacity: 1;
71
+ }
72
+ }
73
+
74
+ @keyframes tk-show {
75
+ 0% {
76
+ scale: 0;
77
+ }
78
+
79
+ 100% {
80
+ scale: 1;
81
+ }
82
+ }
83
+
84
+ @keyframes module-show {
85
+ 0% {
86
+ margin-top: 0;
87
+ opacity: 0;
88
+ }
89
+
90
+ 100% {
91
+ margin-top: 5%;
92
+ opacity: 1;
93
+ }
94
+ }