New Channel UI updated.

This commit is contained in:
Asal Lotfi
2025-09-03 13:48:37 +03:30
parent 7b54835468
commit 9cd71d33d4
2 changed files with 29 additions and 2 deletions
@@ -30,6 +30,8 @@ public class NewChannelController {
@FXML private Button createButton;
@FXML private StackPane overlayRoot; // the root
@FXML private Label descCounter;
@FXML private Label channelIdLabel;
@FXML private TextField channelIdField;
private File channelImageFile;
@@ -67,6 +69,7 @@ public class NewChannelController {
// Create button → validate name + submit
createButton.setOnAction(e -> {
String channelName = channelNameField.getText().trim();
String channelId = channelIdField.getText().trim();
String description = channelDescField.getText().trim();
if (channelName.isEmpty()) {
@@ -76,6 +79,13 @@ public class NewChannelController {
return;
}
if (channelId.isEmpty()) {
// Apply error style
channelIdField.getStyleClass().add("error");
channelIdLabel.getStyleClass().add("error");
return;
}
try {
// Load Add Members overlay
FXMLLoader loader = new FXMLLoader(getClass().getResource(
@@ -84,7 +94,7 @@ public class NewChannelController {
// Pass channel info to AddMembersController
AddSubscriberController controller = loader.getController();
controller.setChannelInfo(channelName, description, channelImageFile);
controller.setChannelInfo(channelName, channelId, description, channelImageFile);
// Close the current "New Channel" overlay
MainController.getInstance().closeOverlay(overlayRoot);
@@ -133,6 +143,14 @@ public class NewChannelController {
}
});
// Reset error state when typing
channelIdField.textProperty().addListener((obs, oldVal, newVal) -> {
if (!newVal.trim().isEmpty()) {
channelIdField.getStyleClass().remove("error");
channelIdLabel.getStyleClass().remove("error");
}
});
// Auto-focus channel name on open
Platform.runLater(() -> channelNameField.requestFocus());