Skip to content

Commit

Permalink
Beautify GUI and add contact list empty messages
Browse files Browse the repository at this point in the history
  • Loading branch information
KrashKart committed Oct 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d0614e8 commit cb2266e
Showing 5 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -42,6 +42,12 @@ protected ContainsKeywordsPredicate getPredicate() {
public CommandResult execute(Model model) {
requireNonNull(model);
model.updateFilteredPersonList(this.predicate);

// if the result find list is empty
if (model.getFilteredPersonList().isEmpty()) {
return new CommandResult(String.format("No persons found!"));
}

return new CommandResult(
String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
}
Original file line number Diff line number Diff line change
@@ -42,7 +42,12 @@ public CommandResult execute(Model model) throws CommandException {

Person personToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deletePerson(personToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(personToDelete)));

String result = String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete);
if (model.getFilteredPersonList().isEmpty()) {
result += "\nThe contact list is empty! :(";
}
return new CommandResult(result);
}

@Override
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -115,6 +115,9 @@ void fillInnerParts() {

resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
if (logic.getFilteredPersonList().isEmpty()) {
resultDisplay.setFeedbackToUser("The contact list is empty! :(");
}

StatusBarFooter statusBarFooter = new StatusBarFooter(logic.getCampusConnectFilePath());
statusbarPlaceholder.getChildren().add(statusBarFooter.getRoot());
1 change: 0 additions & 1 deletion src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@
</HBox>
<FlowPane fx:id="tags" />
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
<!-- <Label fx:id="address" styleClass="cell_small_label" text="\$address" />-->
<Label fx:id="email" styleClass="cell_small_label" text="\$email" />
</VBox>
</GridPane>
2 changes: 1 addition & 1 deletion src/main/resources/view/PersonListPanel.fxml
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@
<?import javafx.scene.layout.VBox?>

<VBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<ListView fx:id="personListView" VBox.vgrow="ALWAYS" />
<ListView fx:id="personListView" VBox.vgrow="ALWAYS" styleClass="background"/>
</VBox>

0 comments on commit cb2266e

Please sign in to comment.