dankgrinder 8.88.0 → 8.89.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 +49 -50
- package/package.json +1 -1
package/lib/ui.js
CHANGED
|
@@ -134,16 +134,6 @@ function render() {
|
|
|
134
134
|
|
|
135
135
|
let out = '';
|
|
136
136
|
|
|
137
|
-
// 1. BRANDING
|
|
138
|
-
const titleStr = figlet.textSync('DANK GRINDER', { font: 'ANSI Shadow' });
|
|
139
|
-
out += chalk.bold(applyGradient(titleStr));
|
|
140
|
-
out += chalk.dim(' v' + _version + ' | ') + chalk.cyan.bold(getLoader() + ' RUNNING') + '\n\n';
|
|
141
|
-
|
|
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
|
-
const actualC = logW + overhead;
|
|
146
|
-
|
|
147
137
|
const sorted = [..._workers].sort((a, b) => {
|
|
148
138
|
if (!a.channel !== !b.channel) return a.channel ? -1 : 1;
|
|
149
139
|
return (b.stats.commands || 0) - (a.stats.commands || 0);
|
|
@@ -157,23 +147,30 @@ function render() {
|
|
|
157
147
|
if (w.channel && !w.paused && !w.dashboardPaused) onlineCount++;
|
|
158
148
|
}
|
|
159
149
|
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
// 1. MODERN BRANDING (Vercel / Claude CLI Style)
|
|
151
|
+
// No big flashy ASCII, just a clean sleek badge
|
|
152
|
+
out += '\n ' + chalk.bgBlack.white.bold(' DANK GRINDER ') + chalk.gray(' v' + _version) +
|
|
153
|
+
chalk.dim(' │ ') + chalk.cyan('● ' + getLoader() + ' Running') + '\n\n';
|
|
154
|
+
|
|
155
|
+
// 2. MINIMALIST STATS
|
|
156
|
+
const profStr = totalCoins > 0 ? '+' + formatBal(totalCoins) : '0';
|
|
157
|
+
|
|
158
|
+
out += ' ' + chalk.cyan('◆') + chalk.bold(' ONLINE ') + chalk.white(onlineCount + ' / ' + _workers.length) + '\n';
|
|
159
|
+
out += ' ' + chalk.blue('◆') + chalk.bold(' UPTIME ') + chalk.white(fmtUptime()) + '\n';
|
|
160
|
+
out += ' ' + chalk.green('◆') + chalk.bold(' BALANCE ') + chalk.white('⏣ ' + formatBal(totalBal)) + chalk.gray(' (profit: ' + profStr + ')') + '\n';
|
|
161
|
+
|
|
162
|
+
// Divider
|
|
163
|
+
const divWidth = Math.min(C - 4, 100);
|
|
164
|
+
out += '\n ' + chalk.dim('─'.repeat(divWidth)) + '\n\n';
|
|
165
|
+
|
|
166
|
+
// 3. TABLE DATA (Clean spacing, dimmed headers)
|
|
167
|
+
const wCols = { num: 4, name: 20, bal: 12, ls: 6, lv: 5 };
|
|
168
|
+
const overhead = 2 + wCols.num + 1 + wCols.name + 1 + wCols.bal + 1 + wCols.ls + 1 + wCols.lv + 1;
|
|
169
|
+
const logW = Math.max(15, C - overhead - 4);
|
|
163
170
|
|
|
164
|
-
|
|
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')}`;
|
|
171
|
+
const headRow = ` ${chalk.dim(pad('ID', wCols.num))} ${chalk.dim(pad('ACCOUNT', wCols.name))} ${chalk.dim(pad('BAL', wCols.bal))} ${chalk.dim(pad('LIFE', wCols.ls))} ${chalk.dim(pad('LVL', wCols.lv))} ${chalk.dim('PROCESS')}`;
|
|
174
172
|
|
|
175
|
-
out += headRow + '\n';
|
|
176
|
-
out += ' ' + chalk.dim('─'.repeat(Math.min(C - 4, 100))) + '\n';
|
|
173
|
+
out += headRow + '\n\n';
|
|
177
174
|
|
|
178
175
|
for (let i = 0; i < sorted.length; i++) {
|
|
179
176
|
const w = sorted[i];
|
|
@@ -183,60 +180,62 @@ function render() {
|
|
|
183
180
|
if (w.globalCooldownUntil && Date.now() < w.globalCooldownUntil) {
|
|
184
181
|
const s = Math.ceil((w.globalCooldownUntil - Date.now()) / 1000);
|
|
185
182
|
logText = s > 60 ? `cd ${Math.ceil(s/60)}m` : `cd ${s}s`;
|
|
186
|
-
activity = chalk.yellow(
|
|
183
|
+
activity = chalk.yellow('⏸');
|
|
187
184
|
} else if (w.paused || w.dashboardPaused) {
|
|
188
185
|
logText = 'paused';
|
|
186
|
+
activity = chalk.dim('⏸');
|
|
189
187
|
} else if (w.channel) {
|
|
190
|
-
activity = chalk.cyan(
|
|
188
|
+
activity = chalk.cyan('▶');
|
|
191
189
|
} else {
|
|
192
|
-
activity = chalk.gray(
|
|
190
|
+
activity = chalk.gray('◎');
|
|
193
191
|
}
|
|
194
192
|
|
|
195
|
-
const numStr = chalk.dim(
|
|
193
|
+
const numStr = chalk.dim(String(i + 1).padStart(2, '0'));
|
|
196
194
|
const dot = getDot(w);
|
|
197
195
|
|
|
198
196
|
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 3);
|
|
199
|
-
const nameStr = dot.color(dot.dot) + ' ' +
|
|
197
|
+
const nameStr = dot.color(dot.dot) + ' ' + chalk.whiteBright(nameRaw);
|
|
200
198
|
|
|
201
199
|
const bVal = w.stats.balance !== undefined ? formatBal(w.stats.balance) : '—';
|
|
202
|
-
const balRaw = trunc(bVal === '—' ? '—' :
|
|
203
|
-
const balStr = balRaw === '—' ? chalk.dim('—') : chalk.
|
|
200
|
+
const balRaw = trunc(bVal === '—' ? '—' : bVal, wCols.bal - 1);
|
|
201
|
+
const balStr = balRaw === '—' ? chalk.dim('—') : chalk.greenBright(balRaw);
|
|
204
202
|
|
|
205
|
-
|
|
206
|
-
let lsStr = chalk.dim('[ - ]');
|
|
203
|
+
let lsStr = chalk.dim('-');
|
|
207
204
|
if (w._lifesavers !== undefined) {
|
|
208
205
|
let lsCount = w._lifesavers;
|
|
209
|
-
let lsColor = chalk.
|
|
210
|
-
if (lsCount >= 5) lsColor = chalk.
|
|
211
|
-
else if (lsCount >= 3) lsColor = chalk.
|
|
212
|
-
|
|
213
|
-
lsStr = lsColor(`[ ${lsCount} ]`);
|
|
206
|
+
let lsColor = chalk.red;
|
|
207
|
+
if (lsCount >= 5) lsColor = chalk.green;
|
|
208
|
+
else if (lsCount >= 3) lsColor = chalk.yellow;
|
|
209
|
+
lsStr = lsColor(lsCount);
|
|
214
210
|
}
|
|
215
211
|
|
|
216
|
-
const lvStr = w._level !== undefined ? chalk.
|
|
212
|
+
const lvStr = w._level !== undefined ? chalk.magenta(w._level) : chalk.dim('-');
|
|
217
213
|
const logStr = activity + ' ' + chalk.dim(trunc(logText, logW - 2));
|
|
218
214
|
|
|
219
215
|
out += ` ${pad(numStr, wCols.num)} ${pad(nameStr, wCols.name)} ${pad(balStr, wCols.bal)} ${pad(lsStr, wCols.ls)} ${pad(lvStr, wCols.lv)} ${logStr}\n`;
|
|
220
216
|
}
|
|
221
217
|
|
|
222
218
|
if (sorted.length === 0) {
|
|
223
|
-
out += ` ${chalk.dim('No
|
|
219
|
+
out += ` ${chalk.dim('No accounts configured...')}\n`;
|
|
224
220
|
}
|
|
225
|
-
|
|
226
|
-
out += '\n';
|
|
227
221
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
222
|
+
out += '\n ' + chalk.dim('─'.repeat(divWidth)) + '\n\n';
|
|
223
|
+
|
|
224
|
+
// 4. ACTIVITY STREAM
|
|
225
|
+
out += chalk.gray(' ACTIVITY') + '\n';
|
|
226
|
+
if (_events.length === 0) {
|
|
227
|
+
out += chalk.dim(' No recent events.\n');
|
|
228
|
+
} else {
|
|
229
|
+
_events.forEach(ev => {
|
|
230
|
+
out += ` ${chalk.dim(ev.ts)} ${ev.icon} ${chalk.white(ev.msg)}\n`;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
234
233
|
|
|
235
234
|
logUpdate(out.trimEnd());
|
|
236
235
|
}
|
|
237
236
|
function start() {}
|
|
238
237
|
function draw() { render(); }
|
|
239
|
-
function setLive(val) { _live = val; if (val) render(); }
|
|
238
|
+
function setLive(val) { _live = val; if (val) { process.stdout.write('\x1b[2J\x1b[3J\x1b[H'); render(); } }
|
|
240
239
|
function setPhase(phase) {}
|
|
241
240
|
function startRefresh() { setInterval(() => { if(_live){ const tot = _workers.reduce((a,w)=>a+(w.stats.coins||0),0); _coinHistory.shift(); _coinHistory.push(tot); } }, 5000);
|
|
242
241
|
if (!_refreshTimer) _refreshTimer = setInterval(() => { if (_live) render(); }, 80); }
|