Skip to content

Commit cf29faf

Browse files
author
scinorandex
committed
Add minor changes to dashboard
1 parent 0f05b5d commit cf29faf

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/utils/routes/dashboard/blessedConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const blessedConfig: {
4141
[key in DashboardSize]: BlessedSizeConfiguration;
4242
} = {
4343
sm: {
44-
mockStdout: [180, 40],
45-
screenshot: [90, 36],
44+
mockStdout: [180, 44],
45+
screenshot: [90, 40],
4646
header: {
4747
position: [0, 0, 4, 4],
4848
},

src/utils/routes/dashboard/generateDashboardOutput.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import blessed from "blessed";
22
import contrib from "blessed-contrib";
33
import { removeANSI } from "../../libs/generateTable";
4-
import { welcomeMessage } from "../../libs/getResponses";
4+
import { lines, welcomeMessage } from "../../libs/getResponses";
5+
import { getSaying } from "../../libs/getSaying";
56
import { blessedConfig } from "./blessedConfig";
67
import { DashboardSize } from "./dashboardHandlers";
78

@@ -201,7 +202,17 @@ export const generateDashboardOutput: (
201202
let response = screen.screenshot(0, screenshotX, 0, screenshotY);
202203
screen.destroy();
203204

205+
// Remove garbage lines
204206
response = removeUnneededLines(response);
207+
response += "\n";
208+
209+
response += getSaying() + "\n";
210+
response += lines.WNrepoLink + "\n\n";
211+
response += lines.BMCLink + "\n";
212+
response += lines.sponsorMessage + "\n";
213+
response += lines.twitterPlug;
214+
response += lines.handleHashtag.join(" ") + "\n";
215+
205216
return response;
206217
};
207218

@@ -212,7 +223,7 @@ const removeUnneededLines: (str: string) => string = (str) => {
212223
// Lines with ansi removed
213224
let rawLines = splitLines.map((line) => {
214225
// If line contains a background color code then replace it with NON ansi string
215-
// This is mostly to preserve bars since they are just whitespace
226+
// This is mostly to preserve bars since they are just colored whitespace
216227
if (line.includes("\x1B[4")) line.replace("\x1B[4", "_");
217228
return removeANSI(line);
218229
});
@@ -221,11 +232,9 @@ const removeUnneededLines: (str: string) => string = (str) => {
221232
let goodLines: number[] = [];
222233

223234
rawLines.forEach((line, index) => {
224-
// remove border
225-
line = line.replace(//g, "");
235+
// remove border and spaces
236+
line = line.replace(//g, "").replace(/\s/g, "");
226237

227-
// remove spaces
228-
line = line.replace(/\s/g, "");
229238
if (line.length !== 0) goodLines.push(index);
230239
});
231240

0 commit comments

Comments
 (0)