Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eivind branch #20

Open
wants to merge 83 commits into
base: main
Choose a base branch
from
Open
Changes from 14 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
93679e1
backend is ... in existence
paglenn Jul 3, 2023
4a64617
Merge pull request #1 from StabRabbit41/paul-backend-fix
JasonY000 Jul 4, 2023
5f836f6
initial frontend possible webpack issue
morahgeist Jul 4, 2023
69fe8f6
created userCreate and tests
paglenn Jul 5, 2023
0769e8b
delete user functionality and associated testing
paglenn Jul 5, 2023
8d256d3
Merge pull request #2 from StabRabbit41/paul-user-create
paglenn Jul 5, 2023
be45089
working website
EivindDelFierro Jul 5, 2023
c4b2b6d
working website
EivindDelFierro Jul 5, 2023
d1b0f71
merged tests
EivindDelFierro Jul 5, 2023
e599aa6
Co-authored-by: Morah Geist <morahgeist@users.noreply.github.com>
EivindDelFierro Jul 5, 2023
f395c8b
fixed package.json
EivindDelFierro Jul 5, 2023
4587ce8
user-auth-tests
paglenn Jul 5, 2023
6ed98e1
Merge branch 'dev' into paul-user-auth-tests
paglenn Jul 5, 2023
393faa5
completed authUser in userController
JasonY000 Jul 5, 2023
81add06
Merge pull request #4 from StabRabbit41/paul-user-auth-tests
dianemoon Jul 5, 2023
e625af4
Merge branch 'dev' into jasonBranch
JasonY000 Jul 5, 2023
74eeacd
authUser passed tests
JasonY000 Jul 5, 2023
b5942b7
Merge pull request #5 from StabRabbit41/jasonBranch
paglenn Jul 5, 2023
c143232
test for adding favorites
paglenn Jul 5, 2023
5804543
Added the addFavorite middleware in userController. Added the patch r…
dianemoon Jul 5, 2023
5673306
communicating with server, working menu, cards rendering
EivindDelFierro Jul 5, 2023
e37405b
Merge pull request #6 from StabRabbit41/paul-favorite-test
paglenn Jul 5, 2023
a8c3d6a
test passes for addFavorite
dianemoon Jul 5, 2023
753d84c
Merge pull request #7 from StabRabbit41/diane-branch
JasonY000 Jul 5, 2023
d41b335
creating middleware for server.js, stepping away for lunch
dianemoon Jul 5, 2023
b9e4afb
added cors and some statuses
paglenn Jul 5, 2023
3ba2d14
Merge pull request #8 from StabRabbit41/paul-cors-and-status
EivindDelFierro Jul 5, 2023
b3b07c4
updated header files
EivindDelFierro Jul 5, 2023
c4739a0
Merge branch 'dev' into Eivind-branch
EivindDelFierro Jul 5, 2023
7c17ff2
Merge pull request #9 from StabRabbit41/Eivind-branch
paglenn Jul 5, 2023
330a1d8
staged
EivindDelFierro Jul 5, 2023
3745565
Merge branch 'dev' into Eivind-branch
EivindDelFierro Jul 5, 2023
c2e3ca4
Merge pull request #10 from StabRabbit41/Eivind-branch
dianemoon Jul 5, 2023
2a7e276
im not sure abotu this commit
dianemoon Jul 5, 2023
3dd2d31
Merge branch 'dev' into Diane-branch
dianemoon Jul 5, 2023
047e229
update
JasonY000 Jul 5, 2023
1722c92
Created base login/signup and welcomescreen app
EivindDelFierro Jul 5, 2023
497b143
backend request for html
paglenn Jul 5, 2023
ee1db56
routed to correct file WelcomeScreen
paglenn Jul 5, 2023
1749187
both routes
paglenn Jul 5, 2023
828c4b6
fixed css parsing error
JasonY000 Jul 5, 2023
ecb939e
Merge pull request #11 from StabRabbit41/paul-backend-hookup
dianemoon Jul 5, 2023
3797f91
'merge webpack fix with dev'
JasonY000 Jul 5, 2023
8c0b747
Merge pull request #12 from StabRabbit41/jasonBranch
paglenn Jul 5, 2023
16b3503
menuContainerTest created
dianemoon Jul 5, 2023
283fdf0
Working login and signup
EivindDelFierro Jul 5, 2023
1894d97
menuContainerTest
dianemoon Jul 5, 2023
88d9707
Merge branch 'dev' into Eivind-Branch.
EivindDelFierro Jul 5, 2023
8b9caab
Merge pull request #13 from StabRabbit41/Eivind-Branch
dianemoon Jul 5, 2023
4d58730
yea
dianemoon Jul 5, 2023
9874a41
Merge branch 'dev' into Diane-branch
dianemoon Jul 5, 2023
f06b3cf
login component
EivindDelFierro Jul 5, 2023
a2788c4
mg initial styles
morahgeist Jul 6, 2023
ae2355b
Co-authored-by: EivindDelFierro <EivindDelFierro@users.noreply.github…
morahgeist Jul 6, 2023
05dc01d
mg redone styles with fav icon and favorites menu item
morahgeist Jul 6, 2023
7caea2f
beginning of last day of iteration project
dianemoon Jul 6, 2023
e899910
improved exercise menu logic
EivindDelFierro Jul 6, 2023
8e15a97
mg fav menu changed to btn
morahgeist Jul 6, 2023
8f55108
Merge pull request #14 from StabRabbit41/mg-styles
EivindDelFierro Jul 6, 2023
13b8e11
overlay working
morahgeist Jul 6, 2023
017fe10
Merge pull request #15 from StabRabbit41/mg-styles
EivindDelFierro Jul 6, 2023
d919ce9
Merge branch 'dev' into Eivind-Branch
EivindDelFierro Jul 6, 2023
fe95698
Merge pull request #16 from StabRabbit41/Eivind-Branch
EivindDelFierro Jul 6, 2023
8e2217b
logout functionality
paglenn Jul 6, 2023
271e72b
Merge pull request #17 from StabRabbit41/paul-logout
EivindDelFierro Jul 6, 2023
04e023a
Updated favorites buttons logic
EivindDelFierro Jul 6, 2023
23dc2a2
Merge branch 'dev' into Eivind-branch
EivindDelFierro Jul 6, 2023
bf7d869
Merge branch 'dev' into diane-branch
paglenn Jul 6, 2023
b8ea53a
Merge pull request #18 from StabRabbit41/diane-branch
paglenn Jul 6, 2023
4ec74c2
Merge branch 'dev' into Eivind-branch
EivindDelFierro Jul 6, 2023
188c33b
mg login screen and change font
morahgeist Jul 6, 2023
3eb1598
semi-working favorites render
EivindDelFierro Jul 6, 2023
6d797eb
Merge branch 'dev' into mg-styles
paglenn Jul 6, 2023
8d133bb
Merge pull request #19 from StabRabbit41/mg-styles
paglenn Jul 6, 2023
4aa6102
working timer
morahgeist Jul 6, 2023
36f10ff
add fade to welcome screen
EivindDelFierro Jul 6, 2023
70fa28d
Co-authored-by: Paul Glenn <paglenn@users.noreply.github.com>
EivindDelFierro Jul 6, 2023
8c7bdae
Merge pull request #20 from StabRabbit41/Eivind-branch
paglenn Jul 6, 2023
de8abf2
Merge branch 'dev' into mgTimer
EivindDelFierro Jul 6, 2023
caf10af
Merge pull request #21 from StabRabbit41/mgTimer
EivindDelFierro Jul 6, 2023
fe81918
fixed some styles and stretch logic
EivindDelFierro Jul 6, 2023
d6f076a
Merge branch 'dev' into Eivind-branch
EivindDelFierro Jul 6, 2023
79b5957
Clock has full functionality
EivindDelFierro Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Client/App.jsx
Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@

import React from 'react';
import HeaderContainer from './containers/HeaderContainer.jsx';
import TimerContainer from './containers/TimerContainer.jsx';
// import TimerContainer from './containers/TimerContainer.jsx';
import MenuContainer from './containers/MenuContainer.jsx';
import StretchContainer from './containers/StretchContainer.jsx';
import './stylesheets/styles.css';
import './stylesheets/application.scss';

// Init func app that returns our main containers
const App = () => {
return (
<div className='mainApp'>
<div className="mainApp">
<HeaderContainer />
{/* <TimerContainer /> */}
<MenuContainer />
11 changes: 5 additions & 6 deletions Client/actionCreator/actionCreator.js
Original file line number Diff line number Diff line change
@@ -7,15 +7,14 @@ export const updateExercisesFromAPI = (array) => ({

export const updateUSER_LOG_ON = (userObj) => ({
type: types.USER_LOG_ON,
payload: userObj
})
payload: userObj,
});

export const updateUSER_LOG_OFF = () => ({
type: types.USER_LOG_OFF,
payload: 'probably none'
})
});

export const updateDifficultyAndMuscle = ([muscle, difficulty]) => ({
type: types.UPDATE_MUSCLE_DIFFICULTY,
payload: [muscle, difficulty]
})
payload: [muscle, difficulty],
});
22 changes: 22 additions & 0 deletions Client/components/LabeledText.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* ************************************
*
* @module LabeledText
* @author
* @date
* @description Simple presentation component that shows a bold label next to plain text
*
* ************************************
*/

import React from 'react';
import '../stylesheets/application.scss';

const LabeledText = ({ label, text }) => (
<p>
<strong>{`${label}: `}</strong>
{text}
</p>
);

export default LabeledText;
40 changes: 35 additions & 5 deletions Client/components/Stretch.jsx
Original file line number Diff line number Diff line change
@@ -10,23 +10,53 @@
*/

import React from 'react';
import { Link } from 'react-router-dom';
import LabeledText from './LabeledText.jsx';
import { FontAwesomeIcon as FAIcon } from '@fortawesome/react-fontawesome';
import { faStar as solidStar } from '@fortawesome/free-solid-svg-icons';
import { faStar as regStar } from '@fortawesome/free-regular-svg-icons';

const Stretch = (props) => {
props = props.exercises;
// insert any logic for the Stretch here
let FavIcon;

// if (fav)
// FavIcon = (
// <span className="favIcon">
// <FAIcon
// onClick={() => props.favClicked(id)}
// icon={solidStar}
// style={{ color: '#ff7300' }}
// />
// </span>
// );
// else
// FavIcon = (
// <span className="favIcon">
// <FAIcon onClick={() => props.favClicked(id)} icon={regStar} />
// </span>;
// );

// return stretch component with passed-in props from query to server
return (
<div className='stretchCard'>
<h3>{props.name}</h3>
<div className="stretchCard">
<div className="cardHeadBox">
<h3 className="cardHeader">{props.name}</h3>
{/* need logic to make Fav Icon then comment this back in and delete other */}
<span className="favIcon">
<FAIcon onClick={() => props.favClicked(id)} icon={regStar} />
</span>
</div>
<ul>
<li>
<strong>Equipment:</strong> {props.equipment}
<LabeledText label="Equipment" text={props.equipment} />
</li>
<li>
<strong>Difficulty:</strong> {props.difficulty}
<LabeledText label="Difficulty" text={props.difficulty} />
</li>
<li>
<strong>Instructions:</strong> {props.instructions}
<LabeledText label="Instructions" text={props.instructions} />
</li>
</ul>
</div>
98 changes: 51 additions & 47 deletions Client/components/login.jsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
import React from 'react';
import { useDispatch } from 'react-redux';
import * as actions from '../actionCreator/actionCreator.js'
import * as actions from '../actionCreator/actionCreator.js';

const login = () => {
const dispatch = useDispatch();

const loginFunc = (event) => {
event.preventDefault()
const un = document.getElementById('usernameLogin').value;
const pw = document.getElementById('passwordLogin').value;

const loginObj = {
username : un,
password : pw
const dispatch = useDispatch();

const loginFunc = (event) => {
event.preventDefault();
const un = document.getElementById('usernameLogin').value;
const pw = document.getElementById('passwordLogin').value;

const loginObj = {
username: un,
password: pw,
};

console.log(loginObj);

fetch('http://localhost:3000/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(loginObj),
})
.then((data) => data.json())
.then((data) => {
if (!data.err) {
console.log(data);
// Do something
// change logged in user state with the returned userState
dispatch(actions.updateUSER_LOG_ON(data));

// disable opacity
document.getElementById('overlay').style.display = 'none';
} else {
alert(data.err);
}
})
.catch((error) => alert('Invalid Username/Password'));
};

return (
<div>
<form>
<input type='text' id='usernameLogin' placeholder='Username'></input>
<input
type='password'
id='passwordLogin'
placeholder='Password'
></input>
<button onClick={(event) => loginFunc(event)}>Login</button>
</form>
</div>
);
};

console.log(loginObj)

fetch('http://localhost:3000/login', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(loginObj)
})
.then( data => data.json())
.then( data => {
if (!data.err) {
console.log(data)
// Do something
// change logged in user state with the returned userState
dispatch(actions.updateUSER_LOG_ON(data))

// disable opacity
document.getElementById("overlay").style.display = 'none'
} else {
alert(data.err)
}
})
.catch(error => alert(error))
}

return(
<div>
<form>
<input type='text' id='usernameLogin' placeholder='Username'></input>
<input type='password' id='passwordLogin' placeholder='Password'></input>
<button onClick={event => loginFunc(event)}>Login</button>
</form>
</div>
)
}

export default login;
export default login;
88 changes: 48 additions & 40 deletions Client/components/signup.jsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
import React from 'react';
import { useDispatch } from 'react-redux'
import * as actions from '../actionCreator/actionCreator.js'
import { useDispatch } from 'react-redux';
import * as actions from '../actionCreator/actionCreator.js';

const signup = () => {
const dispatch = useDispatch();
const dispatch = useDispatch();

const signupFunc = (event) => {
event.preventDefault();
const username = document.getElementById('usernameSignup').value;
const password1 = document.getElementById('passwordSignup').value;
const password2 = document.getElementById('passwordSignupConfirm').value;
const signupFunc = (event) => {
event.preventDefault();
const username = document.getElementById('usernameSignup').value;
const password1 = document.getElementById('passwordSignup').value;
const password2 = document.getElementById('passwordSignupConfirm').value;

// check if passwords match
if (password1 !== password2) {
return alert("Sign up passwords do not match");
}

fetch('http://localhost:3000/user', {
method: "POST",
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username, password: password1})
})
.then( data => data.json())
.then( data => {
// if there is an error object
if (data.err) alert(data.err);
// update logged in user
dispatch(actions.updateUSER_LOG_ON(data));
// disable opacity
document.getElementById("overlay").style.display = 'none'
})
.catch(error => alert(error));
// check if passwords match
if (password1 !== password2) {
return alert('Sign up passwords do not match');
}

return (
<div>
<form>
<input type='text' id='usernameSignup' placeholder='Username'></input>
<input type='password' id='passwordSignup' placeholder='Password'></input>
<input type='password' id='passwordSignupConfirm' placeholder='Confirm Password'></input>
<button onClick={event => signupFunc(event)}>Login</button>
</form>
</div>
)
}
fetch('http://localhost:3000/user', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password: password1 }),
})
.then((data) => data.json())
.then((data) => {
// if there is an error object
if (data.err) alert(data.err);
// update logged in user
dispatch(actions.updateUSER_LOG_ON(data));
// disable opacity
document.getElementById('overlay').style.display = 'none';
})
.catch((error) => alert(error));
};

return (
<div>
<form>
<input type="text" id="usernameSignup" placeholder="Username"></input>
<input
type="password"
id="passwordSignup"
placeholder="Password"
></input>
<input
type="password"
id="passwordSignupConfirm"
placeholder="Confirm Password"
></input>
<button onClick={(event) => signupFunc(event)}>Sign Up</button>
</form>
</div>
);
};

export default signup
export default signup;
14 changes: 14 additions & 0 deletions Client/components/star-style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.star_true {
/* represents on state */
color: #d4af37;
}

.star_false {
/* represents off state */
color: black;
}

.star-button {
background: none;
border: none;
}
12 changes: 11 additions & 1 deletion Client/containers/HeaderContainer.jsx
Original file line number Diff line number Diff line change
@@ -11,12 +11,22 @@

import React from 'react';
import * as actions from '../actionCreator/actionCreator.js';
import { useDispatch } from 'react-redux';

const HeaderContainer = () => {
const dispatch = useDispatch();

const logoutHandler = () => {
dispatch(actions.updateUSER_LOG_OFF());
document.getElementById('overlay').style.display = 'block';
};

return (
<div className='appHeaderBox'>
<h4 className='mainHeader'>Stretch</h4>
<button>Logout</button>
<button onClick={logoutHandler} className='logoutBtn'>
Logout
</button>
</div>
);
};
Loading