New Group UI updated.

This commit is contained in:
Asal Lotfi
2025-09-03 13:58:43 +03:30
parent 9cd71d33d4
commit cb63664701
4 changed files with 36 additions and 3 deletions
@@ -24,6 +24,8 @@ public class NewGroupController {
@FXML private Button cancelButton;
@FXML private Button nextButton;
@FXML private StackPane overlayRoot; // the root
@FXML private TextField groupIdField;
@FXML private Label groupIdLabel;
private File groupImageFile;
@@ -58,6 +60,7 @@ public class NewGroupController {
nextButton.setOnAction(e -> {
String groupName = groupNameField.getText().trim();
String groupId = groupIdField.getText().trim();
if (groupName.isEmpty()) {
// Apply error style
@@ -67,6 +70,14 @@ public class NewGroupController {
return;
}
if (groupId.isEmpty()) {
// Apply error style
groupIdField.getStyleClass().add("error");
groupIdLabel.getStyleClass().add("error");
return;
}
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(
"/org/to/telegramfinalproject/Fxml/add_member.fxml"));
@@ -74,7 +85,7 @@ public class NewGroupController {
// Optional: pass groupName and image to AddMembersController
AddMembersController controller = loader.getController();
controller.setGroupInfo(groupName, groupImageFile);
controller.setGroupInfo(groupName, groupId, groupImageFile);
// Close the current "New Group" overlay
MainController.getInstance().closeOverlay(overlayRoot);
@@ -87,6 +98,7 @@ public class NewGroupController {
}
});
// Reset error state when typing
groupNameField.textProperty().addListener((obs, oldVal, newVal) -> {
if (!newVal.trim().isEmpty()) {
groupNameField.getStyleClass().remove("error");
@@ -94,6 +106,14 @@ public class NewGroupController {
}
});
// Reset error state when typing
groupIdField.textProperty().addListener((obs, oldVal, newVal) -> {
if (!newVal.trim().isEmpty()) {
groupIdField.getStyleClass().remove("error");
groupIdLabel.getStyleClass().remove("error");
}
});
// Auto_focus search bar when overlay opens
Platform.runLater(() -> groupNameField.requestFocus());
}