Skip to content

Commit c17acbb

Browse files
authored
Update UI (and bug fix for CCAs) (#119)
1 parent aab7595 commit c17acbb

File tree

5 files changed

+70
-28
lines changed

5 files changed

+70
-28
lines changed

src/main/java/seedu/connectus/model/tag/CcaPosition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
public class CcaPosition extends Tag {
88

9-
public static final String MESSAGE_CONSTRAINTS = "CCA Position should be alphanumeric";
9+
public static final String MESSAGE_CONSTRAINTS = "CCA Position names should be alphanumeric";
1010
public final String ccaPositionName;
1111

1212
/**

src/main/java/seedu/connectus/model/tag/Tag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class Tag implements Comparable<Tag> {
1111

1212
public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric";
13-
public static final String VALIDATION_REGEX = "\\p{Alnum}+";
13+
public static final String VALIDATION_REGEX = "[\\p{Alnum} ]+";
1414

1515
public final String tagName;
1616

src/main/java/seedu/connectus/model/util/SampleDataUtil.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ public static Person[] getSamplePersons() {
3737
p1.setBirthday(new Birthday("01/01/1990"));
3838
p1.setRemarks(getRemarkSet("friends"));
3939
p1.setModules(getModuleSet("CS2107"));
40-
p1.setCcas(getCcaSet("NES"));
40+
p1.setCcas(getCcaSet("NUS Hackers"));
4141
p1.setCcaPositions(getCcaPositionSet("Director"));
4242

43-
4443
// Sample person 2
4544
Person p2 = new Person(new Name("Bernice Yu"));
4645
p2.setPhone(new Phone("99272758"));
@@ -52,8 +51,8 @@ public static Person[] getSamplePersons() {
5251
p2.setBirthday(new Birthday("31/05/2000"));
5352
p2.setRemarks(getRemarkSet("colleagues", "friends"));
5453
p2.setModules(getModuleSet("CS2105"));
55-
p2.setCcas(getCcaSet("ICS"));
56-
p2.setCcaPositions(getCcaPositionSet("President"));
54+
p2.setCcas(getCcaSet("NUS Chess Club"));
55+
p2.setCcaPositions(getCcaPositionSet("Secretary"));
5756

5857
// Sample person 3
5958
Person p3 = new Person(new Name("Charlotte Oliveiro"));
@@ -65,9 +64,7 @@ public static Person[] getSamplePersons() {
6564
p3.setBirthday(new Birthday("07/07/1993"));
6665
p3.setRemarks(getRemarkSet("neighbours"));
6766
p3.setModules(getModuleSet("CS2105", "ES2660"));
68-
p3.setCcas(getCcaSet("NUS Computing Club"));
69-
p3.setCcaPositions(getCcaPositionSet("Treasurer"));
70-
67+
p3.setCcas(getCcaSet("NUS Chess Club", "NUS Computing Club"));
7168

7269
// Sample person 4
7370
Person p4 = new Person(new Name("David Li"));
@@ -80,8 +77,8 @@ public static Person[] getSamplePersons() {
8077
p4.setBirthday(new Birthday("18/06/1999"));
8178
p4.setRemarks(getRemarkSet("family"));
8279
p4.setModules(getModuleSet("CS2109S"));
83-
p4.setCcas(getCcaSet("NUS Chess Club"));
84-
p4.setCcaPositions(getCcaPositionSet("Secretary"));
80+
p4.setCcas(getCcaSet("ICS"));
81+
p4.setCcaPositions(getCcaPositionSet("President"));
8582

8683
// Sample person 5
8784
Person p5 = new Person(new Name("Irfan Ibrahim"));
@@ -94,8 +91,7 @@ public static Person[] getSamplePersons() {
9491
p5.setBirthday(new Birthday("29/02/2004"));
9592
p5.setRemarks(getRemarkSet("classmates"));
9693
p5.setModules(getModuleSet("CS1101S"));
97-
p5.setCcas(getCcaSet("ICS"));
98-
p5.setCcaPositions(getCcaPositionSet("Vice-President"));
94+
p5.setCcas(getCcaSet("Art Club"));
9995

10096
// Sample person 6
10197
Person p6 = new Person(new Name("Roy Balakrishnan"));
@@ -108,8 +104,7 @@ public static Person[] getSamplePersons() {
108104
p6.setBirthday(new Birthday("24/09/2004"));
109105
p6.setRemarks(getRemarkSet("colleagues"));
110106
p6.setModules(getModuleSet("CS1101S"));
111-
p6.setCcas(getCcaSet("NUS Hackers"));
112-
p6.setCcaPositions(getCcaPositionSet("Executive"));
107+
p6.setCcas(getCcaSet("NUS Chess Club"));
113108

114109
return new Person[] {
115110
p1, p2, p3, p4, p5, p6

src/main/java/seedu/connectus/ui/PersonCard.java

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,46 @@ public PersonCard(Person person, int displayedIndex) {
9494
socialMediaContainer.setVisible(false);
9595
socialMediaContainer.managedProperty().bind(socialMediaContainer.visibleProperty());
9696
}
97+
if (person.getBirthday().isPresent()) {
98+
birthday.setText(person.getBirthday().get().toString());
99+
} else {
100+
birthday.setText("");
101+
birthdayContainer.setVisible(false);
102+
birthdayContainer.managedProperty().bind(birthdayContainer.visibleProperty());
103+
}
97104

98105
person.getRemarks().stream()
99106
.sorted(Comparator.comparing(remark -> remark.tagName))
100-
.forEach(remark -> tags.getChildren().add(new Label(remark.tagName)));
107+
.forEach(remark -> {
108+
Label remarkLabel = new Label(remark.tagName);
109+
remarkLabel.getStyleClass().add("label");
110+
remarkLabel.getStyleClass().add("remark");
111+
tags.getChildren().add(remarkLabel);
112+
});
101113
person.getModules().stream()
102114
.sorted(Comparator.comparing(module -> module.tagName))
103-
.forEach(module -> tags.getChildren().add(new Label(module.tagName)));
115+
.forEach(module -> {
116+
Label moduleLabel = new Label(module.tagName);
117+
moduleLabel.getStyleClass().add("label");
118+
moduleLabel.getStyleClass().add("module");
119+
tags.getChildren().add(moduleLabel);
120+
});
104121
person.getCcas().stream()
105122
.sorted(Comparator.comparing(cca -> cca.tagName))
106-
.forEach(cca -> tags.getChildren().add(new Label(cca.tagName)));
123+
.forEach(cca -> {
124+
Label ccaLabel = new Label(cca.tagName);
125+
ccaLabel.getStyleClass().add("label");
126+
ccaLabel.getStyleClass().add("cca");
127+
tags.getChildren().add(ccaLabel);
128+
});
107129
person.getCcaPositions().stream()
108130
.sorted(Comparator.comparing(ccaPosition -> ccaPosition.tagName))
109-
.forEach(ccaPosition -> tags.getChildren().add(new Label(ccaPosition.tagName)));
110-
111-
if (person.getBirthday().isPresent()) {
112-
birthday.setText(person.getBirthday().get().toString());
113-
} else {
114-
birthday.setText("");
115-
birthdayContainer.setVisible(false);
116-
birthdayContainer.managedProperty().bind(birthdayContainer.visibleProperty());
117-
}
131+
.forEach(ccaPosition -> {
132+
Label ccaPositionLabel = new Label(ccaPosition.tagName);
133+
ccaPositionLabel.getStyleClass().add("label");
134+
ccaPositionLabel.getStyleClass().add("ccaPosition");
135+
tags.getChildren().add(ccaPositionLabel);
136+
});
118137
}
119138

120139
@Override

src/main/resources/view/DarkTheme.css

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,39 @@
351351
-fx-vgap: 3;
352352
}
353353

354-
#tags .label {
354+
#tags .label.remark {
355355
-fx-text-fill: white;
356356
-fx-background-color: #3e7b91;
357357
-fx-padding: 1 3 1 3;
358358
-fx-border-radius: 2;
359359
-fx-background-radius: 2;
360360
-fx-font-size: 11;
361361
}
362+
363+
#tags .label.module {
364+
-fx-text-fill: white;
365+
-fx-background-color: #ff7f50;
366+
-fx-padding: 1 3 1 3;
367+
-fx-border-radius: 2;
368+
-fx-background-radius: 2;
369+
-fx-font-size: 11;
370+
}
371+
372+
#tags .label.cca {
373+
-fx-text-fill: white;
374+
-fx-background-color: #773E4A;
375+
-fx-padding: 1 3 1 3;
376+
-fx-border-radius: 2;
377+
-fx-background-radius: 2;
378+
-fx-font-size: 11;
379+
}
380+
381+
#tags .label.ccaPosition {
382+
-fx-text-fill: white;
383+
-fx-background-color: #67773E;
384+
-fx-padding: 1 3 1 3;
385+
-fx-border-radius: 2;
386+
-fx-background-radius: 2;
387+
-fx-font-size: 11;
388+
}
389+

0 commit comments

Comments
 (0)