@azuro-org/images-generator 1.3.10 → 1.3.11
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/index.es.js +23 -16
- package/dist/templates/trendle-leaderboard/images/avatar.png +0 -0
- package/dist/templates/trendle-leaderboard/images/black-wide.png +0 -0
- package/dist/templates/trendle-leaderboard/images/black.png +0 -0
- package/dist/templates/trendle-leaderboard/images/bronze-wide.png +0 -0
- package/dist/templates/trendle-leaderboard/images/bronze.png +0 -0
- package/dist/templates/trendle-leaderboard/images/gold-wide.png +0 -0
- package/dist/templates/trendle-leaderboard/images/gold.png +0 -0
- package/dist/templates/trendle-leaderboard/images/silver-wide.png +0 -0
- package/dist/templates/trendle-leaderboard/images/silver.png +0 -0
- package/dist/templates/trendle-leaderboard/index.d.ts +50 -0
- package/dist/templates/trendle-leaderboard/index.html +286 -0
- package/dist/templates/trendle-leaderboard/index.js +76 -0
- package/lib/index.js +23 -16
- package/lib/templates/trendle-leaderboard/images/avatar.png +0 -0
- package/lib/templates/trendle-leaderboard/images/black-wide.png +0 -0
- package/lib/templates/trendle-leaderboard/images/black.png +0 -0
- package/lib/templates/trendle-leaderboard/images/bronze-wide.png +0 -0
- package/lib/templates/trendle-leaderboard/images/bronze.png +0 -0
- package/lib/templates/trendle-leaderboard/images/gold-wide.png +0 -0
- package/lib/templates/trendle-leaderboard/images/gold.png +0 -0
- package/lib/templates/trendle-leaderboard/images/silver-wide.png +0 -0
- package/lib/templates/trendle-leaderboard/images/silver.png +0 -0
- package/lib/templates/trendle-leaderboard/index.d.ts +50 -0
- package/lib/templates/trendle-leaderboard/index.html +286 -0
- package/lib/templates/trendle-leaderboard/index.js +76 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -88,46 +88,53 @@ function __generator(thisArg, body) {
|
|
|
88
88
|
})];
|
|
89
89
|
case 4:
|
|
90
90
|
_d.sent();
|
|
91
|
-
return [4 /*yield*/, page.setContent(html, { waitUntil: '
|
|
91
|
+
return [4 /*yield*/, page.setContent(html, { waitUntil: 'networkidle0' })
|
|
92
|
+
// Wait for fonts to load
|
|
93
|
+
];
|
|
92
94
|
case 5:
|
|
95
|
+
_d.sent();
|
|
96
|
+
// Wait for fonts to load
|
|
97
|
+
return [4 /*yield*/, page.evaluate(function () { return document.fonts.ready; })];
|
|
98
|
+
case 6:
|
|
99
|
+
// Wait for fonts to load
|
|
93
100
|
_d.sent();
|
|
94
101
|
return [4 /*yield*/, page.$('body')
|
|
95
102
|
// dont' change this condition!
|
|
96
103
|
];
|
|
97
|
-
case
|
|
104
|
+
case 7:
|
|
98
105
|
content = _d.sent();
|
|
99
|
-
if (!(headless === false)) return [3 /*break*/,
|
|
106
|
+
if (!(headless === false)) return [3 /*break*/, 9];
|
|
100
107
|
return [4 /*yield*/, new Promise(function () { })];
|
|
101
|
-
case 7:
|
|
102
|
-
_d.sent();
|
|
103
|
-
_d.label = 8;
|
|
104
108
|
case 8:
|
|
105
|
-
|
|
109
|
+
_d.sent();
|
|
110
|
+
_d.label = 9;
|
|
111
|
+
case 9:
|
|
112
|
+
if (!output) return [3 /*break*/, 13];
|
|
106
113
|
if (!fs.existsSync(output)) {
|
|
107
114
|
fs.mkdirSync(output);
|
|
108
115
|
}
|
|
109
116
|
filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
110
117
|
return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
|
|
111
|
-
case
|
|
118
|
+
case 10:
|
|
112
119
|
_d.sent();
|
|
113
120
|
return [4 /*yield*/, page.close()];
|
|
114
|
-
case
|
|
121
|
+
case 11:
|
|
115
122
|
_d.sent();
|
|
116
123
|
return [4 /*yield*/, browser.close()];
|
|
117
|
-
case
|
|
124
|
+
case 12:
|
|
118
125
|
_d.sent();
|
|
119
|
-
return [3 /*break*/,
|
|
120
|
-
case
|
|
121
|
-
case
|
|
126
|
+
return [3 /*break*/, 17];
|
|
127
|
+
case 13: return [4 /*yield*/, content.screenshot({ omitBackground: true, type: type })];
|
|
128
|
+
case 14:
|
|
122
129
|
imageBuffer = _d.sent();
|
|
123
130
|
return [4 /*yield*/, page.close()];
|
|
124
|
-
case
|
|
131
|
+
case 15:
|
|
125
132
|
_d.sent();
|
|
126
133
|
return [4 /*yield*/, browser.close()];
|
|
127
|
-
case
|
|
134
|
+
case 16:
|
|
128
135
|
_d.sent();
|
|
129
136
|
return [2 /*return*/, imageBuffer];
|
|
130
|
-
case
|
|
137
|
+
case 17: return [2 /*return*/];
|
|
131
138
|
}
|
|
132
139
|
});
|
|
133
140
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Template } from '../../utils';
|
|
2
|
+
declare const textByType: {
|
|
3
|
+
readonly pnlPercent: "PnL%";
|
|
4
|
+
readonly pnl: "PnL$";
|
|
5
|
+
readonly consistencyScore: "consistency score";
|
|
6
|
+
};
|
|
7
|
+
type LeaderboardType = keyof typeof textByType;
|
|
8
|
+
declare const cardTypes: {
|
|
9
|
+
readonly black: {
|
|
10
|
+
readonly bgImg: "images/black.png";
|
|
11
|
+
readonly wideImg: "images/black-wide.png";
|
|
12
|
+
readonly title: "0.1%";
|
|
13
|
+
readonly subtitle: "Top of Trendle traders <br> by ";
|
|
14
|
+
readonly color: "black";
|
|
15
|
+
readonly additionalClassName: "black";
|
|
16
|
+
};
|
|
17
|
+
readonly gold: {
|
|
18
|
+
readonly bgImg: "images/gold.png";
|
|
19
|
+
readonly wideImg: "images/gold-wide.png";
|
|
20
|
+
readonly title: "Top 1%";
|
|
21
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
22
|
+
readonly color: "#00000099";
|
|
23
|
+
readonly additionalClassName: "";
|
|
24
|
+
};
|
|
25
|
+
readonly silver: {
|
|
26
|
+
readonly bgImg: "images/silver.png";
|
|
27
|
+
readonly wideImg: "images/silver-wide.png";
|
|
28
|
+
readonly title: "Top 3%";
|
|
29
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
30
|
+
readonly color: "#00000099";
|
|
31
|
+
readonly additionalClassName: "";
|
|
32
|
+
};
|
|
33
|
+
readonly bronze: {
|
|
34
|
+
readonly bgImg: "images/bronze.png";
|
|
35
|
+
readonly wideImg: "images/bronze-wide.png";
|
|
36
|
+
readonly title: "Top 10%";
|
|
37
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
38
|
+
readonly color: "#00000099";
|
|
39
|
+
readonly additionalClassName: "";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type Props = {
|
|
43
|
+
type: keyof typeof cardTypes;
|
|
44
|
+
leaderboardType: LeaderboardType;
|
|
45
|
+
avatarUrl: string | 'mock';
|
|
46
|
+
username: string;
|
|
47
|
+
isWide?: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const template: Template<Props>;
|
|
50
|
+
export default template;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
7
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
8
|
+
<link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap&family=Mona+Sans:ital,wdth,wght@0,75..125,200..900;1,75..125,200..900&display=swap" rel="stylesheet">
|
|
9
|
+
<style>
|
|
10
|
+
html {
|
|
11
|
+
font-family: 'Inter', sans-serif;
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html, body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
width: fit-content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.geist-mono {
|
|
21
|
+
font-family: "Geist Mono", sans-serif;
|
|
22
|
+
font-optical-sizing: auto;
|
|
23
|
+
font-weight: 400;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.mona-sans {
|
|
28
|
+
font-family: "Mona Sans", sans-serif;
|
|
29
|
+
font-optical-sizing: auto;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
* {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.flex {
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.flex-wrap {
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.flex-1 {
|
|
46
|
+
flex: 1 1 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.flex-auto {
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.flex-none {
|
|
54
|
+
flex: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.items-center {
|
|
58
|
+
align-items: center;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.items-start {
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.items-end {
|
|
66
|
+
align-items: flex-end;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.items-baseline {
|
|
70
|
+
align-items: baseline;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.items-stretch {
|
|
74
|
+
align-items: stretch;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.self-auto {
|
|
78
|
+
align-self: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.self-start {
|
|
82
|
+
align-self: flex-start;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.self-end {
|
|
86
|
+
align-self: flex-end;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.self-center {
|
|
90
|
+
align-self: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.self-stretch {
|
|
94
|
+
align-self: stretch;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.justify-around {
|
|
98
|
+
justify-content: space-around;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.justify-between {
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.justify-center {
|
|
106
|
+
justify-content: center;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.justify-start {
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.justify-end {
|
|
114
|
+
justify-content: flex-end;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.flex-row {
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.flex-col {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.flex-col-reverse {
|
|
126
|
+
flex-direction: column-reverse;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.text-upper {
|
|
130
|
+
text-transform: uppercase;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.text-center {
|
|
134
|
+
text-align: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.card {
|
|
138
|
+
width: 850px;
|
|
139
|
+
height: 1060px;
|
|
140
|
+
padding-bottom: 32px;
|
|
141
|
+
position: relative;
|
|
142
|
+
z-index: 1;
|
|
143
|
+
/* color: --color; */
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.wrapper {
|
|
147
|
+
width: --wrapper-width;
|
|
148
|
+
position: relative;
|
|
149
|
+
background: #393939;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.wrapper__img {
|
|
153
|
+
position: absolute;
|
|
154
|
+
display: block;
|
|
155
|
+
top: 0;
|
|
156
|
+
top: 50%;
|
|
157
|
+
transform: translateY(-50%);
|
|
158
|
+
width: 100%;
|
|
159
|
+
mix-blend-mode: multiply;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.w-full {
|
|
163
|
+
width: 100%;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.bg {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: 0px;
|
|
169
|
+
left: 0px;
|
|
170
|
+
width: 100%;
|
|
171
|
+
height: 100%;
|
|
172
|
+
z-index: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.text-shadow {
|
|
176
|
+
color: black;
|
|
177
|
+
opacity: 0.6;
|
|
178
|
+
text-shadow:
|
|
179
|
+
0px -1px 1px rgba(255, 255, 255, 0.29),
|
|
180
|
+
-1px -1px 1px rgba(255, 255, 255, 0.5),
|
|
181
|
+
0px 3px 6px rgba(0, 0, 0),
|
|
182
|
+
-1px 1px 1px rgba(255, 255, 255, 0.5);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.title {
|
|
186
|
+
font-weight: 800;
|
|
187
|
+
font-size: 109.91px;
|
|
188
|
+
line-height: 80%;
|
|
189
|
+
letter-spacing: -2%;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.text {
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
font-size: 24px;
|
|
195
|
+
line-height: 140%;
|
|
196
|
+
letter-spacing: 2%;
|
|
197
|
+
width: 300px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.black .text {
|
|
201
|
+
font-weight: 900;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.subtitle {
|
|
205
|
+
font-weight: 700;
|
|
206
|
+
font-size: 36.41px;
|
|
207
|
+
line-height: 100%;
|
|
208
|
+
letter-spacing: -2%;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.box {
|
|
212
|
+
padding: 0px 30px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.box2 {
|
|
216
|
+
margin-top: 30px;
|
|
217
|
+
padding-left: 27px;
|
|
218
|
+
padding-right: 30px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.content {
|
|
222
|
+
z-index: 2;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.avatar {
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: 209px;
|
|
228
|
+
left: 50%;
|
|
229
|
+
transform: translateX(-50%);
|
|
230
|
+
width: 370px;
|
|
231
|
+
height: 370px;
|
|
232
|
+
border-radius: 100%;
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
z-index: 10;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.avatar > img {
|
|
238
|
+
width: 100%;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.username {
|
|
242
|
+
position: absolute;
|
|
243
|
+
top: 555px;
|
|
244
|
+
left: 50%;
|
|
245
|
+
transform: translateX(-50%);
|
|
246
|
+
background-color: #000;
|
|
247
|
+
color: #fff;
|
|
248
|
+
padding: 7px 40px 11px;
|
|
249
|
+
width: fit-content;
|
|
250
|
+
font-size: 32px;
|
|
251
|
+
line-height: 100%;
|
|
252
|
+
font-weight: 500;
|
|
253
|
+
border-radius: 66px;
|
|
254
|
+
z-index: 10;
|
|
255
|
+
}
|
|
256
|
+
</style>
|
|
257
|
+
</head>
|
|
258
|
+
<body>
|
|
259
|
+
<div class="wrapper flex justify-center {additionalClassName}">
|
|
260
|
+
<img src="{wrapperImg}" alt="" class="wrapper__img">
|
|
261
|
+
<div class="card flex items-end">
|
|
262
|
+
<img src="{bgImg}" alt="" class="bg">
|
|
263
|
+
<div class="avatar flex items-center justify-center">
|
|
264
|
+
<img src="{avatar}" alt="">
|
|
265
|
+
</div>
|
|
266
|
+
<div class="username geist-mono">{username}</div>
|
|
267
|
+
<div class="content w-full">
|
|
268
|
+
<div class="box flex items-center justify-between w-full">
|
|
269
|
+
<div class="title text-shadow text-upper mona-sans">{title}</div>
|
|
270
|
+
<div class="text text-shadow geist-mono text-upper">
|
|
271
|
+
Attention<br> Prediction Market<br> Leaderboard
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
<div class="box2 flex items-end justify-between w-full">
|
|
275
|
+
<div class="subtitle text-shadow mona-sans">
|
|
276
|
+
{subtitle}
|
|
277
|
+
</div>
|
|
278
|
+
<div class="text text-shadow geist-mono text-upper">
|
|
279
|
+
Trendle.fi
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</body>
|
|
286
|
+
</html>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {_ as __awaiter,a as __generator,d as downloadImage,g as getFile,b as getBase64Image}from'../../index-82868da9.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'assert';import'tty';import'zlib';import'events';var textByType = {
|
|
2
|
+
pnlPercent: 'PnL%',
|
|
3
|
+
pnl: 'PnL$',
|
|
4
|
+
consistencyScore: 'consistency score'
|
|
5
|
+
};
|
|
6
|
+
var cardTypes = {
|
|
7
|
+
'black': {
|
|
8
|
+
bgImg: 'images/black.png',
|
|
9
|
+
wideImg: 'images/black-wide.png',
|
|
10
|
+
title: '0.1%',
|
|
11
|
+
subtitle: 'Top of Trendle traders <br> by ',
|
|
12
|
+
color: 'black',
|
|
13
|
+
additionalClassName: 'black'
|
|
14
|
+
},
|
|
15
|
+
'gold': {
|
|
16
|
+
bgImg: 'images/gold.png',
|
|
17
|
+
wideImg: 'images/gold-wide.png',
|
|
18
|
+
title: 'Top 1%',
|
|
19
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
20
|
+
color: '#00000099',
|
|
21
|
+
additionalClassName: ''
|
|
22
|
+
},
|
|
23
|
+
'silver': {
|
|
24
|
+
bgImg: 'images/silver.png',
|
|
25
|
+
wideImg: 'images/silver-wide.png',
|
|
26
|
+
title: 'Top 3%',
|
|
27
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
28
|
+
color: '#00000099',
|
|
29
|
+
additionalClassName: ''
|
|
30
|
+
},
|
|
31
|
+
'bronze': {
|
|
32
|
+
bgImg: 'images/bronze.png',
|
|
33
|
+
wideImg: 'images/bronze-wide.png',
|
|
34
|
+
title: 'Top 10%',
|
|
35
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
36
|
+
color: '#00000099',
|
|
37
|
+
additionalClassName: ''
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// 2020
|
|
41
|
+
var template = {
|
|
42
|
+
width: 850,
|
|
43
|
+
height: 1060,
|
|
44
|
+
type: 'jpeg',
|
|
45
|
+
html: function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var type, leaderboardType, avatarUrl, username, _a, isWide, _b, bgImg, wideImg, title, subtitle, color, additionalClassName, html, bgImage, wideImage, avatarImage;
|
|
47
|
+
return __generator(this, function (_c) {
|
|
48
|
+
switch (_c.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
type = props.type, leaderboardType = props.leaderboardType, avatarUrl = props.avatarUrl, username = props.username, _a = props.isWide, isWide = _a === void 0 ? true : _a;
|
|
51
|
+
_b = cardTypes[type], bgImg = _b.bgImg, wideImg = _b.wideImg, title = _b.title, subtitle = _b.subtitle, color = _b.color, additionalClassName = _b.additionalClassName;
|
|
52
|
+
html = getFile(path.join(__dirname, 'index.html'));
|
|
53
|
+
bgImage = getBase64Image(path.resolve(__dirname, bgImg));
|
|
54
|
+
wideImage = getBase64Image(path.resolve(__dirname, wideImg));
|
|
55
|
+
avatarImage = '';
|
|
56
|
+
if (!(avatarUrl === 'mock')) return [3 /*break*/, 1];
|
|
57
|
+
avatarImage = getBase64Image(path.resolve(__dirname, 'images/avatar.png'));
|
|
58
|
+
return [3 /*break*/, 3];
|
|
59
|
+
case 1: return [4 /*yield*/, downloadImage(avatarUrl)];
|
|
60
|
+
case 2:
|
|
61
|
+
avatarImage = _c.sent();
|
|
62
|
+
_c.label = 3;
|
|
63
|
+
case 3: return [2 /*return*/, html
|
|
64
|
+
.replace('--wrapper-width', "".concat(isWide ? 2020 : 850, "px"))
|
|
65
|
+
.replace('{wrapperImg}', wideImage)
|
|
66
|
+
.replace('--color', color)
|
|
67
|
+
.replace('{additionalClassName}', additionalClassName)
|
|
68
|
+
.replace('{bgImg}', bgImage)
|
|
69
|
+
.replace('{avatar}', avatarImage)
|
|
70
|
+
.replace('{username}', username)
|
|
71
|
+
.replace('{title}', title)
|
|
72
|
+
.replace('{subtitle}', subtitle + textByType[leaderboardType])];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); }
|
|
76
|
+
};export{template as default};
|
package/lib/index.js
CHANGED
|
@@ -88,46 +88,53 @@ function __generator(thisArg, body) {
|
|
|
88
88
|
})];
|
|
89
89
|
case 4:
|
|
90
90
|
_d.sent();
|
|
91
|
-
return [4 /*yield*/, page.setContent(html, { waitUntil: '
|
|
91
|
+
return [4 /*yield*/, page.setContent(html, { waitUntil: 'networkidle0' })
|
|
92
|
+
// Wait for fonts to load
|
|
93
|
+
];
|
|
92
94
|
case 5:
|
|
95
|
+
_d.sent();
|
|
96
|
+
// Wait for fonts to load
|
|
97
|
+
return [4 /*yield*/, page.evaluate(function () { return document.fonts.ready; })];
|
|
98
|
+
case 6:
|
|
99
|
+
// Wait for fonts to load
|
|
93
100
|
_d.sent();
|
|
94
101
|
return [4 /*yield*/, page.$('body')
|
|
95
102
|
// dont' change this condition!
|
|
96
103
|
];
|
|
97
|
-
case
|
|
104
|
+
case 7:
|
|
98
105
|
content = _d.sent();
|
|
99
|
-
if (!(headless === false)) return [3 /*break*/,
|
|
106
|
+
if (!(headless === false)) return [3 /*break*/, 9];
|
|
100
107
|
return [4 /*yield*/, new Promise(function () { })];
|
|
101
|
-
case 7:
|
|
102
|
-
_d.sent();
|
|
103
|
-
_d.label = 8;
|
|
104
108
|
case 8:
|
|
105
|
-
|
|
109
|
+
_d.sent();
|
|
110
|
+
_d.label = 9;
|
|
111
|
+
case 9:
|
|
112
|
+
if (!output) return [3 /*break*/, 13];
|
|
106
113
|
if (!fs__default["default"].existsSync(output)) {
|
|
107
114
|
fs__default["default"].mkdirSync(output);
|
|
108
115
|
}
|
|
109
116
|
filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
110
117
|
return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
|
|
111
|
-
case
|
|
118
|
+
case 10:
|
|
112
119
|
_d.sent();
|
|
113
120
|
return [4 /*yield*/, page.close()];
|
|
114
|
-
case
|
|
121
|
+
case 11:
|
|
115
122
|
_d.sent();
|
|
116
123
|
return [4 /*yield*/, browser.close()];
|
|
117
|
-
case
|
|
124
|
+
case 12:
|
|
118
125
|
_d.sent();
|
|
119
|
-
return [3 /*break*/,
|
|
120
|
-
case
|
|
121
|
-
case
|
|
126
|
+
return [3 /*break*/, 17];
|
|
127
|
+
case 13: return [4 /*yield*/, content.screenshot({ omitBackground: true, type: type })];
|
|
128
|
+
case 14:
|
|
122
129
|
imageBuffer = _d.sent();
|
|
123
130
|
return [4 /*yield*/, page.close()];
|
|
124
|
-
case
|
|
131
|
+
case 15:
|
|
125
132
|
_d.sent();
|
|
126
133
|
return [4 /*yield*/, browser.close()];
|
|
127
|
-
case
|
|
134
|
+
case 16:
|
|
128
135
|
_d.sent();
|
|
129
136
|
return [2 /*return*/, imageBuffer];
|
|
130
|
-
case
|
|
137
|
+
case 17: return [2 /*return*/];
|
|
131
138
|
}
|
|
132
139
|
});
|
|
133
140
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Template } from '../../utils';
|
|
2
|
+
declare const textByType: {
|
|
3
|
+
readonly pnlPercent: "PnL%";
|
|
4
|
+
readonly pnl: "PnL$";
|
|
5
|
+
readonly consistencyScore: "consistency score";
|
|
6
|
+
};
|
|
7
|
+
type LeaderboardType = keyof typeof textByType;
|
|
8
|
+
declare const cardTypes: {
|
|
9
|
+
readonly black: {
|
|
10
|
+
readonly bgImg: "images/black.png";
|
|
11
|
+
readonly wideImg: "images/black-wide.png";
|
|
12
|
+
readonly title: "0.1%";
|
|
13
|
+
readonly subtitle: "Top of Trendle traders <br> by ";
|
|
14
|
+
readonly color: "black";
|
|
15
|
+
readonly additionalClassName: "black";
|
|
16
|
+
};
|
|
17
|
+
readonly gold: {
|
|
18
|
+
readonly bgImg: "images/gold.png";
|
|
19
|
+
readonly wideImg: "images/gold-wide.png";
|
|
20
|
+
readonly title: "Top 1%";
|
|
21
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
22
|
+
readonly color: "#00000099";
|
|
23
|
+
readonly additionalClassName: "";
|
|
24
|
+
};
|
|
25
|
+
readonly silver: {
|
|
26
|
+
readonly bgImg: "images/silver.png";
|
|
27
|
+
readonly wideImg: "images/silver-wide.png";
|
|
28
|
+
readonly title: "Top 3%";
|
|
29
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
30
|
+
readonly color: "#00000099";
|
|
31
|
+
readonly additionalClassName: "";
|
|
32
|
+
};
|
|
33
|
+
readonly bronze: {
|
|
34
|
+
readonly bgImg: "images/bronze.png";
|
|
35
|
+
readonly wideImg: "images/bronze-wide.png";
|
|
36
|
+
readonly title: "Top 10%";
|
|
37
|
+
readonly subtitle: "of Trendle traders <br> by ";
|
|
38
|
+
readonly color: "#00000099";
|
|
39
|
+
readonly additionalClassName: "";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type Props = {
|
|
43
|
+
type: keyof typeof cardTypes;
|
|
44
|
+
leaderboardType: LeaderboardType;
|
|
45
|
+
avatarUrl: string | 'mock';
|
|
46
|
+
username: string;
|
|
47
|
+
isWide?: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const template: Template<Props>;
|
|
50
|
+
export default template;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
7
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
8
|
+
<link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap&family=Mona+Sans:ital,wdth,wght@0,75..125,200..900;1,75..125,200..900&display=swap" rel="stylesheet">
|
|
9
|
+
<style>
|
|
10
|
+
html {
|
|
11
|
+
font-family: 'Inter', sans-serif;
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
html, body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
width: fit-content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.geist-mono {
|
|
21
|
+
font-family: "Geist Mono", sans-serif;
|
|
22
|
+
font-optical-sizing: auto;
|
|
23
|
+
font-weight: 400;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.mona-sans {
|
|
28
|
+
font-family: "Mona Sans", sans-serif;
|
|
29
|
+
font-optical-sizing: auto;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
* {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.flex {
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.flex-wrap {
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.flex-1 {
|
|
46
|
+
flex: 1 1 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.flex-auto {
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.flex-none {
|
|
54
|
+
flex: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.items-center {
|
|
58
|
+
align-items: center;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.items-start {
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.items-end {
|
|
66
|
+
align-items: flex-end;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.items-baseline {
|
|
70
|
+
align-items: baseline;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.items-stretch {
|
|
74
|
+
align-items: stretch;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.self-auto {
|
|
78
|
+
align-self: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.self-start {
|
|
82
|
+
align-self: flex-start;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.self-end {
|
|
86
|
+
align-self: flex-end;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.self-center {
|
|
90
|
+
align-self: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.self-stretch {
|
|
94
|
+
align-self: stretch;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.justify-around {
|
|
98
|
+
justify-content: space-around;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.justify-between {
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.justify-center {
|
|
106
|
+
justify-content: center;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.justify-start {
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.justify-end {
|
|
114
|
+
justify-content: flex-end;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.flex-row {
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.flex-col {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.flex-col-reverse {
|
|
126
|
+
flex-direction: column-reverse;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.text-upper {
|
|
130
|
+
text-transform: uppercase;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.text-center {
|
|
134
|
+
text-align: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.card {
|
|
138
|
+
width: 850px;
|
|
139
|
+
height: 1060px;
|
|
140
|
+
padding-bottom: 32px;
|
|
141
|
+
position: relative;
|
|
142
|
+
z-index: 1;
|
|
143
|
+
/* color: --color; */
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.wrapper {
|
|
147
|
+
width: --wrapper-width;
|
|
148
|
+
position: relative;
|
|
149
|
+
background: #393939;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.wrapper__img {
|
|
153
|
+
position: absolute;
|
|
154
|
+
display: block;
|
|
155
|
+
top: 0;
|
|
156
|
+
top: 50%;
|
|
157
|
+
transform: translateY(-50%);
|
|
158
|
+
width: 100%;
|
|
159
|
+
mix-blend-mode: multiply;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.w-full {
|
|
163
|
+
width: 100%;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.bg {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: 0px;
|
|
169
|
+
left: 0px;
|
|
170
|
+
width: 100%;
|
|
171
|
+
height: 100%;
|
|
172
|
+
z-index: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.text-shadow {
|
|
176
|
+
color: black;
|
|
177
|
+
opacity: 0.6;
|
|
178
|
+
text-shadow:
|
|
179
|
+
0px -1px 1px rgba(255, 255, 255, 0.29),
|
|
180
|
+
-1px -1px 1px rgba(255, 255, 255, 0.5),
|
|
181
|
+
0px 3px 6px rgba(0, 0, 0),
|
|
182
|
+
-1px 1px 1px rgba(255, 255, 255, 0.5);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.title {
|
|
186
|
+
font-weight: 800;
|
|
187
|
+
font-size: 109.91px;
|
|
188
|
+
line-height: 80%;
|
|
189
|
+
letter-spacing: -2%;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.text {
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
font-size: 24px;
|
|
195
|
+
line-height: 140%;
|
|
196
|
+
letter-spacing: 2%;
|
|
197
|
+
width: 300px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.black .text {
|
|
201
|
+
font-weight: 900;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.subtitle {
|
|
205
|
+
font-weight: 700;
|
|
206
|
+
font-size: 36.41px;
|
|
207
|
+
line-height: 100%;
|
|
208
|
+
letter-spacing: -2%;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.box {
|
|
212
|
+
padding: 0px 30px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.box2 {
|
|
216
|
+
margin-top: 30px;
|
|
217
|
+
padding-left: 27px;
|
|
218
|
+
padding-right: 30px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.content {
|
|
222
|
+
z-index: 2;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.avatar {
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: 209px;
|
|
228
|
+
left: 50%;
|
|
229
|
+
transform: translateX(-50%);
|
|
230
|
+
width: 370px;
|
|
231
|
+
height: 370px;
|
|
232
|
+
border-radius: 100%;
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
z-index: 10;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.avatar > img {
|
|
238
|
+
width: 100%;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.username {
|
|
242
|
+
position: absolute;
|
|
243
|
+
top: 555px;
|
|
244
|
+
left: 50%;
|
|
245
|
+
transform: translateX(-50%);
|
|
246
|
+
background-color: #000;
|
|
247
|
+
color: #fff;
|
|
248
|
+
padding: 7px 40px 11px;
|
|
249
|
+
width: fit-content;
|
|
250
|
+
font-size: 32px;
|
|
251
|
+
line-height: 100%;
|
|
252
|
+
font-weight: 500;
|
|
253
|
+
border-radius: 66px;
|
|
254
|
+
z-index: 10;
|
|
255
|
+
}
|
|
256
|
+
</style>
|
|
257
|
+
</head>
|
|
258
|
+
<body>
|
|
259
|
+
<div class="wrapper flex justify-center {additionalClassName}">
|
|
260
|
+
<img src="{wrapperImg}" alt="" class="wrapper__img">
|
|
261
|
+
<div class="card flex items-end">
|
|
262
|
+
<img src="{bgImg}" alt="" class="bg">
|
|
263
|
+
<div class="avatar flex items-center justify-center">
|
|
264
|
+
<img src="{avatar}" alt="">
|
|
265
|
+
</div>
|
|
266
|
+
<div class="username geist-mono">{username}</div>
|
|
267
|
+
<div class="content w-full">
|
|
268
|
+
<div class="box flex items-center justify-between w-full">
|
|
269
|
+
<div class="title text-shadow text-upper mona-sans">{title}</div>
|
|
270
|
+
<div class="text text-shadow geist-mono text-upper">
|
|
271
|
+
Attention<br> Prediction Market<br> Leaderboard
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
<div class="box2 flex items-end justify-between w-full">
|
|
275
|
+
<div class="subtitle text-shadow mona-sans">
|
|
276
|
+
{subtitle}
|
|
277
|
+
</div>
|
|
278
|
+
<div class="text text-shadow geist-mono text-upper">
|
|
279
|
+
Trendle.fi
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</body>
|
|
286
|
+
</html>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';var index=require('../../index-de0b52f4.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var textByType = {
|
|
2
|
+
pnlPercent: 'PnL%',
|
|
3
|
+
pnl: 'PnL$',
|
|
4
|
+
consistencyScore: 'consistency score'
|
|
5
|
+
};
|
|
6
|
+
var cardTypes = {
|
|
7
|
+
'black': {
|
|
8
|
+
bgImg: 'images/black.png',
|
|
9
|
+
wideImg: 'images/black-wide.png',
|
|
10
|
+
title: '0.1%',
|
|
11
|
+
subtitle: 'Top of Trendle traders <br> by ',
|
|
12
|
+
color: 'black',
|
|
13
|
+
additionalClassName: 'black'
|
|
14
|
+
},
|
|
15
|
+
'gold': {
|
|
16
|
+
bgImg: 'images/gold.png',
|
|
17
|
+
wideImg: 'images/gold-wide.png',
|
|
18
|
+
title: 'Top 1%',
|
|
19
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
20
|
+
color: '#00000099',
|
|
21
|
+
additionalClassName: ''
|
|
22
|
+
},
|
|
23
|
+
'silver': {
|
|
24
|
+
bgImg: 'images/silver.png',
|
|
25
|
+
wideImg: 'images/silver-wide.png',
|
|
26
|
+
title: 'Top 3%',
|
|
27
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
28
|
+
color: '#00000099',
|
|
29
|
+
additionalClassName: ''
|
|
30
|
+
},
|
|
31
|
+
'bronze': {
|
|
32
|
+
bgImg: 'images/bronze.png',
|
|
33
|
+
wideImg: 'images/bronze-wide.png',
|
|
34
|
+
title: 'Top 10%',
|
|
35
|
+
subtitle: 'of Trendle traders <br> by ',
|
|
36
|
+
color: '#00000099',
|
|
37
|
+
additionalClassName: ''
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// 2020
|
|
41
|
+
var template = {
|
|
42
|
+
width: 850,
|
|
43
|
+
height: 1060,
|
|
44
|
+
type: 'jpeg',
|
|
45
|
+
html: function (props) { return index._(void 0, void 0, void 0, function () {
|
|
46
|
+
var type, leaderboardType, avatarUrl, username, _a, isWide, _b, bgImg, wideImg, title, subtitle, color, additionalClassName, html, bgImage, wideImage, avatarImage;
|
|
47
|
+
return index.a(this, function (_c) {
|
|
48
|
+
switch (_c.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
type = props.type, leaderboardType = props.leaderboardType, avatarUrl = props.avatarUrl, username = props.username, _a = props.isWide, isWide = _a === void 0 ? true : _a;
|
|
51
|
+
_b = cardTypes[type], bgImg = _b.bgImg, wideImg = _b.wideImg, title = _b.title, subtitle = _b.subtitle, color = _b.color, additionalClassName = _b.additionalClassName;
|
|
52
|
+
html = index.g(path__default["default"].join(__dirname, 'index.html'));
|
|
53
|
+
bgImage = index.b(path__default["default"].resolve(__dirname, bgImg));
|
|
54
|
+
wideImage = index.b(path__default["default"].resolve(__dirname, wideImg));
|
|
55
|
+
avatarImage = '';
|
|
56
|
+
if (!(avatarUrl === 'mock')) return [3 /*break*/, 1];
|
|
57
|
+
avatarImage = index.b(path__default["default"].resolve(__dirname, 'images/avatar.png'));
|
|
58
|
+
return [3 /*break*/, 3];
|
|
59
|
+
case 1: return [4 /*yield*/, index.d(avatarUrl)];
|
|
60
|
+
case 2:
|
|
61
|
+
avatarImage = _c.sent();
|
|
62
|
+
_c.label = 3;
|
|
63
|
+
case 3: return [2 /*return*/, html
|
|
64
|
+
.replace('--wrapper-width', "".concat(isWide ? 2020 : 850, "px"))
|
|
65
|
+
.replace('{wrapperImg}', wideImage)
|
|
66
|
+
.replace('--color', color)
|
|
67
|
+
.replace('{additionalClassName}', additionalClassName)
|
|
68
|
+
.replace('{bgImg}', bgImage)
|
|
69
|
+
.replace('{avatar}', avatarImage)
|
|
70
|
+
.replace('{username}', username)
|
|
71
|
+
.replace('{title}', title)
|
|
72
|
+
.replace('{subtitle}', subtitle + textByType[leaderboardType])];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); }
|
|
76
|
+
};module.exports=template;
|