Skip to content

Commit

Permalink
Implement the Welcome Page
Browse files Browse the repository at this point in the history
  • Loading branch information
ALEEF02 committed Nov 11, 2022
1 parent ffafbce commit 39b9ee0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
22 changes: 17 additions & 5 deletions MavenBack/src/main/java/ppp/staticServe/MainServe.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

@WebServlet("") // Disable until future need
public class MainServe extends HttpServlet {
Expand All @@ -15,11 +16,22 @@ public class MainServe extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

try {

RequestDispatcher view = request.getRequestDispatcher("/index.html"); // The static HTML file to serve.
response.setHeader("Cache-Control", "max-age=86400, public"); // 1 day
System.out.println(view.toString());
view.forward(request, response);
if (request.getSession().getAttribute("new") == null && request.getSession().getAttribute("email") == null) {
// Freshly created.
RequestDispatcher view = request.getRequestDispatcher("/home.html"); // The static HTML file to serve.
response.setHeader("Cache-Control", "no-store, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
System.out.println(view.toString());
view.forward(request, response);
} else {
// Already created.
RequestDispatcher view = request.getRequestDispatcher("/index.html"); // The static HTML file to serve.
response.setHeader("Cache-Control", "max-age=86400, public"); // 1 day
System.out.println(view.toString());
view.forward(request, response);
}
request.getSession().setAttribute("new", false);
return;

} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions MavenBack/src/main/webapp/baseStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ p, h1, th, td {color: white;}

.navBar{
overflow: hidden;
background-color: #5A5A5A;
/*background-color: #5A5A5A;*/
background-color: #333335;
width: 100%;
}
.navBar a{
Expand All @@ -61,7 +62,6 @@ p, h1, th, td {color: white;}
}
.navBar a.left{float:left;}
.navBar a:hover{
/*background-color: #7fa751;*/
background-color: #8c463d;
}

Expand Down
15 changes: 7 additions & 8 deletions MavenBack/src/main/webapp/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,26 @@
<link rel="preconnect" href="https://www.google-analytics.com">
-->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="apple-touch-icon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="images/apple-touch-icon.png">

<link rel="stylesheet" type="text/css" href="baseStyle.css">
<link rel="stylesheet" type="text/css" href="homeStyle.css">
<title>PingPongPage</title>
</head>
<body>

<div class = "navBar" style="background-color: #232325;">
<a href = "#" class = "left" style="color: #f95a42;"> The Ping Pong Page</a>
<a id="userButton" href="/login">...</a> <!--Leads to user page to display user name, stats, etc.-->
<div class = "navBar" role="navigation" aria-label="Main">
<a href = "#" class = "left" style="color: #f95a42;">The Ping Pong Page</a>
<a id="userButton" href="/login">Login</a> <!--Leads to user page to display user name, stats, etc.-->
<a href = "/games">Manage Your Games</a> <!--Leads to seprate page for ppl to register their games-->
</div>
<div class = "welcomeContainer">
<h1>Welcome to the Ping Pong Page.</h1>
<p id = "descript">Join the ranks. Beat your friends. Get good kid.</p>
</div>
<div class = "links">
<p class = "learn" href= "/qa">Learn More ></p>
<p>Play Pong ></p>
<a href= "/qa"><p class = "learn">What is this? ></p></a>
<a href= "."><p>Play Pong ></p></a>
</div>
</body>
</html>
Expand Down
12 changes: 6 additions & 6 deletions MavenBack/src/main/webapp/homeStyle.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

h1{
text-align: center;
font-size: 6.5vw;
Expand All @@ -8,25 +7,27 @@ h1{
p{
text-align: center;
color: white;


}

.links{
display: flex;
color: #f95a42;
flex-direction: row;
align-items:center;
justify-content: space-around;
}
.learn{


.links div a p, .links a:visited p {
color: #f95a42;
}

.welcomeContainer{
color: white;
margin-top: 8%;
margin-left: 25%;
margin-right: 25%;
}

body p{
color: inherit;
}
Expand All @@ -36,6 +37,5 @@ body p{
/*margin-left: 20%;
margin-right: 20%;*/
flex-direction: column;

}
}
11 changes: 3 additions & 8 deletions MavenBack/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<link rel="preconnect" href="https://www.google-analytics.com">
-->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="apple-touch-icon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="images/apple-touch-icon.png">

<link rel="stylesheet" type="text/css" href="baseStyle.css">
<link rel="stylesheet" type="text/css" href="style.css">
Expand Down Expand Up @@ -195,13 +195,8 @@
</head>
<body>

<<<<<<< HEAD
<div class = "navBar">
<a href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" class = "left">The Ping Pong Page</a>
=======
<div class = "navBar" role="navigation" aria-label="Main">
<a href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" class = "left">Welcome to the UCC Ping Pong Page!</a>
>>>>>>> 94ba371b477767d8193ad085944fc1d0d1ffb2cf
<a href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" class = "left">The Ping Pong Page</a>
<a id="userButton" href="/login">...</a> <!--Leads to user page to display user name, stats, etc.-->
<a href = "/games">Manage Your Games</a> <!--Leads to seprate page for ppl to register their games-->
</div>
Expand Down
6 changes: 6 additions & 0 deletions MavenBack/src/main/webapp/qaa.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
<a id="userButton" href="/login">...</a> <!--Leads to user page to display user name, stats, etc.-->
<a href = "/games">Manage Your Games</a> <!--Leads to seprate page for ppl to register their games-->
</div>

<h1>What is this?</h1>
<div style="margin: 10px;">
<p>Imagine like chess.com, but instead of playing online, you play ping pong in the UCC Bridge & you log your scores here. Then, we'll generate ratings based off those games :D
</p>
</div>

<h1>What are the rules to play games?</h1>
<div style="margin: 10px;">
Expand Down

0 comments on commit 39b9ee0

Please sign in to comment.