-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
865 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { withRouter } from 'react-router-dom'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
|
||
const ConfirmationPage = ({ history }) => { | ||
const user = JSON.parse(localStorage.getItem('AuthorsHavenUser')); | ||
|
||
const checkVerification = () => { | ||
if (user && user.isVerified) { | ||
history.push('/homepage'); | ||
} else if (!user) { | ||
history.push('/'); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{checkVerification()} | ||
<div> | ||
<h3>Congratulations</h3> | ||
<p> | ||
You have been sent an email, please click on the link in your email to verify your account | ||
</p> | ||
<p> if you dont receive the email click here to be resent the email</p> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
ConfirmationPage.propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
}; | ||
export default withRouter(ConfirmationPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,67 @@ | ||
import React from 'react'; | ||
import { withRouter } from 'react-router-dom'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import Banner from './Banner/Banner'; | ||
import NovelOfTheWeek from './NovelOfTheWeek/NovelOfTheWeek'; | ||
import './landingPage.scss'; | ||
|
||
const LandingPage = () => ( | ||
<div> | ||
<div className="landingPage"> | ||
<Banner /> | ||
<NovelOfTheWeek /> | ||
<section id="writingCaption"> | ||
<p>The Best Place To Express Yourself and Collaborate</p> | ||
<button type="button" className="btnLarge">Start Writing</button> | ||
</section> | ||
<section id="membership"> | ||
<h2>Membership</h2> | ||
<div className="membershipBox"> | ||
<div className="freeMembership"> | ||
<div> | ||
<h4>Free</h4> | ||
<ul> | ||
<li>Read Novels</li> | ||
<li>Bookmark Novels</li> | ||
<li>Follow Authors</li> | ||
</ul> | ||
</div> | ||
<div> | ||
<p>SIGN UP</p> | ||
</div> | ||
</div> | ||
<div className="subscribeMembership"> | ||
<div> | ||
<h4>Subscription</h4> | ||
<ul> | ||
<li>Read Novels</li> | ||
<li>Bookmark Novels</li> | ||
<li>Follow and Collaborate with other Authors</li> | ||
<li>Like and Comment on Novels</li> | ||
<li>Novel Review and Analytics</li> | ||
</ul> | ||
</div> | ||
<div> | ||
<p>SUBSCRIBE</p> | ||
const LandingPage = ({ history }) => { | ||
const user = JSON.parse(localStorage.getItem('AuthorsHavenUser')); | ||
|
||
return ( | ||
<> | ||
{ | ||
user ? history.push('/homepage') : null | ||
} | ||
<div> | ||
<div className="landingPage"> | ||
<Banner /> | ||
<NovelOfTheWeek /> | ||
<section id="writingCaption"> | ||
<p>The Best Place To Express Yourself and Collaborate</p> | ||
<button type="button" className="btnLarge">Start Writing</button> | ||
</section> | ||
<section id="membership"> | ||
<h2>Membership</h2> | ||
<div className="membershipBox"> | ||
<div className="freeMembership"> | ||
<div> | ||
<h4>Free</h4> | ||
<ul> | ||
<li>Read Novels</li> | ||
<li>Bookmark Novels</li> | ||
<li>Follow Authors</li> | ||
</ul> | ||
</div> | ||
<div> | ||
<p>SIGN UP</p> | ||
</div> | ||
</div> | ||
<div className="subscribeMembership"> | ||
<div> | ||
<h4>Subscription</h4> | ||
<ul> | ||
<li>Read Novels</li> | ||
<li>Bookmark Novels</li> | ||
<li>Follow and Collaborate with other Authors</li> | ||
<li>Like and Comment on Novels</li> | ||
<li>Novel Review and Analytics</li> | ||
</ul> | ||
</div> | ||
<div> | ||
<p>SUBSCRIBE</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
</section> | ||
</div> | ||
</div> | ||
); | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
LandingPage.propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
}; | ||
|
||
export default LandingPage; | ||
export default withRouter(LandingPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { Route, Redirect } from 'react-router-dom'; | ||
import PropTypes from 'prop-types'; | ||
|
||
let user; | ||
|
||
const UserProtected = ({ component: Component, path }) => { | ||
user = JSON.parse(window.localStorage.getItem('AuthorsHavenUser')); | ||
|
||
return ( | ||
<Route | ||
path={path} | ||
render={({ location }) => ( | ||
user && user.isVerified | ||
? <Component /> | ||
: <Redirect to={{ pathname: '/confirmation-page', state: { from: location } }} /> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
UserProtected.propTypes = { | ||
component: PropTypes.func.isRequired, | ||
path: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default UserProtected; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
import React from 'react'; | ||
import React, { useState } from 'react'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
import Navbar from '../layout/Navbar'; | ||
import Footer from '../layout/Footer/Footer'; | ||
import LandingPage from '../LandingPage/LandingPage'; | ||
import NotFound from '../NotFound/NotFound'; | ||
import SignUpFormContainer from '../SignupForm/SignupFormContainer'; | ||
import ConfirmationPage from '../ConfirmationPage/ConfirmationPage'; | ||
|
||
const Router = () => ( | ||
<div> | ||
<Navbar /> | ||
<Switch> | ||
<Route exact path="/" component={LandingPage} /> | ||
<Route component={NotFound} /> | ||
</Switch> | ||
<Footer /> | ||
</div> | ||
); | ||
const Router = () => { | ||
const [isOpenSignup, setIsOpenSignup] = useState(false); | ||
|
||
const handleOpenModal = () => { | ||
setIsOpenSignup(true); | ||
document.body.style.height = '100vh'; | ||
document.body.style.overflowY = 'hidden'; | ||
}; | ||
|
||
const handleCloseModal = () => { | ||
setIsOpenSignup(false); | ||
document.body.style.height = '100vh'; | ||
document.body.style.overflowY = 'auto'; | ||
}; | ||
|
||
return ( | ||
<div> | ||
<SignUpFormContainer closeModal={handleCloseModal} isOpen={isOpenSignup} /> | ||
<Navbar openModal={handleOpenModal} /> | ||
<Switch> | ||
<Route exact path="/" component={LandingPage} /> | ||
<Route exact path="/confirmation-page" component={ConfirmationPage} /> | ||
<Route component={NotFound} /> | ||
</Switch> | ||
<Footer /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable react/prop-types */ | ||
import React from 'react'; | ||
import Input from '../helpers/TextInput/TextInput'; | ||
import AuthModalContainer from '../helpers/AuthModal/AuthModalContainer'; | ||
import SocialLogin from '../helpers/SocialLogin/SocialLogin'; | ||
import Separator from '../helpers/Separator/Separator'; | ||
import './SignupForm.scss'; | ||
|
||
const SignupForm = ({ | ||
formdata, onChange, handleSubmit, resourceLoading, closeModal, isOpen, | ||
}) => ( | ||
<AuthModalContainer desc="Sign up to create an account" title="CREATE AN ACCOUNT" isOpen={isOpen} closeModal={closeModal}> | ||
<SocialLogin /> | ||
<Separator /> | ||
<form onSubmit={handleSubmit}> | ||
{formdata.map((formField, index) => ( | ||
<Input | ||
key={formField.id} | ||
onChange={onChange} | ||
formField={formField} | ||
index={index} | ||
/> | ||
))} | ||
<button type="submit" disabled={resourceLoading} className="btn">{resourceLoading ? <i className="fa fa-spinner fa-spin loader" /> : 'signup'}</button> | ||
<p className="small-text"> | ||
Already have an account? | ||
{' '} | ||
<a href="abc">Sign In</a> | ||
</p> | ||
</form> | ||
</AuthModalContainer> | ||
); | ||
|
||
export default SignupForm; |
Oops, something went wrong.