dankgrinder 8.86.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 +41 -71
- 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
|
+
// 1. BRANDING
|
|
139
138
|
const titleStr = figlet.textSync('DANK GRINDER', { font: 'ANSI Shadow' });
|
|
140
139
|
out += chalk.bold(applyGradient(titleStr));
|
|
141
|
-
out += chalk.
|
|
140
|
+
out += chalk.dim(' v' + _version + ' | ') + chalk.cyan.bold(getLoader() + ' RUNNING') + '\n\n';
|
|
142
141
|
|
|
143
|
-
const wCols = { num: 4, name:
|
|
144
|
-
const overhead =
|
|
145
|
-
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);
|
|
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,36 +157,23 @@ function render() {
|
|
|
161
157
|
if (w.channel && !w.paused && !w.dashboardPaused) onlineCount++;
|
|
162
158
|
}
|
|
163
159
|
|
|
164
|
-
//
|
|
165
|
-
const
|
|
166
|
-
const
|
|
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());
|
|
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';
|
|
171
163
|
|
|
172
|
-
out += '
|
|
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')}`;
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
out += '
|
|
176
|
-
+ '─'.repeat(wCols.name + 2) + '┬'
|
|
177
|
-
+ '─'.repeat(wCols.bal + 2) + '┬'
|
|
178
|
-
+ '─'.repeat(wCols.ls + 2) + '┬'
|
|
179
|
-
+ '─'.repeat(wCols.lv + 2) + '┬'
|
|
180
|
-
+ '─'.repeat(logW + 2) + '╮\n';
|
|
181
|
-
|
|
182
|
-
out += makeRow(
|
|
183
|
-
chalk.bold('#'), chalk.bold('ACCOUNT'), chalk.bold('BAL'),
|
|
184
|
-
chalk.bold('LS'), chalk.bold('LV'), chalk.bold('LOGS'),
|
|
185
|
-
wCols, logW
|
|
186
|
-
) + '\n';
|
|
187
|
-
|
|
188
|
-
out += '├' + '─'.repeat(wCols.num + 2) + '┼'
|
|
189
|
-
+ '─'.repeat(wCols.name + 2) + '┼'
|
|
190
|
-
+ '─'.repeat(wCols.bal + 2) + '┼'
|
|
191
|
-
+ '─'.repeat(wCols.ls + 2) + '┼'
|
|
192
|
-
+ '─'.repeat(wCols.lv + 2) + '┼'
|
|
193
|
-
+ '─'.repeat(logW + 2) + '┤\n';
|
|
175
|
+
out += headRow + '\n';
|
|
176
|
+
out += ' ' + chalk.dim('─'.repeat(Math.min(C - 4, 100))) + '\n';
|
|
194
177
|
|
|
195
178
|
for (let i = 0; i < sorted.length; i++) {
|
|
196
179
|
const w = sorted[i];
|
|
@@ -209,61 +192,48 @@ function render() {
|
|
|
209
192
|
activity = chalk.gray(getLoader());
|
|
210
193
|
}
|
|
211
194
|
|
|
212
|
-
const numStr =
|
|
195
|
+
const numStr = chalk.dim('#' + (i + 1));
|
|
213
196
|
const dot = getDot(w);
|
|
214
197
|
|
|
215
|
-
|
|
216
|
-
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 2);
|
|
198
|
+
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 3);
|
|
217
199
|
const nameStr = dot.color(dot.dot) + ' ' + getAccountColor(nameRaw)(chalk.bold(nameRaw));
|
|
218
200
|
|
|
219
|
-
// Balance Formatter
|
|
220
201
|
const bVal = w.stats.balance !== undefined ? formatBal(w.stats.balance) : '—';
|
|
221
|
-
const balRaw = trunc(bVal === '—' ? '—' : '⏣' + bVal, wCols.bal);
|
|
202
|
+
const balRaw = trunc(bVal === '—' ? '—' : '⏣ ' + bVal, wCols.bal - 1);
|
|
222
203
|
const balStr = balRaw === '—' ? chalk.dim('—') : chalk.bold.green(balRaw);
|
|
223
204
|
|
|
224
|
-
//
|
|
225
|
-
let
|
|
226
|
-
let lsStr = chalk.dim('—');
|
|
205
|
+
// Clean Bracket numbers for stats instead of emojis
|
|
206
|
+
let lsStr = chalk.dim('[ - ]');
|
|
227
207
|
if (w._lifesavers !== undefined) {
|
|
228
208
|
let lsCount = w._lifesavers;
|
|
229
|
-
let lsEmoji = '❤️'; // Red for 0-2
|
|
230
209
|
let lsColor = chalk.bold.red;
|
|
210
|
+
if (lsCount >= 5) lsColor = chalk.bold.green;
|
|
211
|
+
else if (lsCount >= 3) lsColor = chalk.bold.yellow;
|
|
231
212
|
|
|
232
|
-
|
|
233
|
-
else if (lsCount >= 3) { lsEmoji = '💛'; lsColor = chalk.bold.yellow; }
|
|
234
|
-
|
|
235
|
-
lsRaw = trunc(`${lsEmoji} ${lsCount}`, wCols.ls);
|
|
236
|
-
lsStr = lsColor(lsRaw);
|
|
213
|
+
lsStr = lsColor(`[ ${lsCount} ]`);
|
|
237
214
|
}
|
|
238
215
|
|
|
239
|
-
const
|
|
240
|
-
const
|
|
216
|
+
const lvStr = w._level !== undefined ? chalk.bold.magenta(`[ ${w._level} ]`) : chalk.dim('[ - ]');
|
|
217
|
+
const logStr = activity + ' ' + chalk.dim(trunc(logText, logW - 2));
|
|
241
218
|
|
|
242
|
-
|
|
243
|
-
const logStr = activity + ' ' + chalk.dim.bold(logRaw);
|
|
244
|
-
|
|
245
|
-
out += makeRow(numStr, nameStr, balStr, lsStr, lvStr, logStr, wCols, logW) + '\n';
|
|
219
|
+
out += ` ${pad(numStr, wCols.num)} ${pad(nameStr, wCols.name)} ${pad(balStr, wCols.bal)} ${pad(lsStr, wCols.ls)} ${pad(lvStr, wCols.lv)} ${logStr}\n`;
|
|
246
220
|
}
|
|
247
221
|
|
|
248
222
|
if (sorted.length === 0) {
|
|
249
|
-
out +=
|
|
223
|
+
out += ` ${chalk.dim('No Accounts Running...\n')}`;
|
|
250
224
|
}
|
|
251
225
|
|
|
252
|
-
out += '
|
|
253
|
-
+ '─'.repeat(wCols.name + 2) + '┴'
|
|
254
|
-
+ '─'.repeat(wCols.bal + 2) + '┴'
|
|
255
|
-
+ '─'.repeat(wCols.ls + 2) + '┴'
|
|
256
|
-
+ '─'.repeat(wCols.lv + 2) + '┴'
|
|
257
|
-
+ '─'.repeat(logW + 2) + '╯\n\n';
|
|
226
|
+
out += '\n';
|
|
258
227
|
|
|
259
|
-
//
|
|
260
|
-
out += chalk.bold.cyan('
|
|
261
|
-
if (_events.length === 0) out += chalk.dim('
|
|
262
|
-
_events.forEach(ev => {
|
|
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
|
+
});
|
|
263
234
|
|
|
264
|
-
|
|
235
|
+
logUpdate(out.trimEnd());
|
|
265
236
|
}
|
|
266
|
-
|
|
267
237
|
function start() {}
|
|
268
238
|
function draw() { render(); }
|
|
269
239
|
function setLive(val) { _live = val; if (val) render(); }
|