dankgrinder 8.87.0 → 8.88.0
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/lib/ui.js +39 -71
- package/package.json +1 -1
package/lib/ui.js
CHANGED
|
@@ -134,14 +134,14 @@ function render() {
|
|
|
134
134
|
|
|
135
135
|
let out = '';
|
|
136
136
|
|
|
137
|
-
//
|
|
137
|
+
// 1. BRANDING
|
|
138
138
|
const titleStr = figlet.textSync('DANK GRINDER', { font: 'ANSI Shadow' });
|
|
139
139
|
out += chalk.bold(applyGradient(titleStr));
|
|
140
|
-
out += chalk.
|
|
140
|
+
out += chalk.dim(' v' + _version + ' | ') + chalk.cyan.bold(getLoader() + ' RUNNING') + '\n\n';
|
|
141
141
|
|
|
142
|
-
const wCols = { num: 4, name:
|
|
143
|
-
const overhead =
|
|
144
|
-
const logW = Math.max(
|
|
142
|
+
const wCols = { num: 4, name: 20, bal: 15, ls: 8, lv: 7 };
|
|
143
|
+
const overhead = 2 + wCols.num + 1 + wCols.name + 1 + wCols.bal + 1 + wCols.ls + 1 + wCols.lv + 1;
|
|
144
|
+
const logW = Math.max(15, C - overhead - 2);
|
|
145
145
|
const actualC = logW + overhead;
|
|
146
146
|
|
|
147
147
|
const sorted = [..._workers].sort((a, b) => {
|
|
@@ -157,44 +157,23 @@ function render() {
|
|
|
157
157
|
if (w.channel && !w.paused && !w.dashboardPaused) onlineCount++;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
//
|
|
161
|
-
const
|
|
160
|
+
// 2. GLOBAL STATS (Ultra Modern Borderless Design)
|
|
161
|
+
const bar = chalk.dim('━'.repeat(Math.min(C, 90)));
|
|
162
|
+
const profStr = totalCoins > 0 ? '+' + formatBal(totalCoins) : '+0';
|
|
162
163
|
|
|
163
|
-
out +=
|
|
164
|
-
out +=
|
|
165
|
-
chalk.bold('
|
|
166
|
-
|
|
164
|
+
out += ' ' + bar + '\n';
|
|
165
|
+
out += ' ' + chalk.bold.blue('⚡ ONLINE: ') + chalk.whiteBright(onlineCount + ' / ' + _workers.length).padEnd(20) +
|
|
166
|
+
chalk.bold.gray('⏱ UPTIME: ') + chalk.whiteBright(fmtUptime()) + '\n';
|
|
167
|
+
out += ' ' + chalk.bold.green('💰 BALANCE: ') + chalk.whiteBright('⏣ ' + formatBal(totalBal)).padEnd(20) +
|
|
168
|
+
chalk.bold.yellow('📈 PROFIT: ') + chalk.whiteBright(profStr).padEnd(16) +
|
|
169
|
+
chalk.bold.cyan('📊 TREND: ') + getSparkline() + '\n';
|
|
170
|
+
out += ' ' + bar + '\n\n';
|
|
171
|
+
|
|
172
|
+
// 3. WORKER DATAGRID (Clean rows, no chunky boxes)
|
|
173
|
+
const headRow = ` ${chalk.bold.gray(pad('ID', wCols.num))} ${chalk.bold.gray(pad('ACCOUNT', wCols.name))} ${chalk.bold.gray(pad('BALANCE', wCols.bal))} ${chalk.bold.gray(pad('LIFE', wCols.ls))} ${chalk.bold.gray(pad('LVL', wCols.lv))} ${chalk.bold.gray('ACTIVITY')}`;
|
|
167
174
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const profStr = totC;
|
|
171
|
-
const graph = getSparkline();
|
|
172
|
-
|
|
173
|
-
out += chalk.cyan('│') + ' ' + chalk.bold.green('BALANCE: ') + chalk.bold.greenBright(balStr) + ' '.repeat(balPadding) +
|
|
174
|
-
chalk.bold.yellow('PROFIT: ') + chalk.bold.yellowBright(profStr).padEnd(12) +
|
|
175
|
-
chalk.dim('TREND: [') + graph + chalk.dim(']') + ' '.repeat(Math.max(0, actualC - 70)) + chalk.cyan('│\n');
|
|
176
|
-
out += chalk.cyan('╰' + '─'.repeat(actualC - 2) + '╯\n');
|
|
177
|
-
|
|
178
|
-
// Accounts Table
|
|
179
|
-
out += '╭' + '─'.repeat(wCols.num + 2) + '┬'
|
|
180
|
-
+ '─'.repeat(wCols.name + 2) + '┬'
|
|
181
|
-
+ '─'.repeat(wCols.bal + 2) + '┬'
|
|
182
|
-
+ '─'.repeat(wCols.ls + 2) + '┬'
|
|
183
|
-
+ '─'.repeat(wCols.lv + 2) + '┬'
|
|
184
|
-
+ '─'.repeat(logW + 2) + '╮\n';
|
|
185
|
-
|
|
186
|
-
out += makeRow(
|
|
187
|
-
chalk.bold('#'), chalk.bold('ACCOUNT'), chalk.bold('BAL'),
|
|
188
|
-
chalk.bold('LS'), chalk.bold('LV'), chalk.bold('LOGS'),
|
|
189
|
-
wCols, logW
|
|
190
|
-
) + '\n';
|
|
191
|
-
|
|
192
|
-
out += '├' + '─'.repeat(wCols.num + 2) + '┼'
|
|
193
|
-
+ '─'.repeat(wCols.name + 2) + '┼'
|
|
194
|
-
+ '─'.repeat(wCols.bal + 2) + '┼'
|
|
195
|
-
+ '─'.repeat(wCols.ls + 2) + '┼'
|
|
196
|
-
+ '─'.repeat(wCols.lv + 2) + '┼'
|
|
197
|
-
+ '─'.repeat(logW + 2) + '┤\n';
|
|
175
|
+
out += headRow + '\n';
|
|
176
|
+
out += ' ' + chalk.dim('─'.repeat(Math.min(C - 4, 100))) + '\n';
|
|
198
177
|
|
|
199
178
|
for (let i = 0; i < sorted.length; i++) {
|
|
200
179
|
const w = sorted[i];
|
|
@@ -213,59 +192,48 @@ function render() {
|
|
|
213
192
|
activity = chalk.gray(getLoader());
|
|
214
193
|
}
|
|
215
194
|
|
|
216
|
-
const numStr =
|
|
195
|
+
const numStr = chalk.dim('#' + (i + 1));
|
|
217
196
|
const dot = getDot(w);
|
|
218
197
|
|
|
219
|
-
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name -
|
|
198
|
+
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 3);
|
|
220
199
|
const nameStr = dot.color(dot.dot) + ' ' + getAccountColor(nameRaw)(chalk.bold(nameRaw));
|
|
221
200
|
|
|
222
201
|
const bVal = w.stats.balance !== undefined ? formatBal(w.stats.balance) : '—';
|
|
223
|
-
const balRaw = trunc(bVal === '—' ? '—' : '⏣' + bVal, wCols.bal);
|
|
202
|
+
const balRaw = trunc(bVal === '—' ? '—' : '⏣ ' + bVal, wCols.bal - 1);
|
|
224
203
|
const balStr = balRaw === '—' ? chalk.dim('—') : chalk.bold.green(balRaw);
|
|
225
204
|
|
|
226
|
-
//
|
|
227
|
-
let
|
|
228
|
-
let lsStr = chalk.dim('—');
|
|
205
|
+
// Clean Bracket numbers for stats instead of emojis
|
|
206
|
+
let lsStr = chalk.dim('[ - ]');
|
|
229
207
|
if (w._lifesavers !== undefined) {
|
|
230
208
|
let lsCount = w._lifesavers;
|
|
231
|
-
let lsEmoji = '█'; // Solid code block character!
|
|
232
209
|
let lsColor = chalk.bold.red;
|
|
210
|
+
if (lsCount >= 5) lsColor = chalk.bold.green;
|
|
211
|
+
else if (lsCount >= 3) lsColor = chalk.bold.yellow;
|
|
233
212
|
|
|
234
|
-
|
|
235
|
-
else if (lsCount >= 3) { lsColor = chalk.bold.yellow; }
|
|
236
|
-
|
|
237
|
-
lsRaw = trunc(`${lsEmoji} ${lsCount}`, wCols.ls);
|
|
238
|
-
lsStr = lsColor(lsRaw);
|
|
213
|
+
lsStr = lsColor(`[ ${lsCount} ]`);
|
|
239
214
|
}
|
|
240
215
|
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
const logRaw = trunc(logText, logW - 2);
|
|
245
|
-
const logStr = activity + ' ' + chalk.dim.bold(logRaw);
|
|
216
|
+
const lvStr = w._level !== undefined ? chalk.bold.magenta(`[ ${w._level} ]`) : chalk.dim('[ - ]');
|
|
217
|
+
const logStr = activity + ' ' + chalk.dim(trunc(logText, logW - 2));
|
|
246
218
|
|
|
247
|
-
out +=
|
|
219
|
+
out += ` ${pad(numStr, wCols.num)} ${pad(nameStr, wCols.name)} ${pad(balStr, wCols.bal)} ${pad(lsStr, wCols.ls)} ${pad(lvStr, wCols.lv)} ${logStr}\n`;
|
|
248
220
|
}
|
|
249
221
|
|
|
250
222
|
if (sorted.length === 0) {
|
|
251
|
-
out +=
|
|
223
|
+
out += ` ${chalk.dim('No Accounts Running...\n')}`;
|
|
252
224
|
}
|
|
253
225
|
|
|
254
|
-
out += '
|
|
255
|
-
+ '─'.repeat(wCols.name + 2) + '┴'
|
|
256
|
-
+ '─'.repeat(wCols.bal + 2) + '┴'
|
|
257
|
-
+ '─'.repeat(wCols.ls + 2) + '┴'
|
|
258
|
-
+ '─'.repeat(wCols.lv + 2) + '┴'
|
|
259
|
-
+ '─'.repeat(logW + 2) + '╯\n\n';
|
|
226
|
+
out += '\n';
|
|
260
227
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
_events.
|
|
228
|
+
// 4. LATEST EVENTS (Compact layout)
|
|
229
|
+
out += chalk.bold.cyan(' LATEST EVENTS') + '\n';
|
|
230
|
+
if (_events.length === 0) out += chalk.dim(' Quiet here...\n');
|
|
231
|
+
_events.forEach(ev => {
|
|
232
|
+
out += ` ${chalk.dim(`[${ev.ts}]`)} ${ev.icon} ${ev.msg}\n`;
|
|
233
|
+
});
|
|
264
234
|
|
|
265
|
-
// Fixing the blank space spam by ensuring exactly no trailing newlines and NO raw buffer resets
|
|
266
235
|
logUpdate(out.trimEnd());
|
|
267
236
|
}
|
|
268
|
-
|
|
269
237
|
function start() {}
|
|
270
238
|
function draw() { render(); }
|
|
271
239
|
function setLive(val) { _live = val; if (val) render(); }
|