Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blank whitespace in person card when optional fields are not present #130

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@
id.setText(displayedIndex + ". ");
name.setText(person.getName().fullName);
phone.setText(person.getPhone().value);
address.setText(person.hasAddress() ? person.getAddress().get().value : "");
email.setText(person.hasEmail() ? person.getEmail().get().value : "");
if (person.hasAddress()) {
address.setText(person.getAddress().get().value);

Check warning on line 56 in src/main/java/seedu/address/ui/PersonCard.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonCard.java#L56

Added line #L56 was not covered by tests
} else {
address.setText("");
address.setManaged(false);

Check warning on line 59 in src/main/java/seedu/address/ui/PersonCard.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonCard.java#L58-L59

Added lines #L58 - L59 were not covered by tests
}
if (person.hasEmail()) {
email.setText(person.getEmail().get().value);

Check warning on line 62 in src/main/java/seedu/address/ui/PersonCard.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonCard.java#L62

Added line #L62 was not covered by tests
} else {
email.setText("");
email.setManaged(false);

Check warning on line 65 in src/main/java/seedu/address/ui/PersonCard.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/PersonCard.java#L64-L65

Added lines #L64 - L65 were not covered by tests
}
person.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
Expand Down
8 changes: 1 addition & 7 deletions src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,7 @@
-fx-padding: 0 0 0 0;
}

.list-cell:filled:even {
/* even list cells, 0,2,4... */
-fx-background-color: #c5e3f9;
}

.list-cell:filled:odd {
/* odd list cells, 1,3,5... */
.list-cell:filled {
-fx-background-color: #c5e3f9;
}

Expand Down