hedgequantx 1.2.98 → 1.2.99

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/package.json +1 -1
  2. package/src/app.js +27 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "1.2.98",
3
+ "version": "1.2.99",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/app.js CHANGED
@@ -579,48 +579,57 @@ const mainMenu = async () => {
579
579
  */
580
580
  const dashboardMenu = async (service) => {
581
581
  const user = service.user;
582
- const boxWidth = getLogoWidth();
583
- const innerWidth = boxWidth - 2;
582
+ const W = 60; // Fixed width for dashboard box
583
+
584
+ // Helper to center text
585
+ const centerLine = (text, width) => {
586
+ const pad = Math.floor((width - text.length) / 2);
587
+ return ' '.repeat(Math.max(0, pad)) + text + ' '.repeat(Math.max(0, width - pad - text.length));
588
+ };
589
+
590
+ // Helper to pad text left
591
+ const padLine = (text, width) => {
592
+ return ' ' + text + ' '.repeat(Math.max(0, width - text.length - 1));
593
+ };
584
594
 
585
595
  // Dashboard box header
586
596
  console.log();
587
- console.log(chalk.cyan('╔' + '═'.repeat(innerWidth) + '╗'));
588
- console.log(chalk.cyan('║') + chalk.white.bold(centerText('DASHBOARD', innerWidth)) + chalk.cyan('║'));
589
- console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
597
+ console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
598
+ console.log(chalk.cyan('║') + chalk.white.bold(centerLine('DASHBOARD', W)) + chalk.cyan('║'));
599
+ console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
590
600
 
591
601
  // Connection info - show all active connections
592
602
  const allConns = connections.getAll();
593
603
  if (allConns.length > 0) {
594
604
  const connNames = allConns.map(c => c.propfirm || c.type).join(', ');
595
605
  const connText = `Connected to ${connNames}`;
596
- const connInfo = chalk.green(connText);
597
- console.log(chalk.cyan('║') + ' ' + connInfo + ' '.repeat(Math.max(0, innerWidth - connText.length - 2)) + chalk.cyan('║'));
606
+ console.log(chalk.cyan('║') + chalk.green(padLine(connText, W)) + chalk.cyan('║'));
598
607
  }
599
608
 
600
609
  if (user) {
601
- const userInfo = 'Welcome, ' + user.userName.toUpperCase() + '!';
602
- console.log(chalk.cyan('║') + ' ' + chalk.white(userInfo) + ' '.repeat(innerWidth - userInfo.length - 2) + chalk.cyan('║'));
610
+ const userText = 'Welcome, ' + user.userName.toUpperCase() + '!';
611
+ console.log(chalk.cyan('║') + chalk.white(padLine(userText, W)) + chalk.cyan('║'));
603
612
  }
604
613
 
605
- console.log(chalk.cyan('╠' + '═'.repeat(innerWidth) + '╣'));
614
+ console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
606
615
 
607
616
  // Menu options in 2 columns
608
- const col1Width = Math.floor(innerWidth / 2);
609
- const col2Width = innerWidth - col1Width;
617
+ const col1Width = Math.floor(W / 2);
618
+ const col2Width = W - col1Width;
610
619
 
611
620
  const menuRow = (left, right) => {
612
- const leftText = ' ' + left;
613
- const rightText = right ? ' ' + right : '';
614
- const leftPad = col1Width - leftText.replace(/\x1b\[[0-9;]*m/g, '').length;
615
- const rightPad = col2Width - rightText.replace(/\x1b\[[0-9;]*m/g, '').length;
616
- console.log(chalk.cyan('║') + leftText + ' '.repeat(Math.max(0, leftPad)) + rightText + ' '.repeat(Math.max(0, rightPad)) + chalk.cyan('║'));
621
+ const leftPlain = left.replace(/\x1b\[[0-9;]*m/g, '');
622
+ const rightPlain = right ? right.replace(/\x1b\[[0-9;]*m/g, '') : '';
623
+ const leftPad = ' '.repeat(Math.max(0, col1Width - leftPlain.length - 2));
624
+ const rightPad = ' '.repeat(Math.max(0, col2Width - rightPlain.length - 2));
625
+ console.log(chalk.cyan('║') + ' ' + left + leftPad + ' ' + (right || '') + rightPad + chalk.cyan('║'));
617
626
  };
618
627
 
619
628
  menuRow(chalk.cyan('[1] View Accounts'), chalk.cyan('[2] View Stats'));
620
629
  menuRow(chalk.cyan('[+] Add Prop-Account'), chalk.cyan('[A] Algo-Trading'));
621
630
  menuRow(chalk.yellow('[U] Update HQX'), chalk.red('[X] Disconnect'));
622
631
 
623
- console.log(chalk.cyan('╚' + '═'.repeat(innerWidth) + '╝'));
632
+ console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
624
633
  console.log();
625
634
 
626
635
  const { action } = await inquirer.prompt([