Skip to content

Commit

Permalink
Add more details of functions in help window and make it scrollable i…
Browse files Browse the repository at this point in the history
…f text exceeds help window
  • Loading branch information
atjy5421 committed Oct 8, 2024
1 parent 0c7e94b commit 9fcd82c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
28 changes: 24 additions & 4 deletions src/main/java/seedu/address/ui/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.stage.Stage;
Expand All @@ -16,7 +16,25 @@
public class HelpWindow extends UiPart<Stage> {

public static final String USERGUIDE_URL = "https://se-education.org/addressbook-level3/UserGuide.html";
public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL;
public static final String HELP_MESSAGE = "Welcome to the AcademyAssist Help Window!\n\n"
+ "Here are some useful commands to get started:\n\n"
+ "1. add: Adds a student's details\n"
+ " Format: add n/NAME ic/IC_NUMBER e/EMAIL p/PHONE_NUMBER a/ADDRESS c/CLASS y/ACADEMIC_YEAR\n\n"
+ "2. view: Shows a list of all students\n"
+ " Format: view\n\n"
+ "3. edit: Edits an existing student's details\n"
+ " Format: edit STUDENT_ID FIELD:NEW_VALUE\n\n"
+ "4. find: Find students whose names contain any of the given keywords\n"
+ " Format: find KEYWORD [MORE_KEYWORDS]\n\n"
+ "5. delete: Deletes the specified student\n"
+ " Format: del STUDENT_ID\n\n"
+ "6. sort: arranges the list of students based on a specified field\n"
+ " Format: sort FIELD\n\n"
+ "7. clear: Clears all entries from the address book\n"
+ " Format: clear\n\n"
+ "8. exit: Exits the program\n"
+ " Format: exit\n\n"
+ "For more detailed information, please refer to the user guide: " + USERGUIDE_URL;

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
private static final String FXML = "HelpWindow.fxml";
Expand All @@ -25,7 +43,7 @@ public class HelpWindow extends UiPart<Stage> {
private Button copyButton;

@FXML
private Label helpMessage;
private TextArea helpMessageArea;

/**
* Creates a new HelpWindow.
Expand All @@ -34,7 +52,9 @@ public class HelpWindow extends UiPart<Stage> {
*/
public HelpWindow(Stage root) {
super(FXML, root);
helpMessage.setText(HELP_MESSAGE);
helpMessageArea.setText(HELP_MESSAGE);
helpMessageArea.setWrapText(true);
helpMessageArea.setEditable(false);

Check warning on line 57 in src/main/java/seedu/address/ui/HelpWindow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/ui/HelpWindow.java#L55-L57

Added lines #L55 - L57 were not covered by tests
}

/**
Expand Down
18 changes: 15 additions & 3 deletions src/main/resources/view/HelpWindow.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#copyButton, #helpMessage {
-fx-text-fill: white;
.root {
-fx-background-color: derive(#1d1d1d, 20%);
}

#copyButton {
-fx-background-color: dimgray;
-fx-text-fill: white;
}

#copyButton:hover {
Expand All @@ -14,6 +15,17 @@
-fx-background-color: darkgray;
}

#helpMessageContainer {
#helpMessageArea {
-fx-background-color: derive(#1d1d1d, 20%);
-fx-text-fill: white;
-fx-font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
-fx-font-size: 14px;
}

#helpMessageArea .content {
-fx-background-color: derive(#1d1d1d, 20%);
}

#helpMessageArea:focused .content {
-fx-background-color: derive(#1d1d1d, 20%);
}
31 changes: 10 additions & 21 deletions src/main/resources/view/HelpWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>

<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<fx:root resizable="true" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
Expand All @@ -19,26 +19,15 @@
<URL value="@HelpWindow.css" />
</stylesheets>

<HBox alignment="CENTER" fx:id="helpMessageContainer">
<children>
<Label fx:id="helpMessage" text="Label">
<HBox.margin>
<Insets right="5.0" />
</HBox.margin>
</Label>
<Button fx:id="copyButton" mnemonicParsing="false" onAction="#copyUrl" text="Copy URL">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Button>
</children>
<opaqueInsets>
<Insets bottom="10.0" left="5.0" right="10.0" top="5.0" />
</opaqueInsets>
<VBox alignment="CENTER" spacing="10">
<padding>
<Insets bottom="10.0" left="5.0" right="10.0" top="5.0" />
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</HBox>
<children>
<TextArea fx:id="helpMessageArea" editable="false" wrapText="true" VBox.vgrow="ALWAYS" />
<Button fx:id="copyButton" mnemonicParsing="false" onAction="#copyUrl" text="Copy URL" />
</children>
</VBox>
</Scene>
</scene>
</fx:root>

0 comments on commit 9fcd82c

Please sign in to comment.