@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
@@ -0,0 +1,158 @@
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: rgba(var(--ion-color-sparkle-rgb), var(--bg-alpha, 0.06));
121
+ flex: 0 0 auto;
122
+ text-align: center;
123
+ color: #c0873c;
124
+ flex-basis: 100px;
125
+ margin-bottom: 14px;
126
+ }
127
+ .toggle-mode {
128
+ color: #888;
129
+ }
130
+
131
+ .cloud {
132
+ display: inline;
133
+ list-style-type: none;
134
+ width: 400px;
135
+ }
136
+ .cloud > div {
137
+ list-style: none;
138
+ display: inline;
139
+ padding: 20px;
140
+ }
141
+ .cloud > div:nth-of-type(3n + 1) {
142
+ font-size: 1.25em;
143
+ }
144
+ .cloud > div:nth-of-type(4n + 3) {
145
+ font-size: 1.5em;
146
+ }
147
+ .cloud > div:nth-of-type(5n - 3) {
148
+ font-size: 1em;
149
+ }
150
+
151
+ .bar-graph-column {
152
+ display: flex;
153
+ align-items: flex-end;
154
+ }
155
+ .bar-graph-questions {
156
+ display: flex;
157
+ align-items: flex-start;
158
+ }
@@ -0,0 +1,274 @@
1
+ import { Component, Element, State, Prop, Listen, h, Watch } from '@stencil/core';
2
+ import { SignalRService } from '../../../services/signalR.service';
3
+ import signalRStore from '../../../stores/signalR.store';
4
+ export class SparkleDiscussionResults {
5
+ constructor() {
6
+ this.allowPostToFeed = false;
7
+ this.feedStartingText = 'My suggestions are:';
8
+ this.isTeacherMode = false;
9
+ this.questions = [];
10
+ this.error = '';
11
+ this.modelChange = '';
12
+ this.responses = [];
13
+ this.tempResponses = [];
14
+ this.suggestionList = [];
15
+ }
16
+ questionsChaged(newValue, _oldValue) {
17
+ this.setupData(newValue);
18
+ }
19
+ //Any child component can liste for server events like
20
+ gotServerUpdate(evt) {
21
+ if (this.isTeacherMode) {
22
+ var detail = evt.detail;
23
+ if (detail.type == 'list') {
24
+ detail.data.forEach(element => {
25
+ if (element.responseType == 'TEXT') {
26
+ this.addToWordCloud(element);
27
+ }
28
+ else if (element.responseType == 'MULTIPLE-CHOICE') {
29
+ this.addToBarChart(element);
30
+ }
31
+ });
32
+ }
33
+ else if (detail.type == 'removed') {
34
+ this.responses = [...this.tempResponses];
35
+ }
36
+ else {
37
+ detail = detail.data;
38
+ if (detail.responseType == 'TEXT') {
39
+ this.addToWordCloud(detail);
40
+ }
41
+ else if (detail.responseType == 'MULTIPLE-CHOICE') {
42
+ this.addToBarChart(detail);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ addToWordCloud(q) {
48
+ var isExistObj = this.responses.find(x => x.question == q.question);
49
+ if (isExistObj) {
50
+ this.responses = this.responses.map(resp => {
51
+ if (resp.question == q.question) {
52
+ return q;
53
+ }
54
+ return resp;
55
+ });
56
+ }
57
+ else {
58
+ this.responses = [...this.responses, q];
59
+ }
60
+ console.log(this.responses);
61
+ }
62
+ addToBarChart(q) {
63
+ var isExistObj = this.responses.find(x => x.question == q.question);
64
+ if (isExistObj) {
65
+ isExistObj.responses = isExistObj.responses.map(resp => {
66
+ var correctData = q.responses.find(x => x.response == resp.response);
67
+ if (correctData) {
68
+ return correctData;
69
+ }
70
+ return resp;
71
+ });
72
+ isExistObj.total = q.total;
73
+ this.responses = this.responses.map(resp => {
74
+ if (resp.question == isExistObj.question) {
75
+ return isExistObj;
76
+ }
77
+ return resp;
78
+ });
79
+ }
80
+ else {
81
+ this.responses = [...this.responses, q];
82
+ }
83
+ }
84
+ componentDidLoad() {
85
+ if (this.questions) {
86
+ this.setupData(this.questions);
87
+ signalRStore.onChange('connected', connected => {
88
+ if (connected && this.isTeacherMode) {
89
+ SignalRService.getInstance().callSignalR('GetPollSubmission', { pageUrl: window.location.href });
90
+ }
91
+ });
92
+ }
93
+ }
94
+ setupData(questions) {
95
+ this.setupResponseGraph(questions);
96
+ // if (this.isTeacherMode) {
97
+ // SignalRService.getInstance().callSignalR('GetPollSubmission', {});
98
+ // }
99
+ }
100
+ resetPollData() {
101
+ SignalRService.getInstance().callSignalR('ResetPollData', {});
102
+ }
103
+ setupResponseGraph(questions) {
104
+ this.responses = [];
105
+ questions.forEach(q => {
106
+ if (q.questionType == 'TEXT') {
107
+ this.responses = [
108
+ ...this.responses,
109
+ {
110
+ question: q.questionText,
111
+ responseType: q.questionType,
112
+ responses: [],
113
+ total: 0,
114
+ },
115
+ ];
116
+ this.tempResponses = this.responses.slice();
117
+ }
118
+ else if (q.questionType == 'MULTIPLE-CHOICE') {
119
+ var answer = [];
120
+ Object.keys(q.options).map((o) => {
121
+ answer.push({ count: 0, response: q.options[o].option });
122
+ });
123
+ this.responses = [...this.responses, { question: q.questionText, responseType: q.questionType, responses: answer, total: 0 }];
124
+ this.tempResponses = this.responses.slice();
125
+ }
126
+ });
127
+ console.log(this.responses);
128
+ }
129
+ columnHeight(responseCount, totalResponseCount) {
130
+ let maxScale = 100;
131
+ let scaleUnit = 0;
132
+ if (totalResponseCount != 0) {
133
+ scaleUnit = maxScale / totalResponseCount;
134
+ }
135
+ var size = scaleUnit * responseCount;
136
+ return { height: `${size}px` };
137
+ }
138
+ getRandomColorAndFontSize(count) {
139
+ const h = Math.floor(Math.random() * 360), s = Math.floor(Math.random() * 100) + '%', l = Math.floor(Math.random() * 60) + '%';
140
+ let fontSize = 1;
141
+ if (count > 0) {
142
+ fontSize = fontSize + (count - 1) * 0.25;
143
+ }
144
+ return { 'color': `hsl(${h},${s},${l})`, 'font-size': `${fontSize}em` };
145
+ }
146
+ renderResults() {
147
+ console.log('Responsed', this.responses);
148
+ var barResponses = this.responses.filter(x => x.responseType == 'MULTIPLE-CHOICE');
149
+ var cloudResponses = this.responses.filter(x => x.responseType == 'TEXT');
150
+ return [
151
+ // <ion-button size="default" slot="end" color="primary" onClick={(evt) => this.resetPollData()} >Reset</ion-button>,
152
+ barResponses.map((q) => (h("div", null,
153
+ ' ',
154
+ h("h3", { class: "line" }, q.question),
155
+ h("div", { class: "graph-container" },
156
+ h("div", { class: "bar-graph-column" }, q.responses.map(r => (h("div", { class: "answer-column", style: this.columnHeight(r.count, q.total) }, r.count)))),
157
+ h("div", { class: "bar-graph-questions" }, q.responses.map(r => (h("div", { class: 'question' },
158
+ h("p", null, r.response))))))))),
159
+ cloudResponses.map(q => [
160
+ h("p", null,
161
+ h("h3", { class: "line" }, q.question)),
162
+ h("div", { class: "cloud" }, q.responses.map(r => (h("div", { style: this.getRandomColorAndFontSize(r.count) }, r.response)))),
163
+ ]),
164
+ ];
165
+ }
166
+ render() {
167
+ return this.renderResults();
168
+ }
169
+ static get is() { return "sparkle-discussion-results"; }
170
+ static get originalStyleUrls() { return {
171
+ "$": ["sparkle-discussion-results.css"]
172
+ }; }
173
+ static get styleUrls() { return {
174
+ "$": ["sparkle-discussion-results.css"]
175
+ }; }
176
+ static get properties() { return {
177
+ "allowPostToFeed": {
178
+ "type": "boolean",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "boolean",
182
+ "resolved": "boolean",
183
+ "references": {}
184
+ },
185
+ "required": false,
186
+ "optional": false,
187
+ "docs": {
188
+ "tags": [],
189
+ "text": ""
190
+ },
191
+ "attribute": "allow-post-to-feed",
192
+ "reflect": false,
193
+ "defaultValue": "false"
194
+ },
195
+ "feedStartingText": {
196
+ "type": "string",
197
+ "mutable": false,
198
+ "complexType": {
199
+ "original": "string",
200
+ "resolved": "string",
201
+ "references": {}
202
+ },
203
+ "required": false,
204
+ "optional": false,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": ""
208
+ },
209
+ "attribute": "feed-starting-text",
210
+ "reflect": false,
211
+ "defaultValue": "'My suggestions are:'"
212
+ },
213
+ "isTeacherMode": {
214
+ "type": "boolean",
215
+ "mutable": false,
216
+ "complexType": {
217
+ "original": "boolean",
218
+ "resolved": "boolean",
219
+ "references": {}
220
+ },
221
+ "required": false,
222
+ "optional": false,
223
+ "docs": {
224
+ "tags": [],
225
+ "text": ""
226
+ },
227
+ "attribute": "is-teacher-mode",
228
+ "reflect": false,
229
+ "defaultValue": "false"
230
+ },
231
+ "questions": {
232
+ "type": "unknown",
233
+ "mutable": false,
234
+ "complexType": {
235
+ "original": "Array<SparkleQuizQuestion>",
236
+ "resolved": "SparkleQuizQuestion[]",
237
+ "references": {
238
+ "Array": {
239
+ "location": "global"
240
+ },
241
+ "SparkleQuizQuestion": {
242
+ "location": "import",
243
+ "path": "../../../models/quiz.model"
244
+ }
245
+ }
246
+ },
247
+ "required": false,
248
+ "optional": false,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": ""
252
+ },
253
+ "defaultValue": "[]"
254
+ }
255
+ }; }
256
+ static get states() { return {
257
+ "error": {},
258
+ "modelChange": {},
259
+ "responses": {},
260
+ "suggestionList": {}
261
+ }; }
262
+ static get elementRef() { return "el"; }
263
+ static get watchers() { return [{
264
+ "propName": "questions",
265
+ "methodName": "questionsChaged"
266
+ }]; }
267
+ static get listeners() { return [{
268
+ "name": "receivedPollSubmissionSignalREvent",
269
+ "method": "gotServerUpdate",
270
+ "target": "body",
271
+ "capture": false,
272
+ "passive": false
273
+ }]; }
274
+ }
@@ -0,0 +1,5 @@
1
+ sparkle-discussion{
2
+ border: 1px solid var(--line-rule-color);
3
+ display: block;
4
+ padding: 12px;
5
+ }
@@ -0,0 +1,112 @@
1
+ import { Component, Element, State, Prop, h } from '@stencil/core';
2
+ import { AssetsService, EnvironmentConfigService } from '../../services';
3
+ export class SparkleDiscussion {
4
+ constructor() {
5
+ this.allowPostToFeed = false;
6
+ this.feedStartingText = 'My suggestions are:';
7
+ this.isTeacherMode = false;
8
+ this.quizData = [];
9
+ }
10
+ async componentDidLoad() {
11
+ this.isTeacherMode = this.isTeacherMode == false ? window.location.href.indexOf('/presentation/course') > -1 : this.isTeacherMode;
12
+ const config = EnvironmentConfigService.getInstance().get('sparkle');
13
+ let allQuizData = await AssetsService.getInstance().loadJsonFile(config.quizPath);
14
+ if (allQuizData) {
15
+ if (this.questionIds) {
16
+ let questionIds = this.questionIds.split(',');
17
+ this.quizData = [];
18
+ questionIds.forEach(id => {
19
+ this.quizData = [...this.quizData, allQuizData[+id]];
20
+ });
21
+ console.log('QUIZ Data', this.quizData);
22
+ }
23
+ }
24
+ }
25
+ render() {
26
+ return this.isTeacherMode ? (h("sparkle-discussion-results", { allowPostToFeed: this.allowPostToFeed, feedStartingText: this.feedStartingText, isTeacherMode: this.isTeacherMode, questions: this.quizData })) : (h("sparkle-discussion-questions", { allowPostToFeed: this.allowPostToFeed, feedStartingText: this.feedStartingText, isTeacherMode: this.isTeacherMode, questions: this.quizData }));
27
+ }
28
+ static get is() { return "sparkle-discussion"; }
29
+ static get originalStyleUrls() { return {
30
+ "$": ["sparkle-discussion.css"]
31
+ }; }
32
+ static get styleUrls() { return {
33
+ "$": ["sparkle-discussion.css"]
34
+ }; }
35
+ static get properties() { return {
36
+ "allowPostToFeed": {
37
+ "type": "boolean",
38
+ "mutable": false,
39
+ "complexType": {
40
+ "original": "boolean",
41
+ "resolved": "boolean",
42
+ "references": {}
43
+ },
44
+ "required": false,
45
+ "optional": false,
46
+ "docs": {
47
+ "tags": [],
48
+ "text": ""
49
+ },
50
+ "attribute": "allow-post-to-feed",
51
+ "reflect": false,
52
+ "defaultValue": "false"
53
+ },
54
+ "feedStartingText": {
55
+ "type": "string",
56
+ "mutable": false,
57
+ "complexType": {
58
+ "original": "string",
59
+ "resolved": "string",
60
+ "references": {}
61
+ },
62
+ "required": false,
63
+ "optional": false,
64
+ "docs": {
65
+ "tags": [],
66
+ "text": ""
67
+ },
68
+ "attribute": "feed-starting-text",
69
+ "reflect": false,
70
+ "defaultValue": "'My suggestions are:'"
71
+ },
72
+ "isTeacherMode": {
73
+ "type": "boolean",
74
+ "mutable": true,
75
+ "complexType": {
76
+ "original": "boolean",
77
+ "resolved": "boolean",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": false,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": ""
85
+ },
86
+ "attribute": "is-teacher-mode",
87
+ "reflect": false,
88
+ "defaultValue": "false"
89
+ },
90
+ "questionIds": {
91
+ "type": "string",
92
+ "mutable": false,
93
+ "complexType": {
94
+ "original": "string",
95
+ "resolved": "string",
96
+ "references": {}
97
+ },
98
+ "required": false,
99
+ "optional": false,
100
+ "docs": {
101
+ "tags": [],
102
+ "text": ""
103
+ },
104
+ "attribute": "question-ids",
105
+ "reflect": false
106
+ }
107
+ }; }
108
+ static get states() { return {
109
+ "quizData": {}
110
+ }; }
111
+ static get elementRef() { return "el"; }
112
+ }