Code fixes to make menus more unified

This commit is contained in:
Lucas Patenaude
2024-04-24 18:46:31 -06:00
parent e5ac576391
commit 77b33a0606
10 changed files with 37 additions and 18 deletions

View File

@@ -162,7 +162,7 @@ app.get('/', (req, res) => {
// Render login page for /login route
app.get('/login', (req, res) => {
res.render('pages/home');
res.render('/');
});
// Trigger login form to check database for matching username and password
@@ -182,7 +182,7 @@ app.post('/login', async (req, res) => {
// Check if match returns no data
if (!match) {
// Render the login page with the message parameter
return res.render('pages/home', { message: 'Password does not match' });
return res.render('/', { message: 'Password does not match' });
}
else{
// Save user information in the session variable
@@ -190,7 +190,7 @@ app.post('/login', async (req, res) => {
req.session.save();
// Redirect user to the home page
res.redirect('/home');
res.redirect('/');
}
} catch (error) {
// Direct user to login screen if no user is found with matching password
@@ -204,7 +204,7 @@ app.post('/login', async (req, res) => {
// Render registration page for /register route
app.get('/register', (req, res) => {
res.render('pages/register');
res.redirect('/');
});
// Trigger Registration Form to Post
@@ -259,8 +259,6 @@ app.get('/logout', (req, res) => {
});
});
/************************
League Page Routes
*************************/

View File

@@ -0,0 +1,3 @@
#account-pane {
display: none;
}

View File

@@ -1,4 +1,4 @@
#login-page {
#login-pane {
display: none;
}

View File

@@ -1,6 +1,7 @@
/* Standardized Styling for Login, Registration, and Account Panes */
.account-portal-container {
width: 400px;
height: 408px;
position: absolute;
top: 150px; /* Adjust this value as needed */
right: 20px; /* Adjust this value as needed */
@@ -10,7 +11,12 @@
border: 1px solid gray;
}
/* Set Login and Registration Panes to be same size */
#login-pane, #register-pane {
height: 408px;
}
/* */
.form-container {
width: 70%; /* Adjust width as needed */
margin: 0 auto; /* Center horizontally */

View File

@@ -5,10 +5,10 @@ $(document).ready(function() {
$('#register-screen-container').hide();
// Toggle the visibility of the login container
$('#login-page').toggle();
$('#login-pane').toggle();
});
$('#register-page-login-button').click(function() {
$('#register-page-login-button').click(function (event) {
event.preventDefault(); // Prevent the default action of following the link
$('#register-screen-container').hide();
@@ -27,4 +27,15 @@ $(document).ready(function () {
// Show the register container
$('#register-screen-container').show();
});
});
$(document).ready(function() {
// When #user is clicked
$('#user-profile-button').click(function() {
// Toggle the visibility of the login container
$('#account-pane').toggle();
});
});

View File

@@ -13,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/navigation-bar.css">
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/login.css">
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/registration.css">
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/account.css">
<!-- Scoreboard Header Stylesheets -->
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/scoreboard-header/scoreboard.css">

View File

@@ -57,15 +57,15 @@
</nav>
{{#if user.username}}
<div class="account-portal" id="login-screen-container">
{{> navigation-bar/account-screen}}
<div class="account-portal" id="account-screen-container">
{{> navigation-bar/user-menu/account-screen}}
</div>
{{else}}
<div class="account-portal" id="login-account-container">
{{> navigation-bar/login}}
{{> navigation-bar/user-menu/login}}
</div>
{{/if}}
<div class="account-portal" id="register-screen-container">
{{> navigation-bar/register}}
{{> navigation-bar/user-menu/register}}
</div>

View File

@@ -1,5 +1,5 @@
<!-- Linking forms.css -->
<div class="account-portal-container" id="login-page">
<div class="account-portal-container" id="account-pane">
<div class="form-container" id="login-form">
<a id="username">Username: {{user.username}}</a>
@@ -11,7 +11,7 @@
<span>{{this.teamname}}</span> <br>
{{/each}}
<a class="nav-link" href="/logout">Logout</a>
<a class="account-portal-button" id="logout-button" href="/logout">Logout</a>
</div>
</div>

View File

@@ -1,5 +1,5 @@
<!-- Linking forms.css -->
<div class="account-portal-container" id="login-page">
<div class="account-portal-container" id="login-pane">
<div class="form-container" id="login-form">
<h1 class="mt-5 mb-4">Login</h1>

View File

@@ -1,4 +1,4 @@
<div class="account-portal-container" id="register-page">
<div class="account-portal-container" id="register-pane">
<div class="form-container">
<h1 class="mt-5 mb-4">Register</h1>