Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2223S2#65 from nerdyboy98/master
Browse files Browse the repository at this point in the history
Updated UI text and added new Help Classes
  • Loading branch information
nerdyboy98 authored Mar 14, 2023
2 parents f1063e8 + 45f43e0 commit 4cac66c
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class HelpCommand extends Command {
+ "help tutorial\n"
+ "help lab\n"
+ "help consultation";

@Override
public CommandResult execute(Model model) {
return new CommandResult(HELP_CATEGORIES);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package seedu.address.logic.commands;

import seedu.address.model.Model;

/**
* Help instruction for Consultation command
*/
public class HelpConsultationCommand extends HelpCommand {

public static final String COMMAND_WORD = "help consultation";

public static final String CONSULTATION_SYNTAX = "Consultation Input Format:\n"
+ "touch recur [name] Consultations [day] [time] [duration] [period]";

@Override
public CommandResult execute(Model model) {
return new CommandResult(CONSULTATION_SYNTAX);
}
}
19 changes: 19 additions & 0 deletions src/main/java/seedu/address/logic/commands/HelpLabCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package seedu.address.logic.commands;

import seedu.address.model.Model;

/**
* Help instruction for Lab command
*/
public class HelpLabCommand extends HelpCommand {

public static final String COMMAND_WORD = "help lab";

public static final String LAB_SYNTAX = "Labs Input Format:\n"
+ "touch recur [name] Labs [day] [time] [duration] [period] ";

@Override
public CommandResult execute(Model model) {
return new CommandResult(LAB_SYNTAX);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package seedu.address.logic.commands;

import seedu.address.model.Model;

/**
* Help instruction for Tutorial command
*/
public class HelpTutorialCommand extends HelpCommand {

public static final String COMMAND_WORD = "help tutorial";

public static final String TUTORIAL_SYNTAX = "Tutorial Input Format:\n"
+ "touch recur [name] Tutorials [day] [time] [duration] [period] ";

@Override
public CommandResult execute(Model model) {
return new CommandResult(TUTORIAL_SYNTAX);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Command parseCommand(String userInput) throws ParseException {
return new ExitCommand();

case HelpCommand.COMMAND_WORD:
return new HelpCommand();
return new HelpCommandParser().parse(arguments);

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/seedu/address/logic/parser/HelpCommandParser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package seedu.address.logic.parser;

import seedu.address.logic.commands.HelpCommand;
import seedu.address.logic.commands.HelpConsultationCommand;
import seedu.address.logic.commands.HelpLabCommand;
import seedu.address.logic.commands.HelpTutorialCommand;
import seedu.address.logic.parser.exceptions.ParseException;

/**
* Parses input arguments and creates a new HelpCommand, HelpTutorialCommand,
* HelpLabCommand or HelpConsultationCommand object
*/
public class HelpCommandParser {
/**
* Parses the given {@code String} of arguments in the context of the HelpCommand
* and returns an HelpCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/

public HelpCommand parse(String args) {
if (args.equals(" tutorial")) {
return new HelpTutorialCommand();
} else if (args.equals(" lab")) {
return new HelpLabCommand();
} else if (args.equals(" consultation")) {
return new HelpConsultationCommand();
} else {
return new HelpCommand();
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class HelpWindow extends UiPart<Stage> {

public static final String USERGUIDE_URL = "https://github.com/AY2223S2-CS2103-F11-1/tp";
public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL;
public static final String HELP_MESSAGE = "URL: " + USERGUIDE_URL;

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
private static final String FXML = "HelpWindow.fxml";
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/HelpWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.stage.Stage?>

<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<fx:root resizable="false" title="User Guide" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>

<fx:root minHeight="800" minWidth="900" onCloseRequest="#handleExit" title="Address App" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<fx:root minHeight="800" minWidth="900" onCloseRequest="#handleExit" title="TrAcker" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand All @@ -32,7 +32,7 @@
<MenuItem mnemonicParsing="false" onAction="#handleExit" text="Exit" />
</Menu>
<Menu mnemonicParsing="false" text="Help">
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" />
<MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="User Guide"/>
</Menu>
</MenuBar>
<HBox prefHeight="0.0" prefWidth="340.0" style="-fx-background-color: transparent;">
Expand Down

0 comments on commit 4cac66c

Please sign in to comment.