@everymatrix/casino-categories 0.0.344 → 0.0.346

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/index.html CHANGED
@@ -89,7 +89,7 @@
89
89
  </header>
90
90
 
91
91
  <casino-categories
92
- endpoint="https://demo-api.stage.norway.everymatrix.com/v2/casino/groups/"
92
+ endpoint="https://demo-api.stage.norway.everymatrix.com/v2/"
93
93
  datasource="RNG"
94
94
  activecategory="RNG$popular-games"
95
95
  ></casino-categories>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-categories",
3
- "version": "0.0.344",
3
+ "version": "0.0.346",
4
4
  "main": "dist/casino-categories.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "48a212981deaa47f749e7e806d1a69927218a34c"
39
+ "gitHead": "c8fcf7019f2df0b18164cd099547a626f503eb6d"
40
40
  }
@@ -12,6 +12,7 @@
12
12
 
13
13
  let customStylingContainer:HTMLElement;
14
14
  let displayNone:boolean = false;
15
+ let isLoading:boolean = false;
15
16
  const categories:Array<any> = [];
16
17
  let topCategories:Array<any> = [];
17
18
  let otherCategories:Array<any> = [];
@@ -21,22 +22,26 @@
21
22
  });
22
23
 
23
24
  const getCategories = ():void => {
24
- const url:URL = new URL(`${endpoint}/${datasource}`);
25
-
26
- url.searchParams.append('language', lang)
25
+ isLoading = true;
27
26
 
28
- fetch(url.href)
29
- .then((res:any) => res.json())
30
- .then((data:any) => {
31
- categories.push(...data.items)
27
+ const url:URL = new URL(`${endpoint}/casino/groups/${datasource}`);
32
28
 
33
- topCategories = categories.filter(category => category.isTopCategory === true)
34
- otherCategories = categories.filter(category => category.isTopCategory === false)
35
- });
29
+ url.searchParams.append("language", lang);
30
+
31
+ fetch(url)
32
+ .then((res:any) => res.json())
33
+ .then((data:any) => {
34
+ isLoading = false;
35
+
36
+ categories.push(...data.items)
37
+
38
+ topCategories = categories.filter(category => category.isTopCategory === true)
39
+ otherCategories = categories.filter(category => category.isTopCategory === false)
40
+ });
36
41
  }
37
42
 
38
43
  const openGameCategory = (categoryId:any):void => {
39
- window.postMessage({ type: 'OpenGameCategory', categoryId });
44
+ window.postMessage({ type: 'OpenGameCategory', categoryId });
40
45
  };
41
46
 
42
47
  const setActiveLanguage = ():void => {
@@ -73,29 +78,34 @@
73
78
  $: clientstylingurl && setClientStylingURL();
74
79
 
75
80
  </script>
76
-
77
- <div class="CasinoCategories">
78
- <h4 class="CategoryTitle">{$_('Translations.topCategories')}</h4>
79
- {#each topCategories as category}
80
- <div class="Category {activecategory === category.id ? "Active" : ""}">
81
- <img on:click={() => openGameCategory(category.id)} src={category.icon} alt="{category.name}" class="CategoryImage" >
82
- <div class="CategoryTextContainer">
83
- <p>{category.name}</p>
84
- <p>{category.games.count} {$_('Translations.games')}</p>
85
- </div>
81
+ <div bind:this={customStylingContainer}>
82
+ {#if isLoading}
83
+ <p class="Message">Loading, please wait...</p>
84
+ {:else}
85
+ <div class="CasinoCategories">
86
+ <h4 class="CategoryTitle">{$_('Translations.topCategories')}</h4>
87
+ {#each topCategories as category}
88
+ <div class="Category {activecategory === category.id ? "Active" : ""}">
89
+ <img on:click={() => openGameCategory(category.id)} src={category.icon} alt="{category.name}" class="CategoryImage" >
90
+ <div class="CategoryTextContainer">
91
+ <p>{category.name}</p>
92
+ <p>{category.games.count} {$_('Translations.games')}</p>
86
93
  </div>
87
- {/each}
88
- <h4 class="CategoryTitle">{$_('Translations.otherCategories')}</h4>
89
- {#each otherCategories as category}
90
- <div class="Category {activecategory === category.id ? "Active" : ""}">
91
- <img on:click={() => openGameCategory(category.id)} src={category.icon} alt="{category.name}" class="CategoryImage">
92
- <div class="CategoryTextContainer">
93
- <p>{category.name}</p>
94
- <p>{category.games.count} {$_('Translations.games')}</p>
95
- </div>
96
- </div>
97
- {/each}
94
+ </div>
95
+ {/each}
96
+ <h4 class="CategoryTitle">{$_('Translations.otherCategories')}</h4>
97
+ {#each otherCategories as category}
98
+ <div class="Category {activecategory === category.id ? "Active" : ""}">
99
+ <img on:click={() => openGameCategory(category.id)} src={category.icon} alt="{category.name}" class="CategoryImage">
100
+ <div class="CategoryTextContainer">
101
+ <p>{category.name}</p>
102
+ <p>{category.games.count} {$_('Translations.games')}</p>
103
+ </div>
104
+ </div>
105
+ {/each}
98
106
  </div>
107
+ {/if}
108
+ </div>
99
109
 
100
110
  <style lang="scss">
101
111
  :host {
@@ -157,4 +167,11 @@
157
167
  font-weight: 100;
158
168
  }
159
169
  }
170
+ .Message {
171
+ position: absolute;
172
+ top: 50%;
173
+ left: 50%;
174
+ transform: translate(-50%, -50%);
175
+ font-weight: 600;
176
+ }
160
177
  </style>
@@ -3,20 +3,23 @@ export const Translations = {
3
3
  Translations: {
4
4
  topCategories: "Top Categories",
5
5
  otherCategories: "Other Categories",
6
+ loading: "Loading, please wait...",
6
7
  games: "games",
7
8
  },
8
9
  },
9
10
  de: {
10
11
  Translations: {
11
- topCategories: "Top Categories",
12
- otherCategories: "Other Categories",
13
- games: "games",
12
+ topCategories: "Top Kategorien",
13
+ otherCategories: "Weitere Kategorien",
14
+ loading: "Es lädt, bitte warten...",
15
+ games: "Spiele",
14
16
  },
15
17
  },
16
18
  it: {
17
19
  Translations: {
18
20
  topCategories: "Top Categories",
19
21
  otherCategories: "Other Categories",
22
+ loading: "Loading, please wait...",
20
23
  games: "games",
21
24
  },
22
25
  },
@@ -24,6 +27,7 @@ export const Translations = {
24
27
  Translations: {
25
28
  topCategories: "Top Categories",
26
29
  otherCategories: "Other Categories",
30
+ loading: "Loading, please wait...",
27
31
  games: "games",
28
32
  },
29
33
  },
@@ -31,6 +35,7 @@ export const Translations = {
31
35
  Translations: {
32
36
  topCategories: "Top Categories",
33
37
  otherCategories: "Other Categories",
38
+ loading: "Loading, please wait...",
34
39
  games: "games",
35
40
  },
36
41
  },
@@ -38,6 +43,7 @@ export const Translations = {
38
43
  Translations: {
39
44
  topCategories: "Top Categories",
40
45
  otherCategories: "Other Categories",
46
+ loading: "Loading, please wait...",
41
47
  games: "games",
42
48
  },
43
49
  },
@@ -45,20 +51,23 @@ export const Translations = {
45
51
  Translations: {
46
52
  topCategories: "Top Categories",
47
53
  otherCategories: "Other Categories",
54
+ loading: "Loading, please wait...",
48
55
  games: "games",
49
56
  },
50
57
  },
51
58
  ro: {
52
59
  Translations: {
53
- topCategories: "Top Categories",
54
- otherCategories: "Other Categories",
55
- games: "games",
60
+ topCategories: "Categorii de top",
61
+ otherCategories: "Alte categorii",
62
+ loading: "Se incarca, te rugam asteapta…",
63
+ games: "jocuri",
56
64
  },
57
65
  },
58
66
  hr: {
59
67
  Translations: {
60
68
  topCategories: "Top Categories",
61
69
  otherCategories: "Other Categories",
70
+ loading: "Loading, please wait...",
62
71
  games: "games",
63
72
  },
64
73
  },
@@ -66,6 +75,7 @@ export const Translations = {
66
75
  Translations: {
67
76
  topCategories: "Top Categories",
68
77
  otherCategories: "Other Categories",
78
+ loading: "Loading, please wait...",
69
79
  games: "games",
70
80
  },
71
81
  },
@@ -73,6 +83,7 @@ export const Translations = {
73
83
  Translations: {
74
84
  topCategories: "Top Categories",
75
85
  otherCategories: "Other Categories",
86
+ loading: "Loading, please wait...",
76
87
  games: "games",
77
88
  },
78
89
  },
@@ -80,6 +91,7 @@ export const Translations = {
80
91
  Translations: {
81
92
  topCategories: "Top Categories",
82
93
  otherCategories: "Other Categories",
94
+ loading: "Loading, please wait...",
83
95
  games: "games",
84
96
  },
85
97
  },
@@ -87,6 +99,7 @@ export const Translations = {
87
99
  Translations: {
88
100
  topCategories: "Top Categories",
89
101
  otherCategories: "Other Categories",
102
+ loading: "Loading, please wait...",
90
103
  games: "games",
91
104
  },
92
105
  },
@@ -94,6 +107,7 @@ export const Translations = {
94
107
  Translations: {
95
108
  topCategories: "Top Categories",
96
109
  otherCategories: "Other Categories",
110
+ loading: "Loading, please wait...",
97
111
  games: "games",
98
112
  },
99
113
  },