dankgrinder 8.86.0 → 8.87.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 +24 -22
- package/package.json +1 -1
package/lib/ui.js
CHANGED
|
@@ -132,24 +132,20 @@ function render() {
|
|
|
132
132
|
if (!_live) return;
|
|
133
133
|
const C = process.stdout.columns || 110;
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
let out = '\x1b[2J\x1b[H';
|
|
135
|
+
let out = '';
|
|
137
136
|
|
|
138
137
|
// Banner
|
|
139
138
|
const titleStr = figlet.textSync('DANK GRINDER', { font: 'ANSI Shadow' });
|
|
140
139
|
out += chalk.bold(applyGradient(titleStr));
|
|
141
|
-
out += chalk.bold.magenta(` v${_version} — ${getLoader()} Running... \n`);
|
|
140
|
+
out += chalk.bold.magenta(` v${_version} — ${getLoader()} Running... \n\n`);
|
|
142
141
|
|
|
143
|
-
const wCols = { num: 4, name: 18, bal: 14, ls:
|
|
142
|
+
const wCols = { num: 4, name: 18, bal: 14, ls: 6, lv: 5 };
|
|
144
143
|
const overhead = 19 + wCols.num + wCols.name + wCols.bal + wCols.ls + wCols.lv;
|
|
145
144
|
const logW = Math.max(10, C - overhead);
|
|
146
145
|
const actualC = logW + overhead;
|
|
147
146
|
|
|
148
147
|
const sorted = [..._workers].sort((a, b) => {
|
|
149
148
|
if (!a.channel !== !b.channel) return a.channel ? -1 : 1;
|
|
150
|
-
const aA = a.channel && !a.paused && !a.dashboardPaused;
|
|
151
|
-
const bB = b.channel && !b.paused && !b.dashboardPaused;
|
|
152
|
-
if (aA !== bB) return aA ? -1 : 1;
|
|
153
149
|
return (b.stats.commands || 0) - (a.stats.commands || 0);
|
|
154
150
|
});
|
|
155
151
|
|
|
@@ -161,15 +157,23 @@ function render() {
|
|
|
161
157
|
if (w.channel && !w.paused && !w.dashboardPaused) onlineCount++;
|
|
162
158
|
}
|
|
163
159
|
|
|
164
|
-
//
|
|
160
|
+
// BIG STATS DASHBOARD
|
|
165
161
|
const totC = totalCoins > 0 ? '+' + formatBal(totalCoins) : '+0';
|
|
166
|
-
const summStr = chalk.bold(' 🌟 ACT: ') + chalk.bold.magenta(_workers.length) + chalk.dim(' │ ') +
|
|
167
|
-
chalk.bold('⚡ ON: ') + chalk.bold.cyan(onlineCount) + chalk.dim(' │ ') +
|
|
168
|
-
chalk.bold('💰 BAL: ') + chalk.bold.green('⏣' + formatBal(totalBal)) + chalk.dim(' │ ') +
|
|
169
|
-
chalk.bold('📈 GAINED: ') + chalk.bold.yellow(totC) + chalk.dim(' │ ') +
|
|
170
|
-
chalk.bold('⏱ UP: ') + chalk.bold.dim(fmtUptime());
|
|
171
162
|
|
|
172
|
-
out += '
|
|
163
|
+
out += chalk.cyan('╭' + '─'.repeat(actualC - 2) + '╮\n');
|
|
164
|
+
out += chalk.cyan('│') + ' ' + chalk.bold('ACCOUNTS: ') + String(_workers.length).padEnd(5) +
|
|
165
|
+
chalk.bold('ONLINE: ') + String(onlineCount).padEnd(5) +
|
|
166
|
+
chalk.bold('UPTIME: ') + fmtUptime().padEnd(10) + ' '.repeat(Math.max(0, actualC - 48)) + chalk.cyan('│\n');
|
|
167
|
+
|
|
168
|
+
const balStr = '⏣ ' + formatBal(totalBal);
|
|
169
|
+
const balPadding = Math.max(0, 16 - balStr.length);
|
|
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');
|
|
173
177
|
|
|
174
178
|
// Accounts Table
|
|
175
179
|
out += '╭' + '─'.repeat(wCols.num + 2) + '┬'
|
|
@@ -212,25 +216,23 @@ function render() {
|
|
|
212
216
|
const numStr = trunc(String(i + 1), wCols.num);
|
|
213
217
|
const dot = getDot(w);
|
|
214
218
|
|
|
215
|
-
// Support previous UI events format dynamically extracting name
|
|
216
219
|
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 2);
|
|
217
220
|
const nameStr = dot.color(dot.dot) + ' ' + getAccountColor(nameRaw)(chalk.bold(nameRaw));
|
|
218
221
|
|
|
219
|
-
// Balance Formatter
|
|
220
222
|
const bVal = w.stats.balance !== undefined ? formatBal(w.stats.balance) : '—';
|
|
221
223
|
const balRaw = trunc(bVal === '—' ? '—' : '⏣' + bVal, wCols.bal);
|
|
222
224
|
const balStr = balRaw === '—' ? chalk.dim('—') : chalk.bold.green(balRaw);
|
|
223
225
|
|
|
224
|
-
//
|
|
226
|
+
// Exact unicode block character, NOT an emoji
|
|
225
227
|
let lsRaw = '—';
|
|
226
228
|
let lsStr = chalk.dim('—');
|
|
227
229
|
if (w._lifesavers !== undefined) {
|
|
228
230
|
let lsCount = w._lifesavers;
|
|
229
|
-
let lsEmoji = '
|
|
231
|
+
let lsEmoji = '█'; // Solid code block character!
|
|
230
232
|
let lsColor = chalk.bold.red;
|
|
231
233
|
|
|
232
|
-
if (lsCount >= 5) {
|
|
233
|
-
else if (lsCount >= 3) {
|
|
234
|
+
if (lsCount >= 5) { lsColor = chalk.bold.green; }
|
|
235
|
+
else if (lsCount >= 3) { lsColor = chalk.bold.yellow; }
|
|
234
236
|
|
|
235
237
|
lsRaw = trunc(`${lsEmoji} ${lsCount}`, wCols.ls);
|
|
236
238
|
lsStr = lsColor(lsRaw);
|
|
@@ -256,12 +258,12 @@ function render() {
|
|
|
256
258
|
+ '─'.repeat(wCols.lv + 2) + '┴'
|
|
257
259
|
+ '─'.repeat(logW + 2) + '╯\n\n';
|
|
258
260
|
|
|
259
|
-
// Latest events beneath the table cleanly
|
|
260
261
|
out += chalk.bold.cyan(' 📻 LATEST EVENTS') + '\n';
|
|
261
262
|
if (_events.length === 0) out += chalk.dim(' Quiet here...\n');
|
|
262
263
|
_events.forEach(ev => { out += ` ${chalk.dim(`[${ev.ts}]`)} ${ev.icon} ${ev.msg}\n`; });
|
|
263
264
|
|
|
264
|
-
|
|
265
|
+
// Fixing the blank space spam by ensuring exactly no trailing newlines and NO raw buffer resets
|
|
266
|
+
logUpdate(out.trimEnd());
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
function start() {}
|