guess-the-year-web-component 3.0.2 → 3.2.0

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.
package/README.md CHANGED
@@ -32,12 +32,8 @@ The guess-the-year element accepts parameters to control it's behaviour:
32
32
  * `impact` : fetch incidents had this impact(s). Reference https://swagger.tee-e.com for a list of supported emotions.
33
33
  * `no-image-src` : what image should be shown when an incident's image is broken. Use a url or base64 encoded image
34
34
  * `report-broken-images` : report broken images back to the server so that they can be repaired
35
- * `hint-interval-length` : the time (in seconds) waited before the first tip is displayed and the time between the tips
36
35
  * `max-hints` : the maximum amount of hints that will be displayed
37
- * `auto-focus` : set the focus on the answer input element
38
- * `max-tries` : maximum number of tries before the game stops. If not specified then the amount of tries will not be displayed
39
- * `show-duration` : display the amount of seconds that it took to answer correctly
40
- * `show-feedback` : display a feedback input field at the top right of the component
36
+ * `suppress-images` : do not display incident images
41
37
 
42
38
 
43
39
  ### Adjust the styling
@@ -1205,7 +1205,7 @@
1205
1205
  },
1206
1206
  {
1207
1207
  "kind": "method",
1208
- "name": "postIncidentQualityFeedback",
1208
+ "name": "postIncidentFeedback",
1209
1209
  "privacy": "public",
1210
1210
  "parameters": [
1211
1211
  {
@@ -1588,4 +1588,4 @@
1588
1588
  ]
1589
1589
  }
1590
1590
  ]
1591
- }
1591
+ }
@@ -21,6 +21,7 @@ export declare class GuessTheYear extends LitElement {
21
21
  maxHints: number;
22
22
  numberOfQuestions: number;
23
23
  private _numberOfQuestionsSeen;
24
+ private _playerDob;
24
25
  private _incident;
25
26
  private _answers;
26
27
  private _hint;
@@ -48,8 +49,10 @@ export declare class GuessTheYear extends LitElement {
48
49
  private _renderHeader;
49
50
  private _renderFooter;
50
51
  private renderSplashScreen;
51
- private _renderYearSelectOptions;
52
+ private _renderYearStepXSelectOptions;
52
53
  private renderGameIntro;
54
+ private _setPlayerDob;
55
+ private _setNumberOfQuestions;
53
56
  private _setFromDate;
54
57
  private _setToDate;
55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AAW;IAYb,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA8EpC,OAAO,CAAC,iBAAiB;IA4DzB,aAAa,IAAI,cAAc;IAa/B,qBAAqB,QAAS,KAAK,YAAY,QAAQ,uBAiCrD;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
@@ -18,10 +18,16 @@ import { GameState } from "./lib/enums";
18
18
  import stylesheet from "./scss/main.scss";
19
19
  import { QuestionScoreController } from "./lib/controller/scorecontroller";
20
20
  const SPLASH_DELAY = 1000;
21
- const MIN_YEAR = 1950;
22
- const MAX_YEAR = 2024;
23
21
  const MAX_QUESTIONS = 10;
24
22
  const HINT_COST = 2;
23
+ const MIN_YEAR = 1950;
24
+ const MAX_YEAR = parseInt(dayjs().format('YYYY'), 10);
25
+ const GTY_FROM_YEAR_VAR = 'gty-from-year';
26
+ const GTY_TO_YEAR_VAR = 'gty-to-year';
27
+ const GTY_NUM_QUESTIONS_VAR = 'gty-number-of-questions';
28
+ const MAX_DOB = 1915;
29
+ const MIN_DOB = parseInt(dayjs().format('YYYY'), 10) - 10;
30
+ const GTY_PLAYER_DOB_VAR = 'gty-player-dob';
25
31
  let GuessTheYear = class GuessTheYear extends LitElement {
26
32
  get loading() {
27
33
  return this._loading;
@@ -40,13 +46,14 @@ let GuessTheYear = class GuessTheYear extends LitElement {
40
46
  this.category = "";
41
47
  this.emotion = "";
42
48
  this.impact = "";
43
- this.from = dayjs(`${MIN_YEAR}-01-01`, "YYYY-MM-DD");
44
- this.to = dayjs(); // defaults to today
49
+ this.from = dayjs(`${window.localStorage.getItem(GTY_FROM_YEAR_VAR) || MIN_YEAR}-01-01`, "YYYY-MM-DD");
50
+ this.to = dayjs(`${window.localStorage.getItem(GTY_TO_YEAR_VAR) || MAX_YEAR}-01-01`, "YYYY-MM-DD");
45
51
  this.noImageSrc = "";
46
52
  this.suppressImages = false;
47
53
  this.maxHints = 3;
48
- this.numberOfQuestions = 10;
54
+ this.numberOfQuestions = parseInt(window.localStorage.getItem(GTY_NUM_QUESTIONS_VAR) || MAX_QUESTIONS + '', 10);
49
55
  this._numberOfQuestionsSeen = 0;
56
+ this._playerDob = parseInt(window.localStorage.getItem(GTY_PLAYER_DOB_VAR) || 0 + '', 10);
50
57
  this._incident = undefined;
51
58
  this._answers = [];
52
59
  this._hint = undefined;
@@ -180,12 +187,12 @@ let GuessTheYear = class GuessTheYear extends LitElement {
180
187
  }
181
188
  // renders a selector for a year
182
189
  // TODO: set type of selector
183
- _renderYearSelectOptions(selectedValue) {
190
+ _renderYearStepXSelectOptions(from, to, step, selectedValue) {
184
191
  const selected = parseInt(selectedValue, 10);
185
192
  // pre-render year options
186
193
  // and mark selected when they match
187
194
  const selectYearOptions = [];
188
- for (let i = MIN_YEAR; i <= MAX_YEAR; i += 5) {
195
+ for (let i = from; i <= to; i += step) {
189
196
  selectYearOptions.push(html `
190
197
  <option value="${i}" ?selected=${selected == i}>${i}</option>
191
198
  `);
@@ -228,21 +235,21 @@ let GuessTheYear = class GuessTheYear extends LitElement {
228
235
 
229
236
  <div class="game-settings">
230
237
  <p>
238
+ ${this.i18n.translate("game-settings-p0")}
239
+ <select @change="${this._setPlayerDob}">
240
+ ${this._renderYearStepXSelectOptions(MAX_DOB, MIN_DOB, 1, this._playerDob + '')}
241
+ </select>
231
242
  ${this.i18n.translate("game-settings-p1")}
232
- <select
233
- @change="${(event) => {
234
- this.numberOfQuestions = Number(event.target.value);
235
- }}"
236
- >
243
+ <select @change="${this._setNumberOfQuestions}">
237
244
  ${selectQuestionOptions}
238
245
  </select>
239
246
  ${this.i18n.translate("game-settings-p2")}
240
247
  <select @change="${this._setFromDate}">
241
- ${this._renderYearSelectOptions(this.from.format("YYYY"))}
248
+ ${this._renderYearStepXSelectOptions(MIN_YEAR, MAX_YEAR, 5, this.from.format("YYYY"))}
242
249
  </select>
243
250
  ${this.i18n.translate("game-settings-p3")}
244
251
  <select @change="${this._setToDate}">
245
- ${this._renderYearSelectOptions(this.to.format("YYYY"))}
252
+ ${this._renderYearStepXSelectOptions(MIN_YEAR, MAX_YEAR, 5, this.to.format("YYYY"))}
246
253
  </select>
247
254
  ${this.i18n.translate("game-settings-p4")}
248
255
  </p>
@@ -254,11 +261,21 @@ let GuessTheYear = class GuessTheYear extends LitElement {
254
261
  </div>
255
262
  `;
256
263
  }
264
+ _setPlayerDob(event) {
265
+ this._playerDob = Number(event.target.value);
266
+ window.localStorage.setItem(GTY_PLAYER_DOB_VAR, this._playerDob + '');
267
+ }
268
+ _setNumberOfQuestions(event) {
269
+ this.numberOfQuestions = Number(event.target.value);
270
+ window.localStorage.setItem(GTY_NUM_QUESTIONS_VAR, this.numberOfQuestions + '');
271
+ }
257
272
  _setFromDate(event) {
258
273
  this.from = this.from.year(event.target.value);
274
+ window.localStorage.setItem(GTY_FROM_YEAR_VAR, this.from.format('YYYY') + '');
259
275
  }
260
276
  _setToDate(event) {
261
277
  this.to = this.to.year(event.target.value);
278
+ window.localStorage.setItem(GTY_TO_YEAR_VAR, this.to.format('YYYY') + '');
262
279
  }
263
280
  // renders the actual game stage
264
281
  renderGameStage() {
@@ -317,7 +334,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
317
334
  </div>
318
335
  `;
319
336
  }
320
- return html ``;
337
+ // Preserve html structure to prevent the webcomponent to collapse.
338
+ return html `<div class="incident--image">
339
+ <img/>
340
+ </div>`;
321
341
  }
322
342
  // renders a list of possible answers
323
343
  _renderAnswers() {
@@ -408,6 +428,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
408
428
  }
409
429
  // renders the feedback overlay
410
430
  _renderFeedback() {
431
+ var _a, _b;
411
432
  // do not show anything until an answer has been made
412
433
  // and the score is greater than 0
413
434
  if (!this._answer && this._score0.value > 0) {
@@ -421,6 +442,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
421
442
  this._score0.stop();
422
443
  }
423
444
  this.totalScore += score;
445
+ // Fire-and-forget recallability feedback.
446
+ if ((_a = this._incident) === null || _a === void 0 ? void 0 : _a.id) {
447
+ this._apiService.incidentRecallability((_b = this._incident) === null || _b === void 0 ? void 0 : _b.id, this._playerDob, is_correct);
448
+ }
424
449
  if (is_correct) {
425
450
  return html `
426
451
  <div class="feedback">
@@ -479,7 +504,6 @@ let GuessTheYear = class GuessTheYear extends LitElement {
479
504
  this._renderState = GameState.END;
480
505
  }
481
506
  renderGameEnd() {
482
- // clearInterval(this._scoreIntervalHandler);
483
507
  console.debug("renderGameEnd");
484
508
  return html `
485
509
  ${this._renderHeader("The end!")}
@@ -490,8 +514,6 @@ let GuessTheYear = class GuessTheYear extends LitElement {
490
514
  ${this._renderFooter()}
491
515
  `;
492
516
  }
493
- // private _incidentsStack = [];
494
- // private _totalScore: number = 0;
495
517
  setupNewGame() {
496
518
  console.debug("new game!");
497
519
  console.debug({
@@ -501,12 +523,9 @@ let GuessTheYear = class GuessTheYear extends LitElement {
501
523
  });
502
524
  this.totalScore = 0;
503
525
  this._numberOfQuestionsSeen = 0;
504
- // this._question.load(this.from.format('YYYY'), this.to.format('YYYY'));
505
- // this._question.init();
506
526
  this._loadQuestion();
507
527
  }
508
528
  _resetStage() {
509
- // window.scrollTo(0, 0);
510
529
  this.sources = [];
511
530
  this._incident = undefined;
512
531
  this._hints = [];
@@ -585,6 +604,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
585
604
  hint = (hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||
586
605
  hintTemplates[0]).replace(/__TITLE__/, hintIncident.title || hintIncident.text);
587
606
  break;
607
+ case Category.tvShowOrSeries:
608
+ hint = (hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||
609
+ hintTemplates[0]).replace(/__TITLE__/, hintIncident.title || hintIncident.text);
610
+ break;
588
611
  case Category.sports:
589
612
  hint = (hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||
590
613
  hintTemplates[0]).replace(/__TITLE__/, hintIncident.title || hintIncident.text);
@@ -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OAAO,KAAK,EAAE,CAAC;gBACjB,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;oBACvB,OAAO,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;gBACpC,CAAC;gBAED,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC/C,CAAC;YACD,WAAW,EAAE,CAAC,KAAY,EAAE,EAAE;gBAC5B,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;gBACnC,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpC,CAAC;SACF;KACF,CAAC;wCACkB;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAC9B;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDAC1B;AAGhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;8CAC9B;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAC7C;AAIvB;IADP,KAAK,EAAE;+CAC4C;AAK5C;IADP,KAAK,EAAE;2CACsC;AAQtC;IADP,KAAK,EAAE;+CAC0C;AAG3C;IADN,KAAK,EAAE;kDACqC;AAGrC;IADP,KAAK,EAAE;4CACY;AAMZ;IADP,KAAK,EAAE;6CACwC;AAxHrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAuyBxB","sourcesContent":["import { LitElement, css, html, PropertyValues, TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport dayjs from \"dayjs\";\nimport { Dayjs } from \"dayjs\";\nconst { setTimeout } = window;\nimport { Incident, Categories, Category } from \"./lib/Incident\";\nimport { NoImageImg } from \"./lib/Icon\";\nimport { ApiService, ContentFeedback } from \"./lib/ApiService\";\nimport { Util } from \"./lib/Util\";\nimport { i18nFactory } from \"./lib/i18n/i18n\";\nimport { GameState } from \"./lib/enums\";\nimport stylesheet from \"./scss/main.scss\";\nimport { QuestionScoreController } from \"./lib/controller/scorecontroller\";\n\nconst SPLASH_DELAY: number = 1000;\nconst MIN_YEAR: number = 1950;\nconst MAX_YEAR: number = 2024;\nconst MAX_QUESTIONS: number = 10;\nconst HINT_COST: number = 2;\n\n@customElement(\"guess-the-year\")\nexport class GuessTheYear extends LitElement {\n private sources: Array<string> = [];\n private _loading = false;\n\n private _score0: QuestionScoreController;\n\n get loading() {\n return this._loading;\n }\n\n set loading(value: boolean) {\n this._loading = value;\n }\n\n @property({ type: String, attribute: \"tee-e-api-url\" })\n teeeApiUrl: string = \"https://api.tee-e.com\";\n\n @property({ type: Boolean, attribute: \"report-broken-images\" })\n reportBrokenImages: boolean = false;\n\n @property({ type: String })\n date: string = \"\";\n\n @property({ type: String })\n country: string = \"\";\n\n @property({ type: String })\n category: string = \"\";\n\n @property({ type: String })\n emotion: string = \"\";\n\n @property({ type: String })\n impact: string = \"\";\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.debug([\"from\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-01-01`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.debug([\"from\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n from: Dayjs = dayjs(`${MIN_YEAR}-01-01`, \"YYYY-MM-DD\");\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.debug([\"to\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-12-31`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.debug([\"to\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n to: Dayjs = dayjs(); // defaults to today\n\n @property({ type: String, attribute: \"no-image-src\" })\n noImageSrc: string = \"\";\n\n @property({ type: Boolean, attribute: \"suppress-images\" })\n suppressImages: boolean = false;\n\n @property({ type: Number, attribute: \"max-hints\" })\n maxHints: number = 3;\n\n @property({ type: Number, attribute: \"number-of-questions\", reflect: true })\n numberOfQuestions: number = 10;\n private _numberOfQuestionsSeen: number = 0;\n\n @state()\n private _incident: Incident | undefined = undefined;\n\n private _answers: Array<Number> = [];\n\n @state()\n private _hint: string | undefined = undefined;\n\n private _showHint: boolean = true;\n private _showFooter: boolean = false;\n private _hintsIndex: number = 0;\n private _hints: Array<Incident> = [];\n\n @state()\n private _solution: Number | undefined = undefined;\n\n @state()\n public _renderState: string = GameState.INIT;\n\n @state()\n private _score = 30;\n\n public totalScore = 0;\n\n // _answer is stored as string because it will be entered character for character\n @state()\n private _answer: number | undefined = undefined;\n\n private _apiService = new ApiService(this.teeeApiUrl);\n private i18n = i18nFactory(\"nl\");\n\n static override styles = css`\n ${stylesheet}\n `;\n\n constructor() {\n super();\n this._score0 = new QuestionScoreController(this, 30, 1000);\n }\n\n override connectedCallback() {\n console.debug(\"connectedCallback\");\n super.connectedCallback();\n\n // first step is splash\n this._renderState = GameState.SPLASH;\n }\n\n override disconnectedCallback() {\n console.debug(\"disconnectedCallback\");\n super.disconnectedCallback();\n this._renderState = GameState.INIT;\n this._score0.stop();\n this._score0.reset();\n }\n\n override firstUpdated(changedProperties: PropertyValues): void {\n console.debug(\"firstUpdated\");\n super.firstUpdated(changedProperties);\n }\n\n override shouldUpdate(changedProperties: PropertyValues): boolean {\n console.debug(\"shouldUpdate\");\n return super.shouldUpdate(changedProperties);\n }\n\n override update(changedProperties: PropertyValues) {\n console.debug(\"update\");\n return super.update(changedProperties);\n }\n\n override updated(changedProperties: PropertyValues) {\n console.debug(\"updated\");\n return super.updated(changedProperties);\n }\n\n override render() {\n /**\n * this is the main render function\n * it renders different stages during the game\n */\n console.debug(\"render\");\n\n return html`\n <div class=\"guess-the-year-container\">\n ${this._renderState == GameState.INIT ? \"Loading...\" : \"\"}\n ${this._renderState == GameState.SPLASH\n ? this.renderSplashScreen()\n : \"\"}\n ${this._renderState == GameState.INTRO ? this.renderGameIntro() : \"\"}\n ${this._renderState == GameState.PLAY ? this.renderGameStage() : \"\"}\n ${this._renderState == GameState.END ? this.renderGameEnd() : \"\"}\n ${this._renderFooter()}\n </div>\n `;\n }\n\n colorElement(element: any, color: string) {\n console.debug(\"colorElement\");\n this?.shadowRoot?.querySelector(element)?.style.setProperty(\"color\", color);\n }\n\n // this renders the game header\n private _renderHeader(content: string = this.i18n.translate(\"game-name\")): TemplateResult {\n return html`\n <section id=\"top\" class=\"header guess-the-year-header\">\n <h1>${content}</h1>\n </section>\n `;\n }\n\n // this renders the game footer\n private _renderFooter(): TemplateResult {\n if (this._showFooter) {\n return html`\n <section class=\"footer guess-the-year-footer\">\n <div class=\"guess-the-year-copyright\">\n ${\"The Throwback Company ©\" + dayjs().year()}\n </div>\n </section>\n `;\n }\n return html``;\n }\n\n // render the splash screen\n private renderSplashScreen(): TemplateResult {\n console.debug(\"renderSplashScreen\");\n\n // (pretend) to load before the game starts\n setTimeout(() => {\n this._renderState = GameState.INTRO;\n }, SPLASH_DELAY);\n\n return html`\n <div id=\"splash-screen-container\" class=\"splashscreen\">\n <div class=\"splash-logo\">\n <h2>${this.i18n.translate(\"game-name\")}</h2>\n <p>${this.i18n.translate(\"Loading...\")}</p>\n </div>\n </div>\n `;\n }\n\n // renders a selector for a year\n // TODO: set type of selector\n private _renderYearSelectOptions(selectedValue: string): TemplateResult {\n const selected = parseInt(selectedValue, 10);\n // pre-render year options\n // and mark selected when they match\n const selectYearOptions = [];\n for (let i = MIN_YEAR; i <= MAX_YEAR; i += 5) {\n selectYearOptions.push(html`\n <option value=\"${i}\" ?selected=${selected == i}>${i}</option>\n `);\n }\n\n return html`${selectYearOptions}`;\n }\n\n // render the game intro\n // allows to select the number of questions,\n // select the year range\n // and to start the game\n private renderGameIntro(): TemplateResult {\n console.debug(\"renderGameIntro\");\n\n // pre-render number of question options\n // and mark selected when they match\n const selectQuestionOptions = [];\n for (let i = 1; i <= MAX_QUESTIONS; i++) {\n selectQuestionOptions.push(html`\n <option value=\"${i}\" ?selected=${this.numberOfQuestions == i}>\n ${i}\n </option>\n `);\n }\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-introduction-welcome\"))}\n\n <div class=\"game-intro\">\n <div class=\"game-explanation\">\n <p>\n ${this.i18n.translate(\"game-introduction-p1\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p2\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p3\")}\n </p>\n </div>\n\n <div class=\"game-settings\">\n <p>\n ${this.i18n.translate(\"game-settings-p1\")}\n <select\n @change=\"${(event: any) => {\n this.numberOfQuestions = Number(event.target.value);\n }}\"\n >\n ${selectQuestionOptions}\n </select>\n ${this.i18n.translate(\"game-settings-p2\")}\n <select @change=\"${this._setFromDate}\">\n ${this._renderYearSelectOptions(this.from.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p3\")}\n <select @change=\"${this._setToDate}\">\n ${this._renderYearSelectOptions(this.to.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p4\")}\n </p>\n </div>\n\n <div class=\"game-start\">\n <button @click=\"${this.setupNewGame}\">${this.i18n.translate(\"start\")}</button>\n </div>\n </div>\n `;\n }\n\n private _setFromDate(event: any): void {\n this.from = this.from.year(event.target.value);\n }\n\n private _setToDate(event: any): void {\n this.to = this.to.year(event.target.value);\n }\n\n // renders the actual game stage\n private renderGameStage(): TemplateResult {\n console.debug(\"renderGameStage\");\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-call-to-action\").replace(/__FROM__/, this.from.year() + '').replace(/__TO__/, this.to.year() + ''))}\n <div class=\"guess-the-year-game-stage\">\n <div class=\"game-score\">${this._renderGameScore()}</div>\n\n <div class=\"container\">\n <div class=\"incident\">${this._renderIncident()}</div>\n ${this._renderHint()}\n <div class=\"sources\">${this.renderSources()}</div>\n </div>\n\n <div class=\"game-controls\">\n <div class=\"game-controls--hint\">${this._renderHintButton()}</div>\n <div class=\"game-controls--answers\">${this._renderAnswers()}</div>\n </div>\n\n ${this._renderFeedback()}\n </div>\n `;\n }\n\n // renders the item for the year to guess\n private _renderIncident(): TemplateResult {\n return html`\n <div class=\"incident--title\">\n <h1>${this._incident?.title}</h1>\n </div>\n\n ${this._renderIncidentImage(this._incident)}\n\n <div class=\"incident--text\">\n <p>${this._incident?.text}</p>\n </div>\n `;\n }\n\n private _shouldDisplayAnImage(incident: Incident): boolean {\n const hasImage = !!(incident && incident.image && incident.image[0]);\n const displayImages = !this.suppressImages;\n return hasImage && displayImages;\n }\n\n // renders the optional image with the item\n private _renderIncidentImage(incident: Incident | undefined): TemplateResult {\n if (incident && this._shouldDisplayAnImage(incident)) {\n return html`\n <div class=\"incident--image\">\n <img \n @error=${(evt: Event) => {\n this._handleImageLoadError(evt, incident);\n }}\n src=\"${incident.image[0]}\"\n />\n </div>\n `;\n }\n\n return html``;\n }\n\n // renders a list of possible answers\n private _renderAnswers(): TemplateResult {\n return html`\n <div class=\"answers--list\">\n <ul>\n ${this._answers.map(\n (answer) =>\n html`<li @click=\"${this._handleAnswerClicked}\">${answer}</li>`,\n )}\n </ul>\n </div>\n `;\n }\n\n // renders the current question score\n // it counts back to 0\n private _renderGameScore(): TemplateResult {\n return html`\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-number\")}:</div>\n <div class=\"game-score--value\">\n ${this._numberOfQuestionsSeen} van ${this.numberOfQuestions}\n </div>\n </div>\n\n <div class=\"game-score--score\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-score\")}:</div>\n <div class=\"game-score--value\">${this._score0.value}</div>\n </div>\n\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"total-score\")}:</div>\n <div class=\"game-score--value\">${this.totalScore}</div>\n </div>\n `;\n }\n\n // handles the click on an answer\n private _handleAnswerClicked(event: any): void {\n // get the clicked answer\n const answer = event.target.textContent;\n\n // stop the score counter\n this._score0.stop();\n\n // remove the hint button\n this._showHint = false;\n\n // check if the answer is correct\n if (answer) {\n // this._apiService.postIncidentAnswer(this._incident?.id, answer);\n console.debug(\n answer,\n this._solution,\n this._score,\n answer == this._solution,\n );\n\n this._answer = answer;\n }\n }\n\n // renders the requested hint\n private _renderHint(): TemplateResult {\n if (!this._hint) {\n return html``;\n }\n\n return html` <p>${this._hint}</p> `;\n }\n\n // renders the hint button until\n // all max hints have been used\n private _renderHintButton(): TemplateResult {\n if (!this._showHint) {\n return html``;\n }\n\n return html`\n <div class=\"game-controls--hint\">\n <button @click=\"${this._handleHintClicked}\">\n ${this.i18n.translate(\"show-hint\")} (${this._hints.length - this._hintsIndex})\n </button>\n </div>\n `;\n }\n\n // handles the click on the hint button\n // and shows the next hint if available\n // subtracts the cost of the hint from\n // the question score\n private _handleHintClicked(): void {\n console.debug(\"handleHintClicked\", [this._hintsIndex, this._hints.length]);\n\n if (this._hintsIndex < this._hints.length) {\n const hintText = this._generateHintText(this._hints[this._hintsIndex]);\n\n if (hintText) {\n this._hint = hintText;\n this._hintsIndex++;\n this._score0.subtract(HINT_COST);\n }\n }\n\n if (this._hintsIndex >= this._hints.length) {\n // this._hintsIndex = 0;\n this._showHint = false;\n }\n }\n\n // renders the feedback overlay\n private _renderFeedback(): TemplateResult {\n // do not show anything until an answer has been made\n // and the score is greater than 0\n if (!this._answer && this._score0.value > 0) {\n return html``;\n }\n\n // check if the answer is correct\n // cast to strings to compare\n const is_correct = this._answer + \"\" == this._solution + \"\";\n const score = is_correct ? this._score0.value : 0;\n\n if (this._score0.isRunning()) {\n this._score0.stop();\n }\n\n this.totalScore += score;\n\n if (is_correct) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-correct\")}!</h3>\n <p>\n ${this._hintsIndex == 1 ? this.i18n.translate(\"used-hint-singular\") : this.i18n.translate(\"used-hint-plural\").replace(/__HINTS__/, this._hintsIndex + '')}\n </p>\n <p>\n ${score == 1 ? this.i18n.translate(\"number-points-singular\") : this.i18n.translate(\"number-points-plural\").replace(/__POINTS__/, score + '')}\n </p>\n\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else if (!is_correct && this._answer) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-wrong\")}</h3>\n <p>\n ${this.i18n.translate(\"correct-answer-was\").replace(/__WRONG__/, this._answer + '').replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Helaas</h3>\n <p>\n ${this.i18n.translate(\"no-answer-correct-answer-was\").replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n }\n }\n\n // renders the next question button\n private _renderNextQuestionButton(): TemplateResult {\n if (this._numberOfQuestionsSeen < this.numberOfQuestions) {\n return html`\n <button @click=\"${this._loadQuestion}\">${this.i18n.translate(\"next-question\")}</button>\n `;\n }\n\n return html` <button @click=\"${this._endGame}\">${this.i18n.translate(\"quit\")}</button> `;\n }\n\n // renders the end of the game\n private _endGame(): void {\n this._renderState = GameState.END;\n }\n\n private renderGameEnd(): TemplateResult {\n // clearInterval(this._scoreIntervalHandler);\n\n console.debug(\"renderGameEnd\");\n return html`\n ${this._renderHeader(\"The end!\")}\n <div class=\"guess-the-year-game-end\">${this.i18n.translate(\"end\")}</div>\n <button @click=\"${() => (this._renderState = GameState.SPLASH)}\">\n ${this.i18n.translate(\"new-game\")}\n </button>\n ${this._renderFooter()}\n `;\n }\n\n // private _incidentsStack = [];\n\n // private _totalScore: number = 0;\n\n private setupNewGame(): void {\n console.debug(\"new game!\");\n\n console.debug({\n \"number of questions\": this.numberOfQuestions,\n from: this.from.toISOString(),\n to: this.to.toISOString(),\n });\n\n this.totalScore = 0;\n this._numberOfQuestionsSeen = 0;\n\n // this._question.load(this.from.format('YYYY'), this.to.format('YYYY'));\n // this._question.init();\n\n this._loadQuestion();\n }\n\n private _resetStage(): void {\n // window.scrollTo(0, 0);\n this.sources = [];\n this._incident = undefined;\n this._hints = [];\n this._answer = undefined;\n this._answers = [];\n this._hintsIndex = 0;\n this._score0.reset();\n this._showHint = false;\n this._hint = undefined;\n }\n\n async _loadQuestion(): Promise<void> {\n this._resetStage();\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n this.category,\n this.emotion,\n this.impact,\n this.date,\n this.from.format(\"YYYY-MM-DD\"),\n this.to.format(\"YYYY-MM-DD\"),\n \"40\",\n \"quiz_year\"\n );\n\n this._incident = response.incident;\n this.sources = response.sources;\n\n this._solution = Number(\n (response.incident?.yearplusmonth || \"\").substring(0, 4),\n );\n\n const answers = [this._solution];\n const from = this.from.year();\n const to = this.to.year();\n\n // generate 3 more random and unique answers between to and from\n while (answers.length < 4) {\n const randomAnswer = Math.floor(Math.random() * (to - from)) + from;\n if (!answers.includes(randomAnswer)) {\n answers.push(randomAnswer);\n }\n }\n\n // sort theses answers\n answers.sort();\n\n this._answers = answers;\n\n for (let i = 0; i < this.maxHints; i++) {\n console.debug(\"loading hint\", i);\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n Util.shuffleArray([...Categories]).shift(),\n undefined,\n undefined,\n \"\",\n `${this._solution}-01-01`,\n `${this._solution}-12-31`,\n undefined,\n undefined,\n );\n\n if (response.incident) {\n this._hints.push(response.incident);\n }\n }\n\n if (this._hints.length === 0) {\n this._showHint = false;\n }\n else {\n this._showHint = true;\n }\n\n // start render game stage\n this._renderState = GameState.PLAY;\n\n // start score counter\n this._score0.start();\n\n // increment question counter\n this._numberOfQuestionsSeen += 1;\n }\n\n private _generateHintText(hintIncident: Incident): string {\n let hint = \"\";\n const hintTemplates = this.i18n.HintTemplates[hintIncident.category];\n switch (hintIncident.category) {\n case Category.newsItem:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] || \"\"\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.radioSong:\n // The title property of radioSongs always follow this pattern: track - artist\n const track = hintIncident.title.replace(/(.*?)\\s+\\-.*/, \"$1\");\n const artist = hintIncident.title.replace(/.*\\-(.*)/, \"$1\");\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n )\n .replace(/__ARTIST__/, artist)\n .replace(/__TRACK__/, track);\n break;\n case Category.cinemaMovie:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.tech:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.newsPresenter:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n case Category.sports:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n case Category.showbizz:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n }\n return hint;\n }\n\n renderSources(): TemplateResult {\n console.debug(\"renderSources\");\n if (!this.sources.length) {\n return html``;\n }\n // deduplicate array via [...new Set(this.sources)]\n return html`\n <div class=\"guess-the-year-sources\">\n Source: ${[...new Set(this.sources)].join(\", \")}\n </div>\n `;\n }\n\n _handleImageLoadError = (evt: Event, incident: Incident) => {\n // grab the image element that triggered the error\n const targetImage = evt.target as HTMLImageElement;\n console.debug(`Error loading image: ${targetImage.src}`);\n\n // find out which no image source needs to be used\n const noImageSrc = this.noImageSrc || NoImageImg;\n\n // don't try to set the image source if it\n // has already been set\n if (targetImage.src == noImageSrc) {\n return;\n }\n\n // report broken images back to the server if set.\n if (this.reportBrokenImages) {\n if (incident) {\n this._apiService.postAttributeQualityFeedback(\n incident.id,\n \"image\",\n targetImage.src,\n ContentFeedback.incorrect,\n );\n }\n }\n\n // wait a bit before setting the image\n // so we don't hammer the no image server\n setTimeout(() => {\n targetImage.src = noImageSrc;\n }, 250);\n\n return false;\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"guess-the-year\": GuessTheYear;\n }\n}\n"]}
1
+ {"version":3,"file":"guess-the-year.js","sourceRoot":"","sources":["../src/guess-the-year.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;AAC9B,OAAO,EAAY,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,WAAW,E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CACY;AAMZ;IADP,KAAK,EAAE;6CACwC;AA3HrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAyzBxB","sourcesContent":["import { LitElement, css, html, PropertyValues, TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport dayjs from \"dayjs\";\nimport { Dayjs } from \"dayjs\";\nconst { setTimeout } = window;\nimport { Incident, Categories, Category } from \"./lib/Incident\";\nimport { NoImageImg } from \"./lib/Icon\";\nimport { ApiService, ContentFeedback } from \"./lib/ApiService\";\nimport { Util } from \"./lib/Util\";\nimport { i18nFactory } from \"./lib/i18n/i18n\";\nimport { GameState } from \"./lib/enums\";\nimport stylesheet from \"./scss/main.scss\";\nimport { QuestionScoreController } from \"./lib/controller/scorecontroller\";\n\nconst SPLASH_DELAY: number = 1000;\nconst MAX_QUESTIONS: number = 10;\nconst HINT_COST: number = 2;\nconst MIN_YEAR: number = 1950;\nconst MAX_YEAR: number = parseInt(dayjs().format('YYYY'), 10);\nconst GTY_FROM_YEAR_VAR = 'gty-from-year';\nconst GTY_TO_YEAR_VAR = 'gty-to-year';\nconst GTY_NUM_QUESTIONS_VAR = 'gty-number-of-questions';\nconst MAX_DOB: number = 1915;\nconst MIN_DOB: number = parseInt(dayjs().format('YYYY'), 10) - 10;\nconst GTY_PLAYER_DOB_VAR = 'gty-player-dob';\n\n@customElement(\"guess-the-year\")\nexport class GuessTheYear extends LitElement {\n\n private sources: Array<string> = [];\n private _loading = false;\n\n private _score0: QuestionScoreController;\n\n get loading() {\n return this._loading;\n }\n\n set loading(value: boolean) {\n this._loading = value;\n }\n\n @property({ type: String, attribute: \"tee-e-api-url\" })\n teeeApiUrl: string = \"https://api.tee-e.com\";\n\n @property({ type: Boolean, attribute: \"report-broken-images\" })\n reportBrokenImages: boolean = false;\n\n @property({ type: String })\n date: string = \"\";\n\n @property({ type: String })\n country: string = \"\";\n\n @property({ type: String })\n category: string = \"\";\n\n @property({ type: String })\n emotion: string = \"\";\n\n @property({ type: String })\n impact: string = \"\";\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.debug([\"from\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-01-01`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.debug([\"from\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n from: Dayjs = dayjs(`${window.localStorage.getItem(GTY_FROM_YEAR_VAR) || MIN_YEAR}-01-01`, \"YYYY-MM-DD\");\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.debug([\"to\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-12-31`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.debug([\"to\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n to: Dayjs = dayjs(`${window.localStorage.getItem(GTY_TO_YEAR_VAR) || MAX_YEAR}-01-01`, \"YYYY-MM-DD\");\n\n @property({ type: String, attribute: \"no-image-src\" })\n noImageSrc: string = \"\";\n\n @property({ type: Boolean, attribute: \"suppress-images\" })\n suppressImages: boolean = false;\n\n @property({ type: Number, attribute: \"max-hints\" })\n maxHints: number = 3;\n\n @property({ type: Number, attribute: \"number-of-questions\", reflect: true })\n numberOfQuestions: number = parseInt(window.localStorage.getItem(GTY_NUM_QUESTIONS_VAR) || MAX_QUESTIONS + '', 10);\n private _numberOfQuestionsSeen: number = 0;\n\n private _playerDob: number = parseInt(window.localStorage.getItem(GTY_PLAYER_DOB_VAR) || 0 + '', 10);\n\n @state()\n private _incident: Incident | undefined = undefined;\n\n private _answers: Array<Number> = [];\n\n @state()\n private _hint: string | undefined = undefined;\n\n private _showHint: boolean = true;\n private _showFooter: boolean = false;\n private _hintsIndex: number = 0;\n private _hints: Array<Incident> = [];\n\n @state()\n private _solution: Number | undefined = undefined;\n\n @state()\n public _renderState: string = GameState.INIT;\n\n @state()\n private _score = 30;\n\n public totalScore = 0;\n\n // _answer is stored as string because it will be entered character for character\n @state()\n private _answer: number | undefined = undefined;\n\n private _apiService = new ApiService(this.teeeApiUrl);\n private i18n = i18nFactory(\"nl\");\n\n static override styles = css`\n ${stylesheet}\n `;\n\n constructor() {\n super();\n this._score0 = new QuestionScoreController(this, 30, 1000);\n }\n\n override connectedCallback() {\n console.debug(\"connectedCallback\");\n super.connectedCallback();\n\n // first step is splash\n this._renderState = GameState.SPLASH;\n }\n\n override disconnectedCallback() {\n console.debug(\"disconnectedCallback\");\n super.disconnectedCallback();\n this._renderState = GameState.INIT;\n this._score0.stop();\n this._score0.reset();\n }\n\n override firstUpdated(changedProperties: PropertyValues): void {\n console.debug(\"firstUpdated\");\n super.firstUpdated(changedProperties);\n }\n\n override shouldUpdate(changedProperties: PropertyValues): boolean {\n console.debug(\"shouldUpdate\");\n return super.shouldUpdate(changedProperties);\n }\n\n override update(changedProperties: PropertyValues) {\n console.debug(\"update\");\n return super.update(changedProperties);\n }\n\n override updated(changedProperties: PropertyValues) {\n console.debug(\"updated\");\n return super.updated(changedProperties);\n }\n\n override render() {\n /**\n * this is the main render function\n * it renders different stages during the game\n */\n console.debug(\"render\");\n\n return html`\n <div class=\"guess-the-year-container\">\n ${this._renderState == GameState.INIT ? \"Loading...\" : \"\"}\n ${this._renderState == GameState.SPLASH\n ? this.renderSplashScreen()\n : \"\"}\n ${this._renderState == GameState.INTRO ? this.renderGameIntro() : \"\"}\n ${this._renderState == GameState.PLAY ? this.renderGameStage() : \"\"}\n ${this._renderState == GameState.END ? this.renderGameEnd() : \"\"}\n ${this._renderFooter()}\n </div>\n `;\n }\n\n colorElement(element: any, color: string) {\n console.debug(\"colorElement\");\n this?.shadowRoot?.querySelector(element)?.style.setProperty(\"color\", color);\n }\n\n // this renders the game header\n private _renderHeader(content: string = this.i18n.translate(\"game-name\")): TemplateResult {\n return html`\n <section id=\"top\" class=\"header guess-the-year-header\">\n <h1>${content}</h1>\n </section>\n `;\n }\n\n // this renders the game footer\n private _renderFooter(): TemplateResult {\n if (this._showFooter) {\n return html`\n <section class=\"footer guess-the-year-footer\">\n <div class=\"guess-the-year-copyright\">\n ${\"The Throwback Company ©\" + dayjs().year()}\n </div>\n </section>\n `;\n }\n return html``;\n }\n\n // render the splash screen\n private renderSplashScreen(): TemplateResult {\n console.debug(\"renderSplashScreen\");\n\n // (pretend) to load before the game starts\n setTimeout(() => {\n this._renderState = GameState.INTRO;\n }, SPLASH_DELAY);\n\n return html`\n <div id=\"splash-screen-container\" class=\"splashscreen\">\n <div class=\"splash-logo\">\n <h2>${this.i18n.translate(\"game-name\")}</h2>\n <p>${this.i18n.translate(\"Loading...\")}</p>\n </div>\n </div>\n `;\n }\n\n // renders a selector for a year\n // TODO: set type of selector\n private _renderYearStepXSelectOptions(from: number, to: number, step: number, selectedValue: string): TemplateResult {\n const selected = parseInt(selectedValue, 10);\n // pre-render year options\n // and mark selected when they match\n const selectYearOptions = [];\n for (let i = from; i <= to; i += step) {\n selectYearOptions.push(html`\n <option value=\"${i}\" ?selected=${selected == i}>${i}</option>\n `);\n }\n\n return html`${selectYearOptions}`;\n }\n\n // render the game intro\n // allows to select the number of questions,\n // select the year range\n // and to start the game\n private renderGameIntro(): TemplateResult {\n console.debug(\"renderGameIntro\");\n\n // pre-render number of question options\n // and mark selected when they match\n const selectQuestionOptions = [];\n for (let i = 1; i <= MAX_QUESTIONS; i++) {\n selectQuestionOptions.push(html`\n <option value=\"${i}\" ?selected=${this.numberOfQuestions == i}>\n ${i}\n </option>\n `);\n }\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-introduction-welcome\"))}\n\n <div class=\"game-intro\">\n <div class=\"game-explanation\">\n <p>\n ${this.i18n.translate(\"game-introduction-p1\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p2\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p3\")}\n </p>\n </div>\n\n <div class=\"game-settings\">\n <p>\n ${this.i18n.translate(\"game-settings-p0\")}\n <select @change=\"${this._setPlayerDob}\">\n ${this._renderYearStepXSelectOptions(MAX_DOB, MIN_DOB, 1, this._playerDob + '')}\n </select>\n ${this.i18n.translate(\"game-settings-p1\")}\n <select @change=\"${this._setNumberOfQuestions}\">\n ${selectQuestionOptions}\n </select>\n ${this.i18n.translate(\"game-settings-p2\")}\n <select @change=\"${this._setFromDate}\">\n ${this._renderYearStepXSelectOptions(MIN_YEAR, MAX_YEAR, 5, this.from.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p3\")}\n <select @change=\"${this._setToDate}\">\n ${this._renderYearStepXSelectOptions(MIN_YEAR, MAX_YEAR, 5, this.to.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p4\")}\n </p>\n </div>\n\n <div class=\"game-start\">\n <button @click=\"${this.setupNewGame}\">${this.i18n.translate(\"start\")}</button>\n </div>\n </div>\n `;\n }\n private _setPlayerDob(event: any): void {\n this._playerDob = Number(event.target.value);\n window.localStorage.setItem(GTY_PLAYER_DOB_VAR, this._playerDob + '');\n }\n\n private _setNumberOfQuestions(event: any): void {\n this.numberOfQuestions = Number(event.target.value);\n window.localStorage.setItem(GTY_NUM_QUESTIONS_VAR, this.numberOfQuestions + '');\n }\n\n private _setFromDate(event: any): void {\n this.from = this.from.year(event.target.value);\n window.localStorage.setItem(GTY_FROM_YEAR_VAR, this.from.format('YYYY') + '');\n }\n\n private _setToDate(event: any): void {\n this.to = this.to.year(event.target.value);\n window.localStorage.setItem(GTY_TO_YEAR_VAR, this.to.format('YYYY') + '');\n }\n\n // renders the actual game stage\n private renderGameStage(): TemplateResult {\n console.debug(\"renderGameStage\");\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-call-to-action\").replace(/__FROM__/, this.from.year() + '').replace(/__TO__/, this.to.year() + ''))}\n <div class=\"guess-the-year-game-stage\">\n <div class=\"game-score\">${this._renderGameScore()}</div>\n\n <div class=\"container\">\n <div class=\"incident\">${this._renderIncident()}</div>\n ${this._renderHint()}\n <div class=\"sources\">${this.renderSources()}</div>\n </div>\n\n <div class=\"game-controls\">\n <div class=\"game-controls--hint\">${this._renderHintButton()}</div>\n <div class=\"game-controls--answers\">${this._renderAnswers()}</div>\n </div>\n\n ${this._renderFeedback()}\n </div>\n `;\n }\n\n // renders the item for the year to guess\n private _renderIncident(): TemplateResult {\n return html`\n <div class=\"incident--title\">\n <h1>${this._incident?.title}</h1>\n </div>\n\n ${this._renderIncidentImage(this._incident)}\n\n <div class=\"incident--text\">\n <p>${this._incident?.text}</p>\n </div>\n `;\n }\n\n private _shouldDisplayAnImage(incident: Incident): boolean {\n const hasImage = !!(incident && incident.image && incident.image[0]);\n const displayImages = !this.suppressImages;\n return hasImage && displayImages;\n }\n\n // renders the optional image with the item\n private _renderIncidentImage(incident: Incident | undefined): TemplateResult {\n if (incident && this._shouldDisplayAnImage(incident)) {\n return html`\n <div class=\"incident--image\">\n <img \n @error=${(evt: Event) => {\n this._handleImageLoadError(evt, incident);\n }}\n src=\"${incident.image[0]}\"\n />\n </div>\n `;\n }\n\n // Preserve html structure to prevent the webcomponent to collapse.\n return html`<div class=\"incident--image\">\n <img/>\n </div>`;\n }\n\n // renders a list of possible answers\n private _renderAnswers(): TemplateResult {\n return html`\n <div class=\"answers--list\">\n <ul>\n ${this._answers.map(\n (answer) =>\n html`<li @click=\"${this._handleAnswerClicked}\">${answer}</li>`,\n )}\n </ul>\n </div>\n `;\n }\n\n // renders the current question score\n // it counts back to 0\n private _renderGameScore(): TemplateResult {\n return html`\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-number\")}:</div>\n <div class=\"game-score--value\">\n ${this._numberOfQuestionsSeen} van ${this.numberOfQuestions}\n </div>\n </div>\n\n <div class=\"game-score--score\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-score\")}:</div>\n <div class=\"game-score--value\">${this._score0.value}</div>\n </div>\n\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"total-score\")}:</div>\n <div class=\"game-score--value\">${this.totalScore}</div>\n </div>\n `;\n }\n\n // handles the click on an answer\n private _handleAnswerClicked(event: any): void {\n // get the clicked answer\n const answer = event.target.textContent;\n\n // stop the score counter\n this._score0.stop();\n\n // remove the hint button\n this._showHint = false;\n\n // check if the answer is correct\n if (answer) {\n // this._apiService.postIncidentAnswer(this._incident?.id, answer);\n console.debug(\n answer,\n this._solution,\n this._score,\n answer == this._solution,\n );\n\n this._answer = answer;\n }\n }\n\n // renders the requested hint\n private _renderHint(): TemplateResult {\n if (!this._hint) {\n return html``;\n }\n\n return html` <p>${this._hint}</p> `;\n }\n\n // renders the hint button until\n // all max hints have been used\n private _renderHintButton(): TemplateResult {\n if (!this._showHint) {\n return html``;\n }\n\n return html`\n <div class=\"game-controls--hint\">\n <button @click=\"${this._handleHintClicked}\">\n ${this.i18n.translate(\"show-hint\")} (${this._hints.length - this._hintsIndex})\n </button>\n </div>\n `;\n }\n\n // handles the click on the hint button\n // and shows the next hint if available\n // subtracts the cost of the hint from\n // the question score\n private _handleHintClicked(): void {\n console.debug(\"handleHintClicked\", [this._hintsIndex, this._hints.length]);\n\n if (this._hintsIndex < this._hints.length) {\n const hintText = this._generateHintText(this._hints[this._hintsIndex]);\n\n if (hintText) {\n this._hint = hintText;\n this._hintsIndex++;\n this._score0.subtract(HINT_COST);\n }\n }\n\n if (this._hintsIndex >= this._hints.length) {\n // this._hintsIndex = 0;\n this._showHint = false;\n }\n }\n\n // renders the feedback overlay\n private _renderFeedback(): TemplateResult {\n // do not show anything until an answer has been made\n // and the score is greater than 0\n if (!this._answer && this._score0.value > 0) {\n return html``;\n }\n\n // check if the answer is correct\n // cast to strings to compare\n const is_correct = this._answer + \"\" == this._solution + \"\";\n const score = is_correct ? this._score0.value : 0;\n\n if (this._score0.isRunning()) {\n this._score0.stop();\n }\n\n this.totalScore += score;\n\n // Fire-and-forget recallability feedback.\n if (this._incident?.id) {\n this._apiService.incidentRecallability(this._incident?.id, this._playerDob, is_correct);\n }\n\n if (is_correct) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-correct\")}!</h3>\n <p>\n ${this._hintsIndex == 1 ? this.i18n.translate(\"used-hint-singular\") : this.i18n.translate(\"used-hint-plural\").replace(/__HINTS__/, this._hintsIndex + '')}\n </p>\n <p>\n ${score == 1 ? this.i18n.translate(\"number-points-singular\") : this.i18n.translate(\"number-points-plural\").replace(/__POINTS__/, score + '')}\n </p>\n\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else if (!is_correct && this._answer) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-wrong\")}</h3>\n <p>\n ${this.i18n.translate(\"correct-answer-was\").replace(/__WRONG__/, this._answer + '').replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Helaas</h3>\n <p>\n ${this.i18n.translate(\"no-answer-correct-answer-was\").replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n }\n }\n\n // renders the next question button\n private _renderNextQuestionButton(): TemplateResult {\n if (this._numberOfQuestionsSeen < this.numberOfQuestions) {\n return html`\n <button @click=\"${this._loadQuestion}\">${this.i18n.translate(\"next-question\")}</button>\n `;\n }\n\n return html` <button @click=\"${this._endGame}\">${this.i18n.translate(\"quit\")}</button> `;\n }\n\n // renders the end of the game\n private _endGame(): void {\n this._renderState = GameState.END;\n }\n\n private renderGameEnd(): TemplateResult {\n console.debug(\"renderGameEnd\");\n return html`\n ${this._renderHeader(\"The end!\")}\n <div class=\"guess-the-year-game-end\">${this.i18n.translate(\"end\")}</div>\n <button @click=\"${() => (this._renderState = GameState.SPLASH)}\">\n ${this.i18n.translate(\"new-game\")}\n </button>\n ${this._renderFooter()}\n `;\n }\n\n private setupNewGame(): void {\n console.debug(\"new game!\");\n\n console.debug({\n \"number of questions\": this.numberOfQuestions,\n from: this.from.toISOString(),\n to: this.to.toISOString(),\n });\n\n this.totalScore = 0;\n this._numberOfQuestionsSeen = 0;\n\n this._loadQuestion();\n }\n\n private _resetStage(): void {\n this.sources = [];\n this._incident = undefined;\n this._hints = [];\n this._answer = undefined;\n this._answers = [];\n this._hintsIndex = 0;\n this._score0.reset();\n this._showHint = false;\n this._hint = undefined;\n }\n\n async _loadQuestion(): Promise<void> {\n this._resetStage();\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n this.category,\n this.emotion,\n this.impact,\n this.date,\n this.from.format(\"YYYY-MM-DD\"),\n this.to.format(\"YYYY-MM-DD\"),\n \"40\",\n \"quiz_year\"\n );\n\n this._incident = response.incident;\n this.sources = response.sources;\n\n this._solution = Number(\n (response.incident?.yearplusmonth || \"\").substring(0, 4),\n );\n\n const answers = [this._solution];\n const from = this.from.year();\n const to = this.to.year();\n\n // generate 3 more random and unique answers between to and from\n while (answers.length < 4) {\n const randomAnswer = Math.floor(Math.random() * (to - from)) + from;\n if (!answers.includes(randomAnswer)) {\n answers.push(randomAnswer);\n }\n }\n\n // sort theses answers\n answers.sort();\n\n this._answers = answers;\n\n for (let i = 0; i < this.maxHints; i++) {\n console.debug(\"loading hint\", i);\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n Util.shuffleArray([...Categories]).shift(),\n undefined,\n undefined,\n \"\",\n `${this._solution}-01-01`,\n `${this._solution}-12-31`,\n undefined,\n undefined,\n );\n\n if (response.incident) {\n this._hints.push(response.incident);\n }\n }\n\n if (this._hints.length === 0) {\n this._showHint = false;\n }\n else {\n this._showHint = true;\n }\n\n // start render game stage\n this._renderState = GameState.PLAY;\n\n // start score counter\n this._score0.start();\n\n // increment question counter\n this._numberOfQuestionsSeen += 1;\n }\n\n private _generateHintText(hintIncident: Incident): string {\n let hint = \"\";\n const hintTemplates = this.i18n.HintTemplates[hintIncident.category];\n switch (hintIncident.category) {\n case Category.newsItem:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] || \"\"\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.radioSong:\n // The title property of radioSongs always follow this pattern: track - artist\n const track = hintIncident.title.replace(/(.*?)\\s+\\-.*/, \"$1\");\n const artist = hintIncident.title.replace(/.*\\-(.*)/, \"$1\");\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n )\n .replace(/__ARTIST__/, artist)\n .replace(/__TRACK__/, track);\n break;\n case Category.cinemaMovie:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.tech:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case Category.newsPresenter:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n case Category.tvShowOrSeries:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n case Category.sports:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n case Category.showbizz:\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title || hintIncident.text);\n break;\n }\n return hint;\n }\n\n renderSources(): TemplateResult {\n console.debug(\"renderSources\");\n if (!this.sources.length) {\n return html``;\n }\n // deduplicate array via [...new Set(this.sources)]\n return html`\n <div class=\"guess-the-year-sources\">\n Source: ${[...new Set(this.sources)].join(\", \")}\n </div>\n `;\n }\n\n _handleImageLoadError = (evt: Event, incident: Incident) => {\n // grab the image element that triggered the error\n const targetImage = evt.target as HTMLImageElement;\n console.debug(`Error loading image: ${targetImage.src}`);\n\n // find out which no image source needs to be used\n const noImageSrc = this.noImageSrc || NoImageImg;\n\n // don't try to set the image source if it\n // has already been set\n if (targetImage.src == noImageSrc) {\n return;\n }\n\n // report broken images back to the server if set.\n if (this.reportBrokenImages) {\n if (incident) {\n this._apiService.postAttributeQualityFeedback(\n incident.id,\n \"image\",\n targetImage.src,\n ContentFeedback.incorrect,\n );\n }\n }\n\n // wait a bit before setting the image\n // so we don't hammer the no image server\n setTimeout(() => {\n targetImage.src = noImageSrc;\n }, 250);\n\n return false;\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"guess-the-year\": GuessTheYear;\n }\n}\n"]}
package/dist/index.html CHANGED
@@ -28,8 +28,8 @@
28
28
  --guess-the-year-title-background-color: orange;
29
29
  --guess-the-year-title-color: white;
30
30
  /* --guess-the-year-text-position: static; */
31
- --guess-the-year-text-background-color: rgba(255, 255, 255, 0.9);
32
- --guess-the-year-text-color: #000;
31
+ /* --guess-the-year-text-color: white;
32
+ --guess-the-year-text-background-color: rgb(3, 78, 3); */
33
33
  --guess-the-year-text-max-height: 200px;
34
34
  --guess-the-year-tile-min-height: 500px;
35
35
  --guess-the-year-tile-max-height: 90vh;
@@ -7,7 +7,8 @@ export declare class ApiService {
7
7
  sources: string[];
8
8
  }>;
9
9
  postAttributeQualityFeedback(incidentid: string, attribute: string, value: string, remark: string): Promise<void>;
10
- postIncidentQualityFeedback(incidentid: string, remark: string): Promise<void>;
10
+ postIncidentFeedback(incidentid: string, remark: string): Promise<void>;
11
+ incidentRecallability(incidentid: string, dob: number, is_correct: boolean): Promise<void>;
11
12
  }
12
13
  export declare enum ContentFeedback {
13
14
  incorrect = "incorrect",// This content is not correct
@@ -1 +1 @@
1
- {"version":3,"file":"ApiService.d.ts","sourceRoot":"","sources":["../../src/lib/ApiService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM;IAEzB,gBAAgB,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA2FpD,4BAA4B,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAkBH,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAa5E;AAED,oBAAY,eAAe;IACzB,SAAS,cAAc,CAAE,8BAA8B;IACvD,QAAQ,aAAa,CAAE,4BAA4B;IACnD,OAAO,YAAY,CAAE,2BAA2B;IAChD,WAAW,gBAAgB,CAAE,uDAAuD;IACpF,OAAO,YAAY,CAAE,iCAAiC;IACtD,OAAO,YAAY,CAAE,oDAAoD;IACzE,OAAO,YAAY,CAAE,iCAAiC;IACtD,OAAO,YAAY;CACpB"}
1
+ {"version":3,"file":"ApiService.d.ts","sourceRoot":"","sources":["../../src/lib/ApiService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM;IAEzB,gBAAgB,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IA2FpD,4BAA4B,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAkBH,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAevD,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;CAGxF;AAED,oBAAY,eAAe;IACzB,SAAS,cAAc,CAAE,8BAA8B;IACvD,QAAQ,aAAa,CAAE,4BAA4B;IACnD,OAAO,YAAY,CAAE,2BAA2B;IAChD,WAAW,gBAAgB,CAAE,uDAAuD;IACpF,OAAO,YAAY,CAAE,iCAAiC;IACtD,OAAO,YAAY,CAAE,oDAAoD;IACzE,OAAO,YAAY,CAAE,iCAAiC;IACtD,OAAO,YAAY;CACpB"}
@@ -97,7 +97,7 @@ export class ApiService {
97
97
  });
98
98
  }
99
99
  // post feedback about an incident.
100
- async postIncidentQualityFeedback(incidentid, remark) {
100
+ async postIncidentFeedback(incidentid, remark) {
101
101
  const url = `${this.teeeApiUrl}/feedback/${incidentid}/remark`;
102
102
  await fetch(url, {
103
103
  method: "POST",
@@ -110,6 +110,10 @@ export class ApiService {
110
110
  }),
111
111
  });
112
112
  }
113
+ // Post the recallability of this incident by the player.
114
+ async incidentRecallability(incidentid, dob, is_correct) {
115
+ this.postIncidentFeedback(incidentid, `recall:absolute-year:${Util.dobToGeneration(dob)}:${is_correct}`);
116
+ }
113
117
  }
114
118
  export var ContentFeedback;
115
119
  (function (ContentFeedback) {
@@ -1 +1 @@
1
- {"version":3,"file":"ApiService.js","sourceRoot":"","sources":["../../src/lib/ApiService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAC;AAGrC,MAAM,OAAO,UAAU;IACrB,YAAoB,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;IAAI,CAAC;IAEpC,KAAK,CAAC,gBAAgB,CAC3B,GAAW,EACX,QAA4B,EAC5B,OAA2B,EAC3B,MAA0B,EAC1B,IAAY,EACZ,IAAY,EACZ,EAAU,EACV,SAA6B,EAC7B,OAA2B;QAE3B,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAE9B,yCAAyC;YACzC,MAAM,IAAI,GAAG,GAAG,IAAI,EAAE,CAAC;YACvB,MAAM,UAAU,GAAG,QAAQ,IAAI,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,MAAM,IAAI,EAAE,CAAC;YAC7B,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,CAAC;YAC1B,MAAM,WAAW,GAAG,GAAG,CAAC;YACxB,MAAM,eAAe,GAAG,SAAS,IAAI,EAAE,CAAC;YACxC,MAAM,QAAQ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"./Util\";\nimport { Incident } from \"./Incident\";\n\nexport class ApiService {\n constructor(private teeeApiUrl: string) { }\n\n public async fetchOneIncident(\n pov: string,\n category: string | undefined,\n emotion: string | undefined,\n impact: string | undefined,\n date: string,\n from: string,\n to: string,\n maxLasted: string | undefined,\n variant: string | undefined,\n ): Promise<{ incident: Incident | undefined; sources: string[] }> {\n return new Promise(async (resolve, reject) => {\n console.debug(\"fetchHistory\");\n\n // Set defaults to explicit empty string.\n const povs = pov || \"\";\n const categories = category || \"\";\n const emotions = emotion || \"\";\n const impacts = impact || \"\";\n const dateString = date || \"\";\n const fromString = from || \"\";\n const toString = to || \"\";\n const limitString = \"1\";\n const maxLastedString = maxLasted || \"\";\n const variants = variant || \"\";\n\n try {\n const urls: Array<URL> = [];\n\n const urlSearch = new URLSearchParams({\n pov: povs,\n emotion: emotions,\n impact: impacts,\n limit: limitString,\n variant: variants\n });\n\n // Always randomize incidents on the backend.\n urlSearch.append(\"seed\", \"\" + new Date().getTime());\n\n if (maxLasted) {\n urlSearch.append(\"maxlasted\", \"\" + maxLastedString);\n }\n\n // add category to search\n urlSearch.set(\"category\", categories);\n\n if (dateString) {\n // setup url\n const url = new URL(`${this.teeeApiUrl}/${date}`);\n url.search = urlSearch.toString();\n\n urls.push(url);\n } else if (fromString && toString) {\n const from = new Date(fromString).toISOString().substring(0, 10);\n const to = new Date(toString).toISOString().substring(0, 10);\n\n // add from and to date to search\n urlSearch.set(\"from\", from);\n urlSearch.set(\"to\", to);\n\n // setup url\n const url = new URL(this.teeeApiUrl);\n url.search = urlSearch.toString();\n\n urls.push(url);\n } else {\n throw \"No correct date or period specified.\";\n }\n\n // start fetching all incidents\n let incidents: Array<Incident> = [];\n await Util.asyncForeach(urls, async (url: string) => {\n const response = await fetch(url);\n const json = await response.json();\n incidents = incidents.concat(json.results);\n });\n // Choose the first incident in the list as the one to return.\n const firstIncidentInList = incidents.length ? incidents[0] : undefined;\n\n // search for sources on incidents\n const sourcesFoundInIncidents: IHash = {};\n incidents.forEach((incident: Incident) => {\n if (incident.source) {\n sourcesFoundInIncidents[incident.source] = true;\n }\n });\n\n console.debug([incidents, sourcesFoundInIncidents]);\n\n resolve({\n incident: firstIncidentInList,\n sources: Object.keys(sourcesFoundInIncidents),\n });\n } catch (e) {\n reject(e);\n }\n });\n }\n\n // post feedback about the attribute of an incident.\n public async postAttributeQualityFeedback(\n incidentid: string,\n attribute: string,\n value: string,\n remark: string,\n ) {\n const url = `${this.teeeApiUrl}/feedback/${incidentid}/attribute`;\n await fetch(url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n attribute,\n value,\n remark,\n }),\n });\n }\n\n // post feedback about an incident.\n public async postIncidentQualityFeedback(incidentid: string, remark: string) {\n const url = `${this.teeeApiUrl}/feedback/${incidentid}/remark`;\n await fetch(url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n remark,\n }),\n });\n }\n}\n\nexport enum ContentFeedback {\n incorrect = \"incorrect\", // This content is not correct\n tooShort = \"tooShort\", // This content is too short\n tooLong = \"tooLong\", // This content is too long\n toneOfVoice = \"toneOfVoice\", // The tone of voice of this content should be improved\n missing = \"missing\", // This content should be created\n noMatch = \"noMatch\", // This content does not match with its sibling data\n badData = \"badData\", // This content contains bad data\n unknown = \"unknown\", // We did not expect this input...\n}\n"]}
1
+ {"version":3,"file":"ApiService.js","sourceRoot":"","sources":["../../src/lib/ApiService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAC;AAGrC,MAAM,OAAO,UAAU;IACrB,YAAoB,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;IAAI,CAAC;IAEpC,KAAK,CAAC,gBAAgB,CAC3B,GAAW,EACX,QAA4B,EAC5B,OAA2B,EAC3B,MAA0B,EAC1B,IAAY,EACZ,IAAY,EACZ,EAAU,EACV,SAA6B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,UAAkB,EAAE,MAAc;QAClE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,SAAS,CAAC;QAC/D,MAAM,KAAK,CAAC,GAAG,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,MAAM;aACP,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED,yDAAyD;IAClD,KAAK,CAAC,qBAAqB,CAAC,UAAkB,EAAE,GAAW,EAAE,UAAmB;QACrF,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,wBAAwB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;IAC3G,CAAC;CACF;AAED,MAAM,CAAN,IAAY,eASX;AATD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,8CAA2B,CAAA;IAC3B,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EATW,eAAe,KAAf,eAAe,QAS1B","sourcesContent":["import { Util, IHash } from \"./Util\";\nimport { Incident } from \"./Incident\";\n\nexport class ApiService {\n constructor(private teeeApiUrl: string) { }\n\n public async fetchOneIncident(\n pov: string,\n category: string | undefined,\n emotion: string | undefined,\n impact: string | undefined,\n date: string,\n from: string,\n to: string,\n maxLasted: string | undefined,\n variant: string | undefined,\n ): Promise<{ incident: Incident | undefined; sources: string[] }> {\n return new Promise(async (resolve, reject) => {\n console.debug(\"fetchHistory\");\n\n // Set defaults to explicit empty string.\n const povs = pov || \"\";\n const categories = category || \"\";\n const emotions = emotion || \"\";\n const impacts = impact || \"\";\n const dateString = date || \"\";\n const fromString = from || \"\";\n const toString = to || \"\";\n const limitString = \"1\";\n const maxLastedString = maxLasted || \"\";\n const variants = variant || \"\";\n\n try {\n const urls: Array<URL> = [];\n\n const urlSearch = new URLSearchParams({\n pov: povs,\n emotion: emotions,\n impact: impacts,\n limit: limitString,\n variant: variants\n });\n\n // Always randomize incidents on the backend.\n urlSearch.append(\"seed\", \"\" + new Date().getTime());\n\n if (maxLasted) {\n urlSearch.append(\"maxlasted\", \"\" + maxLastedString);\n }\n\n // add category to search\n urlSearch.set(\"category\", categories);\n\n if (dateString) {\n // setup url\n const url = new URL(`${this.teeeApiUrl}/${date}`);\n url.search = urlSearch.toString();\n\n urls.push(url);\n } else if (fromString && toString) {\n const from = new Date(fromString).toISOString().substring(0, 10);\n const to = new Date(toString).toISOString().substring(0, 10);\n\n // add from and to date to search\n urlSearch.set(\"from\", from);\n urlSearch.set(\"to\", to);\n\n // setup url\n const url = new URL(this.teeeApiUrl);\n url.search = urlSearch.toString();\n\n urls.push(url);\n } else {\n throw \"No correct date or period specified.\";\n }\n\n // start fetching all incidents\n let incidents: Array<Incident> = [];\n await Util.asyncForeach(urls, async (url: string) => {\n const response = await fetch(url);\n const json = await response.json();\n incidents = incidents.concat(json.results);\n });\n // Choose the first incident in the list as the one to return.\n const firstIncidentInList = incidents.length ? incidents[0] : undefined;\n\n // search for sources on incidents\n const sourcesFoundInIncidents: IHash = {};\n incidents.forEach((incident: Incident) => {\n if (incident.source) {\n sourcesFoundInIncidents[incident.source] = true;\n }\n });\n\n console.debug([incidents, sourcesFoundInIncidents]);\n\n resolve({\n incident: firstIncidentInList,\n sources: Object.keys(sourcesFoundInIncidents),\n });\n } catch (e) {\n reject(e);\n }\n });\n }\n\n // post feedback about the attribute of an incident.\n public async postAttributeQualityFeedback(\n incidentid: string,\n attribute: string,\n value: string,\n remark: string,\n ) {\n const url = `${this.teeeApiUrl}/feedback/${incidentid}/attribute`;\n await fetch(url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n attribute,\n value,\n remark,\n }),\n });\n }\n\n // post feedback about an incident.\n public async postIncidentFeedback(incidentid: string, remark: string) {\n const url = `${this.teeeApiUrl}/feedback/${incidentid}/remark`;\n await fetch(url, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n remark,\n }),\n });\n }\n\n // Post the recallability of this incident by the player.\n public async incidentRecallability(incidentid: string, dob: number, is_correct: boolean) {\n this.postIncidentFeedback(incidentid, `recall:absolute-year:${Util.dobToGeneration(dob)}:${is_correct}`);\n }\n}\n\nexport enum ContentFeedback {\n incorrect = \"incorrect\", // This content is not correct\n tooShort = \"tooShort\", // This content is too short\n tooLong = \"tooLong\", // This content is too long\n toneOfVoice = \"toneOfVoice\", // The tone of voice of this content should be improved\n missing = \"missing\", // This content should be created\n noMatch = \"noMatch\", // This content does not match with its sibling data\n badData = \"badData\", // This content contains bad data\n unknown = \"unknown\", // We did not expect this input...\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Incident.d.ts","sourceRoot":"","sources":["../../src/lib/Incident.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,QAAQ;IAClB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,UAAU,YActB,CAAC"}
1
+ {"version":3,"file":"Incident.d.ts","sourceRoot":"","sources":["../../src/lib/Incident.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,QAAQ;IAClB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,UAAU,YAetB,CAAC"}
@@ -32,5 +32,6 @@ export const Categories = [
32
32
  Category.showbizz,
33
33
  Category.sports,
34
34
  Category.tech,
35
+ Category.tvShowOrSeries,
35
36
  ];
36
37
  //# sourceMappingURL=Incident.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Incident.js","sourceRoot":"","sources":["../../src/lib/Incident.ts"],"names":[],"mappings":"AAYA,MAAM,CAAN,IAAY,QAkBX;AAlBD,WAAY,QAAQ;IAClB,6CAAiC,CAAA;IACjC,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yCAA6B,CAAA;IAC7B,uCAA2B,CAAA;IAC3B,uCAA2B,CAAA;IAC3B,2CAA+B,CAAA;IAC/B,mCAAuB,CAAA;IACvB,iCAAqB,CAAA;IACrB,uCAA2B,CAAA;IAC3B,mCAAuB,CAAA;IACvB,6CAAiC,CAAA;IACjC,2CAA+B,CAAA;IAC/B,uBAAW,CAAA;IACX,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;AACrB,CAAC,EAlBW,QAAQ,KAAR,QAAQ,QAkBnB;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,0BAA0B;IAC1B,2BAA2B;IAC3B,gBAAgB;IAChB,QAAQ,CAAC,WAAW;IACpB,yBAAyB;IACzB,wBAAwB;IACxB,QAAQ,CAAC,QAAQ;IACjB,QAAQ,CAAC,aAAa;IACtB,sBAAsB;IACtB,QAAQ,CAAC,SAAS;IAClB,QAAQ,CAAC,QAAQ;IACjB,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,IAAI;CACd,CAAC","sourcesContent":["export interface Incident {\n image: string;\n audio: string;\n id: string;\n title: string;\n text: string;\n category: string;\n country: string;\n source: string;\n yearplusmonth: string;\n}\n\nexport enum Category {\n tvShowOrSeries = \"tvShowOrSeries\",\n showbizz = \"showbizz\",\n trend = \"trend\",\n tech = \"tech\",\n fashionTrend = \"fashionTrend\",\n cinemaMovie = \"cinemaMovie\",\n streetScene = \"streetScene\",\n newsPresenter = \"newsPresenter\",\n radioSong = \"radioSong\",\n newsItem = \"newsItem\",\n iconicAlbum = \"iconicAlbum\",\n radioShow = \"radioShow\",\n bestSellerBook = \"bestSellerBook\",\n advertisement = \"advertisement\",\n car = \"car\",\n sports = \"sports\",\n unknown = \"unknown\",\n}\n\nexport const Categories = [\n // Category.advertisement,\n // Category.bestSellerBook,\n // Category.car,\n Category.cinemaMovie,\n // Category.fashionTrend,\n // Category.iconicAlbum,\n Category.newsItem,\n Category.newsPresenter,\n // Category.radioShow,\n Category.radioSong,\n Category.showbizz,\n Category.sports,\n Category.tech,\n];\n"]}
1
+ {"version":3,"file":"Incident.js","sourceRoot":"","sources":["../../src/lib/Incident.ts"],"names":[],"mappings":"AAYA,MAAM,CAAN,IAAY,QAkBX;AAlBD,WAAY,QAAQ;IAClB,6CAAiC,CAAA;IACjC,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yCAA6B,CAAA;IAC7B,uCAA2B,CAAA;IAC3B,uCAA2B,CAAA;IAC3B,2CAA+B,CAAA;IAC/B,mCAAuB,CAAA;IACvB,iCAAqB,CAAA;IACrB,uCAA2B,CAAA;IAC3B,mCAAuB,CAAA;IACvB,6CAAiC,CAAA;IACjC,2CAA+B,CAAA;IAC/B,uBAAW,CAAA;IACX,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;AACrB,CAAC,EAlBW,QAAQ,KAAR,QAAQ,QAkBnB;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,0BAA0B;IAC1B,2BAA2B;IAC3B,gBAAgB;IAChB,QAAQ,CAAC,WAAW;IACpB,yBAAyB;IACzB,wBAAwB;IACxB,QAAQ,CAAC,QAAQ;IACjB,QAAQ,CAAC,aAAa;IACtB,sBAAsB;IACtB,QAAQ,CAAC,SAAS;IAClB,QAAQ,CAAC,QAAQ;IACjB,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,cAAc;CACxB,CAAC","sourcesContent":["export interface Incident {\n image: string;\n audio: string;\n id: string;\n title: string;\n text: string;\n category: string;\n country: string;\n source: string;\n yearplusmonth: string;\n}\n\nexport enum Category {\n tvShowOrSeries = \"tvShowOrSeries\",\n showbizz = \"showbizz\",\n trend = \"trend\",\n tech = \"tech\",\n fashionTrend = \"fashionTrend\",\n cinemaMovie = \"cinemaMovie\",\n streetScene = \"streetScene\",\n newsPresenter = \"newsPresenter\",\n radioSong = \"radioSong\",\n newsItem = \"newsItem\",\n iconicAlbum = \"iconicAlbum\",\n radioShow = \"radioShow\",\n bestSellerBook = \"bestSellerBook\",\n advertisement = \"advertisement\",\n car = \"car\",\n sports = \"sports\",\n unknown = \"unknown\",\n}\n\nexport const Categories = [\n // Category.advertisement,\n // Category.bestSellerBook,\n // Category.car,\n Category.cinemaMovie,\n // Category.fashionTrend,\n // Category.iconicAlbum,\n Category.newsItem,\n Category.newsPresenter,\n // Category.radioShow,\n Category.radioSong,\n Category.showbizz,\n Category.sports,\n Category.tech,\n Category.tvShowOrSeries,\n];\n"]}
@@ -6,6 +6,7 @@ export declare class Util {
6
6
  * Shuffle an array
7
7
  */
8
8
  static shuffleArray(array: Array<any>): Array<any>;
9
+ static dobToGeneration(dob: number): string;
9
10
  }
10
11
  export interface IHash {
11
12
  [Identifier: string | number]: boolean | number | string | string[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/lib/Util.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI;WACK,YAAY,CAC9B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,yDAAyD;IAC5E,QAAQ,EAAE,GAAG;WAOD,iBAAiB,CAC7B,aAAa,EAAE,WAAW,GAAG,SAAS,GACrC,IAAI;IAWP;;OAEG;WACW,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;CAG1D;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GACxB,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,SAAS,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CACzC"}
1
+ {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/lib/Util.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI;WACK,YAAY,CAC9B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,yDAAyD;IAC5E,QAAQ,EAAE,GAAG;WAOD,iBAAiB,CAC7B,aAAa,EAAE,WAAW,GAAG,SAAS,GACrC,IAAI;IAWP;;OAEG;WACW,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;WAK3C,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAkBnD;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAC1B,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,SAAS,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CACzC"}