@azuro-org/images-generator 1.3.13 → 1.3.15
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 +72 -21
- package/dist/templates/trendle-trading/images/arnold.png +0 -0
- package/dist/templates/trendle-trading/images/elon-2.png +0 -0
- package/dist/templates/trendle-trading/images/macron.png +0 -0
- package/dist/templates/trendle-trading/images/person-1.png +0 -0
- package/dist/templates/trendle-trading/images/person-2.png +0 -0
- package/dist/templates/trendle-trading/images/powell.png +0 -0
- package/dist/templates/trendle-trading/images/taylor.png +0 -0
- package/dist/templates/trendle-trading/images/tramp-2.png +0 -0
- package/dist/templates/trendle-trading/index.d.ts +4 -1
- package/dist/templates/trendle-trading/index.html +44 -3
- package/dist/templates/trendle-trading/index.js +6 -3
- package/lib/index.js +72 -21
- package/lib/templates/trendle-trading/images/arnold.png +0 -0
- package/lib/templates/trendle-trading/images/elon-2.png +0 -0
- package/lib/templates/trendle-trading/images/macron.png +0 -0
- package/lib/templates/trendle-trading/images/person-1.png +0 -0
- package/lib/templates/trendle-trading/images/person-2.png +0 -0
- package/lib/templates/trendle-trading/images/powell.png +0 -0
- package/lib/templates/trendle-trading/images/taylor.png +0 -0
- package/lib/templates/trendle-trading/images/tramp-2.png +0 -0
- package/lib/templates/trendle-trading/index.d.ts +4 -1
- package/lib/templates/trendle-trading/index.html +44 -3
- package/lib/templates/trendle-trading/index.js +6 -3
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -13,6 +13,17 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
|
+
var __assign = function() {
|
|
17
|
+
__assign = Object.assign || function __assign(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
|
|
16
27
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
17
28
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
29
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -68,7 +79,27 @@ function __generator(thisArg, body) {
|
|
|
68
79
|
'--disable-setuid-sandbox',
|
|
69
80
|
'--disable-gpu',
|
|
70
81
|
'--disable-accelerated-video-decode',
|
|
71
|
-
|
|
82
|
+
'--disable-dev-shm-usage',
|
|
83
|
+
'--disable-web-security',
|
|
84
|
+
'--disable-plugins',
|
|
85
|
+
'--disable-extensions',
|
|
86
|
+
'--disable-background-networking',
|
|
87
|
+
'--disable-background-timer-throttling',
|
|
88
|
+
'--disable-renderer-backgrounding',
|
|
89
|
+
'--disable-backgrounding-occluded-windows',
|
|
90
|
+
'--disable-breakpad',
|
|
91
|
+
'--disable-component-extensions-with-background-pages',
|
|
92
|
+
'--disable-features=TranslateUI',
|
|
93
|
+
'--disable-ipc-flooding-protection',
|
|
94
|
+
'--disable-hang-monitor',
|
|
95
|
+
'--disable-prompt-on-repost',
|
|
96
|
+
'--disable-sync',
|
|
97
|
+
'--metrics-recording-only',
|
|
98
|
+
'--no-first-run',
|
|
99
|
+
'--safebrowsing-disable-auto-update',
|
|
100
|
+
'--enable-automation',
|
|
101
|
+
'--password-store=basic',
|
|
102
|
+
'--use-mock-keychain',
|
|
72
103
|
],
|
|
73
104
|
};
|
|
74
105
|
if (typeof modifyPuppeteerOptions === 'function') {
|
|
@@ -81,60 +112,80 @@ function __generator(thisArg, body) {
|
|
|
81
112
|
case 3:
|
|
82
113
|
page = _d.sent();
|
|
83
114
|
page.setDefaultNavigationTimeout(0);
|
|
115
|
+
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
116
|
+
case 4:
|
|
117
|
+
_d.sent();
|
|
118
|
+
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
119
|
+
case 5:
|
|
120
|
+
_d.sent();
|
|
121
|
+
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
122
|
+
case 6:
|
|
123
|
+
_d.sent();
|
|
124
|
+
page.on('request', function (req) {
|
|
125
|
+
var resourceType = req.resourceType();
|
|
126
|
+
// Block only truly unnecessary resources that don't affect rendering
|
|
127
|
+
// Allow images, stylesheets, scripts, and data URLs
|
|
128
|
+
if (['font', 'media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
129
|
+
req.abort();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
req.continue();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
84
135
|
return [4 /*yield*/, page.setViewport({
|
|
85
136
|
width: width,
|
|
86
137
|
height: height,
|
|
87
138
|
deviceScaleFactor: scaleFactor,
|
|
88
139
|
})];
|
|
89
|
-
case
|
|
140
|
+
case 7:
|
|
90
141
|
_d.sent();
|
|
91
|
-
return [4 /*yield*/, page.setContent(html, { waitUntil: '
|
|
142
|
+
return [4 /*yield*/, page.setContent(html, { waitUntil: 'domcontentloaded' })
|
|
92
143
|
// Wait for fonts to load
|
|
93
144
|
];
|
|
94
|
-
case
|
|
145
|
+
case 8:
|
|
95
146
|
_d.sent();
|
|
96
147
|
// Wait for fonts to load
|
|
97
148
|
return [4 /*yield*/, page.evaluate(function () { return document.fonts.ready; })];
|
|
98
|
-
case
|
|
149
|
+
case 9:
|
|
99
150
|
// Wait for fonts to load
|
|
100
151
|
_d.sent();
|
|
101
152
|
return [4 /*yield*/, page.$('body')
|
|
102
153
|
// dont' change this condition!
|
|
103
154
|
];
|
|
104
|
-
case
|
|
155
|
+
case 10:
|
|
105
156
|
content = _d.sent();
|
|
106
|
-
if (!(headless === false)) return [3 /*break*/,
|
|
157
|
+
if (!(headless === false)) return [3 /*break*/, 12];
|
|
107
158
|
return [4 /*yield*/, new Promise(function () { })];
|
|
108
|
-
case
|
|
159
|
+
case 11:
|
|
109
160
|
_d.sent();
|
|
110
|
-
_d.label =
|
|
111
|
-
case
|
|
112
|
-
if (!output) return [3 /*break*/,
|
|
161
|
+
_d.label = 12;
|
|
162
|
+
case 12:
|
|
163
|
+
if (!output) return [3 /*break*/, 16];
|
|
113
164
|
if (!fs.existsSync(output)) {
|
|
114
165
|
fs.mkdirSync(output);
|
|
115
166
|
}
|
|
116
167
|
filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
117
|
-
return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
|
|
118
|
-
case
|
|
168
|
+
return [4 /*yield*/, content.screenshot(__assign({ path: filePath, type: type }, (type === 'jpeg' ? { quality: 85 } : {})))];
|
|
169
|
+
case 13:
|
|
119
170
|
_d.sent();
|
|
120
171
|
return [4 /*yield*/, page.close()];
|
|
121
|
-
case
|
|
172
|
+
case 14:
|
|
122
173
|
_d.sent();
|
|
123
174
|
return [4 /*yield*/, browser.close()];
|
|
124
|
-
case
|
|
175
|
+
case 15:
|
|
125
176
|
_d.sent();
|
|
126
|
-
return [3 /*break*/,
|
|
127
|
-
case
|
|
128
|
-
case
|
|
177
|
+
return [3 /*break*/, 20];
|
|
178
|
+
case 16: return [4 /*yield*/, content.screenshot(__assign({ omitBackground: true, type: type }, (type === 'jpeg' ? { quality: 85 } : {})))];
|
|
179
|
+
case 17:
|
|
129
180
|
imageBuffer = _d.sent();
|
|
130
181
|
return [4 /*yield*/, page.close()];
|
|
131
|
-
case
|
|
182
|
+
case 18:
|
|
132
183
|
_d.sent();
|
|
133
184
|
return [4 /*yield*/, browser.close()];
|
|
134
|
-
case
|
|
185
|
+
case 19:
|
|
135
186
|
_d.sent();
|
|
136
187
|
return [2 /*return*/, imageBuffer];
|
|
137
|
-
case
|
|
188
|
+
case 20: return [2 /*return*/];
|
|
138
189
|
}
|
|
139
190
|
});
|
|
140
191
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Template } from '../../utils';
|
|
2
|
+
type Person = 'obama' | 'drake' | 'crash' | 'sydney' | 'tramp' | 'elon' | 'lewis' | 'mark' | 'powell' | 'macron' | 'arnold' | 'person-1' | 'tramp-2' | 'elon-2' | 'person-2' | 'taylor';
|
|
2
3
|
export type Props = {
|
|
3
|
-
type:
|
|
4
|
+
type: Person;
|
|
4
5
|
trend: {
|
|
5
6
|
image: string;
|
|
6
7
|
title: string;
|
|
@@ -8,6 +9,8 @@ export type Props = {
|
|
|
8
9
|
position: {
|
|
9
10
|
leverage: number;
|
|
10
11
|
isLong: boolean;
|
|
12
|
+
openLevel: number;
|
|
13
|
+
exitLevel: number | undefined;
|
|
11
14
|
};
|
|
12
15
|
pnl: number;
|
|
13
16
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
5
|
<meta charset="UTF-8">
|
|
5
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<link
|
|
7
|
+
<link
|
|
8
|
+
href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Mona+Sans:wdth,wght@75..125,700&display=swap"
|
|
9
|
+
rel="stylesheet">
|
|
7
10
|
<style>
|
|
8
11
|
html {
|
|
9
12
|
font-family: 'Inter', sans-serif;
|
|
@@ -11,7 +14,8 @@
|
|
|
11
14
|
color: #000;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
html,
|
|
17
|
+
html,
|
|
18
|
+
body {
|
|
15
19
|
margin: 0;
|
|
16
20
|
width: fit-content;
|
|
17
21
|
}
|
|
@@ -30,6 +34,10 @@
|
|
|
30
34
|
display: flex;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
.none {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
.flex-wrap {
|
|
34
42
|
flex-wrap: wrap;
|
|
35
43
|
}
|
|
@@ -152,7 +160,7 @@
|
|
|
152
160
|
overflow: hidden;
|
|
153
161
|
}
|
|
154
162
|
|
|
155
|
-
.trend__img
|
|
163
|
+
.trend__img>img {
|
|
156
164
|
width: 100%;
|
|
157
165
|
}
|
|
158
166
|
|
|
@@ -206,8 +214,30 @@
|
|
|
206
214
|
left: 0px;
|
|
207
215
|
width: 100%;
|
|
208
216
|
}
|
|
217
|
+
|
|
218
|
+
.level-wrapper {
|
|
219
|
+
margin-top: 30px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.level-title {
|
|
223
|
+
opacity: 50%;
|
|
224
|
+
color: #000000CC;
|
|
225
|
+
font-size: 24px;
|
|
226
|
+
line-height: 100%;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.level-content {
|
|
230
|
+
margin-top: 6px;
|
|
231
|
+
font-size: 28px;
|
|
232
|
+
line-height: 37.86px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.level-box {
|
|
236
|
+
margin-left: 125px;
|
|
237
|
+
}
|
|
209
238
|
</style>
|
|
210
239
|
</head>
|
|
240
|
+
|
|
211
241
|
<body>
|
|
212
242
|
<div class="card flex flex-col justify-between">
|
|
213
243
|
<img class="bg-img" src={bgImg} alt="">
|
|
@@ -228,7 +258,18 @@
|
|
|
228
258
|
</div>
|
|
229
259
|
</div>
|
|
230
260
|
<div class="pnl">{pnl}%</div>
|
|
261
|
+
<div class="level-wrapper flex items-center">
|
|
262
|
+
<div>
|
|
263
|
+
<div class="level-title">Entry level:</div>
|
|
264
|
+
<div class="level-content">{openLevel}</div>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="level-box {exitLevelClass}">
|
|
267
|
+
<div class="level-title">Exit level:</div>
|
|
268
|
+
<div class="level-content">{exitLevel}</div>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
231
271
|
</div>
|
|
232
272
|
</div>
|
|
233
273
|
</body>
|
|
274
|
+
|
|
234
275
|
</html>
|
|
@@ -13,14 +13,14 @@ var template = {
|
|
|
13
13
|
height: 630,
|
|
14
14
|
type: 'jpeg',
|
|
15
15
|
html: function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
16
|
-
var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
|
|
16
|
+
var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
|
|
17
17
|
return __generator(this, function (_b) {
|
|
18
18
|
switch (_b.label) {
|
|
19
19
|
case 0:
|
|
20
20
|
type = props.type, trend = props.trend, pnl = props.pnl, position = props.position;
|
|
21
21
|
isProfit = pnl > 0;
|
|
22
22
|
_a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
|
|
23
|
-
leverage = position.leverage, isLong = position.isLong;
|
|
23
|
+
leverage = position.leverage, isLong = position.isLong, openLevel = position.openLevel, exitLevel = position.exitLevel;
|
|
24
24
|
html = getFile(path.join(__dirname, 'index.html'));
|
|
25
25
|
logo = getBase64Image(path.resolve(__dirname, 'images/logo.png'));
|
|
26
26
|
bgImage = getBase64Image(path.resolve(__dirname, 'images/bg.png'));
|
|
@@ -41,7 +41,10 @@ var template = {
|
|
|
41
41
|
.replace('{trendTitle}', trend.title)
|
|
42
42
|
.replace('{positionInfo}', positionInfo)
|
|
43
43
|
.replace('{arrowImage}', arrowImage)
|
|
44
|
-
.replace('{pnl}', pnl > 0 ? "+".concat(pnl) : "".concat(pnl))
|
|
44
|
+
.replace('{pnl}', pnl > 0 ? "+".concat(pnl) : "".concat(pnl))
|
|
45
|
+
.replace('{openLevel}', String(openLevel))
|
|
46
|
+
.replace('{exitLevel}', String(exitLevel || ''))
|
|
47
|
+
.replace('{exitLevelClass}', exitLevel ? '' : 'none')];
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
}); }
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,17 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
|
+
var __assign = function() {
|
|
17
|
+
__assign = Object.assign || function __assign(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
|
|
16
27
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
17
28
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
29
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -68,7 +79,27 @@ function __generator(thisArg, body) {
|
|
|
68
79
|
'--disable-setuid-sandbox',
|
|
69
80
|
'--disable-gpu',
|
|
70
81
|
'--disable-accelerated-video-decode',
|
|
71
|
-
|
|
82
|
+
'--disable-dev-shm-usage',
|
|
83
|
+
'--disable-web-security',
|
|
84
|
+
'--disable-plugins',
|
|
85
|
+
'--disable-extensions',
|
|
86
|
+
'--disable-background-networking',
|
|
87
|
+
'--disable-background-timer-throttling',
|
|
88
|
+
'--disable-renderer-backgrounding',
|
|
89
|
+
'--disable-backgrounding-occluded-windows',
|
|
90
|
+
'--disable-breakpad',
|
|
91
|
+
'--disable-component-extensions-with-background-pages',
|
|
92
|
+
'--disable-features=TranslateUI',
|
|
93
|
+
'--disable-ipc-flooding-protection',
|
|
94
|
+
'--disable-hang-monitor',
|
|
95
|
+
'--disable-prompt-on-repost',
|
|
96
|
+
'--disable-sync',
|
|
97
|
+
'--metrics-recording-only',
|
|
98
|
+
'--no-first-run',
|
|
99
|
+
'--safebrowsing-disable-auto-update',
|
|
100
|
+
'--enable-automation',
|
|
101
|
+
'--password-store=basic',
|
|
102
|
+
'--use-mock-keychain',
|
|
72
103
|
],
|
|
73
104
|
};
|
|
74
105
|
if (typeof modifyPuppeteerOptions === 'function') {
|
|
@@ -81,60 +112,80 @@ function __generator(thisArg, body) {
|
|
|
81
112
|
case 3:
|
|
82
113
|
page = _d.sent();
|
|
83
114
|
page.setDefaultNavigationTimeout(0);
|
|
115
|
+
return [4 /*yield*/, page.setCacheEnabled(false)];
|
|
116
|
+
case 4:
|
|
117
|
+
_d.sent();
|
|
118
|
+
return [4 /*yield*/, page.setJavaScriptEnabled(true)];
|
|
119
|
+
case 5:
|
|
120
|
+
_d.sent();
|
|
121
|
+
return [4 /*yield*/, page.setRequestInterception(true)];
|
|
122
|
+
case 6:
|
|
123
|
+
_d.sent();
|
|
124
|
+
page.on('request', function (req) {
|
|
125
|
+
var resourceType = req.resourceType();
|
|
126
|
+
// Block only truly unnecessary resources that don't affect rendering
|
|
127
|
+
// Allow images, stylesheets, scripts, and data URLs
|
|
128
|
+
if (['font', 'media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
|
|
129
|
+
req.abort();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
req.continue();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
84
135
|
return [4 /*yield*/, page.setViewport({
|
|
85
136
|
width: width,
|
|
86
137
|
height: height,
|
|
87
138
|
deviceScaleFactor: scaleFactor,
|
|
88
139
|
})];
|
|
89
|
-
case
|
|
140
|
+
case 7:
|
|
90
141
|
_d.sent();
|
|
91
|
-
return [4 /*yield*/, page.setContent(html, { waitUntil: '
|
|
142
|
+
return [4 /*yield*/, page.setContent(html, { waitUntil: 'domcontentloaded' })
|
|
92
143
|
// Wait for fonts to load
|
|
93
144
|
];
|
|
94
|
-
case
|
|
145
|
+
case 8:
|
|
95
146
|
_d.sent();
|
|
96
147
|
// Wait for fonts to load
|
|
97
148
|
return [4 /*yield*/, page.evaluate(function () { return document.fonts.ready; })];
|
|
98
|
-
case
|
|
149
|
+
case 9:
|
|
99
150
|
// Wait for fonts to load
|
|
100
151
|
_d.sent();
|
|
101
152
|
return [4 /*yield*/, page.$('body')
|
|
102
153
|
// dont' change this condition!
|
|
103
154
|
];
|
|
104
|
-
case
|
|
155
|
+
case 10:
|
|
105
156
|
content = _d.sent();
|
|
106
|
-
if (!(headless === false)) return [3 /*break*/,
|
|
157
|
+
if (!(headless === false)) return [3 /*break*/, 12];
|
|
107
158
|
return [4 /*yield*/, new Promise(function () { })];
|
|
108
|
-
case
|
|
159
|
+
case 11:
|
|
109
160
|
_d.sent();
|
|
110
|
-
_d.label =
|
|
111
|
-
case
|
|
112
|
-
if (!output) return [3 /*break*/,
|
|
161
|
+
_d.label = 12;
|
|
162
|
+
case 12:
|
|
163
|
+
if (!output) return [3 /*break*/, 16];
|
|
113
164
|
if (!fs__default["default"].existsSync(output)) {
|
|
114
165
|
fs__default["default"].mkdirSync(output);
|
|
115
166
|
}
|
|
116
167
|
filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
|
|
117
|
-
return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
|
|
118
|
-
case
|
|
168
|
+
return [4 /*yield*/, content.screenshot(__assign({ path: filePath, type: type }, (type === 'jpeg' ? { quality: 85 } : {})))];
|
|
169
|
+
case 13:
|
|
119
170
|
_d.sent();
|
|
120
171
|
return [4 /*yield*/, page.close()];
|
|
121
|
-
case
|
|
172
|
+
case 14:
|
|
122
173
|
_d.sent();
|
|
123
174
|
return [4 /*yield*/, browser.close()];
|
|
124
|
-
case
|
|
175
|
+
case 15:
|
|
125
176
|
_d.sent();
|
|
126
|
-
return [3 /*break*/,
|
|
127
|
-
case
|
|
128
|
-
case
|
|
177
|
+
return [3 /*break*/, 20];
|
|
178
|
+
case 16: return [4 /*yield*/, content.screenshot(__assign({ omitBackground: true, type: type }, (type === 'jpeg' ? { quality: 85 } : {})))];
|
|
179
|
+
case 17:
|
|
129
180
|
imageBuffer = _d.sent();
|
|
130
181
|
return [4 /*yield*/, page.close()];
|
|
131
|
-
case
|
|
182
|
+
case 18:
|
|
132
183
|
_d.sent();
|
|
133
184
|
return [4 /*yield*/, browser.close()];
|
|
134
|
-
case
|
|
185
|
+
case 19:
|
|
135
186
|
_d.sent();
|
|
136
187
|
return [2 /*return*/, imageBuffer];
|
|
137
|
-
case
|
|
188
|
+
case 20: return [2 /*return*/];
|
|
138
189
|
}
|
|
139
190
|
});
|
|
140
191
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Template } from '../../utils';
|
|
2
|
+
type Person = 'obama' | 'drake' | 'crash' | 'sydney' | 'tramp' | 'elon' | 'lewis' | 'mark' | 'powell' | 'macron' | 'arnold' | 'person-1' | 'tramp-2' | 'elon-2' | 'person-2' | 'taylor';
|
|
2
3
|
export type Props = {
|
|
3
|
-
type:
|
|
4
|
+
type: Person;
|
|
4
5
|
trend: {
|
|
5
6
|
image: string;
|
|
6
7
|
title: string;
|
|
@@ -8,6 +9,8 @@ export type Props = {
|
|
|
8
9
|
position: {
|
|
9
10
|
leverage: number;
|
|
10
11
|
isLong: boolean;
|
|
12
|
+
openLevel: number;
|
|
13
|
+
exitLevel: number | undefined;
|
|
11
14
|
};
|
|
12
15
|
pnl: number;
|
|
13
16
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
5
|
<meta charset="UTF-8">
|
|
5
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<link
|
|
7
|
+
<link
|
|
8
|
+
href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Mona+Sans:wdth,wght@75..125,700&display=swap"
|
|
9
|
+
rel="stylesheet">
|
|
7
10
|
<style>
|
|
8
11
|
html {
|
|
9
12
|
font-family: 'Inter', sans-serif;
|
|
@@ -11,7 +14,8 @@
|
|
|
11
14
|
color: #000;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
html,
|
|
17
|
+
html,
|
|
18
|
+
body {
|
|
15
19
|
margin: 0;
|
|
16
20
|
width: fit-content;
|
|
17
21
|
}
|
|
@@ -30,6 +34,10 @@
|
|
|
30
34
|
display: flex;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
.none {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
.flex-wrap {
|
|
34
42
|
flex-wrap: wrap;
|
|
35
43
|
}
|
|
@@ -152,7 +160,7 @@
|
|
|
152
160
|
overflow: hidden;
|
|
153
161
|
}
|
|
154
162
|
|
|
155
|
-
.trend__img
|
|
163
|
+
.trend__img>img {
|
|
156
164
|
width: 100%;
|
|
157
165
|
}
|
|
158
166
|
|
|
@@ -206,8 +214,30 @@
|
|
|
206
214
|
left: 0px;
|
|
207
215
|
width: 100%;
|
|
208
216
|
}
|
|
217
|
+
|
|
218
|
+
.level-wrapper {
|
|
219
|
+
margin-top: 30px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.level-title {
|
|
223
|
+
opacity: 50%;
|
|
224
|
+
color: #000000CC;
|
|
225
|
+
font-size: 24px;
|
|
226
|
+
line-height: 100%;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.level-content {
|
|
230
|
+
margin-top: 6px;
|
|
231
|
+
font-size: 28px;
|
|
232
|
+
line-height: 37.86px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.level-box {
|
|
236
|
+
margin-left: 125px;
|
|
237
|
+
}
|
|
209
238
|
</style>
|
|
210
239
|
</head>
|
|
240
|
+
|
|
211
241
|
<body>
|
|
212
242
|
<div class="card flex flex-col justify-between">
|
|
213
243
|
<img class="bg-img" src={bgImg} alt="">
|
|
@@ -228,7 +258,18 @@
|
|
|
228
258
|
</div>
|
|
229
259
|
</div>
|
|
230
260
|
<div class="pnl">{pnl}%</div>
|
|
261
|
+
<div class="level-wrapper flex items-center">
|
|
262
|
+
<div>
|
|
263
|
+
<div class="level-title">Entry level:</div>
|
|
264
|
+
<div class="level-content">{openLevel}</div>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="level-box {exitLevelClass}">
|
|
267
|
+
<div class="level-title">Exit level:</div>
|
|
268
|
+
<div class="level-content">{exitLevel}</div>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
231
271
|
</div>
|
|
232
272
|
</div>
|
|
233
273
|
</body>
|
|
274
|
+
|
|
234
275
|
</html>
|
|
@@ -13,14 +13,14 @@ var template = {
|
|
|
13
13
|
height: 630,
|
|
14
14
|
type: 'jpeg',
|
|
15
15
|
html: function (props) { return index._(void 0, void 0, void 0, function () {
|
|
16
|
-
var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
|
|
16
|
+
var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
|
|
17
17
|
return index.a(this, function (_b) {
|
|
18
18
|
switch (_b.label) {
|
|
19
19
|
case 0:
|
|
20
20
|
type = props.type, trend = props.trend, pnl = props.pnl, position = props.position;
|
|
21
21
|
isProfit = pnl > 0;
|
|
22
22
|
_a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
|
|
23
|
-
leverage = position.leverage, isLong = position.isLong;
|
|
23
|
+
leverage = position.leverage, isLong = position.isLong, openLevel = position.openLevel, exitLevel = position.exitLevel;
|
|
24
24
|
html = index.g(path__default["default"].join(__dirname, 'index.html'));
|
|
25
25
|
logo = index.b(path__default["default"].resolve(__dirname, 'images/logo.png'));
|
|
26
26
|
bgImage = index.b(path__default["default"].resolve(__dirname, 'images/bg.png'));
|
|
@@ -41,7 +41,10 @@ var template = {
|
|
|
41
41
|
.replace('{trendTitle}', trend.title)
|
|
42
42
|
.replace('{positionInfo}', positionInfo)
|
|
43
43
|
.replace('{arrowImage}', arrowImage)
|
|
44
|
-
.replace('{pnl}', pnl > 0 ? "+".concat(pnl) : "".concat(pnl))
|
|
44
|
+
.replace('{pnl}', pnl > 0 ? "+".concat(pnl) : "".concat(pnl))
|
|
45
|
+
.replace('{openLevel}', String(openLevel))
|
|
46
|
+
.replace('{exitLevel}', String(exitLevel || ''))
|
|
47
|
+
.replace('{exitLevelClass}', exitLevel ? '' : 'none')];
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
}); }
|