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 CSS parsing errors, remarks and gui #63

Merged
Merged
Show file tree
Hide file tree
Changes from 7 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
16 changes: 16 additions & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ Examples:
* `remark 1 r/Great attitude, hardworking` Edits the remark of the 1st person on the list to have a remark `Great attitude, hardworking`
* `remark 1 r/` Empties the remark of the 1st person.

### Viewing a person's details: `view`

Creates a complete view for details of a person in the address book

Format: `view INDEX`

* Shows the complete details of the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​
* The index used will be the same as the index used in the `list` command.
* Compatible with search and other features that change the order and content of the list.

Examples:
* `view 1`
Shows the complete details of the 1st person on the list.


### Adding Github/LinkedIn username for a user: 'add linkedin/github'

Adds the username for their social profile [LinkedIn/Github] to the existing contact details of users
Expand Down Expand Up @@ -285,6 +300,7 @@ Action | Format, Examples
---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
**Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​` <br> e.g., `add n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 t/friend t/colleague`
**Remark** | `remark r/REMARK` <br> e.g., `remark 1 r/Great attitude, hardworking`
**View** | `view INDEX` <br> e.g., `view 1`
**Add Github/LinkedIn** | `addL INDEX u/USERNAME` or `addG INDEX u/USERNAME` e.g., `addL 1 u/alex-yeoh`, `addG 2 u/bernicesanders123`
**Open Github/LinkedIn** | `linkedin INDEX` or `github INDEX` e.g., `linkedin 1`, `github 2`
**Clear** | `clear`
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public interface Logic {
/** Returns an unmodifiable view of the filtered list of persons */
ObservableList<Person> getFilteredPersonList();


/**
* Returns the user prefs' address book file path.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public ObservableList<Person> getFilteredPersonList() {
return model.getFilteredPersonList();
}



@Override
public Index getLastViewedPersonIndex() {
return model.getLastViewedPersonIndex();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ public CommandResult execute(Model model) {
requireNonNull(model);

if (sortingComparator != null) {
// If a sorting comparator is provided, sort the list using it
model.sortPersonList(sortingComparator);
}
model.sortPersonList(sortingComparator);

model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);

return new CommandResult(MESSAGE_SUCCESS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public ListCommand parse(String args) throws ParseException {
}

String sortingAttribute = argMultimap.getValue(CliSyntax.PREFIX_SORT).orElse(null);
System.out.println("sortingAttribute: " + sortingAttribute);

if (sortingAttribute == null) {
return new ListCommand();
Expand All @@ -30,11 +31,13 @@ public ListCommand parse(String args) throws ParseException {
// Create the sorting comparator based on the sorting attribute
Comparator<Person> sortingComparator = createSortingComparator(sortingAttribute);


return new ListCommand(sortingComparator);
}

private Comparator<Person> createSortingComparator(String sortingAttribute) {
if ("name".equalsIgnoreCase(sortingAttribute)) {
System.out.println("Sorting by name");
return Comparator.comparing(Person::getName);
} else {
// Default: no sorting (you can change this behavior as needed)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/address/model/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void removePerson(Person key) {
persons.remove(key);
}


//// util methods

@Override
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public interface Model {
/** Returns an unmodifiable view of the filtered person list */
ObservableList<Person> getFilteredPersonList();



/**
* Updates the filter of the filtered person list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
Expand Down Expand Up @@ -135,7 +134,6 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
filteredPersons.setPredicate(predicate);
}


@Override
public void updateFilteredPersonList(List<Predicate<Person>> predicatesList) {
requireNonNull(predicatesList);
Expand All @@ -145,17 +143,10 @@ public void updateFilteredPersonList(List<Predicate<Person>> predicatesList) {
filteredPersons.setPredicate(combinedPredicate);
}

// TODO: fix the sorting
@Override
public void sortPersonList(Comparator<Person> comparator) {
requireNonNull(comparator);

List<Person> sortedList = new ArrayList<>(getFilteredPersonList());
sortedList.sort(comparator);

// Update the filtered list
Predicate<Person> predicate = sortedList::contains;
updateFilteredPersonList(predicate);
return;
}


Expand Down
5 changes: 4 additions & 1 deletion src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ public class Person {
// Data fields
private final Address address;

private final Remark remark;
private final Set<Tag> tags = new HashSet<>();
private LinkedIn linkedIn = new LinkedIn("");
private Github github = new Github("");

private Remark remark;
private final Status currentStatus = new Status();



/**
* Every field must be present and not null.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public void setPersons(List<Person> persons) {
internalList.setAll(persons);
}



/**
* Returns the backing list as an unmodifiable {@code ObservableList}.
*/
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/seedu/address/storage/JsonAdaptedPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ class JsonAdaptedPerson {
private final String linkedIn;
private final String github;

private final String remark;

/**
* Constructs a {@code JsonAdaptedPerson} with the given person details.
*/
@JsonCreator
public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone,
@JsonProperty("email") String email, @JsonProperty("address") String address,
@JsonProperty("tags") List<JsonAdaptedTag> tags, @JsonProperty("linkedIn") String linkedIn,
@JsonProperty("github") String github) {
@JsonProperty("github") String github, @JsonProperty("remark") String remark) {
this.name = name;
this.phone = phone;
this.email = email;
Expand All @@ -52,6 +54,7 @@ public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone
}
this.linkedIn = linkedIn;
this.github = github;
this.remark = remark;

}

Expand All @@ -68,6 +71,7 @@ public JsonAdaptedPerson(Person source) {
.collect(Collectors.toList()));
linkedIn = source.getLinkedIn().value;
github = source.getGithub().value;
remark = source.getRemark().value;
}

/**
Expand Down Expand Up @@ -112,7 +116,10 @@ public Person toModelType() throws IllegalValueException {
throw new IllegalValueException(Address.MESSAGE_CONSTRAINTS);
}
final Address modelAddress = new Address(address);
final Remark modelRemark = new Remark(""); //TODO: Implement parsing and marshalling in storage commits
if (remark == null) {
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Remark.class.getSimpleName()));
}
final Remark modelRemark = new Remark(remark);

final Set<Tag> modelTags = new HashSet<>(personTags);
Person p = new Person(modelName, modelPhone, modelEmail, modelAddress, modelRemark, modelTags);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ private CommandResult executeCommand(String commandText) throws CommandException
logger.info("Result: " + commandResult.getFeedbackToUser());
resultDisplay.setFeedbackToUser(commandResult.getFeedbackToUser());



if (commandResult.isShowHelp()) {
handleHelp();
}
Expand Down
66 changes: 30 additions & 36 deletions src/main/resources/view/Form.css
Original file line number Diff line number Diff line change
@@ -1,83 +1,77 @@
/* Style for white box container */
.white-box {
-fx-background-color: #fff; /* White background color */
-fx-border-color: #ccc; /* Gray border */
-fx-padding: 20px; /* Padding inside the box */
-fx-pref-width: 300px; /* Set the width as needed */
-fx-margin: 0; /* Center the box horizontally on the page */
-fx-effect: drop shadow(three-pass-box, #888, 2, 2, 5, 0); /* Add a subtle shadow */
-fx-background-radius: 5px; /* Rounded corners */
-fx-background-color: #fff;
-fx-border-color: #ccc;
-fx-padding: 20px;
-fx-pref-width: 300px;
-fx-margin: 0;
-fx-effect: drop shadow(three-pass-box, #888, 2, 2, 5, 0);
-fx-background-radius: 5px;
}

/* Style for text fields */
.text-field {
-fx-background-color: #333333;
-fx-border-color: #fff;
-fx-padding: 3px; /* Padding inside the text field */
-fx-margin: 10px; /* Spacing between text fields */
-fx-background-radius: 3px; /* Slightly rounded corners */
-fx-padding: 3px;
-fx-margin: 10px;
-fx-background-radius: 3px;
-fx-font-family: "Segoe UI";
-fx-font-size: 12px;
-fx-text-fill: #fff;
}

/* Style for boxes or buttons */
.box {
-fx-padding: 10px; /* Padding inside the box or button */
-fx-background-color: #0074d9; /* Blue background color */
-fx-text-fill: #fff; /* White text color */
-fx-border-width: 0; /* No border */
-fx-cursor: hand; /* Change cursor to hand on hover */
-fx-background-radius: 3px; /* Rounded corners */
-fx-padding: 10px;
-fx-background-color: #0074d9;
-fx-text-fill: #fff;
-fx-border-width: 0;
-fx-cursor: hand;
-fx-background-radius: 3px;
}

/* Add hover effect to boxes */
.box:hover {
-fx-background-color: #0056b3; /* Darker blue on hover */
-fx-background-color: #0056b3;
}

.stage-button {
-fx-background-color: #ccc; /* Default color for an unselected stage */
-fx-background-color: #ccc;
-fx-text-fill: black;
-fx-font-weight: bold;
-fx-padding: 5px 10px;
-fx-background-radius: 50;
}

.offered-button {
-fx-background-color: #00FF00; /* Default color for an unselected stage */
-fx-background-color: #00FF00;
-fx-text-fill: white;
-fx-font-weight: bold;
-fx-padding: 5px 10px;
-fx-background-radius: 50;
}

.rejected-button {
-fx-background-color: #ff0000; /* Default color for an unselected stage */
-fx-background-color: #ff0000;
-fx-text-fill: white;
-fx-font-weight: bold;
-fx-padding: 5px 10px;
-fx-background-radius: 50;
}

/* Define a CSS class for the connection line */
.connection-line {
border-top: 1px solid grey; /* Adjust the color and thickness of the line as needed */
-fx-border-style: solid;
-fx-border-color: grey;
-fx-border-width: 1px;
}

/* Style for the connection boxes (HBox) */
.connection-box {
-fx-padding: 5 0;
}

/* Style for the connecting lines (Rectangle) */
.connection-line {
-fx-fill: #ccc; /* Color of the connecting lines */
-fx-stroke: #ccc; /* Color of the connecting lines' borders */
-fx-stroke-width: 4px; /* Width of the borders */
-fx-min-width: 100px; /* Adjust as needed */
-fx-max-width: 200px; /* Adjust as needed */
-fx-min-height: 2px; /* Adjust as needed */
-fx-max-height: 2px; /* Adjust as needed */
-fx-fill: #ccc;
-fx-stroke: #ccc;
-fx-stroke-width: 4px;
-fx-min-width: 100px;
-fx-max-width: 200px;
-fx-min-height: 2px;
-fx-max-height: 2px;
}

2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<stylesheets>
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
<URL value="@Form.css" />/
<URL value="@Form.css" />
</stylesheets>

<VBox>
Expand Down
Loading
Loading