@everymatrix/casino-tournament-duration 1.43.4 → 1.45.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/dist/casino-tournament-duration/casino-tournament-duration.esm.js +1 -1
- package/dist/casino-tournament-duration/p-57ef1124.js +2 -0
- package/dist/casino-tournament-duration/p-b0ea5595.entry.js +1 -0
- package/dist/casino-tournament-duration/p-e1255160.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-tournament-duration.cjs.entry.js +205 -201
- package/dist/cjs/casino-tournament-duration.cjs.js +17 -11
- package/dist/cjs/index-5302010b.js +1201 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +263 -268
- package/dist/collection/components/casino-tournament-duration/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +88 -88
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-tournament-duration.entry.js +205 -201
- package/dist/esm/casino-tournament-duration.js +14 -11
- package/dist/esm/index-2af9ace7.js +1174 -0
- package/dist/esm/loader.js +7 -13
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +45 -45
- package/dist/types/components/casino-tournament-duration/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/casino-tournament-duration/p-183a9160.entry.js +0 -1
- package/dist/casino-tournament-duration/p-5f4837aa.js +0 -1
- package/dist/cjs/index-764d2bff.js +0 -1170
- package/dist/components/casino-tournament-duration.d.ts +0 -11
- package/dist/components/casino-tournament-duration.js +0 -257
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/index-4075dde6.js +0 -1144
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-duration/.stencil/packages/casino-tournament-duration/stencil.config.d.ts +0 -2
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
const DEFAULT_LANGUAGE = 'en';
|
|
2
2
|
const TRANSLATIONS = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
3
|
+
en: {
|
|
4
|
+
finished: 'Finished',
|
|
5
|
+
starting: 'Starting in ',
|
|
6
|
+
left: 'left',
|
|
7
|
+
minutes: 'minutes',
|
|
8
|
+
hours: 'hours',
|
|
9
|
+
days: 'days',
|
|
10
|
+
},
|
|
11
|
+
hr: {
|
|
12
|
+
finished: 'Gotovo',
|
|
13
|
+
starting: 'Počinje u ',
|
|
14
|
+
left: 'lijevo',
|
|
15
|
+
minutes: 'minute',
|
|
16
|
+
hours: 'sati',
|
|
17
|
+
days: 'dani',
|
|
18
|
+
},
|
|
19
|
+
'zh-hk': {
|
|
20
|
+
finished: '完成的',
|
|
21
|
+
starting: '開始於',
|
|
22
|
+
left: '剩下',
|
|
23
|
+
minutes: '分鐘',
|
|
24
|
+
hours: '小時',
|
|
25
|
+
days: '天',
|
|
26
|
+
},
|
|
27
|
+
fr: {
|
|
28
|
+
finished: 'Fini',
|
|
29
|
+
starting: 'Début dans ',
|
|
30
|
+
left: 'restant',
|
|
31
|
+
minutes: 'minutes',
|
|
32
|
+
hours: 'heures',
|
|
33
|
+
days: 'jours',
|
|
34
|
+
},
|
|
35
|
+
ro: {
|
|
36
|
+
finished: 'Finalizat',
|
|
37
|
+
starting: 'Începe în',
|
|
38
|
+
left: 'rămase',
|
|
39
|
+
minutes: 'minute',
|
|
40
|
+
hours: 'ore',
|
|
41
|
+
days: 'zile',
|
|
42
|
+
},
|
|
43
|
+
tr: {
|
|
44
|
+
finished: 'Sona ermiş',
|
|
45
|
+
starting: 'Başlamasına ',
|
|
46
|
+
left: 'kaldı',
|
|
47
|
+
minutes: 'dakika',
|
|
48
|
+
hours: 'saat',
|
|
49
|
+
days: 'gün',
|
|
50
|
+
},
|
|
51
|
+
el: {
|
|
52
|
+
finished: 'Ολοκληρωμένα',
|
|
53
|
+
starting: 'Αρχίζει σε ',
|
|
54
|
+
left: 'απομένουν',
|
|
55
|
+
minutes: 'λεπτά',
|
|
56
|
+
hours: 'ώρες',
|
|
57
|
+
days: 'ημέρες',
|
|
58
|
+
},
|
|
59
|
+
es: {
|
|
60
|
+
finished: 'Finalizado',
|
|
61
|
+
starting: 'Iniciando en ',
|
|
62
|
+
left: 'izquierda',
|
|
63
|
+
minutes: 'minutos',
|
|
64
|
+
hours: 'horas',
|
|
65
|
+
days: 'días',
|
|
66
|
+
},
|
|
67
|
+
hu: {
|
|
68
|
+
finished: 'Befejezve',
|
|
69
|
+
starting: 'Kezdésig',
|
|
70
|
+
left: 'bal',
|
|
71
|
+
minutes: 'perc',
|
|
72
|
+
hours: 'óra',
|
|
73
|
+
days: 'nap',
|
|
74
|
+
},
|
|
75
|
+
pt: {
|
|
76
|
+
finished: 'Finalizado',
|
|
77
|
+
starting: 'Começando em',
|
|
78
|
+
left: 'Abandonou',
|
|
79
|
+
minutes: 'Minutos',
|
|
80
|
+
hours: 'Horas',
|
|
81
|
+
days: 'Dias',
|
|
82
|
+
}
|
|
83
83
|
};
|
|
84
84
|
export const translate = (key, customLang) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
var _a, _b;
|
|
86
|
+
const lang = customLang;
|
|
87
|
+
return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
|
|
88
88
|
};
|
|
89
89
|
export const getTranslations = (data) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
Object.keys(data).forEach((item) => {
|
|
91
|
+
for (let key in data[item]) {
|
|
92
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
95
|
};
|
|
@@ -1,226 +1,230 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-2af9ace7.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
4
|
const TRANSLATIONS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
5
|
+
en: {
|
|
6
|
+
finished: 'Finished',
|
|
7
|
+
starting: 'Starting in ',
|
|
8
|
+
left: 'left',
|
|
9
|
+
minutes: 'minutes',
|
|
10
|
+
hours: 'hours',
|
|
11
|
+
days: 'days',
|
|
12
|
+
},
|
|
13
|
+
hr: {
|
|
14
|
+
finished: 'Gotovo',
|
|
15
|
+
starting: 'Počinje u ',
|
|
16
|
+
left: 'lijevo',
|
|
17
|
+
minutes: 'minute',
|
|
18
|
+
hours: 'sati',
|
|
19
|
+
days: 'dani',
|
|
20
|
+
},
|
|
21
|
+
'zh-hk': {
|
|
22
|
+
finished: '完成的',
|
|
23
|
+
starting: '開始於',
|
|
24
|
+
left: '剩下',
|
|
25
|
+
minutes: '分鐘',
|
|
26
|
+
hours: '小時',
|
|
27
|
+
days: '天',
|
|
28
|
+
},
|
|
29
|
+
fr: {
|
|
30
|
+
finished: 'Fini',
|
|
31
|
+
starting: 'Début dans ',
|
|
32
|
+
left: 'restant',
|
|
33
|
+
minutes: 'minutes',
|
|
34
|
+
hours: 'heures',
|
|
35
|
+
days: 'jours',
|
|
36
|
+
},
|
|
37
|
+
ro: {
|
|
38
|
+
finished: 'Finalizat',
|
|
39
|
+
starting: 'Începe în',
|
|
40
|
+
left: 'rămase',
|
|
41
|
+
minutes: 'minute',
|
|
42
|
+
hours: 'ore',
|
|
43
|
+
days: 'zile',
|
|
44
|
+
},
|
|
45
|
+
tr: {
|
|
46
|
+
finished: 'Sona ermiş',
|
|
47
|
+
starting: 'Başlamasına ',
|
|
48
|
+
left: 'kaldı',
|
|
49
|
+
minutes: 'dakika',
|
|
50
|
+
hours: 'saat',
|
|
51
|
+
days: 'gün',
|
|
52
|
+
},
|
|
53
|
+
el: {
|
|
54
|
+
finished: 'Ολοκληρωμένα',
|
|
55
|
+
starting: 'Αρχίζει σε ',
|
|
56
|
+
left: 'απομένουν',
|
|
57
|
+
minutes: 'λεπτά',
|
|
58
|
+
hours: 'ώρες',
|
|
59
|
+
days: 'ημέρες',
|
|
60
|
+
},
|
|
61
|
+
es: {
|
|
62
|
+
finished: 'Finalizado',
|
|
63
|
+
starting: 'Iniciando en ',
|
|
64
|
+
left: 'izquierda',
|
|
65
|
+
minutes: 'minutos',
|
|
66
|
+
hours: 'horas',
|
|
67
|
+
days: 'días',
|
|
68
|
+
},
|
|
69
|
+
hu: {
|
|
70
|
+
finished: 'Befejezve',
|
|
71
|
+
starting: 'Kezdésig',
|
|
72
|
+
left: 'bal',
|
|
73
|
+
minutes: 'perc',
|
|
74
|
+
hours: 'óra',
|
|
75
|
+
days: 'nap',
|
|
76
|
+
},
|
|
77
|
+
pt: {
|
|
78
|
+
finished: 'Finalizado',
|
|
79
|
+
starting: 'Começando em',
|
|
80
|
+
left: 'Abandonou',
|
|
81
|
+
minutes: 'Minutos',
|
|
82
|
+
hours: 'Horas',
|
|
83
|
+
days: 'Dias',
|
|
84
|
+
}
|
|
85
85
|
};
|
|
86
86
|
const translate = (key, customLang) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const lang = customLang;
|
|
89
|
+
return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
|
|
90
90
|
};
|
|
91
91
|
const getTranslations = (data) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
Object.keys(data).forEach((item) => {
|
|
93
|
+
for (let key in data[item]) {
|
|
94
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const casinoTournamentDurationCss = ":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";
|
|
100
|
+
const CasinoTournamentDurationStyle0 = casinoTournamentDurationCss;
|
|
100
101
|
|
|
101
102
|
const CasinoTournamentDuration = class {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.getDuration();
|
|
103
|
+
constructor(hostRef) {
|
|
104
|
+
registerInstance(this, hostRef);
|
|
105
|
+
this.startTime = undefined;
|
|
106
|
+
this.endTime = undefined;
|
|
107
|
+
this.status = undefined;
|
|
108
|
+
this.language = undefined;
|
|
109
|
+
this.clientStyling = '';
|
|
110
|
+
this.clientStylingUrl = '';
|
|
111
|
+
this.translationData = undefined;
|
|
112
|
+
this.tournamentUntilStartDays = undefined;
|
|
113
|
+
this.tournamentLeftDays = undefined;
|
|
114
|
+
this.showRemain = undefined;
|
|
115
|
+
this.limitStylingAppends = false;
|
|
116
|
+
this.durationInterval = undefined;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
getDuration() {
|
|
123
|
-
const dateNow = new Date();
|
|
124
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
125
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
126
|
-
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
127
|
-
}
|
|
128
|
-
formatDate(date) {
|
|
129
|
-
const dateOptions = { month: 'long' };
|
|
130
|
-
let currentDate = new Date(date);
|
|
131
|
-
let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
|
|
132
|
-
let currentDay = currentDate.getDate();
|
|
133
|
-
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
134
|
-
}
|
|
135
|
-
getTextByDiff(diff) {
|
|
136
|
-
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
137
|
-
const renderTimeColumn = (column) => {
|
|
138
|
-
const columnInt = Math.floor(column);
|
|
139
|
-
if (columnInt < 10) {
|
|
140
|
-
return `0${columnInt}`;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
return `${columnInt}`;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
if (diff < 1440) {
|
|
147
|
-
const hours = diff / 60;
|
|
148
|
-
const minutes = diff % 60;
|
|
149
|
-
const seconds = (minutes - Math.floor(minutes)) * 60;
|
|
150
|
-
return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
|
|
118
|
+
watchLanguage(newValue, oldValue) {
|
|
119
|
+
if (newValue && newValue != oldValue) {
|
|
120
|
+
this.getDuration();
|
|
121
|
+
}
|
|
151
122
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
123
|
+
getDateTimeDiff(dateString1, dateString2) {
|
|
124
|
+
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
125
|
+
}
|
|
126
|
+
getDuration() {
|
|
127
|
+
const dateNow = new Date();
|
|
128
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
129
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
130
|
+
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
131
|
+
}
|
|
132
|
+
formatDate(date) {
|
|
133
|
+
const dateOptions = { month: 'long' };
|
|
134
|
+
let currentDate = new Date(date);
|
|
135
|
+
let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
|
|
136
|
+
let currentDay = currentDate.getDate();
|
|
137
|
+
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
138
|
+
}
|
|
139
|
+
getTextByDiff(diff) {
|
|
140
|
+
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
141
|
+
const renderTimeColumn = (column) => {
|
|
142
|
+
const columnInt = Math.floor(column);
|
|
143
|
+
if (columnInt < 10) {
|
|
144
|
+
return `0${columnInt}`;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return `${columnInt}`;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
if (diff < 1440) {
|
|
151
|
+
const hours = diff / 60;
|
|
152
|
+
const minutes = diff % 60;
|
|
153
|
+
const seconds = (minutes - Math.floor(minutes)) * 60;
|
|
154
|
+
return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
|
|
155
|
+
}
|
|
156
|
+
return renderText(Math.ceil(diff / (60 * 24)), 'days');
|
|
165
157
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
158
|
+
getProgress() {
|
|
159
|
+
if (this.tournamentLeftDays <= 0)
|
|
160
|
+
return 100;
|
|
161
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
162
|
+
const step = 100 / tournamentDuration;
|
|
163
|
+
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
164
|
+
return width;
|
|
169
165
|
}
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
componentWillLoad() {
|
|
167
|
+
if (this.translationData) {
|
|
168
|
+
getTranslations(JSON.parse(this.translationData));
|
|
169
|
+
}
|
|
172
170
|
if (this.startTime && this.endTime) {
|
|
173
|
-
|
|
171
|
+
this.getDuration();
|
|
172
|
+
this.getTextByDiff(this.tournamentLeftDays);
|
|
173
|
+
}
|
|
174
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
175
|
+
this.durationInterval = window.setInterval(() => {
|
|
176
|
+
if (this.startTime && this.endTime) {
|
|
177
|
+
this.getDuration();
|
|
178
|
+
}
|
|
179
|
+
}, 1000);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
clearInterval(this.durationInterval);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
componentDidRender() {
|
|
186
|
+
if (!this.limitStylingAppends && this.host) {
|
|
187
|
+
if (this.clientStyling)
|
|
188
|
+
this.setClientStyling();
|
|
189
|
+
if (this.clientStylingUrl)
|
|
190
|
+
this.setClientStylingURL();
|
|
191
|
+
this.limitStylingAppends = true;
|
|
174
192
|
}
|
|
175
|
-
}, 1000);
|
|
176
193
|
}
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
setClientStyling() {
|
|
195
|
+
const sheet = new CSSStyleSheet();
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
sheet.replace(this.clientStyling);
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
179
200
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
201
|
+
setClientStylingURL() {
|
|
202
|
+
let url = new URL(this.clientStylingUrl);
|
|
203
|
+
fetch(url.href)
|
|
204
|
+
.then((res) => res.text())
|
|
205
|
+
.then((data) => {
|
|
206
|
+
const sheet = new CSSStyleSheet();
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
sheet.replace(data);
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
211
|
+
});
|
|
188
212
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
let url = new URL(this.clientStylingUrl);
|
|
199
|
-
fetch(url.href)
|
|
200
|
-
.then((res) => res.text())
|
|
201
|
-
.then((data) => {
|
|
202
|
-
const sheet = new CSSStyleSheet();
|
|
203
|
-
// @ts-ignore
|
|
204
|
-
sheet.replace(data);
|
|
205
|
-
// @ts-ignore
|
|
206
|
-
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
render() {
|
|
210
|
-
if (this.startTime && this.endTime) {
|
|
211
|
-
return h("div", { class: "TournamentDurationWrap" }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { class: "ProgressBarWrapper" }, h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
212
|
-
h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
213
|
-
this.tournamentUntilStartDays > 0 ?
|
|
214
|
-
h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
215
|
-
h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
216
|
-
h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
213
|
+
render() {
|
|
214
|
+
if (this.startTime && this.endTime) {
|
|
215
|
+
return h("div", { key: 'd0051545a243161e89e126fd26b9ea9d2e09f8ab', class: "TournamentDurationWrap" }, h("div", { key: 'b585f0137268f0185dfd15e563a0075bfe617d5b', class: "TournamentDuration" }, h("div", { key: '9cc3670780d9f8c40b77ac978cdadb0e0afdcacb', class: "TournamentDates" }, h("div", { key: '85e4f3b1de4f36efd8d13b090f8f9013976d8685', class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { key: '688a84ce16a4d26359637b80837a9c5f50fc24c3', class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { key: '149c0431ac2d8f9b5058a2a269b50e01d23ed26f', class: "ProgressBarWrapper" }, h("div", { key: '85523f37f511f9184260f8575ec08e914f535858', class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
216
|
+
h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
217
|
+
this.tournamentUntilStartDays > 0 ?
|
|
218
|
+
h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
219
|
+
h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
220
|
+
h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
221
|
+
}
|
|
217
222
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}; }
|
|
223
|
+
get host() { return getElement(this); }
|
|
224
|
+
static get watchers() { return {
|
|
225
|
+
"language": ["watchLanguage"]
|
|
226
|
+
}; }
|
|
223
227
|
};
|
|
224
|
-
CasinoTournamentDuration.style =
|
|
228
|
+
CasinoTournamentDuration.style = CasinoTournamentDurationStyle0;
|
|
225
229
|
|
|
226
230
|
export { CasinoTournamentDuration as casino_tournament_duration };
|