guess-the-year-web-component 3.1.0 → 3.2.1
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 +2 -5
- package/dist/guess-the-year.d.ts.map +1 -1
- package/dist/guess-the-year.js +10 -7
- package/dist/guess-the-year.js.map +1 -1
- package/dist/index.html +4 -2
- package/dist/main.js +9 -7
- package/package.json +1 -1
- package/src/guess-the-year.ts +11 -11
- package/src/index.html +4 -2
- package/src/scss/_variables.scss +8 -9
- package/todo.txt +0 -3
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
|
-
* `
|
|
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
|
|
@@ -45,6 +41,7 @@ The guess-the-year element accepts css parameters to specify (significant parts
|
|
|
45
41
|
* `--guess-the-year-font-family` : the font of the tile
|
|
46
42
|
* `--guess-the-year-title-color` : the text color of the title of the tile
|
|
47
43
|
* `--guess-the-year-title-background-color`: the background color of the title of the tile
|
|
44
|
+
* `--guess-the-year-intro-background-color`: the background color of the intro paragraphs
|
|
48
45
|
* `--guess-the-year-title-font-size` : the font size of the title text of the tile
|
|
49
46
|
* `--guess-the-year-text-color` : the color of the content text of the tile
|
|
50
47
|
* `--guess-the-year-text-background-color` : the color of the background of the content of the tile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guess-the-year.d.ts","sourceRoot":"","sources":["../src/guess-the-year.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5E,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAwB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"guess-the-year.d.ts","sourceRoot":"","sources":["../src/guess-the-year.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5E,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAwB,MAAM,gBAAgB,CAAC;AAqBhE,qBACa,YAAa,SAAQ,UAAU;IAE1C,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,OAAO,CAA0B;IAEzC,IAAI,OAAO,IAIQ,OAAO,CAFzB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAGD,UAAU,EAAE,MAAM,CAA2B;IAG7C,kBAAkB,EAAE,OAAO,CAAS;IAGpC,IAAI,EAAE,MAAM,CAAM;IAGlB,OAAO,EAAE,MAAM,CAAM;IAGrB,QAAQ,EAAE,MAAM,CAAM;IAGtB,OAAO,EAAE,MAAM,CAAM;IAGrB,MAAM,EAAE,MAAM,CAAM;IAuBpB,IAAI,EAAE,KAAK,CAA8F;IAuBzG,EAAE,EAAE,KAAK,CAA4F;IAGrG,UAAU,EAAE,MAAM,CAAM;IAGxB,cAAc,EAAE,OAAO,CAAS;IAGhC,QAAQ,EAAE,MAAM,CAAK;IAGrB,iBAAiB,EAAE,MAAM,CAA0F;I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oBAAoB;IAyB5B,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,eAAe;IAmEvB,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,WAAW;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"}
|
package/dist/guess-the-year.js
CHANGED
|
@@ -25,6 +25,8 @@ const MAX_YEAR = parseInt(dayjs().format('YYYY'), 10);
|
|
|
25
25
|
const GTY_FROM_YEAR_VAR = 'gty-from-year';
|
|
26
26
|
const GTY_TO_YEAR_VAR = 'gty-to-year';
|
|
27
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;
|
|
28
30
|
const GTY_PLAYER_DOB_VAR = 'gty-player-dob';
|
|
29
31
|
let GuessTheYear = class GuessTheYear extends LitElement {
|
|
30
32
|
get loading() {
|
|
@@ -235,7 +237,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
235
237
|
<p>
|
|
236
238
|
${this.i18n.translate("game-settings-p0")}
|
|
237
239
|
<select @change="${this._setPlayerDob}">
|
|
238
|
-
${this._renderYearStepXSelectOptions(
|
|
240
|
+
${this._renderYearStepXSelectOptions(MAX_DOB, MIN_DOB, 1, this._playerDob + '')}
|
|
239
241
|
</select>
|
|
240
242
|
${this.i18n.translate("game-settings-p1")}
|
|
241
243
|
<select @change="${this._setNumberOfQuestions}">
|
|
@@ -331,6 +333,12 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
331
333
|
/>
|
|
332
334
|
</div>
|
|
333
335
|
`;
|
|
336
|
+
}
|
|
337
|
+
if (!this.suppressImages) {
|
|
338
|
+
// Preserve html structure to prevent the webcomponent to collapse.
|
|
339
|
+
return html `<div class="incident--image">
|
|
340
|
+
<img/>
|
|
341
|
+
</div>`;
|
|
334
342
|
}
|
|
335
343
|
return html ``;
|
|
336
344
|
}
|
|
@@ -437,6 +445,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
437
445
|
this._score0.stop();
|
|
438
446
|
}
|
|
439
447
|
this.totalScore += score;
|
|
448
|
+
// Fire-and-forget recallability feedback.
|
|
440
449
|
if ((_a = this._incident) === null || _a === void 0 ? void 0 : _a.id) {
|
|
441
450
|
this._apiService.incidentRecallability((_b = this._incident) === null || _b === void 0 ? void 0 : _b.id, this._playerDob, is_correct);
|
|
442
451
|
}
|
|
@@ -498,7 +507,6 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
498
507
|
this._renderState = GameState.END;
|
|
499
508
|
}
|
|
500
509
|
renderGameEnd() {
|
|
501
|
-
// clearInterval(this._scoreIntervalHandler);
|
|
502
510
|
console.debug("renderGameEnd");
|
|
503
511
|
return html `
|
|
504
512
|
${this._renderHeader("The end!")}
|
|
@@ -509,8 +517,6 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
509
517
|
${this._renderFooter()}
|
|
510
518
|
`;
|
|
511
519
|
}
|
|
512
|
-
// private _incidentsStack = [];
|
|
513
|
-
// private _totalScore: number = 0;
|
|
514
520
|
setupNewGame() {
|
|
515
521
|
console.debug("new game!");
|
|
516
522
|
console.debug({
|
|
@@ -520,12 +526,9 @@ let GuessTheYear = class GuessTheYear extends LitElement {
|
|
|
520
526
|
});
|
|
521
527
|
this.totalScore = 0;
|
|
522
528
|
this._numberOfQuestionsSeen = 0;
|
|
523
|
-
// this._question.load(this.from.format('YYYY'), this.to.format('YYYY'));
|
|
524
|
-
// this._question.init();
|
|
525
529
|
this._loadQuestion();
|
|
526
530
|
}
|
|
527
531
|
_resetStage() {
|
|
528
|
-
// window.scrollTo(0, 0);
|
|
529
532
|
this.sources = [];
|
|
530
533
|
this._incident = undefined;
|
|
531
534
|
this._hints = [];
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,YAAY,GAAW,IAAI,CAAC;AAClC,MAAM,aAAa,GAAW,EAAE,CAAC;AACjC,MAAM,SAAS,GAAW,CAAC,CAAC;AAC5B,MAAM,QAAQ,GAAW,IAAI,CAAC;AAC9B,MAAM,QAAQ,GAAW,QAAQ,CAAC,KAAK,EAA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AC,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;wCACmG;AAGrG;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;uDACuC;AAM3G;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;AA3HrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA+zBxB","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 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(MIN_YEAR, MAX_YEAR, 1, this.from.format(\"YYYY\"))}\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 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 (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 // 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.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"]}
|
|
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,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,YAAY,GAAW,IAAI,CAAC;AAClC,MAAM,aAAa,GAAW,EAAE,CAAC;AACjC,MAAM,SAAS,GAAW,CAAC,CAAC;AAC5B,MAAM,QAAQ,GAAW,IAAI,CAAC;AAC9B,MAAM,QAAQ,GAAW,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,CAA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,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;wCACmG;AAGrG;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;uDACuC;AAM3G;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;AA3HrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA6zBxB","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 if (!this.suppressImages) {\n // Preserve html structure to prevent the webcomponent to collapse.\n return html`<div class=\"incident--image\">\n <img/>\n </div>`;\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 // 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,14 +28,16 @@
|
|
|
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-
|
|
32
|
-
--guess-the-year-
|
|
31
|
+
/* --guess-the-year-text-color: white; */
|
|
32
|
+
--guess-the-year-intro-background-color: white;
|
|
33
|
+
--guess-the-year-text-background-color: rgba(255, 255, 255, 0.861);
|
|
33
34
|
--guess-the-year-text-max-height: 200px;
|
|
34
35
|
--guess-the-year-tile-min-height: 500px;
|
|
35
36
|
--guess-the-year-tile-max-height: 90vh;
|
|
36
37
|
--guess-the-year-attribution-font-color: rgb(168, 170, 171);
|
|
37
38
|
--guess-the-year-attribution-font-size: 8px;
|
|
38
39
|
--guess-the-year-font-family: "Comfortaa", cursive;
|
|
40
|
+
--guess-the-year-button-background-color: rgb(124, 1, 78);
|
|
39
41
|
|
|
40
42
|
min-height: 80vh;
|
|
41
43
|
}
|