Skip to content

Commit ec7e23e

Browse files
committed
Use zero-width space for milestone lines and remove unused health card methods
1 parent c49b726 commit ec7e23e

3 files changed

Lines changed: 26 additions & 84 deletions

File tree

editor/src/main/java/com/jvn/editor/ui/RunConsoleView.java

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ private void scrollToBottom() {
403403
}
404404

405405
private static String classifyLine(String line) {
406-
if (line.startsWith("── ")) return "run-console-line-milestone";
406+
if (line.startsWith("\u200B")) return "run-console-line-milestone";
407407
if (ERROR_LINE.matcher(line).find()) return "run-console-line-error";
408408
if (WARN_LINE.matcher(line).find()) return "run-console-line-warn";
409409
if (RUNTIME_LOG_LINE.matcher(line).find()) {
@@ -416,24 +416,26 @@ private static String classifyLine(String line) {
416416
}
417417

418418
private class LogLineCell extends ListCell<String> {
419-
private static final List<String> LEVEL_CLASSES = List.of(
420-
"run-console-line-error", "run-console-line-warn",
421-
"run-console-line-info", "run-console-line-engine",
422-
"run-console-line-milestone", "run-console-line-noise",
423-
"run-console-line-normal"
424-
);
419+
private String currentClass = null;
425420

426421
@Override
427422
protected void updateItem(String item, boolean empty) {
428423
super.updateItem(item, empty);
429-
getStyleClass().removeAll(LEVEL_CLASSES);
430424
if (empty || item == null) {
431425
setText(null);
426+
if (currentClass != null) {
427+
getStyleClass().remove(currentClass);
428+
currentClass = null;
429+
}
432430
return;
433431
}
434432
setText(item);
435-
setWrapText(wordWrapBtn.isSelected());
436-
getStyleClass().add(classifyLine(item));
433+
String newClass = classifyLine(item);
434+
if (!newClass.equals(currentClass)) {
435+
if (currentClass != null) getStyleClass().remove(currentClass);
436+
getStyleClass().add(newClass);
437+
currentClass = newClass;
438+
}
437439
}
438440
}
439441

@@ -454,7 +456,7 @@ public void onProcessExit(int exitCode) {
454456

455457
private void appendInfoMessage(String msg) {
456458
Runnable task = () -> {
457-
outputList.getItems().add("── " + msg + " ──");
459+
outputList.getItems().add("\u200B" + msg);
458460
scrollToBottom();
459461
};
460462
if (Platform.isFxApplicationThread()) task.run();
@@ -686,6 +688,11 @@ private MenuBar createMenuBar(String title) {
686688
MenuItem miWordWrap = new MenuItem("Toggle Word Wrap");
687689
miWordWrap.setOnAction(e -> {
688690
wordWrapBtn.setSelected(!wordWrapBtn.isSelected());
691+
if (wordWrapBtn.isSelected()) {
692+
outputList.setFixedCellSize(-1);
693+
} else {
694+
outputList.setFixedCellSize(20);
695+
}
689696
outputList.refresh();
690697
});
691698

@@ -778,7 +785,14 @@ private ToolBar createToolBar() {
778785
wordWrapBtn.getStyleClass().add("run-console-toggle");
779786
wordWrapBtn.setTooltip(new Tooltip("Toggle word wrapping"));
780787
wordWrapBtn.setFocusTraversable(false);
781-
wordWrapBtn.setOnAction(e -> outputList.refresh());
788+
wordWrapBtn.setOnAction(e -> {
789+
if (wordWrapBtn.isSelected()) {
790+
outputList.setFixedCellSize(-1);
791+
} else {
792+
outputList.setFixedCellSize(20);
793+
}
794+
outputList.refresh();
795+
});
782796

783797
// Search field
784798
searchField.setPromptText("Search output...");

editor/src/main/java/com/jvn/editor/ui/WelcomeCenterView.java

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import javafx.collections.ObservableList;
3333
import javafx.geometry.Insets;
3434
import javafx.geometry.Pos;
35-
import javafx.scene.Node;
3635
import javafx.scene.control.Button;
3736
import javafx.scene.control.ContentDisplay;
3837
import javafx.scene.control.ContextMenu;
@@ -1087,73 +1086,6 @@ private void renderHealthRows(List<HealthRow> rows) {
10871086
updateHealthOverview(rows);
10881087
}
10891088

1090-
private HBox buildHealthCard(HealthRow row) {
1091-
HBox box = new HBox(8);
1092-
box.setPadding(new Insets(6, 8, 6, 8));
1093-
box.getStyleClass().add("welcome-health-card");
1094-
box.setAlignment(Pos.CENTER_LEFT);
1095-
1096-
Label badge = new Label();
1097-
badge.getStyleClass().addAll("welcome-health-badge", severityBadgeClass(row.severity()));
1098-
configureSeverityBadge(badge, row.severity());
1099-
Label title = new Label(row.title());
1100-
title.getStyleClass().add("welcome-health-title");
1101-
Label summary = new Label(row.summary());
1102-
summary.getStyleClass().add("welcome-health-summary");
1103-
summary.setMaxWidth(Double.MAX_VALUE);
1104-
summary.setTooltip(new Tooltip(row.detail() == null || row.detail().isBlank() ? row.summary() : row.detail()));
1105-
HBox.setHgrow(summary, Priority.ALWAYS);
1106-
1107-
box.getChildren().addAll(badge, title, summary);
1108-
return box;
1109-
}
1110-
1111-
private String severityLabel(Severity severity) {
1112-
return switch (severity) {
1113-
case OK -> "OK";
1114-
case WARN -> "WARN";
1115-
case ERROR -> "ERROR";
1116-
case INFO -> "INFO";
1117-
};
1118-
}
1119-
1120-
private void configureSeverityBadge(Label badge, Severity severity) {
1121-
if (badge == null || severity == null) return;
1122-
badge.setGraphic(null);
1123-
badge.setText(null);
1124-
badge.setContentDisplay(ContentDisplay.LEFT);
1125-
switch (severity) {
1126-
case OK -> {
1127-
Node okIcon = CssIcon.check("#8bcf98");
1128-
badge.setGraphic(okIcon);
1129-
badge.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
1130-
badge.setAccessibleText("OK");
1131-
}
1132-
case WARN -> {
1133-
Node warnIcon = CssIcon.warning("#efbf82");
1134-
badge.setGraphic(warnIcon);
1135-
badge.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
1136-
badge.setAccessibleText("WARN");
1137-
}
1138-
case ERROR -> {
1139-
Node errorIcon = CssIcon.error("#f0a1b2");
1140-
badge.setGraphic(errorIcon);
1141-
badge.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
1142-
badge.setAccessibleText("ERROR");
1143-
}
1144-
case INFO -> badge.setText(severityLabel(severity));
1145-
}
1146-
}
1147-
1148-
private String severityBadgeClass(Severity severity) {
1149-
return switch (severity) {
1150-
case OK -> "welcome-health-badge-ok";
1151-
case WARN -> "welcome-health-badge-warn";
1152-
case ERROR -> "welcome-health-badge-error";
1153-
case INFO -> "welcome-health-badge-info";
1154-
};
1155-
}
1156-
11571089
private void updateHealthOverview(List<HealthRow> rows) {
11581090
healthOverviewValueLabel.getStyleClass().removeAll(
11591091
"welcome-overview-value-ok",

editor/src/main/resources/com/jvn/editor/editor.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@
254254
-fx-padding: 1 8 1 8;
255255
}
256256

257-
.run-console-output .list-cell:empty {
258-
-fx-pref-height: 4;
259-
}
260-
261257
.run-console-output .list-cell:selected {
262258
-fx-background-color: rgba(255, 255, 255, 0.06);
263259
}

0 commit comments

Comments
 (0)