@articles-media/articles-dev-box 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -2
- package/index.js +3 -1
- package/package.json +7 -1
- package/src/GameScoreboard.jsx +234 -17
- package/src/components/Ad.jsx +629 -0
- package/src/hooks/Ads/useAd.js +55 -0
- package/src/hooks/Ads/useAds.js +54 -0
- package/src/hooks/useGameScoreboard.js +59 -0
- package/styles/components/Ad.scss +223 -0
- package/styles/components/GameScoreboard.scss +35 -1
- package/styles/global.scss +98 -0
- package/styles/variables.scss +3 -0
- /package/src/{ArticlesAd.jsx → components/ArticlesAd.jsx} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import useSWR from "swr";
|
|
2
|
+
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { minutesToMilliseconds } from "date-fns";
|
|
5
|
+
|
|
6
|
+
const fetcher = async (data) => {
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
try {
|
|
9
|
+
const res = await axios.get("http://localhost:3001/api/ads", {
|
|
10
|
+
params: {
|
|
11
|
+
// ad_id: data.ad_id
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return res.data;
|
|
15
|
+
} catch (err) {
|
|
16
|
+
// Failed to fetch from localhost, fallback to default URL
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return axios.get(data.url, {
|
|
21
|
+
params: {
|
|
22
|
+
// ad_id: data.ad_id
|
|
23
|
+
}
|
|
24
|
+
}).then((res) => res.data);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const minutes = 60;
|
|
28
|
+
const options = {
|
|
29
|
+
dedupingInterval: minutesToMilliseconds(minutes),
|
|
30
|
+
focusThrottleInterval: minutesToMilliseconds(minutes),
|
|
31
|
+
// keepPreviousData: true,
|
|
32
|
+
// fallbackData: []
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const useAds = (params) => {
|
|
36
|
+
|
|
37
|
+
const { data, error, isLoading, mutate } = useSWR(
|
|
38
|
+
{
|
|
39
|
+
url: `https://articles.media/api/ads`,
|
|
40
|
+
// ad_id
|
|
41
|
+
},
|
|
42
|
+
fetcher,
|
|
43
|
+
options
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
data,
|
|
48
|
+
error,
|
|
49
|
+
isLoading,
|
|
50
|
+
mutate,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default useAds;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import useSWR from "swr";
|
|
2
|
+
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
|
|
5
|
+
const fetcher = async (obj) => {
|
|
6
|
+
if (process.env.NODE_ENV === 'development') {
|
|
7
|
+
try {
|
|
8
|
+
const res = await axios.get("http://localhost:3001/api/community/games/scoreboard", {
|
|
9
|
+
params: {
|
|
10
|
+
game: obj.game,
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return res.data;
|
|
14
|
+
} catch (err) {
|
|
15
|
+
// Failed to fetch from localhost, fallback to default URL
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return axios.get(obj.url, {
|
|
20
|
+
params: {
|
|
21
|
+
game: obj.game,
|
|
22
|
+
}
|
|
23
|
+
}).then((res) => res.data);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const options = {
|
|
27
|
+
dedupingInterval: ((1000 * 60) * 30),
|
|
28
|
+
refreshInterval: 0,
|
|
29
|
+
revalidateOnFocus: false,
|
|
30
|
+
revalidateIfStale: false,
|
|
31
|
+
shouldRetryOnError: false,
|
|
32
|
+
// fallbackData: []
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const useGameScoreboard = (params) => {
|
|
36
|
+
|
|
37
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR(
|
|
38
|
+
params?.game ?
|
|
39
|
+
{
|
|
40
|
+
// url: "/api/community/games/scoreboard",
|
|
41
|
+
url: "https://articles.media/api/community/games/scoreboard",
|
|
42
|
+
game: params.game,
|
|
43
|
+
}
|
|
44
|
+
:
|
|
45
|
+
null,
|
|
46
|
+
fetcher,
|
|
47
|
+
options
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
data,
|
|
52
|
+
error,
|
|
53
|
+
isLoading,
|
|
54
|
+
isValidating,
|
|
55
|
+
mutate,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default useGameScoreboard;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
@use "../global.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ad-wrap {
|
|
4
|
+
z-index: 1;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
margin-bottom: 1rem;
|
|
7
|
+
max-width: 312px;
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
.ad {
|
|
11
|
+
position: relative;
|
|
12
|
+
align-self: flex-start;
|
|
13
|
+
width: 100%;
|
|
14
|
+
z-index: 2;
|
|
15
|
+
font-family: brandon-grotesque, sans-serif;
|
|
16
|
+
@include shadow-articles;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
|
|
19
|
+
@include media-breakpoint-down(md) {
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.main-panel {
|
|
25
|
+
background-color: var(--articles-ad-background-color, var(--card-background));
|
|
26
|
+
color: var(--articles-ad-font-color, var(--bs-body-color));
|
|
27
|
+
// background-color: #343746;
|
|
28
|
+
height: 400px;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
|
|
32
|
+
.ad-warning {
|
|
33
|
+
// background-color: $base-color;
|
|
34
|
+
// background-color: white;
|
|
35
|
+
// color: black;
|
|
36
|
+
padding: 0.1rem 0.75rem;
|
|
37
|
+
font-family: brandon-grotesque, sans-serif;
|
|
38
|
+
// font-style: normal;
|
|
39
|
+
font-weight: 900;
|
|
40
|
+
font-size: 1rem;
|
|
41
|
+
border-bottom: 1px solid var(--articles-ad-border-color, var(--card-background));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.content-wrap {
|
|
45
|
+
display: flex;
|
|
46
|
+
// flex-direction: row;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
|
|
50
|
+
@include media-breakpoint-up(lg) {
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.photo-banner {
|
|
56
|
+
position: relative;
|
|
57
|
+
height: 100px;
|
|
58
|
+
width: 100px;
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
// justify-content: center;
|
|
62
|
+
align-items: center;
|
|
63
|
+
padding-left: 1rem;
|
|
64
|
+
margin-left: 0.75rem;
|
|
65
|
+
|
|
66
|
+
// @include media-breakpoint-up(lg) {
|
|
67
|
+
margin-left: 0rem;
|
|
68
|
+
height: 125px;
|
|
69
|
+
width: 100%;
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
.logo {
|
|
73
|
+
// padding: 1rem;
|
|
74
|
+
// $height: 125px;
|
|
75
|
+
// position: absolute;
|
|
76
|
+
// top: 1rem;
|
|
77
|
+
// left: 50%;
|
|
78
|
+
// transform: translateX(-50%);
|
|
79
|
+
// height: $height;
|
|
80
|
+
object-fit: cover;
|
|
81
|
+
z-index: 1;
|
|
82
|
+
|
|
83
|
+
img {
|
|
84
|
+
width: 75px;
|
|
85
|
+
height: 75px;
|
|
86
|
+
object-fit: contain;
|
|
87
|
+
|
|
88
|
+
// @include media-breakpoint-up(lg) {
|
|
89
|
+
// width: 100px;
|
|
90
|
+
// height: 100px;
|
|
91
|
+
// }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.icon {
|
|
96
|
+
display: none;
|
|
97
|
+
position: absolute;
|
|
98
|
+
bottom: calc(-125px / 2);
|
|
99
|
+
left: 20px;
|
|
100
|
+
height: 125px;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
color: white;
|
|
105
|
+
font-size: 3.5rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.photo {
|
|
109
|
+
position: absolute;
|
|
110
|
+
left: 0;
|
|
111
|
+
top: 0;
|
|
112
|
+
width: 100%;
|
|
113
|
+
height: 100%;
|
|
114
|
+
object-fit: cover;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.details-wrap {
|
|
119
|
+
width: 100%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.details,
|
|
123
|
+
.detail-title {
|
|
124
|
+
padding: 0.75rem;
|
|
125
|
+
// color: white;
|
|
126
|
+
display: grid;
|
|
127
|
+
grid-gap: 5px 5px;
|
|
128
|
+
grid-template-columns: repeat(2, 1fr);
|
|
129
|
+
padding-bottom: 0rem;
|
|
130
|
+
|
|
131
|
+
@include media-breakpoint-down(md) {
|
|
132
|
+
// padding-top: 80px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.detail {
|
|
136
|
+
// margin-left: 5%;
|
|
137
|
+
// width: 50%;
|
|
138
|
+
|
|
139
|
+
.icon {
|
|
140
|
+
display: inline-block;
|
|
141
|
+
width: 1.5rem;
|
|
142
|
+
|
|
143
|
+
i {
|
|
144
|
+
justify-content: flex-start;
|
|
145
|
+
display: flex;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.short-description {
|
|
152
|
+
padding: 0.75rem;
|
|
153
|
+
padding-top: 0.25rem;
|
|
154
|
+
padding-bottom: 0rem;
|
|
155
|
+
min-height: 50px;
|
|
156
|
+
overflow-y: auto;
|
|
157
|
+
max-height: 125px;
|
|
158
|
+
// @include articles-scrollbar;
|
|
159
|
+
@include alternate-scrollbar;
|
|
160
|
+
// color: white;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.detail-title {
|
|
164
|
+
display: flex;
|
|
165
|
+
justify-content: space-between;
|
|
166
|
+
align-items: center;
|
|
167
|
+
|
|
168
|
+
// .detail {
|
|
169
|
+
// // font-size: 2rem;
|
|
170
|
+
// width: 100%;
|
|
171
|
+
// font-family: brandon-grotesque, sans-serif;
|
|
172
|
+
// font-style: normal;
|
|
173
|
+
// font-weight: 900;
|
|
174
|
+
// font-size: 1.25rem;
|
|
175
|
+
|
|
176
|
+
// .icon {
|
|
177
|
+
// margin-right: 1rem;
|
|
178
|
+
// }
|
|
179
|
+
// }
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.action-wrap {
|
|
183
|
+
// background-color: #343746;
|
|
184
|
+
// color: white;
|
|
185
|
+
border-top: 1px solid var(--articles-ad-border-color, var(--card-background));
|
|
186
|
+
|
|
187
|
+
.action {
|
|
188
|
+
// color: white;
|
|
189
|
+
// margin-top: 0.75rem;
|
|
190
|
+
padding: 0.25rem;
|
|
191
|
+
display: flex;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
align-items: center;
|
|
194
|
+
border: 1px solid var(--articles-ad-border-color, var(--card-background));
|
|
195
|
+
color: var(--articles-ad-font-color, var(--bs-body-color));
|
|
196
|
+
border-radius: 10px;
|
|
197
|
+
margin-left: auto;
|
|
198
|
+
margin-right: auto;
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
transition-duration: 200ms;
|
|
201
|
+
|
|
202
|
+
&:hover {
|
|
203
|
+
background-color: white;
|
|
204
|
+
color: black;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&:active {
|
|
208
|
+
background-color: gray;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.advertise-with-us {
|
|
216
|
+
background-color: var(--articles-ad-background-color, var(--card-background));
|
|
217
|
+
border-top: 2px solid var(--articles-ad-border-color, var(--card-background));
|
|
218
|
+
|
|
219
|
+
a {
|
|
220
|
+
color: var(--articles-ad-font-color, var(--bs-body-color))!important;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
@use "../global.scss" as *;
|
|
2
|
+
|
|
3
|
+
.scoreboard {
|
|
4
|
+
margin-top: 1rem;
|
|
5
|
+
max-width: 300px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
margin-bottom: 1rem;
|
|
8
|
+
|
|
9
|
+
@include media-breakpoint-up(lg) {
|
|
10
|
+
margin-top: 0rem;
|
|
11
|
+
margin-bottom: 0rem;
|
|
12
|
+
display: block;
|
|
13
|
+
position: absolute;
|
|
14
|
+
left: 1rem;
|
|
15
|
+
top: 50%;
|
|
16
|
+
transform: translateY(-50%);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
1
20
|
.articles-game-scoreboard {
|
|
2
|
-
|
|
21
|
+
border: 1px solid rgb(206, 212, 218);
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
box-shadow: rgba(0, 0, 0, 0.07) 0px 2px 8px;
|
|
24
|
+
// background: rgb(255, 255, 255);
|
|
25
|
+
color: rgb(34, 34, 34);
|
|
26
|
+
width: 100%;
|
|
27
|
+
max-width: 350px;
|
|
28
|
+
margin: 0px 1rem;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
position: fixed;
|
|
34
|
+
bottom: 50%;
|
|
35
|
+
transform: translateY(50%);
|
|
36
|
+
left: 8px;
|
|
3
37
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
@use "./variables.scss" as *;
|
|
4
|
+
|
|
5
|
+
@mixin alternate-scrollbar {
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Define Bootstrap-like breakpoints
|
|
10
|
+
$grid-breakpoints: (
|
|
11
|
+
xs: 0,
|
|
12
|
+
sm: 576px,
|
|
13
|
+
md: 768px,
|
|
14
|
+
lg: 992px,
|
|
15
|
+
xl: 1200px,
|
|
16
|
+
xxl: 1400px
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// Mixin for media-breakpoint-up
|
|
20
|
+
@mixin media-breakpoint-up($name) {
|
|
21
|
+
$min: map.get($grid-breakpoints, $name);
|
|
22
|
+
@if $min != null and $min != 0 {
|
|
23
|
+
@media (min-width: $min) {
|
|
24
|
+
@content;
|
|
25
|
+
}
|
|
26
|
+
} @else if $min == 0 {
|
|
27
|
+
@content;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Mixin for media-breakpoint-down
|
|
32
|
+
@mixin media-breakpoint-down($name) {
|
|
33
|
+
$max: map.get($grid-breakpoints, $name);
|
|
34
|
+
@if $max != null and $max != 0 {
|
|
35
|
+
@media (max-width: $max) {
|
|
36
|
+
@content;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
$shadow-articles: 0 0 0 1px rgba(0, 0, 0, 25%), 0 2px 3px rgba(0, 0, 0, 20%);
|
|
42
|
+
|
|
43
|
+
@mixin shadow-articles {
|
|
44
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 25%), 0 2px 3px rgba(0, 0, 0, 20%);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.shadow-articles {
|
|
48
|
+
box-shadow:
|
|
49
|
+
0 0 0 1px rgba(0, 0, 0, 30%),
|
|
50
|
+
0 2px 3px rgba(0, 0, 0, 20%);
|
|
51
|
+
@include shadow-articles;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// @mixin alternate-scrollbar {
|
|
55
|
+
// /* Width */
|
|
56
|
+
// &::-webkit-scrollbar {
|
|
57
|
+
// width: 10px;
|
|
58
|
+
// height: 10px;
|
|
59
|
+
// }
|
|
60
|
+
|
|
61
|
+
// /* Track */
|
|
62
|
+
// &::-webkit-scrollbar-track {
|
|
63
|
+
// background: rgba(255, 255, 255, 0);
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
// /* Handle */
|
|
67
|
+
// &::-webkit-scrollbar-thumb {
|
|
68
|
+
// background: #000;
|
|
69
|
+
// height: 10px;
|
|
70
|
+
// height: 6px;
|
|
71
|
+
// border: 4px solid rgba(0, 0, 0, 0);
|
|
72
|
+
// background-clip: padding-box;
|
|
73
|
+
// -webkit-border-radius: 7px;
|
|
74
|
+
// background-color: rgba(0, 0, 0, 0.15);
|
|
75
|
+
// -webkit-box-shadow:
|
|
76
|
+
// inset -1px -1px 0px rgba(0, 0, 0, 0.473),
|
|
77
|
+
// inset 1px 1px 0px rgba(0, 0, 0, 0.493);
|
|
78
|
+
// }
|
|
79
|
+
|
|
80
|
+
// /* Handle on hover */
|
|
81
|
+
// &::-webkit-scrollbar-thumb:hover {
|
|
82
|
+
// background: rgba(128, 128, 128, 0.5);
|
|
83
|
+
// }
|
|
84
|
+
// }
|
|
85
|
+
|
|
86
|
+
.text-center {
|
|
87
|
+
text-align: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.d-flex {
|
|
91
|
+
display: flex;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.flex-header {
|
|
95
|
+
display: flex;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
File without changes
|