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.
Files changed (2) hide show
  1. package/lib/ui.js +41 -71
  2. 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
- // Clear screen to prevent duplication on resize
136
- let out = '\x1b[2J\x1b[H';
135
+ let out = '';
137
136
 
138
- // Banner
137
+ // 1. BRANDING
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.dim(' v' + _version + ' | ') + chalk.cyan.bold(getLoader() + ' RUNNING') + '\n\n';
142
141
 
143
- const wCols = { num: 4, name: 18, bal: 14, ls: 5, lv: 5 };
144
- const overhead = 19 + wCols.num + wCols.name + wCols.bal + wCols.ls + wCols.lv;
145
- const logW = Math.max(10, C - overhead);
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
- // High-Visibility Summary directly below the Title
165
- 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());
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 += '\n' + summStr + '\n\n';
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
- // Accounts Table
175
- out += '' + '─'.repeat(wCols.num + 2) + ''
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 = trunc(String(i + 1), wCols.num);
195
+ const numStr = chalk.dim('#' + (i + 1));
213
196
  const dot = getDot(w);
214
197
 
215
- // Support previous UI events format dynamically extracting name
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
- // Heart Lifesavers
225
- let lsRaw = '';
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
- if (lsCount >= 5) { lsEmoji = '💚'; lsColor = chalk.bold.green; }
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 lvRaw = trunc(w._level !== undefined ? String(w._level) : '', wCols.lv);
240
- const lvStr = chalk.bold.magenta(lvRaw);
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
- const logRaw = trunc(logText, logW - 2);
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 += makeRow('—', 'No Accounts', '—', '—', '—', 'Waiting...', wCols, logW) + '\n';
223
+ out += ` ${chalk.dim('No Accounts Running...\n')}`;
250
224
  }
251
225
 
252
- out += '' + '─'.repeat(wCols.num + 2) + '┴'
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
- // Latest events beneath the table cleanly
260
- out += chalk.bold.cyan(' 📻 LATEST EVENTS') + '\n';
261
- if (_events.length === 0) out += chalk.dim(' Quiet here...\n');
262
- _events.forEach(ev => { out += ` ${chalk.dim(`[${ev.ts}]`)} ${ev.icon} ${ev.msg}\n`; });
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
- require("log-update")(out);
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(); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dankgrinder",
3
- "version": "8.86.0",
3
+ "version": "8.88.0",
4
4
  "description": "Dank Memer automation engine — grind coins while you sleep",
5
5
  "bin": {
6
6
  "dankgrinder": "bin/dankgrinder.js"