@everymatrix/casino-games-category-section 1.0.16 → 1.0.69

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.
@@ -1,967 +0,0 @@
1
- <svelte:options tag={null} />
2
-
3
- <script lang="ts">
4
- import { onMount } from "svelte";
5
- import { platformFavorite, getDevice, isMobile } from 'rvhelper';
6
- import { _, addNewMessages } from './i18n';
7
- import type { CategoryData } from './CasinoGamesCategorySection.type';
8
- import { GamesCategorySectionTranslations } from './translations';
9
-
10
- import '@everymatrix/casino-game-thumbnail';
11
-
12
- const MASONRY_CLASS_PREFIX = 'game-tile-';
13
-
14
- export let categoryindex:string = '';
15
- export let endpoint:string = '';
16
- export let datasource:string = '';
17
- export let lang:string = ''; // Language
18
- export let session:string = ''; // Value for sessionID
19
- export let userid:string = ''; // Value for UserID;
20
- export let favorites:string = '';
21
- export let clientstyling:string = '';
22
- export let clientstylingurl:string = '';
23
- export let translationUrl:string = '';
24
- export let currency:string = '';
25
-
26
- export let categoryid:string = '';
27
- export let categorygames:number = 0;
28
- export let livecasino:string = 'false';
29
- export let visiblegames:string = '';
30
- export let gamepagemodalurl:string = 'false';
31
- export let integratedgameframedesktop:string = 'false';
32
- export let integratedgameframemobile:string = 'false';
33
-
34
- export let once = true;
35
- export let top = 0;
36
- export let bottom = 0;
37
- export let left = 0;
38
- export let right = 0;
39
-
40
- // CasinoPage loading state
41
- let isLoading:boolean = false;
42
- let hasErrors:boolean = false;
43
- let sessionID:string;
44
- let playerID:string;
45
-
46
- let lobbyView:boolean = true;
47
-
48
- let userAgent = window.navigator.userAgent;
49
-
50
- let operatorSpecifications:Object;
51
- let categoryData:CategoryData;
52
- let shownCategoryData = [];
53
- let showLoadCategory:boolean = true;
54
- let offset:number = 0;
55
- let limit:number = 40;
56
- let searched:boolean = false;
57
- let recentSearched:boolean = false;
58
- let scrollTop:boolean = false;
59
- let searchItem:boolean = false;
60
- let filteresPresent:boolean = false;
61
- let showItems:boolean = true;
62
-
63
- /* Start Lazy Loading */
64
- let nativeLoading:boolean = true;
65
- let intersecting:boolean = false;
66
- let container:any;
67
- let maxTotal:number;
68
- let categoryName:HTMLElement;
69
- let favoriteGames:Array<Object>;
70
- let showFavGamesCategory:boolean = false;
71
- let receivedFavoriteResults:Object;
72
- let sessionId:string = '';
73
- let userId:string = '';
74
- let mostPlayedScreen:Boolean = false;
75
- let customStylingContainer:HTMLElement;
76
- let validObservers:boolean = false;
77
- let lastPlayedScreen:boolean = false;
78
-
79
- let thumbnailContainer:Array<HTMLElement> = new Array(10000);
80
- let intersectingIndexes:Object = {};
81
- let visibilityconnect:string = '';
82
- let hidden;
83
- let visibilityChange;
84
- let dataloaded;
85
-
86
- let favoriteGamesData:any = {
87
- items: [],
88
- count: 0,
89
- name: ''
90
- };
91
- /* End Lazy Loading */
92
-
93
- const setTranslationUrl = ():void => {
94
- let url:string = translationUrl;
95
-
96
- fetch(url).then((res:any) => res.json())
97
- .then((res) => {
98
- Object.keys(res).forEach((item:any):void => {
99
- addNewMessages(item, res[item]);
100
- });
101
- }).catch((err:any) => {
102
- console.log(err);
103
- });
104
- }
105
-
106
- Object.keys(GamesCategorySectionTranslations).forEach((item) => {
107
- addNewMessages(item, GamesCategorySectionTranslations[item]);
108
- });
109
-
110
- if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
111
- hidden = 'hidden';
112
- visibilityChange = 'visibilitychange';
113
- } else if (typeof document.msHidden !== 'undefined') {
114
- hidden = 'msHidden';
115
- visibilityChange = 'msvisibilitychange';
116
- } else if (typeof document.webkitHidden !== 'undefined') {
117
- hidden = 'webkitHidden';
118
- visibilityChange = 'webkitvisibilitychange';
119
- }
120
-
121
- // IntersectionObserver used for loading more games
122
- let observer = new IntersectionObserver((entries) => {
123
- entries.forEach(async (entry) => {
124
- let gameid = entry.target.gameid; // eslint-disable-line
125
- let index = entry.target.elems_index; // eslint-disable-line
126
-
127
- if (entry.isIntersecting) {
128
- if (index * 1.2 > limit ) {
129
- loadMoreGames(categoryid);
130
- }
131
- intersectingIndexes[gameid] = 1;
132
- } else {
133
- intersectingIndexes[gameid] = 0;
134
- }
135
- });
136
- });
137
-
138
- // Start favored games section
139
- const getFavoredGames = (url:string, sessionId:string, userId:string) => {
140
- let options = {
141
- method: "GET",
142
- headers: {
143
- 'X-SessionID': sessionId,
144
- }
145
- };
146
-
147
- return new Promise((resolve, reject) => {
148
- fetch(url, options)
149
- .then((res:any) => res.json())
150
- .then((updatedArray:any) => {
151
- if (updatedArray) {
152
- favoriteGames = updatedArray.items;
153
- } else {
154
- favoriteGames = [];
155
- }
156
-
157
- shownCategoryData.forEach((item:any) => {
158
- item.isFavorite = checkFavorite(item.id);
159
- });
160
-
161
- let aux:any = shownCategoryData;
162
-
163
- shownCategoryData = undefined;
164
- shownCategoryData = aux;
165
-
166
- resolve(favoriteGames);
167
- }).catch((err:any) => {
168
- console.error(err);
169
-
170
- reject(err);
171
- });
172
- });
173
- }
174
-
175
- // @TODO categoryId type
176
- const getData = (categoryId:any, offset:number, limit:number, filterArray:Array<Object> = []) => {
177
- let categoryidparsed = '';
178
- let url:any = '';
179
-
180
- if((categoryid.match(/\$/g) || []).length > 1) {
181
- categoryidparsed = categoryid.split('$').slice(0, 2).join('$');
182
- url = new URL(`${endpoint}/casino/groups/${datasource}/${categoryidparsed}/subGroups`);
183
- } else {
184
- url = new URL(`${endpoint}/casino/groups/${datasource}/${categoryid}`);
185
- }
186
-
187
- let vendorFilters = JSON.parse(sessionStorage.getItem('vendorFiltersByCategory'));
188
-
189
- return new Promise((resolve, reject) => {
190
- url.searchParams.delete("pagination");
191
- url.searchParams.append("expand", "games(vendor)");
192
- url.searchParams.append("fields", "id,name,games");
193
- url.searchParams.append("platform", getDevice(userAgent));
194
- url.searchParams.append("pagination", `games(offset=${offset},limit=${limit})`);
195
- url.searchParams.append('language', lang);
196
-
197
- // if vendor filters are active, get filtered games
198
- window.postMessage({ type: 'CategoryVendors', categoryid }, window.location.href);
199
-
200
- if (vendorFilters) {
201
- if (vendorFilters[categoryid]) {
202
- if (vendorFilters[categoryid].length && lobbyView === false && showFavGamesCategory === false) {
203
- let queryParamVendorId:string = '';
204
-
205
- filteresPresent = true;
206
- vendorFilters[categoryid].forEach(vendorId => {
207
- queryParamVendorId = queryParamVendorId + (queryParamVendorId ? `, id=${vendorId}` : `id=${vendorId}`);
208
- });
209
-
210
- url.searchParams.append('filter', `games(vendor(${queryParamVendorId}))`);
211
- } else {
212
- filteresPresent = false;
213
- }
214
- }
215
- }
216
-
217
- fetch(url)
218
- .then((res:any) => res.json())
219
- .then((categoryData:any) => {
220
-
221
- if((categoryid.match(/\$/g) || []).length > 1) {
222
- categoryData = categoryData.items.filter(subcategory => {
223
- if(subcategory.id == categoryid) return subcategory;
224
- })[0];
225
- }
226
-
227
- dataloaded = true
228
- hasErrors = false;
229
- maxTotal = categoryData.games.total;
230
-
231
- resolve(categoryData);
232
- }, (err:any) => {
233
- hasErrors = true;
234
-
235
- console.error(err);
236
-
237
- reject(err);
238
- });
239
- });
240
- }
241
-
242
- const messageHandler = (e:any) => {
243
- if (e.data) {
244
- switch(e.data.type) {
245
- case 'MostPlayedData':
246
- searched = false;
247
- lobbyView = false;
248
- showLoadCategory = false;
249
- mostPlayedScreen = true;
250
- shownCategoryData = e.data.mostPlayedGames;
251
- categoryData = {
252
- id: 'MOSTPLAYED',
253
- name: 'Most Played Games',
254
- games: {
255
- count: e.data.mostPlayedGames.length,
256
- total: e.data.mostPlayedGames.length,
257
- items: e.data.mostPlayedGames
258
- }
259
- };
260
- break;
261
-
262
- case 'LastPlayedData':
263
- searched = false;
264
- lobbyView = false;
265
- showLoadCategory = false;
266
- mostPlayedScreen = false;
267
- lastPlayedScreen = true;
268
- shownCategoryData = e.data.lastPlayedGames;
269
- categoryData = {
270
- id: 'LASTPLAYED',
271
- name: 'Last Played Games',
272
- games: {
273
- count: e.data.lastPlayedGames.length,
274
- total: e.data.lastPlayedGames.length,
275
- items: e.data.lastPlayedGames
276
- }
277
- };
278
- break;
279
-
280
- case 'CustomOperatorData':
281
- operatorSpecifications = e.data.operatordetail;
282
- break;
283
-
284
- case "RecentSearchData":
285
- searched = true;
286
- mostPlayedScreen = false;
287
- recentSearched = true;
288
- if (e.data.searchData.length > 0) {
289
- shownCategoryData = e.data.searchData;
290
- showItems = true;
291
- if (shownCategoryData) {
292
- shownCategoryData.forEach((item:any) => {
293
- item.isFavorite = checkFavorite(item.id);
294
- });
295
- }
296
- } else {
297
- shownCategoryData = [];
298
- showItems = false;
299
- }
300
- break;
301
-
302
- case 'OutOfRecentSearches':
303
- searched = false;
304
- recentSearched = false;
305
- break;
306
-
307
- case "SearchData":
308
- searched = true;
309
- mostPlayedScreen = false;
310
- recentSearched = false;
311
- shownCategoryData = e.data.searchData.items || [];
312
- searchItem = true;
313
- if (e.data.receivedFavoriteResults) {
314
- favoriteGames = e.data.receivedFavoriteResults.items;
315
- }
316
- if (shownCategoryData) {
317
- shownCategoryData.forEach((item:any) => {
318
- item.isFavorite = checkFavorite(item.id);
319
- });
320
- }
321
- break;
322
-
323
- case `CategoryData_${categoryid}`:
324
- searched = false;
325
- lobbyView = true;
326
- showLoadCategory = true;
327
- searchItem = false;
328
- mostPlayedScreen = false;
329
- validObservers = false;
330
- if (e.data.receivedFavoriteResults) {
331
- favoriteGames = e.data.receivedFavoriteResults.items;
332
- }
333
-
334
- getData(e.data.categoryId, 0, e.data.visiblegames).then((res:any) => {
335
- categoryData = res;
336
- shownCategoryData = categoryData.games.items;
337
- if(shownCategoryData) {
338
- shownCategoryData.forEach((item:any) => {
339
- item.isFavorite = checkFavorite(item.id);
340
- });
341
- }
342
- });
343
- break;
344
-
345
- case 'CategoryChange':
346
- limit = 20;
347
- break;
348
-
349
-
350
- case 'CategoryUpdate':
351
- searched = false;
352
- lobbyView = false;
353
- searchItem = false;
354
- mostPlayedScreen = false;
355
- validObservers = true;
356
- categoryid = e.data.itemId;
357
- if (categoryid !== 'MOSTPLAYED') {
358
- showLoadCategory = false;
359
- }
360
-
361
- getData(categoryid, 0, limit).then((res:any) => {
362
- categoryData = res;
363
- categoryData.games.items.forEach((item:any) => {
364
- item.isFavorite = checkFavorite(item.id);
365
- });
366
- shownCategoryData = categoryData.games.items;
367
- showLoadCategory = false;
368
- // @TODO: replace this quick fix - when there are only a few category games, the view scrolls to the footer
369
- if(shownCategoryData.length < 10) {
370
- scrollTop = true;
371
- setTimeout(() => {
372
- window.postMessage({ type: 'WidgetTopReference', scrollTop }, window.location.href);
373
- }, 500);
374
- }
375
- });
376
- break;
377
-
378
- case 'FavoriteUpdate':
379
- mostPlayedScreen = false;
380
- lobbyView = true;
381
- shownCategoryData = categoryData.games.items;
382
- shownCategoryData.forEach((item:any) => {
383
- item.isFavorite = checkFavorite(item.id);
384
- });
385
-
386
- break;
387
-
388
- // Start favorite category section
389
- case 'UpdateCategoryFavoriteGames':
390
-
391
- if (e.data.receivedFavoriteResults) {
392
- favoriteGames = e.data.receivedFavoriteResults.items;
393
- if(e.data.favStadalone) return;
394
- if(showFavGamesCategory) {
395
- if(!lobbyView && !mostPlayedScreen) {
396
- window.postMessage({ type: 'CategoryUpdate', itemId: categoryid }, window.location.href);
397
- }
398
- } else {
399
- window.postMessage({ type: 'FavoriteUpdate' }, window.location.href);
400
- }
401
- }
402
- break;
403
-
404
- case 'ShowFavoriteSection':
405
- let favGameArray;
406
- lobbyView = false;
407
- if (e.data) {
408
- favGameArray = e.data.receivedFavoriteResults.items;
409
- if (favGameArray.length) {
410
- favGameArray.forEach((item:any) => {
411
- if (item.gameModel) {
412
- item.gameModel.isFavorite = item.gameModel ? true : false;
413
- }
414
- });
415
- }
416
- favoriteGamesData.items = platformFavorite(favGameArray, favoriteGamesData.items);
417
- favoriteGamesData.name = "Favorites";
418
- showFavGamesCategory = true;
419
- }
420
- break;
421
- // End favorite category section
422
-
423
- case 'UserSessionID':
424
- sessionID = e.data.session;
425
- playerID = e.data.userID;
426
- if (favorites == 'true') {
427
- if (playerID && playerID.length && sessionID && sessionID.length > 0) {
428
- getFavoredGames(`${endpoint}/player/${playerID}/favorites/`, sessionID, playerID);
429
- }
430
- }
431
-
432
- break;
433
-
434
- default:
435
- // do nothing
436
- break;
437
- }
438
- }
439
- }
440
-
441
- // @TODO categoryId type fix
442
- const loadMoreGames = (categoryId:any) => {
443
- limit += 1;
444
-
445
- if (limit <= maxTotal) {
446
- getData(categoryId, offset, limit).then((res:any) => {
447
- categoryData = res;
448
- // @TODO categoryData type fix
449
- /**
450
- * This check is needed to prevent requests with less items
451
- * that started before but ended after the last request to add items to list
452
- * This could also use abort controller instead but refactoring is needed
453
- */
454
- if(categoryData.games.items.length > shownCategoryData.length){
455
- shownCategoryData = categoryData.games.items;
456
- shownCategoryData.forEach((item:any) => {
457
- item.isFavorite = checkFavorite(item.id);
458
- });
459
- }
460
- });
461
- }
462
- }
463
-
464
- const checkFavorite = (gameId:string) => {
465
- if (favoriteGames) {
466
- if (favoriteGames.findIndex(obj => obj.id == gameId) !== -1) {
467
- return true;
468
- } else {
469
- return false;
470
- }
471
- }
472
-
473
- return false;
474
- }
475
-
476
- // @TODO categoryId type fix
477
- const showCategory = (categoryId:any, categoryData:Object) => {
478
- window.postMessage({ type: "CategoryChange", itemId: categoryId }, window.location.href);
479
- }
480
-
481
- const initialSetup = () => {
482
- // Nothing to do here
483
- }
484
-
485
- const handleVisibilityChange = () => {
486
- if (!document[hidden]) {
487
- visibilityconnect = 'connect';
488
- } else {
489
- visibilityconnect = 'disconnect';
490
- }
491
- }
492
-
493
- const setupObserver = () => {
494
- if (validObservers) {
495
- thumbnailContainer.forEach((item, index) => {
496
- if (item) {
497
- // Hack to make sure that I can identify the thumbnail index
498
- item.elems_index = index;
499
- observer.observe(item);
500
- }
501
- });
502
- }
503
- }
504
-
505
- const setClientStyling = ():void => {
506
- let sheet = document.createElement('style');
507
- sheet.innerHTML = clientstyling;
508
- customStylingContainer.appendChild(sheet);
509
- }
510
-
511
- const setClientStylingURL = ():void => {
512
- let url:URL = new URL(clientstylingurl);
513
- let cssFile:HTMLElement = document.createElement('style');
514
-
515
- fetch(url.href)
516
- .then((res:any) => res.text())
517
- .then((data:any) => {
518
- cssFile.innerHTML = data
519
-
520
- setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
521
- });
522
- }
523
-
524
- onMount(() => {
525
- window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
526
- window.addEventListener('message', messageHandler, false);
527
- window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
528
-
529
- return () => {
530
- window.removeEventListener('message', messageHandler);
531
- window.removeEventListener('visibilitychange', messageHandler);
532
- }
533
- });
534
-
535
- $: dataloaded && thumbnailContainer && setupObserver();
536
- $: lang && initialSetup();
537
- $: translationUrl && setTranslationUrl();
538
- $: clientstyling && customStylingContainer && setClientStyling();
539
- $: clientstylingurl && customStylingContainer && setClientStylingURL();
540
-
541
- </script>
542
- <div class="CasinoGamesCategorySectionContainer" part="CasinoGamesCategorySectionContainer" bind:this={customStylingContainer}>
543
- {#if hasErrors}
544
- <!-- @TODO diversify error handling -->
545
- {#if filteresPresent}
546
- <p class="SearchLoading" part="SearchLoading">404 Error - No result found.</p>
547
- {:else}
548
- <p class="SearchLoading" part="SearchLoading">500 Error - Internal Server Error.</p>
549
- {/if}
550
- {:else}
551
- {#if searched}
552
- <div class="CasinoGamesContainer" part="CasinoGamesContainer">
553
- <div class="CasinoGamesHeader Searched {isMobile(userAgent) ? 'CasinoGamesHeaderMobile' : ''}" part="CasinoGamesHeader Searched {isMobile(userAgent) ? 'CasinoGamesHeaderMobile' : ''}">
554
- {#if recentSearched}
555
- <h3 class="StatusText" part="StatusText">
556
- {$_('gamesCategorySection.recentSearchedItems')}
557
- </h3>
558
- {:else}
559
- {#if !shownCategoryData.length}
560
- <h3 class="StatusText" part="StatusText">
561
- {$_('gamesCategorySection.noResults')}
562
- </h3>
563
- {:else}
564
- <h3 class="StatusText" part="StatusText">
565
- {$_('gamesCategorySection.searchedItems')}
566
- </h3>
567
- {/if}
568
- {/if}
569
- </div>
570
- {#if shownCategoryData}
571
- {#if !showItems}
572
- <p class="NoSearchResults NoRecentSearches NoRecentSearchesCenter {isMobile(userAgent) ? 'NoRecentSearchesMobile' : ''}" part="NoSearchResults NoRecentSearches NoRecentSearchesCenter {isMobile(userAgent) ? 'NoRecentSearchesMobile' : ''}">{$_('gamesCategorySection.noRecentSearch')}</p>
573
- {/if}
574
- <ul class="CasinoGamesGrid SearchedGamesGrid GamesListIncreasedGap" part="CasinoGamesGrid SearchedGamesGrid GamesListIncreasedGap">
575
- {#each shownCategoryData as gameprops, index}
576
- <casino-game-thumbnail
577
- class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
578
- part="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
579
- session={session}
580
- userid={userid}
581
- lang={lang}
582
- searchitem={searchItem}
583
- favorites={favorites}
584
- gamethumbnail={gameprops.thumbnail}
585
- gamename={gameprops.name}
586
- gamevendor={gameprops.vendor.name}
587
- gameisnew={gameprops.isNew}
588
- gamepopularity={gameprops.popularity}
589
- gamecellsize={gameprops.cellSize}
590
- gameid={gameprops.id}
591
- gamefunmode={gameprops.hasFunMode}
592
- gamefavorite={gameprops.isFavorite}
593
- {currency}
594
- livelobbyendpoint={gameprops.details ? gameprops.href : ''}
595
- {clientstyling}
596
- {clientstylingurl}
597
- {endpoint}
598
- {livecasino}
599
- {gamepagemodalurl}
600
- {integratedgameframedesktop}
601
- {integratedgameframemobile}
602
- ></casino-game-thumbnail>
603
- {/each}
604
- </ul>
605
- {:else}
606
- <p class="SearchWaiting" part="SearchWaiting">Waiting</p>
607
- {/if}
608
- </div>
609
- {:else}
610
- <div>
611
- {#if categoryData}
612
- <div class="CasinoGamesContainer" part="CasinoGamesContainer">
613
- <div class="CasinoGamesHeader" part="CasinoGamesHeader">
614
- <h3 class="CategoryName" part="CategoryName" bind:this={categoryName}>
615
- {categoryData.name}
616
- </h3>
617
-
618
- {#if showLoadCategory}
619
- <!-- svelte-ignore a11y-missing-attribute -->
620
- <a class="CategoryNameLink" part="CategoryNameLink" on:click="{e => showCategory(categoryData.id, categoryData)}">
621
- <span class="CategoryLoadMore" part="CategoryLoadMore">
622
- {$_('gamesCategorySection.viewAll')} ({categoryData.games.total})
623
- </span>
624
- </a>
625
- {/if}
626
- </div>
627
- {#if shownCategoryData.length !== 0}
628
- <ul class="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" part="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" bind:this={container}>
629
- {#each shownCategoryData as gameprops, index}
630
- {#if intersecting || nativeLoading}
631
- <casino-game-thumbnail
632
- session={session}
633
- userid={userid}
634
- lang={lang}
635
- class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
636
- part="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
637
- favorites={favorites}
638
- gamethumbnail={gameprops.thumbnail}
639
- gamename={gameprops.name}
640
- gamevendor={gameprops.vendor.name}
641
- gameisnew={gameprops.isNew}
642
- gamepopularity={gameprops.popularity}
643
- gamecellsize={gameprops.cellSize}
644
- gameid={gameprops.id}
645
- gamefunmode={gameprops.hasFunMode}
646
- gamefavorite={gameprops.isFavorite}
647
- bind:this={thumbnailContainer[index]}
648
- connectlive={intersectingIndexes[gameprops.id] == 1 ? 'connect' : 'disconnect'}
649
- visibilityconnect={visibilityconnect}
650
- {currency}
651
- livelobbyendpoint={gameprops.details ? gameprops.href : ''}
652
- {clientstyling}
653
- {clientstylingurl}
654
- {endpoint}
655
- {livecasino}
656
- {gamepagemodalurl}
657
- {integratedgameframedesktop}
658
- {integratedgameframemobile}
659
- ></casino-game-thumbnail>
660
- {/if}
661
- {/each}
662
- </ul>
663
- {:else}
664
- <p class="NoSearchResults" part="NoSearchResults">You don't have any games in this category.</p>
665
- {/if}
666
- </div>
667
- {:else if showFavGamesCategory}
668
- <div class="CasinoGamesContainer" part="CasinoGamesContainer">
669
- <div class="CasinoGamesHeader" part="CasinoGamesHeader">
670
- <h3 class="CategoryName" part="CategoryName" bind:this={categoryName}>
671
- {$_('gamesCategorySection.favorites')}
672
- <span class="CategoryFavName">({favoriteGamesData.items.length})</span>
673
- </h3>
674
- </div>
675
- <ul class="{(favoriteGamesData.items.length != 0) ? 'CasinoGamesGrid' : ''} 'GamesListIncreasedGap'}" part="{(favoriteGamesData.items.length != 0) ? 'CasinoGamesGrid' : ''} 'GamesListIncreasedGap'}" bind:this={container}>
676
- {#if favoriteGamesData}
677
- {#each favoriteGamesData.items as gameprops, index}
678
- {#if gameprops.gameModel}
679
- {#if gameprops.gameModel.isFavorite}
680
- {#if intersecting || nativeLoading}
681
- {#if isMobile(userAgent)}
682
- {#if (gameprops.gameModel.platform.includes("iPad") || gameprops.gameModel.platform.includes("iPhone") || gameprops.gameModel.platform.includes("Android"))}
683
- <casino-game-thumbnail
684
- class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
685
- part="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
686
- session={session}
687
- userid={userid}
688
- lang={lang}
689
- favorites={favorites}
690
- gamethumbnail={gameprops.gameModel.thumbnail}
691
- gamename={gameprops.gameModel.name}
692
- gamevendor={gameprops.gameModel.vendor.name}
693
- gameisnew={gameprops.gameModel.isNew}
694
- gamepopularity={gameprops.gameModel.popularity}
695
- gamecellsize={gameprops.cellSize}
696
- gameid={gameprops.gameModel.id}
697
- gamefunmode={gameprops.gameModel.hasFunMode}
698
- gamefavorite={gameprops.gameModel.isFavorite}
699
- showfavoredcategory={showFavGamesCategory}
700
- connectlive={intersectingIndexes[gameprops.id] == 1 ? 'connect' : 'disconnect'}
701
- visibilityconnect={visibilityconnect}
702
- {currency}
703
- livelobbyendpoint={gameprops.gameModel.details ? gameprops.gameModel.launchUrl : ''}
704
- {clientstyling}
705
- {clientstylingurl}
706
- {endpoint}
707
- {livecasino}
708
- {gamepagemodalurl}
709
- {integratedgameframedesktop}
710
- {integratedgameframemobile}
711
- ></casino-game-thumbnail>
712
- {/if}
713
- {:else if gameprops.gameModel.platform.includes("PC")}
714
- <casino-game-thumbnail
715
- class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
716
- part="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
717
- session={session}
718
- userid={userid}
719
- lang={lang}
720
- favorites={favorites}
721
- gamethumbnail={gameprops.gameModel.thumbnail}
722
- gamename={gameprops.gameModel.name}
723
- gamevendor={gameprops.gameModel.vendor.name}
724
- gameisnew={gameprops.gameModel.isNew}
725
- gamepopularity={gameprops.gameModel.popularity}
726
- gamecellsize={gameprops.cellSize}
727
- gameid={gameprops.gameModel.id}
728
- gamefunmode={gameprops.gameModel.hasFunMode}
729
- gamefavorite={gameprops.gameModel.isFavorite}
730
- showfavoredcategory={showFavGamesCategory}
731
- connectlive={intersectingIndexes[gameprops.id] == 1 ? 'connect' : 'disconnect'}
732
- visibilityconnect={visibilityconnect}
733
- {currency}
734
- livelobbyendpoint={gameprops.gameModel.details ? gameprops.gameModel.launchUrl : ''}
735
- {clientstyling}
736
- {clientstylingurl}
737
- {endpoint}
738
- {livecasino}
739
- {gamepagemodalurl}
740
- {integratedgameframedesktop}
741
- {integratedgameframemobile}
742
- ></casino-game-thumbnail>
743
- {/if}
744
- {/if}
745
- {/if}
746
- {/if}
747
- {:else}
748
- <p class="NoFavoriteGames {isMobile(userAgent) ? 'NoFavoriteGamesMobile' : ''}" part="NoFavoriteGames {isMobile(userAgent) ? 'NoFavoriteGamesMobile' : ''}">
749
- <svg version="1.1" class="UnfavoredIcon" part="UnfavoredIcon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="50px" y="50px"
750
- viewBox="0 0 512.001 512.001" style="enable-background:new 0 0 512.001 512.001;" xml:space="preserve"><path style="fill: white" d="M511.266,197.256c-1.764-5.431-6.458-9.388-12.108-10.209l-158.722-23.065L269.452,20.155
751
- c-2.527-5.12-7.741-8.361-13.451-8.361c-5.709,0-10.924,3.242-13.451,8.361l-70.988,143.828L12.843,187.047
752
- c-5.65,0.821-10.344,4.779-12.108,10.209c-1.765,5.43-0.293,11.391,3.795,15.376l114.848,111.955L92.27,482.67
753
- c-0.965,5.627,1.349,11.315,5.968,14.67c4.618,3.355,10.74,3.798,15.797,1.142L256,423.846l141.961,74.637
754
- c2.195,1.154,4.591,1.723,6.979,1.723c3.11,0,6.206-0.966,8.818-2.865c4.619-3.356,6.933-9.043,5.968-14.671L392.61,324.587
755
- l114.86-111.954C511.559,208.647,513.031,202.686,511.266,197.256z M366.023,308.608c-3.536,3.446-5.15,8.412-4.314,13.278
756
- l23.311,135.898l-122.038-64.162c-4.37-2.297-9.591-2.297-13.961,0l-122.045,64.163l23.304-135.9
757
- c0.834-4.866-0.779-9.83-4.313-13.276l-98.731-96.244l136.445-19.829c4.886-0.71,9.108-3.778,11.294-8.205L256,60.685
758
- l61.023,123.645c2.186,4.427,6.408,7.496,11.294,8.206l136.447,19.828L366.023,308.608z"/></svg>
759
- <span class="NoFavoriteText NoFavoriteTextHighlight" part="NoFavoriteText NoFavoriteTextHighlight">{$_('gamesCategorySection.noFavoritesTitle')}</span>
760
- {#if isMobile(userAgent)}
761
- <span class="NoFavoriteText" part="NoFavoriteText">{$_('gamesCategorySection.noFavoritesMobile')}</span>
762
- {:else}
763
- <span class="NoFavoriteText" part="NoFavoriteText">{$_('gamesCategorySection.noFavorites')}</span>
764
- {/if}
765
- </p>
766
- {/each}
767
- {:else}
768
- <p>{$_('gamesCategorySection.waiting')}</p>
769
- {/if}
770
- </ul>
771
- </div>
772
- {/if}
773
- </div>
774
- {/if}
775
- {/if}
776
- </div>
777
-
778
-
779
- <style lang="scss">
780
-
781
- :host {
782
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
783
- }
784
-
785
- *, *::before, *::after {
786
- margin: 0;
787
- padding: 0;
788
- box-sizing: border-box;
789
- }
790
-
791
- $grid-gap: 16px;
792
- $grid-cell-size: 192px;
793
- $grid-cell-size-small: 110px;
794
- $grid-cell-size-medium: 122px;
795
-
796
- .CategoryName,
797
- .StatusText {
798
- color: var(--emfe-w-color-white, #FFFFFF);
799
- font-size: 22px;
800
- font-weight: 500;
801
- }
802
-
803
- .CategoryLoadMore {
804
- font-size: 14px;
805
- color: var(--emfe-w-color-white, #FFFFFF);
806
- }
807
-
808
- .NoSearchResults {
809
- color: var(--emfe-w-color-white, #FFFFFF);
810
- text-align: center;
811
- width: 100%;
812
- padding-left: 5px;
813
- font-size: 16px;
814
- }
815
-
816
- .NoRecentSearches {
817
- padding-bottom: 30px;
818
- }
819
-
820
- .NoRecentSearchesCenter {
821
- text-align: center;
822
- }
823
-
824
- .NoFavoriteGames {
825
- color: var(--emfe-w-color-white, #FFFFFF);
826
- font-size: 16px;
827
- display: flex;
828
- flex-direction: column;
829
- align-items: center;
830
- justify-content: center;
831
- padding: 0 20px;
832
- height: 20vh;
833
- .UnfavoredIcon {
834
- width: 50px;
835
- height: 50px;
836
- }
837
- .NoFavoriteText {
838
- text-align: center;
839
- }
840
- .NoFavoriteTextHighlight {
841
- font-weight: 600;
842
- font-size: 18px;
843
- padding: 15px 0;
844
- }
845
- }
846
-
847
- .NoFavoriteGamesMobile {
848
- height: 50vh;
849
- }
850
-
851
- .SearchWaiting {
852
- grid-column: 1/-1;
853
- color: var(--emfe-w-color-white, #FFFFFF);
854
- font-size: 13px;
855
- text-align: center;
856
- }
857
-
858
- .CasinoGamesHeader {
859
- width: 100%;
860
- display: flex;
861
- align-items: center;
862
- justify-content: space-between;
863
- padding: 8px 5px 0;
864
- margin-bottom: 16px;
865
- .CategoryNameLink {
866
- display: block;
867
- cursor: pointer;
868
- }
869
-
870
- .CategoryLoadMore {
871
- font-weight: normal;
872
- }
873
-
874
- &.Searched {
875
- justify-content: center;
876
- }
877
- }
878
-
879
- .CasinoGamesContainer {
880
- width: 100%;
881
- margin-top: 24px;
882
- padding-bottom: 16px;
883
- }
884
-
885
- .CasinoGamesGrid {
886
- display: grid;
887
- gap: $grid-gap;
888
- grid-template-columns: repeat(auto-fill, minmax(Min($grid-cell-size, 46%), 1fr));
889
- grid-template-rows: repeat(auto-fill, $grid-cell-size);
890
- grid-auto-rows: $grid-cell-size;
891
- grid-auto-columns: $grid-cell-size;
892
- grid-auto-flow: row dense;
893
-
894
- .game-tile-2x1 {
895
- grid-row: span 2;
896
-
897
- @media screen and (max-width: 375px) {
898
- grid-row: span 1;
899
- }
900
- }
901
-
902
- .game-tile-2x2 {
903
- grid-row: span 2;
904
- grid-column: span 2;
905
-
906
- @media screen and (max-width: 375px) {
907
- grid-row: span 1;
908
- grid-column: span 1;
909
- }
910
- }
911
-
912
- .game-tile-1x2 {
913
- grid-column: span 2;
914
-
915
- @media screen and (max-width: 375px) {
916
- grid-column: span 1;
917
- }
918
- }
919
-
920
- &.GamesListIncreasedGap {
921
- gap: $grid-gap + 12;
922
- }
923
- }
924
-
925
- @media screen and (max-width: 385px) {
926
- .CasinoGamesGrid {
927
- display: grid;
928
- gap: $grid-gap;
929
- grid-template-columns: repeat(auto-fill, minmax(Min($grid-cell-size-small, 46%), 1fr));
930
- grid-template-rows: repeat(auto-fill, $grid-cell-size-small);
931
- grid-auto-rows: $grid-cell-size-small;
932
- grid-auto-columns: $grid-cell-size-small;
933
-
934
- &.GamesListIncreasedGap {
935
- gap: $grid-gap;
936
- }
937
- }
938
- }
939
-
940
- @media screen and (max-width: 480px) {
941
- .CasinoGamesGrid {
942
- display: grid;
943
- gap: $grid-gap;
944
- grid-template-columns: repeat(auto-fill, minmax(Min($grid-cell-size-medium, 46%), 1fr));
945
- grid-template-rows: repeat(auto-fill, $grid-cell-size-medium);
946
- grid-auto-rows: $grid-cell-size-medium;
947
- grid-auto-columns: $grid-cell-size-medium;
948
-
949
- &.GamesListIncreasedGap {
950
- gap: $grid-gap;
951
- }
952
- }
953
- }
954
-
955
- @media screen and (min-width: 1100px) {
956
- .CasinoGamesGrid {
957
- grid-template-rows: repeat(auto-fill, 142px);
958
- grid-auto-rows: 142px;
959
- }
960
- }
961
-
962
- .SearchLoading {
963
- display: block;
964
- padding: 50px;
965
- color: var(--emfe-w-color-white, #FFFFFF);
966
- }
967
- </style>