@everymatrix/casino-tournament-list 1.20.5
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/dist/casino-tournament-list/casino-tournament-list.esm.js +1 -0
- package/dist/casino-tournament-list/index.esm.js +0 -0
- package/dist/casino-tournament-list/p-1368789d.js +1 -0
- package/dist/casino-tournament-list/p-908908a6.entry.js +15 -0
- package/dist/cjs/casino-tournament-banner_6.cjs.entry.js +8911 -0
- package/dist/cjs/casino-tournament-list.cjs.js +19 -0
- package/dist/cjs/index-c1b4bd7d.js +1284 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +43 -0
- package/dist/collection/components/casino-tournament-list/casino-tournament-list.css +97 -0
- package/dist/collection/components/casino-tournament-list/casino-tournament-list.js +578 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +104 -0
- package/dist/collection/utils/utils.js +20 -0
- package/dist/components/casino-tournament-banner.js +6 -0
- package/dist/components/casino-tournament-banner2.js +598 -0
- package/dist/components/casino-tournament-buttons.js +6 -0
- package/dist/components/casino-tournament-buttons2.js +534 -0
- package/dist/components/casino-tournament-duration.js +6 -0
- package/dist/components/casino-tournament-duration2.js +220 -0
- package/dist/components/casino-tournament-info.js +6 -0
- package/dist/components/casino-tournament-info2.js +502 -0
- package/dist/components/casino-tournament-list.d.ts +11 -0
- package/dist/components/casino-tournament-list.js +1493 -0
- package/dist/components/casino-tournament-prizes.js +6 -0
- package/dist/components/casino-tournament-prizes2.js +190 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/moment.js +5677 -0
- package/dist/esm/casino-tournament-banner_6.entry.js +8902 -0
- package/dist/esm/casino-tournament-list.js +17 -0
- package/dist/esm/index-b57e0a6b.js +1258 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/sebastian.strulea/Documents/work/widgets-stencil/packages/casino-tournament-list/.stencil/packages/casino-tournament-list/stencil.config.d.ts +2 -0
- package/dist/types/components/casino-tournament-list/casino-tournament-list.d.ts +101 -0
- package/dist/types/components.d.ts +181 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import { Component, Prop, State, h, Element } from '@stencil/core';
|
|
2
|
+
import { getDevice, isMobile } from '../../utils/utils';
|
|
3
|
+
import { translate, getTranslations } from '../../utils/locale.utils';
|
|
4
|
+
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
5
|
+
import '@everymatrix/casino-tournament-banner';
|
|
6
|
+
import '@everymatrix/casino-tournament-info';
|
|
7
|
+
export class CasinoTournamentList {
|
|
8
|
+
constructor() {
|
|
9
|
+
/**
|
|
10
|
+
* NWA parameter tournaments offet
|
|
11
|
+
*/
|
|
12
|
+
this.offset = 0;
|
|
13
|
+
/**
|
|
14
|
+
* NWA parameter tournaments limit
|
|
15
|
+
*/
|
|
16
|
+
this.limit = 6;
|
|
17
|
+
/**
|
|
18
|
+
* NWA parameter show anonymous tournament
|
|
19
|
+
*/
|
|
20
|
+
this.showAnonymous = false;
|
|
21
|
+
/**
|
|
22
|
+
* Tournament states
|
|
23
|
+
*/
|
|
24
|
+
this.state = 'All,Ongoing,Upcoming,Expired';
|
|
25
|
+
/**
|
|
26
|
+
* Real time update
|
|
27
|
+
*/
|
|
28
|
+
this.updateTournaments = true;
|
|
29
|
+
/**
|
|
30
|
+
* Event for login button
|
|
31
|
+
*/
|
|
32
|
+
this.loginEvent = 'OpenLoginRegisterModal';
|
|
33
|
+
/**
|
|
34
|
+
* Event for register button
|
|
35
|
+
*/
|
|
36
|
+
this.registerEvent = 'OpenLoginRegisterModal';
|
|
37
|
+
/**
|
|
38
|
+
* Display as card
|
|
39
|
+
*/
|
|
40
|
+
this.cardMode = false;
|
|
41
|
+
/**
|
|
42
|
+
* Show read more button
|
|
43
|
+
*/
|
|
44
|
+
this.showReadMore = false;
|
|
45
|
+
/**
|
|
46
|
+
* Client custom styling via inline styles
|
|
47
|
+
*/
|
|
48
|
+
this.clientStyling = '';
|
|
49
|
+
/**
|
|
50
|
+
* Client custom styling via url
|
|
51
|
+
*/
|
|
52
|
+
this.clientStylingUrl = '';
|
|
53
|
+
/**
|
|
54
|
+
* Translations via URL
|
|
55
|
+
*/
|
|
56
|
+
this.translationUrl = '';
|
|
57
|
+
this.limitStylingAppends = false;
|
|
58
|
+
this.tournaments = [];
|
|
59
|
+
this.currentState = 'All';
|
|
60
|
+
this.isLoading = false;
|
|
61
|
+
this.tournamentsShown = 0;
|
|
62
|
+
this.allTournamentsShown = false;
|
|
63
|
+
}
|
|
64
|
+
getTournamentInfo(offset, limit) {
|
|
65
|
+
let url = new URL(this.endpoint + `/tournaments`);
|
|
66
|
+
let reqHeaders = new Headers();
|
|
67
|
+
if (this.session) {
|
|
68
|
+
reqHeaders.append('X-SessionId', this.session);
|
|
69
|
+
}
|
|
70
|
+
const filterOptions = {
|
|
71
|
+
StartTimeAfter: this.getStartTimeAfter(),
|
|
72
|
+
};
|
|
73
|
+
if (!this.session && this.showAnonymous == false) {
|
|
74
|
+
filterOptions.tags = 'no-role-set';
|
|
75
|
+
}
|
|
76
|
+
if (this.currentState && this.currentState != 'All') {
|
|
77
|
+
filterOptions.state = this.matchStatus(this.currentState);
|
|
78
|
+
}
|
|
79
|
+
const filter = Object.keys(filterOptions).map(k => `${k}=${filterOptions[k]}`).join(',');
|
|
80
|
+
url.searchParams.append('filter', filter);
|
|
81
|
+
url.searchParams.append('platform', getDevice());
|
|
82
|
+
url.searchParams.append('language', this.language);
|
|
83
|
+
url.searchParams.append('fields', 'id,nameOrTitle,termsUrl,thumbnail,startTime,endTime,closeTime,playerEnrolled');
|
|
84
|
+
url.searchParams.append('pagination', `offset=${offset},limit=${limit}`);
|
|
85
|
+
url.searchParams.append('sortField', 'StartTime');
|
|
86
|
+
url.searchParams.append('sortOrder', this.sortOrder || 'desc');
|
|
87
|
+
if (this.sortType) {
|
|
88
|
+
url.searchParams.append('sortType', this.sortType);
|
|
89
|
+
}
|
|
90
|
+
let requestOptions = {
|
|
91
|
+
method: 'GET',
|
|
92
|
+
headers: reqHeaders,
|
|
93
|
+
cache: 'no-cache'
|
|
94
|
+
};
|
|
95
|
+
this.isLoading = true;
|
|
96
|
+
fetch(url.href, requestOptions).then((res) => res.json())
|
|
97
|
+
.then((res) => {
|
|
98
|
+
this.tournaments = this.tournaments.concat(res.items);
|
|
99
|
+
this.tournamentsShown += res.items.length;
|
|
100
|
+
if (this.tournamentsShown >= res.total) {
|
|
101
|
+
this.allTournamentsShown = true;
|
|
102
|
+
}
|
|
103
|
+
if (this.updateTournaments) {
|
|
104
|
+
url.searchParams.set('pagination', `offset=0,limit=${this.tournamentsShown}`);
|
|
105
|
+
let endpointURL = `${this.endpoint}/tournaments/updates?${url.searchParams.toString()}`;
|
|
106
|
+
this.startUpdate(endpointURL, { headers: { 'accept': 'text/event-stream', 'X-SessionId': this.session } });
|
|
107
|
+
}
|
|
108
|
+
}).catch((err) => {
|
|
109
|
+
throw new Error(err);
|
|
110
|
+
}).finally(() => {
|
|
111
|
+
this.isLoading = false;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
createImagePlaceHolder(width, height) {
|
|
115
|
+
const canvas = document.createElement('canvas');
|
|
116
|
+
canvas.width = width;
|
|
117
|
+
canvas.height = height;
|
|
118
|
+
const ctx = canvas.getContext('2d');
|
|
119
|
+
ctx.fillStyle = 'rgb(0, 0, 0)';
|
|
120
|
+
ctx.fillRect(0, 0, width, height);
|
|
121
|
+
const img = new Image(width, height);
|
|
122
|
+
img.src = canvas.toDataURL();
|
|
123
|
+
return img.src;
|
|
124
|
+
}
|
|
125
|
+
componentDidRender() {
|
|
126
|
+
if (!this.limitStylingAppends && this.host) {
|
|
127
|
+
if (this.clientStyling)
|
|
128
|
+
this.setClientStyling();
|
|
129
|
+
if (this.clientStylingUrl)
|
|
130
|
+
this.setClientStylingURL();
|
|
131
|
+
this.limitStylingAppends = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
componentWillLoad() {
|
|
135
|
+
if (this.state) {
|
|
136
|
+
this.states = this.state.split(',');
|
|
137
|
+
}
|
|
138
|
+
if (this.endpoint) {
|
|
139
|
+
this.getTournamentInfo(this.offset, this.limit);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
setClientStyling() {
|
|
143
|
+
let sheet = document.createElement('style');
|
|
144
|
+
sheet.innerHTML = this.clientStyling;
|
|
145
|
+
this.host.shadowRoot.prepend(sheet);
|
|
146
|
+
}
|
|
147
|
+
setClientStylingURL() {
|
|
148
|
+
let url = new URL(this.clientStylingUrl);
|
|
149
|
+
let cssFile = document.createElement('style');
|
|
150
|
+
fetch(url.href)
|
|
151
|
+
.then((res) => res.text())
|
|
152
|
+
.then((data) => {
|
|
153
|
+
cssFile.innerHTML = data;
|
|
154
|
+
this.clientStyling = data;
|
|
155
|
+
setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
getStartTimeAfter() {
|
|
159
|
+
const dateStartTimeAfter = new Date();
|
|
160
|
+
if (this.startTimeAfter) {
|
|
161
|
+
dateStartTimeAfter.setDate(dateStartTimeAfter.getDate() - Number(this.startTimeAfter));
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
dateStartTimeAfter.setMonth(dateStartTimeAfter.getMonth() - 12);
|
|
165
|
+
}
|
|
166
|
+
return dateStartTimeAfter.toISOString().substring(0, 10);
|
|
167
|
+
}
|
|
168
|
+
onStateChange(state) {
|
|
169
|
+
if (this.isLoading == false) {
|
|
170
|
+
this.tournaments = [];
|
|
171
|
+
this.tournamentsShown = 0;
|
|
172
|
+
this.allTournamentsShown = false;
|
|
173
|
+
this.sseConnection.removeEventListener('message', this.updateHandler);
|
|
174
|
+
this.currentState = state;
|
|
175
|
+
this.getTournamentInfo(this.offset, this.limit);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
showMoreAction() {
|
|
179
|
+
this.getTournamentInfo(this.offset + this.tournamentsShown, this.limit);
|
|
180
|
+
}
|
|
181
|
+
matchStatus(status) {
|
|
182
|
+
if (status == 'Upcoming') {
|
|
183
|
+
return 'Unstarted';
|
|
184
|
+
}
|
|
185
|
+
if (status == 'Ongoing') {
|
|
186
|
+
return 'Running';
|
|
187
|
+
}
|
|
188
|
+
return 'Closing|Closed';
|
|
189
|
+
}
|
|
190
|
+
startUpdate(updateUrl, updateOptions) {
|
|
191
|
+
if (this.sseConnection) {
|
|
192
|
+
this.sseConnection.close();
|
|
193
|
+
}
|
|
194
|
+
this.sseConnection = new EventSourcePolyfill(updateUrl, updateOptions);
|
|
195
|
+
this.sseConnection.removeEventListener('message', this.updateHandler);
|
|
196
|
+
this.sseConnection.addEventListener('message', this.updateHandler.bind(this));
|
|
197
|
+
}
|
|
198
|
+
updateHandler(message) {
|
|
199
|
+
if (!message.data) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
let data = JSON.parse(message.data);
|
|
203
|
+
if (data.messageType == 'LeaderBoardUpdate') {
|
|
204
|
+
this.updateView(data);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
updateView(data) {
|
|
208
|
+
this.tournaments = data.items;
|
|
209
|
+
}
|
|
210
|
+
connectedCallback() {
|
|
211
|
+
if (this.translationUrl) {
|
|
212
|
+
getTranslations(this.translationUrl);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
render() {
|
|
216
|
+
return h("div", { class: `TournamentList ${this.cardMode ? 'CardMode' : ''} ${isMobile() ? 'Mobile' : ''}` },
|
|
217
|
+
this.states && h("div", { class: "States" }, this.states.map(state => {
|
|
218
|
+
return h("div", { onClick: () => this.onStateChange.bind(this)(state), class: `State ${this.currentState == state ? 'active' : ''}` }, state);
|
|
219
|
+
})),
|
|
220
|
+
!this.isLoading && (!this.tournaments || this.tournaments.length == 0) && h("div", { class: `NoTournaments ${isMobile() ? 'Mobile' : ''}` }, translate('noTournaments', this.language)),
|
|
221
|
+
this.tournaments && h("div", { class: `Tournaments ${isMobile() ? 'Mobile' : ''}` },
|
|
222
|
+
this.tournaments.map(item => {
|
|
223
|
+
if (this.cardMode) {
|
|
224
|
+
return h("div", { class: `TournamentCard ${isMobile() ? 'Mobile' : ''}` },
|
|
225
|
+
h("casino-tournament-banner", { "name-or-title": item.nameOrTitle, "tournament-id": item.id, state: item.state, enrolled: item.playerEnrolled, "start-time": item.startTime, "end-time": item.endTime, thumbnail: item.thumbnail ? item.thumbnail : this.createImagePlaceHolder(320, 180), "show-date": "false", "show-check": "true", "show-calendar": "true", "show-running-date": "true", "short-start": "true", "show-read-more": this.showReadMore, "card-mode": this.cardMode, language: this.language, endpoint: this.endpoint, loginEvent: this.loginEvent, session: this.session, registerEvent: this.registerEvent, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl }));
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return h("div", { class: "Tournament" },
|
|
229
|
+
h("casino-tournament-banner", { "name-or-title": item.nameOrTitle, "tournament-id": item.id, state: item.state, enrolled: item.playerEnrolled, "start-time": item.startTime, thumbnail: item.thumbnail ? item.thumbnail : this.createImagePlaceHolder(320, 180), "show-date": "false", "show-check": "true", "show-calendar": "true", "short-start": "true", "card-mode": this.cardMode, language: this.language, endpoint: this.endpoint, session: this.session, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl }),
|
|
230
|
+
h("casino-tournament-info", { "name-or-title": item.nameOrTitle, "tournament-id": item.id, "start-time": item.startTime, "end-time": item.endTime, "score-criteria": item.scoreCriteria, "min-bet-count": item.minBetCount, enrolled: item.playerEnrolled, align: "left", "see-games": "true", "show-button": "true", loginEvent: this.loginEvent, registerEvent: this.registerEvent, "show-read-more": this.showReadMore, language: this.language, endpoint: this.endpoint, session: this.session, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl }));
|
|
231
|
+
}
|
|
232
|
+
}),
|
|
233
|
+
this.isLoading &&
|
|
234
|
+
h("p", { class: "Loading" }, translate('loading', this.language)),
|
|
235
|
+
!this.isLoading && !this.allTournamentsShown &&
|
|
236
|
+
h("div", { class: "CenterButton", part: "CenterButton" },
|
|
237
|
+
h("button", { class: "ShowMoreButton", part: "ShowMoreButton", onClick: () => this.showMoreAction(), title: "Show More" }, translate('showMore', this.language)))));
|
|
238
|
+
}
|
|
239
|
+
static get is() { return "casino-tournament-list"; }
|
|
240
|
+
static get encapsulation() { return "shadow"; }
|
|
241
|
+
static get originalStyleUrls() { return {
|
|
242
|
+
"$": ["casino-tournament-list.scss"]
|
|
243
|
+
}; }
|
|
244
|
+
static get styleUrls() { return {
|
|
245
|
+
"$": ["casino-tournament-list.css"]
|
|
246
|
+
}; }
|
|
247
|
+
static get properties() { return {
|
|
248
|
+
"endpoint": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"mutable": false,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "string",
|
|
253
|
+
"resolved": "string",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": true,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": "The NWA endpoint"
|
|
261
|
+
},
|
|
262
|
+
"attribute": "endpoint",
|
|
263
|
+
"reflect": false
|
|
264
|
+
},
|
|
265
|
+
"language": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"mutable": false,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "string",
|
|
270
|
+
"resolved": "string",
|
|
271
|
+
"references": {}
|
|
272
|
+
},
|
|
273
|
+
"required": true,
|
|
274
|
+
"optional": false,
|
|
275
|
+
"docs": {
|
|
276
|
+
"tags": [],
|
|
277
|
+
"text": "Widget Language to show"
|
|
278
|
+
},
|
|
279
|
+
"attribute": "language",
|
|
280
|
+
"reflect": false
|
|
281
|
+
},
|
|
282
|
+
"session": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"mutable": false,
|
|
285
|
+
"complexType": {
|
|
286
|
+
"original": "string",
|
|
287
|
+
"resolved": "string",
|
|
288
|
+
"references": {}
|
|
289
|
+
},
|
|
290
|
+
"required": false,
|
|
291
|
+
"optional": true,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": "The NWA session for the logged-in user"
|
|
295
|
+
},
|
|
296
|
+
"attribute": "session",
|
|
297
|
+
"reflect": false
|
|
298
|
+
},
|
|
299
|
+
"sortType": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"mutable": false,
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "string",
|
|
304
|
+
"resolved": "string",
|
|
305
|
+
"references": {}
|
|
306
|
+
},
|
|
307
|
+
"required": false,
|
|
308
|
+
"optional": true,
|
|
309
|
+
"docs": {
|
|
310
|
+
"tags": [],
|
|
311
|
+
"text": "NWA parameter for tournaments sort type"
|
|
312
|
+
},
|
|
313
|
+
"attribute": "sort-type",
|
|
314
|
+
"reflect": false
|
|
315
|
+
},
|
|
316
|
+
"sortOrder": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"mutable": false,
|
|
319
|
+
"complexType": {
|
|
320
|
+
"original": "string",
|
|
321
|
+
"resolved": "string",
|
|
322
|
+
"references": {}
|
|
323
|
+
},
|
|
324
|
+
"required": false,
|
|
325
|
+
"optional": true,
|
|
326
|
+
"docs": {
|
|
327
|
+
"tags": [],
|
|
328
|
+
"text": "NWA parameter for tournaments sort order"
|
|
329
|
+
},
|
|
330
|
+
"attribute": "sort-order",
|
|
331
|
+
"reflect": false
|
|
332
|
+
},
|
|
333
|
+
"offset": {
|
|
334
|
+
"type": "number",
|
|
335
|
+
"mutable": false,
|
|
336
|
+
"complexType": {
|
|
337
|
+
"original": "number",
|
|
338
|
+
"resolved": "number",
|
|
339
|
+
"references": {}
|
|
340
|
+
},
|
|
341
|
+
"required": false,
|
|
342
|
+
"optional": true,
|
|
343
|
+
"docs": {
|
|
344
|
+
"tags": [],
|
|
345
|
+
"text": "NWA parameter tournaments offet"
|
|
346
|
+
},
|
|
347
|
+
"attribute": "offset",
|
|
348
|
+
"reflect": false,
|
|
349
|
+
"defaultValue": "0"
|
|
350
|
+
},
|
|
351
|
+
"limit": {
|
|
352
|
+
"type": "number",
|
|
353
|
+
"mutable": false,
|
|
354
|
+
"complexType": {
|
|
355
|
+
"original": "number",
|
|
356
|
+
"resolved": "number",
|
|
357
|
+
"references": {}
|
|
358
|
+
},
|
|
359
|
+
"required": false,
|
|
360
|
+
"optional": true,
|
|
361
|
+
"docs": {
|
|
362
|
+
"tags": [],
|
|
363
|
+
"text": "NWA parameter tournaments limit"
|
|
364
|
+
},
|
|
365
|
+
"attribute": "limit",
|
|
366
|
+
"reflect": false,
|
|
367
|
+
"defaultValue": "6"
|
|
368
|
+
},
|
|
369
|
+
"showAnonymous": {
|
|
370
|
+
"type": "boolean",
|
|
371
|
+
"mutable": false,
|
|
372
|
+
"complexType": {
|
|
373
|
+
"original": "boolean",
|
|
374
|
+
"resolved": "boolean",
|
|
375
|
+
"references": {}
|
|
376
|
+
},
|
|
377
|
+
"required": false,
|
|
378
|
+
"optional": true,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": "NWA parameter show anonymous tournament"
|
|
382
|
+
},
|
|
383
|
+
"attribute": "show-anonymous",
|
|
384
|
+
"reflect": false,
|
|
385
|
+
"defaultValue": "false"
|
|
386
|
+
},
|
|
387
|
+
"state": {
|
|
388
|
+
"type": "string",
|
|
389
|
+
"mutable": false,
|
|
390
|
+
"complexType": {
|
|
391
|
+
"original": "string",
|
|
392
|
+
"resolved": "string",
|
|
393
|
+
"references": {}
|
|
394
|
+
},
|
|
395
|
+
"required": false,
|
|
396
|
+
"optional": true,
|
|
397
|
+
"docs": {
|
|
398
|
+
"tags": [],
|
|
399
|
+
"text": "Tournament states"
|
|
400
|
+
},
|
|
401
|
+
"attribute": "state",
|
|
402
|
+
"reflect": false,
|
|
403
|
+
"defaultValue": "'All,Ongoing,Upcoming,Expired'"
|
|
404
|
+
},
|
|
405
|
+
"startTimeAfter": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"mutable": false,
|
|
408
|
+
"complexType": {
|
|
409
|
+
"original": "string",
|
|
410
|
+
"resolved": "string",
|
|
411
|
+
"references": {}
|
|
412
|
+
},
|
|
413
|
+
"required": false,
|
|
414
|
+
"optional": true,
|
|
415
|
+
"docs": {
|
|
416
|
+
"tags": [],
|
|
417
|
+
"text": "Display tournaments from a specific time onward"
|
|
418
|
+
},
|
|
419
|
+
"attribute": "start-time-after",
|
|
420
|
+
"reflect": false
|
|
421
|
+
},
|
|
422
|
+
"updateTournaments": {
|
|
423
|
+
"type": "boolean",
|
|
424
|
+
"mutable": false,
|
|
425
|
+
"complexType": {
|
|
426
|
+
"original": "boolean",
|
|
427
|
+
"resolved": "boolean",
|
|
428
|
+
"references": {}
|
|
429
|
+
},
|
|
430
|
+
"required": false,
|
|
431
|
+
"optional": true,
|
|
432
|
+
"docs": {
|
|
433
|
+
"tags": [],
|
|
434
|
+
"text": "Real time update"
|
|
435
|
+
},
|
|
436
|
+
"attribute": "update-tournaments",
|
|
437
|
+
"reflect": false,
|
|
438
|
+
"defaultValue": "true"
|
|
439
|
+
},
|
|
440
|
+
"loginEvent": {
|
|
441
|
+
"type": "string",
|
|
442
|
+
"mutable": false,
|
|
443
|
+
"complexType": {
|
|
444
|
+
"original": "string",
|
|
445
|
+
"resolved": "string",
|
|
446
|
+
"references": {}
|
|
447
|
+
},
|
|
448
|
+
"required": false,
|
|
449
|
+
"optional": true,
|
|
450
|
+
"docs": {
|
|
451
|
+
"tags": [],
|
|
452
|
+
"text": "Event for login button"
|
|
453
|
+
},
|
|
454
|
+
"attribute": "login-event",
|
|
455
|
+
"reflect": false,
|
|
456
|
+
"defaultValue": "'OpenLoginRegisterModal'"
|
|
457
|
+
},
|
|
458
|
+
"registerEvent": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"mutable": false,
|
|
461
|
+
"complexType": {
|
|
462
|
+
"original": "string",
|
|
463
|
+
"resolved": "string",
|
|
464
|
+
"references": {}
|
|
465
|
+
},
|
|
466
|
+
"required": false,
|
|
467
|
+
"optional": true,
|
|
468
|
+
"docs": {
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": "Event for register button"
|
|
471
|
+
},
|
|
472
|
+
"attribute": "register-event",
|
|
473
|
+
"reflect": false,
|
|
474
|
+
"defaultValue": "'OpenLoginRegisterModal'"
|
|
475
|
+
},
|
|
476
|
+
"cardMode": {
|
|
477
|
+
"type": "boolean",
|
|
478
|
+
"mutable": false,
|
|
479
|
+
"complexType": {
|
|
480
|
+
"original": "boolean",
|
|
481
|
+
"resolved": "boolean",
|
|
482
|
+
"references": {}
|
|
483
|
+
},
|
|
484
|
+
"required": false,
|
|
485
|
+
"optional": true,
|
|
486
|
+
"docs": {
|
|
487
|
+
"tags": [],
|
|
488
|
+
"text": "Display as card"
|
|
489
|
+
},
|
|
490
|
+
"attribute": "card-mode",
|
|
491
|
+
"reflect": false,
|
|
492
|
+
"defaultValue": "false"
|
|
493
|
+
},
|
|
494
|
+
"showReadMore": {
|
|
495
|
+
"type": "boolean",
|
|
496
|
+
"mutable": false,
|
|
497
|
+
"complexType": {
|
|
498
|
+
"original": "boolean",
|
|
499
|
+
"resolved": "boolean",
|
|
500
|
+
"references": {}
|
|
501
|
+
},
|
|
502
|
+
"required": false,
|
|
503
|
+
"optional": true,
|
|
504
|
+
"docs": {
|
|
505
|
+
"tags": [],
|
|
506
|
+
"text": "Show read more button"
|
|
507
|
+
},
|
|
508
|
+
"attribute": "show-read-more",
|
|
509
|
+
"reflect": false,
|
|
510
|
+
"defaultValue": "false"
|
|
511
|
+
},
|
|
512
|
+
"clientStyling": {
|
|
513
|
+
"type": "string",
|
|
514
|
+
"mutable": false,
|
|
515
|
+
"complexType": {
|
|
516
|
+
"original": "string",
|
|
517
|
+
"resolved": "string",
|
|
518
|
+
"references": {}
|
|
519
|
+
},
|
|
520
|
+
"required": false,
|
|
521
|
+
"optional": true,
|
|
522
|
+
"docs": {
|
|
523
|
+
"tags": [],
|
|
524
|
+
"text": "Client custom styling via inline styles"
|
|
525
|
+
},
|
|
526
|
+
"attribute": "client-styling",
|
|
527
|
+
"reflect": false,
|
|
528
|
+
"defaultValue": "''"
|
|
529
|
+
},
|
|
530
|
+
"clientStylingUrl": {
|
|
531
|
+
"type": "string",
|
|
532
|
+
"mutable": false,
|
|
533
|
+
"complexType": {
|
|
534
|
+
"original": "string",
|
|
535
|
+
"resolved": "string",
|
|
536
|
+
"references": {}
|
|
537
|
+
},
|
|
538
|
+
"required": false,
|
|
539
|
+
"optional": true,
|
|
540
|
+
"docs": {
|
|
541
|
+
"tags": [],
|
|
542
|
+
"text": "Client custom styling via url"
|
|
543
|
+
},
|
|
544
|
+
"attribute": "client-styling-url",
|
|
545
|
+
"reflect": false,
|
|
546
|
+
"defaultValue": "''"
|
|
547
|
+
},
|
|
548
|
+
"translationUrl": {
|
|
549
|
+
"type": "string",
|
|
550
|
+
"mutable": false,
|
|
551
|
+
"complexType": {
|
|
552
|
+
"original": "string",
|
|
553
|
+
"resolved": "string",
|
|
554
|
+
"references": {}
|
|
555
|
+
},
|
|
556
|
+
"required": false,
|
|
557
|
+
"optional": true,
|
|
558
|
+
"docs": {
|
|
559
|
+
"tags": [],
|
|
560
|
+
"text": "Translations via URL"
|
|
561
|
+
},
|
|
562
|
+
"attribute": "translation-url",
|
|
563
|
+
"reflect": false,
|
|
564
|
+
"defaultValue": "''"
|
|
565
|
+
}
|
|
566
|
+
}; }
|
|
567
|
+
static get states() { return {
|
|
568
|
+
"limitStylingAppends": {},
|
|
569
|
+
"tournaments": {},
|
|
570
|
+
"states": {},
|
|
571
|
+
"currentState": {},
|
|
572
|
+
"isLoading": {},
|
|
573
|
+
"tournamentsShown": {},
|
|
574
|
+
"allTournamentsShown": {},
|
|
575
|
+
"sseConnection": {}
|
|
576
|
+
}; }
|
|
577
|
+
static get elementRef() { return "host"; }
|
|
578
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'zh-hk', 'fr', 'hu', 'tr', 'el', 'es', 'pt'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
500: '500 - Internal server error',
|
|
6
|
+
showMore: 'Show more',
|
|
7
|
+
Scheduled: 'Scheduled',
|
|
8
|
+
Ongoing: 'Ongoing',
|
|
9
|
+
Finished: 'Finished',
|
|
10
|
+
loading: 'Loading, please wait ...',
|
|
11
|
+
noTournaments: 'No tournaments found'
|
|
12
|
+
},
|
|
13
|
+
'zh-hk': {
|
|
14
|
+
500: '500內部服務器錯誤',
|
|
15
|
+
showMore: '顯示更多',
|
|
16
|
+
Scheduled: '預定的',
|
|
17
|
+
Ongoing: '進行中',
|
|
18
|
+
Finished: '完成的',
|
|
19
|
+
loading: '加載請稍候 ...',
|
|
20
|
+
noTournaments: '沒有找到比賽'
|
|
21
|
+
},
|
|
22
|
+
fr: {
|
|
23
|
+
500: '500 - erreur de serveur interne',
|
|
24
|
+
showMore: 'Afficher plus',
|
|
25
|
+
Scheduled: 'Programmé',
|
|
26
|
+
Ongoing: 'En cours',
|
|
27
|
+
Finished: 'Fini',
|
|
28
|
+
loading: 'Chargement , veuillez patienter ...',
|
|
29
|
+
noTournaments: 'Aucun tournoi trouvé'
|
|
30
|
+
},
|
|
31
|
+
ro: {
|
|
32
|
+
500: '500 - Internal server error',
|
|
33
|
+
showMore: 'Mai mult',
|
|
34
|
+
Scheduled: 'Programate',
|
|
35
|
+
Ongoing: 'În curs',
|
|
36
|
+
Finished: 'Finalizat',
|
|
37
|
+
loading: 'Se încarcă, asteptati ...',
|
|
38
|
+
noTournaments: 'Niciun turneu gasit'
|
|
39
|
+
},
|
|
40
|
+
tr: {
|
|
41
|
+
500: '500 - Dahili sunucu hatası',
|
|
42
|
+
showMore: 'Daha fazla',
|
|
43
|
+
Scheduled: 'Planlanmış',
|
|
44
|
+
Ongoing: 'Devam Eden',
|
|
45
|
+
Finished: 'Sona Ermiş',
|
|
46
|
+
loading: 'Yükleniyor, lütfen bekleyin ...',
|
|
47
|
+
noTournaments: 'Herhangi bir turnuva bulunamadı.'
|
|
48
|
+
},
|
|
49
|
+
el: {
|
|
50
|
+
500: '500 - Σφάλμα Διακομιστή',
|
|
51
|
+
showMore: 'Περισσότερα',
|
|
52
|
+
Scheduled: 'Προγραμματισμένα',
|
|
53
|
+
Ongoing: 'Τρέχοντα',
|
|
54
|
+
Finished: 'Ολοκληρωμένα',
|
|
55
|
+
loading: 'Φορτώνει, παρακαλούμε περιμένετε ...',
|
|
56
|
+
noTournaments: 'Δεν βρέθηκαν τουρνουά'
|
|
57
|
+
},
|
|
58
|
+
es: {
|
|
59
|
+
500: '500 - Error servidor interno',
|
|
60
|
+
showMore: 'Mostrar más',
|
|
61
|
+
Scheduled: 'Programado',
|
|
62
|
+
Ongoing: 'En vivo',
|
|
63
|
+
Finished: 'Finalizado',
|
|
64
|
+
loading: 'Cargando …',
|
|
65
|
+
noTournaments: 'No se encontraron Torneos',
|
|
66
|
+
},
|
|
67
|
+
hu: {
|
|
68
|
+
500: '500 - Belső szerver hiba',
|
|
69
|
+
showMore: 'Mutass többet',
|
|
70
|
+
Scheduled: 'Ütemezés',
|
|
71
|
+
Ongoing: 'Folyamatban',
|
|
72
|
+
Finished: 'Befejezett',
|
|
73
|
+
loading: 'Betöltés, kérjük várjon...',
|
|
74
|
+
noTournaments: 'Verseny nem található',
|
|
75
|
+
},
|
|
76
|
+
pt: {
|
|
77
|
+
500: 'Erro 500 - Erro interno do servidor',
|
|
78
|
+
showMore: 'Ver mais',
|
|
79
|
+
Scheduled: 'Agendado',
|
|
80
|
+
Ongoing: 'Em progresso',
|
|
81
|
+
Finished: 'Finalizado',
|
|
82
|
+
loading: 'Carregando, por favor espere ...',
|
|
83
|
+
noTournaments: 'Nenhum torneio encontrado'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export const translate = (key, customLang) => {
|
|
87
|
+
const lang = customLang;
|
|
88
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
89
|
+
};
|
|
90
|
+
export const getTranslations = (url) => {
|
|
91
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
fetch(url)
|
|
94
|
+
.then((res) => res.json())
|
|
95
|
+
.then((data) => {
|
|
96
|
+
Object.keys(data).forEach((item) => {
|
|
97
|
+
for (let key in data[item]) {
|
|
98
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
resolve(true);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|