Skip to content

Commit

Permalink
Merge pull request AY2425S1-CS2103T-T11-2#85 from Incogdino/branch-up…
Browse files Browse the repository at this point in the history
…dateHelpCommand

Add open URL button to help page
  • Loading branch information
Incogdino authored Oct 16, 2024
2 parents 156da9a + 9ffc376 commit c98104b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
21 changes: 19 additions & 2 deletions src/main/java/seedu/address/ui/HelpWindow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package seedu.address.ui;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.logging.Logger;

import javafx.fxml.FXML;
Expand All @@ -15,15 +19,17 @@
*/
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 USERGUIDE_URL = "https://ay2425s1-cs2103t-t11-2.github.io/tp/UserGuide.html";
public static final String HELP_MESSAGE = "Please refer to the user guide: " + USERGUIDE_URL;

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
private static final String FXML = "HelpWindow.fxml";

@FXML
private Button copyButton;

@FXML
private Button openLinkButton;
@FXML
private Label helpMessage;

Expand Down Expand Up @@ -99,4 +105,15 @@ private void copyUrl() {
url.putString(USERGUIDE_URL);
clipboard.setContent(url);
}

/**
* Launches the URL of the user guide in the user's console
*
* @throws URISyntaxException
* @throws IOException
*/
@FXML
private void openUrl() throws URISyntaxException, IOException {
Desktop.getDesktop().browse(new URI(USERGUIDE_URL));
}
}
22 changes: 18 additions & 4 deletions src/main/resources/view/HelpWindow.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
#copyButton, #helpMessage {
#copyButton, #openLinkButton {
-fx-text-fill: white;
-fx-min-width: 80px;
}

#copyButton {
#helpMessage {
-fx-text-fill: white;
-fx-min-width: 100px;
}

#copyButton , #openLinkButton {
-fx-background-color: dimgray;
}

#copyButton:hover {
#copyButton:hover , #openLinkButton:hover {
-fx-background-color: gray;
-fx-border-color: white;
-fx-border-width: 0.5px;
}

#copyButton:focused , #openLinkButton:focused {
-fx-background-color: gray;
-fx-border-color: white;
-fx-border-width: 0.5px;
}

#copyButton:armed {
#copyButton:focused:armed , #openLinkButton:focused:armed {
-fx-background-color: darkgray;
}

Expand Down
9 changes: 7 additions & 2 deletions 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/17" xmlns:fx="http://javafx.com/fxml/1">
<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
Expand All @@ -19,7 +19,7 @@
<URL value="@HelpWindow.css" />
</stylesheets>

<HBox alignment="CENTER" fx:id="helpMessageContainer">
<HBox fx:id="helpMessageContainer" alignment="CENTER">
<children>
<Label fx:id="helpMessage" text="Label">
<HBox.margin>
Expand All @@ -31,6 +31,11 @@
<Insets left="5.0" />
</HBox.margin>
</Button>
<Button fx:id="openLinkButton" mnemonicParsing="false" onAction="#openUrl" text="Open 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" />
Expand Down

0 comments on commit c98104b

Please sign in to comment.