New Channel UI updated.
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user