Skip to content

Commit

Permalink
Fix ui idsplay of personcard contents
Browse files Browse the repository at this point in the history
  • Loading branch information
tengcharmaine committed Apr 4, 2024
1 parent 936dbb3 commit 179b8cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/main/java/seedu/address/ui/PersonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public PersonCard(Person person, int displayedIndex) {
this.person = person;
id.setText(displayedIndex + ". ");
name.setText(person.getName().fullName);
phone.setText(person.getPhone().value);
email.setText(person.getEmail().value);

StringBuilder truncatedPhone = new StringBuilder();
phone.setText(truncatedPhone.append("Phone: ").append(person.getPhone().value).toString());

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#L61-L62

Added lines #L61 - L62 were not covered by tests

StringBuilder truncatedEmail = new StringBuilder();
email.setText(truncatedEmail.append("Email: ").append(person.getEmail().value).toString());

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

String fullNote = person.getNote().value;
int maxLineLength = 30; // Maximum length of each line before truncation
Expand Down Expand Up @@ -93,7 +97,9 @@ public PersonCard(Person person, int displayedIndex) {
ic.setText(person.getIdentityCardNumber().value);
age.setText(String.valueOf(person.getAge().value));
sex.setText(person.getSex().value);
address.setText(person.getAddress().value);

StringBuilder truncatedAddress = new StringBuilder();
address.setText(truncatedAddress.append("Address: ").append(person.getAddress().value).toString());

Check warning on line 102 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#L101-L102

Added lines #L101 - L102 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
3 changes: 0 additions & 3 deletions src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@
<Label fx:id="ic" styleClass="cell_small_label" text="\$ic" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Phone:" styleClass="cell_small_label" />
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Address:" styleClass="cell_small_label" />
<Label fx:id="address" styleClass="cell_small_label" text="\$address" />
</HBox>
<HBox spacing="5" alignment="CENTER_LEFT">
<Label text="Email:" styleClass="cell_small_label" />
<Label fx:id="email" styleClass="cell_small_label" text="\$email" />
</HBox>
<HBox spacing="5" alignment="TOP_LEFT">
Expand Down

0 comments on commit 179b8cf

Please sign in to comment.