@sparkle-learning/core 0.0.52 → 0.0.54

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.
Files changed (148) hide show
  1. package/dist/cjs/{PrivateRoute-074c584e.js → PrivateRoute-e2047db2.js} +18 -30
  2. package/dist/cjs/{feed.service-b4f09441.js → appdata.service-d28cf2d6.js} +4 -56
  3. package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
  4. package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
  5. package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-0b9f6ac7.js} +1 -1
  6. package/dist/cjs/feed.service-6df9382f.js +57 -0
  7. package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +289 -3279
  8. package/dist/cjs/{httpService-7211d93b.js → httpService-d8a5b474.js} +13 -11
  9. package/dist/cjs/index.cjs.js +5 -4
  10. package/dist/cjs/{ion-select_2.cjs.entry.js → ion-select_3.cjs.entry.js} +127 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/media.service-2bc73d37.js +40 -0
  13. package/dist/cjs/signalR.service-0d5da1d3.js +2985 -0
  14. package/dist/cjs/sparkle-animation-player.cjs.entry.js +2 -1
  15. package/dist/cjs/sparkle-assignment.cjs.entry.js +25 -0
  16. package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
  17. package/dist/cjs/sparkle-core.cjs.js +1 -1
  18. package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +281 -0
  19. package/dist/cjs/sparkle-discussion.cjs.entry.js +42 -0
  20. package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
  21. package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
  22. package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
  23. package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
  24. package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
  25. package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
  26. package/dist/cjs/{student.service-2e58f237.js → student.service-d8ec2551.js} +1 -1
  27. package/dist/cjs/token.service-bfb0089b.js +86 -0
  28. package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
  29. package/dist/collection/PrivateRoute.js +2 -2
  30. package/dist/collection/collection-manifest.json +6 -2
  31. package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
  32. package/dist/collection/components/layout/page/page.css +4 -0
  33. package/dist/collection/components/layout/page/page.js +39 -26
  34. package/dist/collection/components/sparkle-animation-player/sparkle-animation-player.js +1 -0
  35. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +3 -0
  36. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +25 -0
  37. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
  38. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
  39. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +12 -1
  40. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.css +157 -0
  41. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +232 -0
  42. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.css +158 -0
  43. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +274 -0
  44. package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
  45. package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +112 -0
  46. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -67
  47. package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
  48. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
  49. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
  50. package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
  51. package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
  52. package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
  53. package/dist/collection/services/assignment.service.js +14 -0
  54. package/dist/collection/services/auth/auth.service.js +15 -14
  55. package/dist/collection/services/environment/environment-config.js +1 -1
  56. package/dist/collection/services/environment/environment-config.service.js +0 -1
  57. package/dist/collection/services/httpService.js +12 -10
  58. package/dist/collection/services/signalR.service.js +17 -19
  59. package/dist/collection/services/token.service.js +68 -0
  60. package/dist/collection/util.js +5 -2
  61. package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-c6e80d5d.js} +17 -29
  62. package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-d1058e00.js} +5 -55
  63. package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
  64. package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
  65. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-53e05a01.js} +1 -1
  66. package/dist/esm/feed.service-8385ad7a.js +54 -0
  67. package/dist/esm/header-mobile-collapse_61.entry.js +278 -3268
  68. package/dist/esm/{httpService-7b75b095.js → httpService-db476835.js} +13 -11
  69. package/dist/esm/index.js +5 -4
  70. package/dist/esm/{ion-select_2.entry.js → ion-select_3.entry.js} +127 -1
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/media.service-b68cbfff.js +37 -0
  73. package/dist/esm/signalR.service-4a2d5a92.js +2982 -0
  74. package/dist/esm/sparkle-animation-player.entry.js +2 -1
  75. package/dist/esm/sparkle-assignment.entry.js +21 -0
  76. package/dist/esm/sparkle-character-intro.entry.js +3 -3
  77. package/dist/esm/sparkle-core.js +1 -1
  78. package/dist/esm/sparkle-discussion-questions_2.entry.js +276 -0
  79. package/dist/esm/sparkle-discussion.entry.js +38 -0
  80. package/dist/esm/sparkle-facilitator-notes-form.entry.js +5 -3
  81. package/dist/esm/sparkle-feedback.entry.js +5 -3
  82. package/dist/esm/sparkle-goal-form.entry.js +8 -5
  83. package/dist/esm/sparkle-quiz-container.entry.js +1 -1
  84. package/dist/esm/sparkle-quiz-old.entry.js +116 -0
  85. package/dist/esm/sparkle-quiz.entry.js +31 -48
  86. package/dist/esm/{student.service-0746418b.js → student.service-6457aaa0.js} +1 -1
  87. package/dist/esm/token.service-20f1a256.js +83 -0
  88. package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
  89. package/dist/sparkle-core/index.esm.js +1 -1
  90. package/dist/sparkle-core/p-11ac00b0.js +1 -0
  91. package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
  92. package/dist/sparkle-core/{p-5efc6566.js → p-17b6b07e.js} +1 -1
  93. package/dist/sparkle-core/p-33a7151d.entry.js +1 -0
  94. package/dist/sparkle-core/{p-fbccd30c.js → p-38f707fb.js} +1 -1
  95. package/dist/sparkle-core/p-38fa5987.js +1 -0
  96. package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
  97. package/dist/sparkle-core/p-630a4fa0.js +1 -0
  98. package/dist/sparkle-core/{p-0335c863.entry.js → p-6a1fc0af.entry.js} +26 -26
  99. package/dist/sparkle-core/p-6fab3a4b.js +1 -0
  100. package/dist/sparkle-core/p-71720d6e.entry.js +1 -0
  101. package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
  102. package/dist/sparkle-core/p-85d4cd5c.entry.js +1 -0
  103. package/dist/sparkle-core/p-967a2ed7.js +1 -0
  104. package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
  105. package/dist/sparkle-core/p-98f7780c.entry.js +1 -0
  106. package/dist/sparkle-core/p-bd90903e.js +1 -0
  107. package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
  108. package/dist/sparkle-core/{p-564e64fc.entry.js → p-ca907214.entry.js} +2 -2
  109. package/dist/sparkle-core/p-d51f30ca.js +1 -0
  110. package/dist/sparkle-core/p-dcff298d.entry.js +1 -0
  111. package/dist/sparkle-core/p-e50c8b04.entry.js +1 -0
  112. package/dist/sparkle-core/p-ed9de327.js +1 -0
  113. package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
  114. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  115. package/dist/types/components/layout/page/page.d.ts +2 -0
  116. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +6 -0
  117. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  118. package/dist/types/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.d.ts +28 -0
  119. package/dist/types/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.d.ts +45 -0
  120. package/dist/types/components/sparkle-discussion/sparkle-discussion.d.ts +11 -0
  121. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +3 -2
  122. package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
  123. package/dist/types/components/sparkle-quiz/sparkle-quiz.d.ts +36 -36
  124. package/dist/types/components.d.ts +115 -37
  125. package/dist/types/models/class.model.d.ts +4 -0
  126. package/dist/types/services/assignment.service.d.ts +8 -0
  127. package/dist/types/services/auth/auth.service.d.ts +1 -1
  128. package/dist/types/services/environment/environment-config.d.ts +3 -0
  129. package/dist/types/services/token.service.d.ts +12 -0
  130. package/dist/types/util.d.ts +1 -0
  131. package/package.json +1 -1
  132. package/dist/cjs/sparkle-feed-post.cjs.entry.js +0 -124
  133. package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
  134. package/dist/esm/sparkle-feed-post.entry.js +0 -120
  135. package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
  136. package/dist/sparkle-core/p-15403881.entry.js +0 -1
  137. package/dist/sparkle-core/p-1d4c7c11.js +0 -1
  138. package/dist/sparkle-core/p-370609ba.entry.js +0 -1
  139. package/dist/sparkle-core/p-41a9ece7.entry.js +0 -1
  140. package/dist/sparkle-core/p-462bffba.js +0 -1
  141. package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
  142. package/dist/sparkle-core/p-600cf6a3.js +0 -1
  143. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  144. package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
  145. package/dist/sparkle-core/p-b226f54d.js +0 -1
  146. package/dist/types/components/sparkle-quiz/sparkle-quiz-v1.d.ts +0 -41
  147. /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
  148. /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -3,7 +3,7 @@ import templates from './templates';
3
3
  import { modalController, alertController } from '@ionic/core';
4
4
  import { AuthStore } from '../../../stores/auth.store';
5
5
  import userStore from '../../../stores/user.store';
6
- import { StoreService } from "../../../services/store.service";
6
+ import { StoreService } from '../../../services/store.service';
7
7
  import { SignalRService } from '../../../services/signalR.service';
8
8
  import signalRStore from '../../../stores/signalR.store';
9
9
  export class SparklePage {
@@ -11,7 +11,15 @@ export class SparklePage {
11
11
  this.presentation = false;
12
12
  this.page = { title: null, path: null, body: null, pageInfo: null };
13
13
  this.isLesson = false;
14
- this.handleFacilitatorNavigationChange = (url) => {
14
+ this.eventEmitter = (user, data) => {
15
+ let event = new CustomEvent('receivedSignalREvent', { detail: JSON.parse(data) });
16
+ document.body.dispatchEvent(event);
17
+ };
18
+ this.pollSubmissionEventEmitter = (type, data) => {
19
+ let event = new CustomEvent('receivedPollSubmissionSignalREvent', { detail: { data: data, type: type } });
20
+ document.body.dispatchEvent(event);
21
+ };
22
+ this.handleFacilitatorNavigationChange = url => {
15
23
  this.history.replace(url, {});
16
24
  };
17
25
  this.validateFetch = (response) => {
@@ -24,7 +32,7 @@ export class SparklePage {
24
32
  this.badFetch = null;
25
33
  this.page = page;
26
34
  if (this.presentation) {
27
- this.page = Object.assign(Object.assign({}, this.page), { previousUrl: "/presentation" + this.page.previousUrl, nextUrl: "/presentation" + this.page.nextUrl });
35
+ this.page = Object.assign(Object.assign({}, this.page), { previousUrl: '/presentation' + this.page.previousUrl, nextUrl: '/presentation' + this.page.nextUrl });
28
36
  }
29
37
  StoreService.getInstance().UpdateTocPageInfo(this.page.pageInfo);
30
38
  this.isLesson = this.page.pageInfo.pageId > 0;
@@ -36,7 +44,7 @@ export class SparklePage {
36
44
  title: error.statusText,
37
45
  body: null,
38
46
  path: null,
39
- pageInfo: null
47
+ pageInfo: null,
40
48
  };
41
49
  };
42
50
  }
@@ -47,19 +55,25 @@ export class SparklePage {
47
55
  }
48
56
  componentDidLoad() {
49
57
  if (this.presentation) {
50
- signalRStore.onChange("connected", (connected) => {
58
+ signalRStore.onChange('connected', connected => {
51
59
  if (connected) {
52
- SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
60
+ SignalRService.getInstance().connection.on('SendMessage', this.eventEmitter);
61
+ SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
62
+ SignalRService.getInstance().connection.on('PollSubmission', this.pollSubmissionEventEmitter);
63
+ }
64
+ else {
65
+ SignalRService.getInstance().connection.off('SendMessage', this.eventEmitter);
66
+ SignalRService.getInstance().connection.off('PollSubmission', this.eventEmitter);
67
+ SignalRService.getInstance().connection.off('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
53
68
  }
54
69
  });
55
70
  }
56
71
  }
57
72
  fetchPage(path, oldPath) {
58
- if (SignalRService.getInstance().connection.connectionState == "Connected") {
59
- SignalRService.getInstance().callSignalR("OnStudentNavigate", { url: window.location.href });
73
+ if (SignalRService.getInstance().connection._connectionState == 'Connected') {
74
+ SignalRService.getInstance().callSignalR('OnStudentNavigate', { url: window.location.href });
60
75
  if (this.presentation) {
61
- console.log('register listener');
62
- SignalRService.getInstance().connection.on("NavigateFacilitatorPresentationCourseTo", this.handleFacilitatorNavigationChange);
76
+ SignalRService.getInstance().connection.on('NavigateFacilitatorPresentationCourseTo', this.handleFacilitatorNavigationChange);
63
77
  }
64
78
  }
65
79
  if (path === null || path === oldPath) {
@@ -130,7 +144,7 @@ export class SparklePage {
130
144
  async presentFeedbackModal() {
131
145
  const modal = await modalController.create({
132
146
  component: 'sparkle-feedback',
133
- cssClass: 'sparkle-modal sparkle-feedback-modal'
147
+ cssClass: 'sparkle-modal sparkle-feedback-modal',
134
148
  });
135
149
  await modal.present();
136
150
  }
@@ -161,22 +175,21 @@ export class SparklePage {
161
175
  text: 'Cancel',
162
176
  role: 'cancel',
163
177
  cssClass: 'secondary',
164
- handler: () => {
165
- }
166
- }, {
178
+ handler: () => { },
179
+ },
180
+ {
167
181
  text: 'Ok',
168
- handler: (data) => {
169
- }
170
- }
171
- ]
182
+ handler: data => { },
183
+ },
184
+ ],
172
185
  });
173
186
  await alert.present();
174
187
  }
175
188
  openWindows() {
176
189
  //this.jwtService.updateDefaultCourseClassId(data);
177
- window.open(window.location.origin + "/presentation" + this.path.replace(".json", ""), "_blank");
190
+ window.open(window.location.origin + '/presentation' + this.path.replace('.json', ''), '_blank');
178
191
  setTimeout(() => {
179
- window.open(window.location.origin + "/presentation" + '/teacher' + this.path.replace(".json", ""), "_blank");
192
+ window.open(window.location.origin + '/presentation' + '/teacher' + this.path.replace('.json', ''), '_blank');
180
193
  }, 500);
181
194
  }
182
195
  renderControls() {
@@ -184,10 +197,10 @@ export class SparklePage {
184
197
  return (h("div", { class: "controls" },
185
198
  h("ion-button", { onClick: () => this.presentFeedbackModal() },
186
199
  h("ion-icon", { name: "chatbox-outline" })),
187
- this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && h("ion-button", { onClick: () => this.openProjectorPage() },
188
- h("ion-icon", { name: "desktop-outline" }))));
200
+ this.isLesson && userStore.state.user && userStore.state.user.Roles.indexOf('Facilitator') > -1 && (h("ion-button", { onClick: () => this.openProjectorPage() },
201
+ h("ion-icon", { name: "desktop-outline" })))));
189
202
  }
190
- return "";
203
+ return '';
191
204
  }
192
205
  render() {
193
206
  if (this.path) {
@@ -199,13 +212,13 @@ export class SparklePage {
199
212
  const content = [
200
213
  h("main", { class: 'no-demo' },
201
214
  this.renderControls(),
202
- h(Template, { page: page }))
215
+ h(Template, { page: page })),
203
216
  ];
204
217
  return content;
205
218
  }
206
219
  else {
207
- return h("main", { class: 'no-demo' },
208
- h("slot", null));
220
+ return (h("main", { class: 'no-demo' },
221
+ h("slot", null)));
209
222
  }
210
223
  }
211
224
  static get is() { return "sparkle-page"; }
@@ -282,6 +282,7 @@ export class SparkleAnimationPlayer {
282
282
  this.captionText = this.captionData[Math.floor(this.timeline.position / this.library.properties.fps)];
283
283
  }
284
284
  if (this.timeline.position % 10 == 0) {
285
+ console.log(this.timeline.duration - 10, this.timeline.position);
285
286
  if (this.timeline.position > (this.timeline.duration - 10)) {
286
287
  this.animationCompleted();
287
288
  }
@@ -0,0 +1,3 @@
1
+ :host {
2
+ display: block;
3
+ }
@@ -0,0 +1,25 @@
1
+ import { Component, Element, State, Host, h } from '@stencil/core';
2
+ export class SparkleAssignment {
3
+ constructor() {
4
+ this.submitted = true;
5
+ }
6
+ async onSubmit(e) {
7
+ e.preventDefault();
8
+ this.submitted = true;
9
+ let isFormValid = true;
10
+ }
11
+ render() {
12
+ return h(Host, null, "Assignment");
13
+ }
14
+ static get is() { return "sparkle-assignment"; }
15
+ static get originalStyleUrls() { return {
16
+ "$": ["sparkle-assignment.scss"]
17
+ }; }
18
+ static get styleUrls() { return {
19
+ "$": ["sparkle-assignment.css"]
20
+ }; }
21
+ static get states() { return {
22
+ "submitted": {}
23
+ }; }
24
+ static get elementRef() { return "el"; }
25
+ }
@@ -8,6 +8,13 @@ sparkle-character-intro .character-phrase-block {
8
8
  align-items: center;
9
9
  padding: 20px;
10
10
  }
11
+ sparkle-character-intro.shift-up .character-phrase-block {
12
+ padding-top: 0px !important;
13
+ }
14
+ sparkle-character-intro.shift-up-overlap .character-phrase-block {
15
+ padding-top: 0px !important;
16
+ margin-top: -50px !important;
17
+ }
11
18
  sparkle-character-intro .character-phrase-block.right {
12
19
  justify-content: flex-end;
13
20
  }
@@ -21,7 +28,7 @@ sparkle-character-intro .character-phrase-block.left .character-image-block {
21
28
  order: 1;
22
29
  }
23
30
  sparkle-character-intro .character-box {
24
- min-width: 300px;
31
+ width: 80%;
25
32
  border-radius: 15px;
26
33
  background: var(--sparkle-character-background-color);
27
34
  color: var(--text-color);
@@ -1,4 +1,4 @@
1
- import { Component, Element, Prop, getAssetPath, h } from '@stencil/core';
1
+ import { Component, Element, Prop, getAssetPath, Host, h } from '@stencil/core';
2
2
  export class SparkleCharacterIntro {
3
3
  constructor() {
4
4
  this.character = 'jen';
@@ -8,11 +8,12 @@ export class SparkleCharacterIntro {
8
8
  console.log(this.character);
9
9
  }
10
10
  render() {
11
- return (h("div", { class: `character-phrase-block ${this.position}` },
12
- h("div", { class: `character-box ${this.position}` },
13
- h("slot", null)),
14
- h("div", { class: `character-image-block ${this.position}` },
15
- h("img", { class: "image-animation", src: getAssetPath('./assets/characters/' + this.character + '.png') }))));
11
+ return (h(Host, null,
12
+ h("div", { class: `character-phrase-block ${this.position}` },
13
+ h("div", { class: `character-box ${this.position}` },
14
+ h("slot", null)),
15
+ h("div", { class: `character-image-block ${this.position}` },
16
+ h("img", { class: "image-animation", src: getAssetPath('./assets/characters/' + this.character + '.png') })))));
16
17
  }
17
18
  static get is() { return "sparkle-character-intro"; }
18
19
  static get originalStyleUrls() { return {
@@ -62,3 +63,6 @@ export class SparkleCharacterIntro {
62
63
  }; }
63
64
  static get elementRef() { return "el"; }
64
65
  }
66
+ //README
67
+ //To set custom margin top use following class selector
68
+ //sparkle-character-intro.shift-up-overlap .character-phrase-block { maring-top:-100px !important;}
@@ -1,4 +1,4 @@
1
- import { Component, State, Event, Watch, Build, h } from '@stencil/core';
1
+ import { Component, State, Event, Watch, Build, h, Listen } from '@stencil/core';
2
2
  import { injectHistory } from '@stencil/router';
3
3
  import { PrivateRoute } from '../../PrivateRoute';
4
4
  import { AssetsService } from '../../services/core/assets.service';
@@ -63,6 +63,10 @@ export class SparkleCourseRoot {
63
63
  var sidebar = document.getElementById('onlineStudents');
64
64
  await sidebar.show();
65
65
  }
66
+ useDidLogin(event) {
67
+ console.log('Received the userDidLogInevent: ', event.detail);
68
+ return h("stencil-router-redirect", { url: "/home" });
69
+ }
66
70
  renderPage(path) {
67
71
  return (h("stencil-route", { url: '/' + path, routeRender: props => [
68
72
  this.renderHeaderAndMenu(),
@@ -181,5 +185,12 @@ export class SparkleCourseRoot {
181
185
  "propName": "isMenuToggled",
182
186
  "methodName": "lockScroll"
183
187
  }]; }
188
+ static get listeners() { return [{
189
+ "name": "userDidLogIn",
190
+ "method": "useDidLogin",
191
+ "target": undefined,
192
+ "capture": false,
193
+ "passive": false
194
+ }]; }
184
195
  }
185
196
  injectHistory(SparkleCourseRoot);
@@ -0,0 +1,157 @@
1
+ div.question {
2
+ margin-bottom: 5px;
3
+ }
4
+ div.question ul {
5
+ padding-left: 5px;
6
+ }
7
+ div.question li {
8
+ list-style-type: none;
9
+ cursor: pointer;
10
+ background: #e5053a;
11
+ border-radius: 4px;
12
+ vertical-align: middle;
13
+ line-height: 40px;
14
+ padding-left: 20px;
15
+ color: #fff;
16
+ margin-bottom: 5px;
17
+ }
18
+ .question h3 {
19
+ color: #333;
20
+ padding-top: 14px;
21
+ margin-bottom: 4px;
22
+ font-size: 16px;
23
+ }
24
+ div.question li.selected {
25
+ font-weight: bold;
26
+ background: #9e0428;
27
+ }
28
+ input[type='text'] {
29
+ width: 100%;
30
+ padding: 12px 20px;
31
+ margin: 8px 0;
32
+ box-sizing: border-box;
33
+ border: 2px solid #ccc;
34
+ -webkit-transition: 0.5s;
35
+ transition: 0.5s;
36
+ outline: none;
37
+ }
38
+
39
+ input[type='text']:focus {
40
+ border: 2px solid var(--ion-color-primary);
41
+ }
42
+ ion-item .item-native {
43
+ padding-left: 0px !important;
44
+ }
45
+ ion-button.suggetion-btn {
46
+ margin-left: 0px !important;
47
+ }
48
+
49
+ /* ion-alert {
50
+ .alert-wrapper {
51
+ --min-width: 320px;
52
+ border: 1px solid #e5053a !important;
53
+ }
54
+ .alert-button {
55
+ background-color: var(--ion-color-primary);
56
+ color: #fff;
57
+ }
58
+ .alert-button-group button {
59
+ background-color: var(--ion-color-primary) !important;
60
+ color: #fff !important;
61
+ }
62
+ .alert-button-group {
63
+ justify-content: space-between !important;
64
+ padding: 10px 12px 10px 24px !important;
65
+ }
66
+ .alert-radio-icon {
67
+ display: none !important;
68
+ }
69
+ .alert-head {
70
+ display: none;
71
+ }
72
+ .alert-radio-label {
73
+ padding: 13px 26px 13px 34px !important;
74
+ }
75
+ .alert-radio-group {
76
+ padding: 20px 0px !important;
77
+ border-bottom: none !important;
78
+ }
79
+ .alert-radio-button {
80
+ &[aria-checked="true"] {
81
+ border-top: 1px solid #e5053a !important;
82
+ border-bottom: 1px solid #e5053a !important;
83
+ .alert-radio-label {
84
+ color: #e5053a !important;
85
+ }
86
+ }
87
+ }
88
+ ion-backdrop {
89
+ opacity: 0.1 !important;
90
+ }
91
+ }
92
+ ion-item {
93
+ ion-label {
94
+ color: var(--ion-color-primary) !important;
95
+ ion-icon {
96
+ transform: rotate(-90deg) !important;
97
+ }
98
+ }
99
+ }
100
+ */
101
+ .graph-container {
102
+ display: flex;
103
+ flex-direction: row;
104
+ flex-wrap: wrap;
105
+ flex-direction: column;
106
+ }
107
+ .graph-container .question-title {
108
+ width: 100%;
109
+ }
110
+ .graph-container div.question {
111
+ display: flex;
112
+ flex-direction: column;
113
+ justify-content: flex-end;
114
+ flex-basis: 100px;
115
+ }
116
+ .graph-container div.question p {
117
+ text-align: center;
118
+ }
119
+ .answer-column {
120
+ background-color: antiquewhite;
121
+ flex: 0 0 auto;
122
+ text-align: center;
123
+ color: #c0873c;
124
+ flex-basis: 100px;
125
+ }
126
+ .toggle-mode {
127
+ color: #888;
128
+ }
129
+
130
+ .cloud {
131
+ display: inline;
132
+ list-style-type: none;
133
+ width: 400px;
134
+ }
135
+ .cloud > div {
136
+ list-style: none;
137
+ display: inline;
138
+ padding: 20px;
139
+ }
140
+ .cloud > div:nth-of-type(3n + 1) {
141
+ font-size: 1.25em;
142
+ }
143
+ .cloud > div:nth-of-type(4n + 3) {
144
+ font-size: 1.5em;
145
+ }
146
+ .cloud > div:nth-of-type(5n - 3) {
147
+ font-size: 1em;
148
+ }
149
+
150
+ .bar-graph-column {
151
+ display: flex;
152
+ align-items: flex-end;
153
+ }
154
+ .bar-graph-questions {
155
+ display: flex;
156
+ align-items: flex-start;
157
+ }
@@ -0,0 +1,232 @@
1
+ import { Component, Element, State, Prop, h } from '@stencil/core';
2
+ import { SignalRService } from '../../../services/signalR.service';
3
+ export class SparkleDiscussionQuestions {
4
+ constructor() {
5
+ this.allowPostToFeed = false;
6
+ this.feedStartingText = 'My suggestions are:';
7
+ this.isTeacherMode = false;
8
+ this.questions = [];
9
+ this.error = '';
10
+ this.modelChange = '';
11
+ this.responses = [];
12
+ this.tempResponses = [];
13
+ this.suggestionList = [];
14
+ this.postToFeedTextValue = '';
15
+ }
16
+ componentDidLoad() { }
17
+ resetPollData() {
18
+ SignalRService.getInstance().callSignalR('ResetPollData', {});
19
+ }
20
+ selectOption(evt, question, option) {
21
+ evt.target.parentElement.childNodes.forEach(e => e.classList.remove('selected'));
22
+ evt.target.classList.add('selected');
23
+ //console.log(question, option);
24
+ SignalRService.getInstance().callSignalR('PollSubmission', {
25
+ questionId: question.questionId,
26
+ question: question.questionText,
27
+ answer: option.option,
28
+ responseType: question.questionType,
29
+ pageUrl: window.location.href,
30
+ });
31
+ }
32
+ addSuggestion(evt, question) {
33
+ var inputVal = evt.target.parentElement.parentElement.querySelector('input[type=text]');
34
+ if (inputVal.value == '' || !inputVal.value) {
35
+ this.error = 'Please enter the value';
36
+ }
37
+ else {
38
+ SignalRService.getInstance().callSignalR('PollSubmission', {
39
+ questionId: question.questionId,
40
+ question: question.questionText,
41
+ answer: inputVal.value,
42
+ responseType: question.questionType,
43
+ pageUrl: window.location.href,
44
+ });
45
+ // this.dataSvc.callSignalR(
46
+ // {
47
+ // questionId: question.questionId,
48
+ // question: question.question,
49
+ // answer: inputVal.value,
50
+ // responseType: question.responseType,
51
+ // },
52
+ // 'PollSubmission',
53
+ // true,
54
+ // );
55
+ //&& question.updateFeedText
56
+ if (this.allowPostToFeed) {
57
+ this.suggestionList.push({ questionId: question.questionId, question: question.questionText, answer: inputVal.value, responseType: question.questionType });
58
+ let value = this.suggestionList
59
+ .map(x => x.answer)
60
+ .join(', ')
61
+ .toString();
62
+ this.postToFeedTextValue = this.feedStartingText + ' ' + value;
63
+ }
64
+ }
65
+ }
66
+ // async presentToast(message: string) {
67
+ // const toast = await this.toastCtrl.create({
68
+ // message: message,
69
+ // duration: 2000
70
+ // });
71
+ // await toast.present();
72
+ // }
73
+ toggleMode() {
74
+ this.isTeacherMode = !this.isTeacherMode;
75
+ }
76
+ renderOptions(question) {
77
+ if (question.questionType == 'MULTIPLE-CHOICE') {
78
+ return (h("ul", null, question.options.map(opt => (h("li", { onClick: evt => this.selectOption(evt, question, opt) }, opt.option)))));
79
+ }
80
+ else if (question.questionType == 'FEEDBACK') {
81
+ let options = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
82
+ return (h("ion-item", null,
83
+ h("ion-label", null,
84
+ "Choose Option ",
85
+ h("ion-icon", { name: "arrow-back", mode: "ios" })),
86
+ h("ion-select", { id: "customAlertSelect", interface: "alert" },
87
+ h("ion-select-option", { value: "bacon" }, "Bacon"),
88
+ h("ion-select-option", { value: "olives" }, "Black Olives"),
89
+ h("ion-select-option", { value: "xcheese" }, "Extra Cheese"),
90
+ h("ion-select-option", { value: "peppers" }, "Green Peppers"),
91
+ h("ion-select-option", { value: "mushrooms" }, "Mushrooms"),
92
+ h("ion-select-option", { value: "onions" }, "Onions"),
93
+ h("ion-select-option", { value: "pepperoni" }, "Pepperoni"),
94
+ h("ion-select-option", { value: "pineapple" }, "Pineapple"),
95
+ h("ion-select-option", { value: "sausage" }, "Sausage"),
96
+ h("ion-select-option", { value: "Spinach" }, "Spinach"))));
97
+ }
98
+ else {
99
+ return (h("div", null,
100
+ h("input", { slot: "start", type: "text", placeholder: "Type suggestion" }),
101
+ h("div", null, this.error),
102
+ h("ion-item", null,
103
+ h("ion-button", { class: "suggetion-btn", size: "default", slot: "end", color: "primary", onClick: evt => this.addSuggestion(evt, question) }, "ADD SUGGESTION"))));
104
+ }
105
+ }
106
+ renderQuestions() {
107
+ return [
108
+ this.questions.map(q => (h("div", { class: 'question' },
109
+ h("h3", null,
110
+ q.questionText,
111
+ ' ',
112
+ h("span", { class: "toggle-mode", onClick: () => this.toggleMode() }, ".")),
113
+ this.renderOptions(q)))),
114
+ this.allowPostToFeed ? h("sparkle-feed-post", { assignmentName: this.postToFeedAssignmentName, textValue: this.postToFeedTextValue }) : '',
115
+ ];
116
+ }
117
+ render() {
118
+ return this.renderQuestions();
119
+ }
120
+ static get is() { return "sparkle-discussion-questions"; }
121
+ static get originalStyleUrls() { return {
122
+ "$": ["sparkle-discussion-questions.css"]
123
+ }; }
124
+ static get styleUrls() { return {
125
+ "$": ["sparkle-discussion-questions.css"]
126
+ }; }
127
+ static get properties() { return {
128
+ "allowPostToFeed": {
129
+ "type": "boolean",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "boolean",
133
+ "resolved": "boolean",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": ""
141
+ },
142
+ "attribute": "allow-post-to-feed",
143
+ "reflect": false,
144
+ "defaultValue": "false"
145
+ },
146
+ "postToFeedAssignmentName": {
147
+ "type": "string",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "string",
151
+ "resolved": "string",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": ""
159
+ },
160
+ "attribute": "post-to-feed-assignment-name",
161
+ "reflect": false
162
+ },
163
+ "feedStartingText": {
164
+ "type": "string",
165
+ "mutable": false,
166
+ "complexType": {
167
+ "original": "string",
168
+ "resolved": "string",
169
+ "references": {}
170
+ },
171
+ "required": false,
172
+ "optional": false,
173
+ "docs": {
174
+ "tags": [],
175
+ "text": ""
176
+ },
177
+ "attribute": "feed-starting-text",
178
+ "reflect": false,
179
+ "defaultValue": "'My suggestions are:'"
180
+ },
181
+ "isTeacherMode": {
182
+ "type": "boolean",
183
+ "mutable": false,
184
+ "complexType": {
185
+ "original": "boolean",
186
+ "resolved": "boolean",
187
+ "references": {}
188
+ },
189
+ "required": false,
190
+ "optional": false,
191
+ "docs": {
192
+ "tags": [],
193
+ "text": ""
194
+ },
195
+ "attribute": "is-teacher-mode",
196
+ "reflect": false,
197
+ "defaultValue": "false"
198
+ },
199
+ "questions": {
200
+ "type": "unknown",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "Array<SparkleQuizQuestion>",
204
+ "resolved": "SparkleQuizQuestion[]",
205
+ "references": {
206
+ "Array": {
207
+ "location": "global"
208
+ },
209
+ "SparkleQuizQuestion": {
210
+ "location": "import",
211
+ "path": "../../../models/quiz.model"
212
+ }
213
+ }
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": ""
220
+ },
221
+ "defaultValue": "[]"
222
+ }
223
+ }; }
224
+ static get states() { return {
225
+ "error": {},
226
+ "modelChange": {},
227
+ "responses": {},
228
+ "suggestionList": {},
229
+ "postToFeedTextValue": {}
230
+ }; }
231
+ static get elementRef() { return "el"; }
232
+ }