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

Implement update for changing the tag labels color in the UI #228

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
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/tag/TagCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Provides categories to sort Tags into, as well as colour codes for display in the UI.
*/
public enum TagCategory {
GENERAL("#ECECEC"), // Light Grey for default color
GENERAL("#A9A9A9"), // Dark Grey for default color

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if dark grey is a good colour because it could mean "invalid tag" to a user that's not familiar to our codebase, but I think it suffices for now

ACADEMICS("#FFD700"), // Gold
ACTIVITIES("#1E90FF"), // Dodger Blue
NETWORKING("#32CD32"), // Lime Green
Expand Down
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 @@ -47,12 +47,18 @@
name.setText(person.getName().fullName);
phone.setText(person.getPhone().value);
email.setText(person.getEmail().value);
person.getOrderedTags()
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName + " " + tag.getTagCategory())));

syncPersonTagDetails(person);

Check warning on line 50 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#L50

Added line #L50 was not covered by tests

// add horizontal and vertical gaps for the tags FlowPane
tags.setHgap(5);
tags.setVgap(5);
}

private void syncPersonTagDetails(Person person) {
person.getOrderedTags().forEach(tag -> {
Label tagLabel = new Label(tag.tagName);
tagLabel.setStyle("-fx-padding: 2; -fx-background-color: " + tag.getTagColour());
tags.getChildren().add(tagLabel);
});
}

Check warning on line 63 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-L63

Added lines #L58 - L63 were not covered by tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation to refresh the tag status of the tags!

}