Run linter
This commit is contained in:
1 parent
ebdb574c07
commit
3b3eb2bb7c
16 files changed
+420
-133
No files matched your search
+8
-3
@@ -20,14 +20,14 @@ import Events from '@advancedalgos/events-client'
|
||||
import KeyVault from '@advancedalgos/key-vault-client'
|
||||
import FinancialBeings from '@advancedalgos/financial-beings-client'
|
||||
|
||||
import { FINANCIAL_BEINGS } from "./constants/routes";
|
||||
import { FINANCIAL_BEINGS } from './constants/routes'
|
||||
|
||||
export const auth = new Auth(
|
||||
result => console.log('Authentication successful.'),
|
||||
client
|
||||
)
|
||||
|
||||
export const MasterApp = (props) => (
|
||||
export const MasterApp = props => (
|
||||
<BrowserRouter>
|
||||
<ApolloProvider client={client}>
|
||||
<MuiThemeProvider theme={theme}>
|
||||
@@ -46,7 +46,12 @@ export const MasterApp = (props) => (
|
||||
path='/email-verification'
|
||||
render={props => {
|
||||
console.log(props.location)
|
||||
return <EmailSignupConfirm {...props} tokenParam={props.location.search} />
|
||||
return (
|
||||
<EmailSignupConfirm
|
||||
{...props}
|
||||
tokenParam={props.location.search}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const FINANCIAL_BEINGS = '/financial-beings';
|
||||
export const FINANCIAL_BEINGS = '/financial-beings'
|
||||
+6
-1
@@ -12,4 +12,9 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
window.localStorage.setItem('debug', 'advanced-algos:*')
|
||||
}
|
||||
|
||||
ReactDOM.render(<Provider store={store}><MasterApp /></Provider>, document.getElementById('masterApp'))
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<MasterApp />
|
||||
</Provider>,
|
||||
document.getElementById('masterApp')
|
||||
)
|
||||
@@ -2,11 +2,13 @@ import React from 'react'
|
||||
|
||||
import { BannerTopBar } from '../common'
|
||||
|
||||
const Callback = () => <BannerTopBar
|
||||
size='big'
|
||||
title=''
|
||||
text='Authenticating...'
|
||||
backgroundUrl='https://aacorporatesitedevelop.azurewebsites.net/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
const Callback = () => (
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title=''
|
||||
text='Authenticating...'
|
||||
backgroundUrl='https://aacorporatesitedevelop.azurewebsites.net/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)
|
||||
|
||||
export default Callback
|
||||
@@ -50,17 +50,24 @@ class Charts extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
context: state.context
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
hideFooter: () => { dispatch({ type: 'HIDE_FOOTER' }) },
|
||||
showFooter: () => { dispatch({ type: 'SHOW_FOOTER' }) }
|
||||
hideFooter: () => {
|
||||
dispatch({ type: 'HIDE_FOOTER' })
|
||||
},
|
||||
showFooter: () => {
|
||||
dispatch({ type: 'SHOW_FOOTER' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(Charts))
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withStyles(styles)(Charts))
|
||||
@@ -2,17 +2,18 @@ import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Typography from '@material-ui/core/Typography'
|
||||
|
||||
const BannerTopBar = ({
|
||||
size,
|
||||
backgroundUrl,
|
||||
title,
|
||||
text,
|
||||
children
|
||||
}) => (
|
||||
<div className={`bannerTopBar ${size}`} style={backgroundUrl ? { backgroundImage: `url(${backgroundUrl})` } : {}}>
|
||||
const BannerTopBar = ({ size, backgroundUrl, title, text, children }) => (
|
||||
<div
|
||||
className={`bannerTopBar ${size}`}
|
||||
style={backgroundUrl ? { backgroundImage: `url(${backgroundUrl})` } : {}}
|
||||
>
|
||||
<div className='caption'>
|
||||
<Typography className='title' variant='h1' align='center'>{title}</Typography>
|
||||
<Typography className='text' variant='h2' align='center'>{text}</Typography>
|
||||
<Typography className='title' variant='h1' align='center'>
|
||||
{title}
|
||||
</Typography>
|
||||
<Typography className='text' variant='h2' align='center'>
|
||||
{text}
|
||||
</Typography>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,15 +39,40 @@ export class SignupForm extends Component {
|
||||
displayIntro
|
||||
} = this.props
|
||||
return (
|
||||
<Mutation
|
||||
mutation={NEWSLETTER_SIGNUP}
|
||||
>
|
||||
<Mutation mutation={NEWSLETTER_SIGNUP}>
|
||||
{(NewsletterSignup, { loading, error, data }) => {
|
||||
return (
|
||||
<Grid container className={classes.signupRight} direction='column' justify={alignCenter ? 'center' : 'flex-start'}>
|
||||
{displayTitle && <Typography variant='h4' className={classes.textWhite} gutterBottom>Stay in touch!</Typography>}
|
||||
{displayIntro && <Typography variant='subtitle1' className={classes.textWhite} gutterBottom>Opt-in our mailing list to stay up to date with the Advanced Algos Project.</Typography>}
|
||||
<form id='email-signup' action='#' className='form-inline' autoComplete='off'>
|
||||
<Grid
|
||||
container
|
||||
className={classes.signupRight}
|
||||
direction='column'
|
||||
justify={alignCenter ? 'center' : 'flex-start'}
|
||||
>
|
||||
{displayTitle && (
|
||||
<Typography
|
||||
variant='h4'
|
||||
className={classes.textWhite}
|
||||
gutterBottom
|
||||
>
|
||||
Stay in touch!
|
||||
</Typography>
|
||||
)}
|
||||
{displayIntro && (
|
||||
<Typography
|
||||
variant='subtitle1'
|
||||
className={classes.textWhite}
|
||||
gutterBottom
|
||||
>
|
||||
Opt-in our mailing list to stay up to date with the Advanced
|
||||
Algos Project.
|
||||
</Typography>
|
||||
)}
|
||||
<form
|
||||
id='email-signup'
|
||||
action='#'
|
||||
className='form-inline'
|
||||
autoComplete='off'
|
||||
>
|
||||
<Typography
|
||||
variant='subtitle1'
|
||||
className={classes.textSuccess}
|
||||
@@ -57,9 +82,16 @@ export class SignupForm extends Component {
|
||||
textAlign: alignCenter ? 'center' : 'inherit'
|
||||
}}
|
||||
>
|
||||
Thank you for signing up! Please check your email and click on the confirmation link to complete the signup process.
|
||||
Thank you for signing up! Please check your email and click on
|
||||
the confirmation link to complete the signup process.
|
||||
</Typography>
|
||||
<Grid container className={classes.signupContainer} justify={(width === 'xs' || alignCenter) ? 'center' : 'flex-start'}>
|
||||
<Grid
|
||||
container
|
||||
className={classes.signupContainer}
|
||||
justify={
|
||||
width === 'xs' || alignCenter ? 'center' : 'flex-start'
|
||||
}
|
||||
>
|
||||
<InputBase
|
||||
id='email'
|
||||
placeholder='Enter your email'
|
||||
@@ -119,9 +151,11 @@ export class SignupForm extends Component {
|
||||
async handleSubmit (e, NewsletterSignup) {
|
||||
e.preventDefault()
|
||||
console.log('NewsletterSignup handleSubmit: ', this.state.email)
|
||||
const signupResponse = await NewsletterSignup({ variables: { email: this.state.email } })
|
||||
const signupResponse = await NewsletterSignup({
|
||||
variables: { email: this.state.email }
|
||||
})
|
||||
console.log('NewsletterSignup: ', signupResponse)
|
||||
if (signupResponse.data.master_NewsletterSignup === 'SUCCESS') this.setState({ email: '', success: true })
|
||||
if (signupResponse.data.master_NewsletterSignup === 'SUCCESS') { this.setState({ email: '', success: true }) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export class SignupVerifyResponse extends React.Component {
|
||||
componentDidMount () {
|
||||
const { mutate } = this.props
|
||||
mutate()
|
||||
};
|
||||
}
|
||||
|
||||
render () {
|
||||
const { loading, error, data } = this.props
|
||||
@@ -17,7 +17,10 @@ export class SignupVerifyResponse extends React.Component {
|
||||
let displayForm = false
|
||||
console.log('SignupVerifyResponse:', loading, error, data)
|
||||
if (error) {
|
||||
if (error.message === 'GraphQL error: Error: Token Expired. Please resubmit email address.') {
|
||||
if (
|
||||
error.message ===
|
||||
'GraphQL error: Error: Token Expired. Please resubmit email address.'
|
||||
) {
|
||||
BannerText = [
|
||||
<strong key='EmailSignupConfirm-error-b1'>
|
||||
Newsletter Signup Error: Verification Token Expired
|
||||
@@ -29,7 +32,11 @@ export class SignupVerifyResponse extends React.Component {
|
||||
]
|
||||
displayForm = true
|
||||
} else {
|
||||
BannerText = ['Newsletter Signup Error: ', <br key='EmailSignupConfirm-error-br' />, error.message]
|
||||
BannerText = [
|
||||
'Newsletter Signup Error: ',
|
||||
<br key='EmailSignupConfirm-error-br' />,
|
||||
error.message
|
||||
]
|
||||
}
|
||||
return (
|
||||
<BannerTopBar
|
||||
@@ -41,7 +48,11 @@ export class SignupVerifyResponse extends React.Component {
|
||||
)
|
||||
}
|
||||
if (loading && !error) {
|
||||
BannerText = ['Processing newsletter sign-up...', <br key='EmailSignupConfirm-br' />, 'Thank you for opting-in to recieve updates about the Advanced Algos project!']
|
||||
BannerText = [
|
||||
'Processing newsletter sign-up...',
|
||||
<br key='EmailSignupConfirm-br' />,
|
||||
'Thank you for opting-in to recieve updates about the Advanced Algos project!'
|
||||
]
|
||||
}
|
||||
if (data !== undefined && data !== null) {
|
||||
console.log(data)
|
||||
|
||||
@@ -33,10 +33,7 @@ export const EmailSignupConfirm = ({ tokenParam }) => {
|
||||
}
|
||||
console.log(token)
|
||||
return (
|
||||
<Mutation
|
||||
mutation={NEWSLETTER_SIGNUP_VERIFY}
|
||||
variables={{ token: token }}
|
||||
>
|
||||
<Mutation mutation={NEWSLETTER_SIGNUP_VERIFY} variables={{ token: token }}>
|
||||
{(NewsletterSignupVerify, { loading, error, data }) => {
|
||||
return (
|
||||
<SignupVerifyResponse
|
||||
@@ -46,8 +43,7 @@ export const EmailSignupConfirm = ({ tokenParam }) => {
|
||||
data={data}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
}}
|
||||
</Mutation>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,27 +13,60 @@ class Home extends Component {
|
||||
backgroundUrl='https://aacorporatesitedevelop.azurewebsites.net/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
<div className='homePage'>
|
||||
<Typography variant='h1' align='center' className='title'>Welcome to the Advanced Algos Platform!</Typography>
|
||||
<Typography variant='h2' align='center' className='subtitle'>CO-CREATE >> COMPETE >> EVOLVE</Typography>
|
||||
<Typography variant='h1' align='center' className='title'>
|
||||
Welcome to the Advanced Algos Platform!
|
||||
</Typography>
|
||||
<Typography variant='h2' align='center' className='subtitle'>
|
||||
CO-CREATE >> COMPETE >> EVOLVE
|
||||
</Typography>
|
||||
<div className='column'>
|
||||
<Typography align='justify'>
|
||||
Before you begin, please be aware <strong>this is a development environment in pre-alpha stage</strong>.
|
||||
The features available as of today are limited but already functional.
|
||||
However, you may encounter occasional instability and errors.
|
||||
Before you begin, please be aware{' '}
|
||||
<strong>
|
||||
this is a development environment in pre-alpha stage
|
||||
</strong>
|
||||
. The features available as of today are limited but already
|
||||
functional. However, you may encounter occasional instability and
|
||||
errors.
|
||||
</Typography>
|
||||
<Typography align='justify'>
|
||||
The Superalgos Platform is the place is which we meet to collaborate in the quest to make trading algorithms evolve.
|
||||
You will be able to register, create or join a team, fork a functional trading bot and eventually put it to compete with other people's forks.
|
||||
The Superalgos Platform is the place is which we meet to
|
||||
collaborate in the quest to make trading algorithms evolve. You
|
||||
will be able to register, create or join a team, fork a functional
|
||||
trading bot and eventually put it to compete with other people's
|
||||
forks.
|
||||
</Typography>
|
||||
</div>
|
||||
<div className='column'>
|
||||
<Typography align='justify'>
|
||||
Feel free to explore the menu in the top-right corner or visit the <a href='https://www.advancedalgos.net/documentation-quick-start.shtml' target='_blank'>Quick Start Guide</a>.
|
||||
Reporting of bugs at the corresponding <a href='https://github.com/AdvancedAlgos' target='_blank' rel='nofollow'>Advanced Algos Github repository</a> is highly appreciated.
|
||||
Feel free to explore the menu in the top-right corner or visit the{' '}
|
||||
<a
|
||||
href='https://www.advancedalgos.net/documentation-quick-start.shtml'
|
||||
target='_blank'
|
||||
>
|
||||
Quick Start Guide
|
||||
</a>
|
||||
. Reporting of bugs at the corresponding{' '}
|
||||
<a
|
||||
href='https://github.com/AdvancedAlgos'
|
||||
target='_blank'
|
||||
rel='nofollow'
|
||||
>
|
||||
Advanced Algos Github repository
|
||||
</a>{' '}
|
||||
is highly appreciated.
|
||||
</Typography>
|
||||
<Typography align='justify'>
|
||||
Get in touch with the rest of the community and get answers to your questions in our <a href='https://t.me/advancedalgoscommunity' target='_blank' rel='nofollow'>Telegram Group</a>.
|
||||
Have fun!
|
||||
Get in touch with the rest of the community and get answers to
|
||||
your questions in our{' '}
|
||||
<a
|
||||
href='https://t.me/advancedalgoscommunity'
|
||||
target='_blank'
|
||||
rel='nofollow'
|
||||
>
|
||||
Telegram Group
|
||||
</a>
|
||||
. Have fun!
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,11 @@ import { connect } from 'react-redux'
|
||||
import Typography from '@material-ui/core/Typography'
|
||||
import Grid from '@material-ui/core/Grid'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { faFacebookF, faTelegramPlane, faTwitter } from '@fortawesome/free-brands-svg-icons'
|
||||
import {
|
||||
faFacebookF,
|
||||
faTelegramPlane,
|
||||
faTwitter
|
||||
} from '@fortawesome/free-brands-svg-icons'
|
||||
import styles from './styles'
|
||||
|
||||
import SignupForm from '../../email-verification/components/SignupForm'
|
||||
@@ -23,7 +27,7 @@ class Footer extends Component {
|
||||
|
||||
const masterApp = this.props.context.masterApp
|
||||
if (masterApp.footer.visible === false) {
|
||||
return (<div />)
|
||||
return <div />
|
||||
} else {
|
||||
return (
|
||||
<footer className={classNames(classes.darkSection, classes.footer)}>
|
||||
@@ -37,33 +41,86 @@ class Footer extends Component {
|
||||
<NavLink to='/'>
|
||||
<img alt='' src={aalogo} width={'100%'} height={'auto'} />
|
||||
</NavLink>
|
||||
<Grid container className={classes.descriptionLeft} direction='column'>
|
||||
<Typography variant='subtitle2' className={classes.textLight} ><strong>Advanced Algos Ltd.</strong></Typography>
|
||||
<Typography variant='subtitle1' className={classes.textLight} gutterBottom>Ground Floor, Palace Court, Church Street,<br />St. Julians STJ3049, Malta</Typography>
|
||||
<Grid
|
||||
container
|
||||
className={classes.descriptionLeft}
|
||||
direction='column'
|
||||
>
|
||||
<Typography variant='subtitle2' className={classes.textLight}>
|
||||
<strong>Advanced Algos Ltd.</strong>
|
||||
</Typography>
|
||||
<Typography
|
||||
variant='subtitle1'
|
||||
className={classes.textLight}
|
||||
gutterBottom
|
||||
>
|
||||
Ground Floor, Palace Court, Church Street,
|
||||
<br />
|
||||
St. Julians STJ3049, Malta
|
||||
</Typography>
|
||||
<Typography variant='subtitle1' className={classes.textLight}>
|
||||
<Link to='legal-privacy-statement.shtml' className={classes.linkLight}>Privacy Statement</Link> | <a href='legal-terms-of-service.shtml' className={classes.linkLight}>Terms of Service</a>
|
||||
<Link
|
||||
to='legal-privacy-statement.shtml'
|
||||
className={classes.linkLight}
|
||||
>
|
||||
Privacy Statement
|
||||
</Link>{' '}
|
||||
|{' '}
|
||||
<a
|
||||
href='legal-terms-of-service.shtml'
|
||||
className={classes.linkLight}
|
||||
>
|
||||
Terms of Service
|
||||
</a>
|
||||
</Typography>
|
||||
<Typography
|
||||
variant='body2'
|
||||
className={classNames(classes.textLight, classes.copyright)}
|
||||
gutterBottom
|
||||
>
|
||||
© Advanced Algos, Ltd. 2018 | All Rights Reserved.
|
||||
</Typography>
|
||||
<Typography variant='body2' className={classNames(classes.textLight, classes.copyright)} gutterBottom>© Advanced Algos, Ltd. 2018 | All Rights Reserved.</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={1} md={1} />
|
||||
<Grid item xs={12} sm={7} md={6}>
|
||||
<SignupForm displayTitle displayIntro />
|
||||
<Typography variant='subtitle1' className={classes.textWhite} style={{ textAlign: width === 'xs' ? 'center' : '' }}>Meet us on Social Networks:</Typography>
|
||||
<Grid container justify={width === 'xs' ? 'center' : 'flex-start'}>
|
||||
<Link to='https://t.me/advancedalgoscommunity' title='Join us on Telgram' className={classes.linkLight}>
|
||||
<Typography
|
||||
variant='subtitle1'
|
||||
className={classes.textWhite}
|
||||
style={{ textAlign: width === 'xs' ? 'center' : '' }}
|
||||
>
|
||||
Meet us on Social Networks:
|
||||
</Typography>
|
||||
<Grid
|
||||
container
|
||||
justify={width === 'xs' ? 'center' : 'flex-start'}
|
||||
>
|
||||
<Link
|
||||
to='https://t.me/advancedalgoscommunity'
|
||||
title='Join us on Telgram'
|
||||
className={classes.linkLight}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={faTelegramPlane}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
/>
|
||||
</Link>
|
||||
<Link to='https://twitter.com/advancedalgos' title='Follow us on Twitter' className={classes.linkLight}>
|
||||
<Link
|
||||
to='https://twitter.com/advancedalgos'
|
||||
title='Follow us on Twitter'
|
||||
className={classes.linkLight}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={faTwitter}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
/>
|
||||
</Link>
|
||||
<Link to='https://www.facebook.com/Advanced-Algos-173249670001615/' title='Meet us on Facebook' className={classes.linkLight}>
|
||||
<Link
|
||||
to='https://www.facebook.com/Advanced-Algos-173249670001615/'
|
||||
title='Meet us on Facebook'
|
||||
className={classes.linkLight}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={faFacebookF}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
@@ -83,7 +140,7 @@ Footer.propTypes = {
|
||||
width: PropTypes.string
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
context: state.context
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ const styles = theme => ({
|
||||
footer: {
|
||||
borderTop: `4px solid ${theme.palette.secondary.light}`,
|
||||
padding: `${theme.spacing.unit * 6}px 0`,
|
||||
backgroundColor: '#19191C', /* #29292c */
|
||||
backgroundColor: '#19191C' /* #29292c */,
|
||||
color: theme.palette.primary.light
|
||||
},
|
||||
footerContainer: {
|
||||
|
||||
@@ -4,7 +4,15 @@ import { Link } from 'react-router-dom'
|
||||
import { isDefined } from '../../../utils/js-helpers'
|
||||
|
||||
export const LoggedIn = props => {
|
||||
let { user, auth, openedMenu, toggleMenuOpen, closeAll, bigScreen, mouseLeave } = props
|
||||
let {
|
||||
user,
|
||||
auth,
|
||||
openedMenu,
|
||||
toggleMenuOpen,
|
||||
closeAll,
|
||||
bigScreen,
|
||||
mouseLeave
|
||||
} = props
|
||||
let displayName = 'No Display Name'
|
||||
|
||||
if (isDefined(user.alias)) {
|
||||
@@ -24,16 +32,32 @@ export const LoggedIn = props => {
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<li
|
||||
onMouseEnter={() => toggleMenuOpen(42, bigScreen)}
|
||||
onMouseLeave={() => mouseLeave(bigScreen)}
|
||||
className={openedMenu === 42 ? 'selected primaryLink hasChildren' : 'primaryLink hasChildren'}
|
||||
className={
|
||||
openedMenu === 42
|
||||
? 'selected primaryLink hasChildren'
|
||||
: 'primaryLink hasChildren'
|
||||
}
|
||||
>
|
||||
<Link to='/users/user' onClick={() => toggleMenuOpen(42, true)}> {displayName} </Link>
|
||||
<Link to='/users/user' onClick={() => toggleMenuOpen(42, true)}>
|
||||
{' '}
|
||||
{displayName}{' '}
|
||||
</Link>
|
||||
<ul className='subMenu'>
|
||||
<li><Link to='/users/user' onClick={() => closeAll()}> Profile </Link></li>
|
||||
<li><a href='#' onClick={() => auth.logout()}> Logout </a></li>
|
||||
<li>
|
||||
<Link to='/users/user' onClick={() => closeAll()}>
|
||||
{' '}
|
||||
Profile{' '}
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<a href='#' onClick={() => auth.logout()}>
|
||||
{' '}
|
||||
Logout{' '}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
AddCircleOutline
|
||||
} from '@material-ui/icons'
|
||||
|
||||
import { FINANCIAL_BEINGS } from "../../../constants/routes";
|
||||
import { FINANCIAL_BEINGS } from '../../../constants/routes'
|
||||
|
||||
const usersMenus = {
|
||||
title: 'Users',
|
||||
@@ -20,8 +20,18 @@ const usersMenus = {
|
||||
submenus: [
|
||||
{ title: 'Directory', to: '/users/browse', icon: ImportContacts },
|
||||
{ title: 'Search', to: '/users/search', icon: Search },
|
||||
{ title: 'Report', to: 'https://github.com/AdvancedAlgos/UsersModule/issues/new', icon: BugReport, externalLink: true },
|
||||
{ title: 'Your Profile', to: '/users/user', icon: People, authenticated: true }
|
||||
{
|
||||
title: 'Report',
|
||||
to: 'https://github.com/AdvancedAlgos/UsersModule/issues/new',
|
||||
icon: BugReport,
|
||||
externalLink: true
|
||||
},
|
||||
{
|
||||
title: 'Your Profile',
|
||||
to: '/users/user',
|
||||
icon: People,
|
||||
authenticated: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -30,10 +40,30 @@ const teamsMenus = {
|
||||
to: '/teams',
|
||||
submenus: [
|
||||
{ title: 'Explore teams', to: '/teams/explore', icon: Search },
|
||||
{ title: 'Your teams', to: '/teams/manage-teams', icon: Group, authenticated: true },
|
||||
{ title: 'Team members', to: '/teams/team-members', icon: People, authenticated: true },
|
||||
{ title: 'Financial beings', to: '/teams/financial-beings', icon: Adb, authenticated: true },
|
||||
{ title: 'Report', to: 'https://github.com/AdvancedAlgos/TeamsModule/issues/new', icon: BugReport, externalLink: true }
|
||||
{
|
||||
title: 'Your teams',
|
||||
to: '/teams/manage-teams',
|
||||
icon: Group,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Team members',
|
||||
to: '/teams/team-members',
|
||||
icon: People,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Financial beings',
|
||||
to: '/teams/financial-beings',
|
||||
icon: Adb,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Report',
|
||||
to: 'https://github.com/AdvancedAlgos/TeamsModule/issues/new',
|
||||
icon: BugReport,
|
||||
externalLink: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -42,10 +72,30 @@ const eventsMenus = {
|
||||
to: '/events',
|
||||
submenus: [
|
||||
{ title: 'All events', to: '/events', icon: Search },
|
||||
{ title: 'Your events', to: '/events/my', icon: GamepadRounded, authenticated: true },
|
||||
{ title: 'Your hosted events', to: '/events/host', icon: AccessibilityNew, authenticated: true },
|
||||
{ title: 'Host an event', to: '/events/create', icon: LibraryAdd, authenticated: true },
|
||||
{ title: 'Report', to: 'https://github.com/AdvancedAlgos/UsersModule/issues/new', icon: BugReport, externalLink: true }
|
||||
{
|
||||
title: 'Your events',
|
||||
to: '/events/my',
|
||||
icon: GamepadRounded,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Your hosted events',
|
||||
to: '/events/host',
|
||||
icon: AccessibilityNew,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Host an event',
|
||||
to: '/events/create',
|
||||
icon: LibraryAdd,
|
||||
authenticated: true
|
||||
},
|
||||
{
|
||||
title: 'Report',
|
||||
to: 'https://github.com/AdvancedAlgos/UsersModule/issues/new',
|
||||
icon: BugReport,
|
||||
externalLink: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -56,7 +106,12 @@ const keyvaultMenus = {
|
||||
submenus: [
|
||||
{ title: 'Manage keys', to: '/key-vault/browse', icon: VpnKey },
|
||||
{ title: 'Add key', to: '/key-vault/addKey', icon: AddCircleOutline },
|
||||
{ title: 'Report', to: 'https://github.com/AdvancedAlgos/KeyVaultModule/issues/new', icon: BugReport, externalLink: true }
|
||||
{
|
||||
title: 'Report',
|
||||
to: 'https://github.com/AdvancedAlgos/KeyVaultModule/issues/new',
|
||||
icon: BugReport,
|
||||
externalLink: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -64,9 +119,15 @@ const financialBeingsMenus = {
|
||||
title: 'Financial beings',
|
||||
to: FINANCIAL_BEINGS,
|
||||
authenticated: false,
|
||||
submenus:[]
|
||||
};
|
||||
submenus: []
|
||||
}
|
||||
|
||||
const allMenus = [ usersMenus, teamsMenus, eventsMenus, financialBeingsMenus, keyvaultMenus ];
|
||||
const allMenus = [
|
||||
usersMenus,
|
||||
teamsMenus,
|
||||
eventsMenus,
|
||||
financialBeingsMenus,
|
||||
keyvaultMenus
|
||||
]
|
||||
|
||||
export default allMenus
|
||||
@@ -64,54 +64,100 @@ class Header extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const bigScreen = (this.props.width === 'lg' || this.props.width === 'xl')
|
||||
const bigScreen = this.props.width === 'lg' || this.props.width === 'xl'
|
||||
let { auth } = this.props
|
||||
let { onTop, mobileOpen, openedMenu } = this.state
|
||||
if (window.localStorage.getItem('access_token')) {
|
||||
if (jwtDecode(window.localStorage.getItem('access_token')).exp < new Date().getTime() / 1000) {
|
||||
if (
|
||||
jwtDecode(window.localStorage.getItem('access_token')).exp <
|
||||
new Date().getTime() / 1000
|
||||
) {
|
||||
window.localStorage.clear()
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
let user = JSON.parse(this.state.user)
|
||||
|
||||
const menus = allMenus.map(({ to, title, submenus, authenticated }, index) => {
|
||||
if (authenticated && !(this.state.user !== undefined && this.state.user !== null)) {
|
||||
return
|
||||
}
|
||||
return (
|
||||
<li
|
||||
onMouseEnter={() => this.toggleMenuOpen(index, bigScreen)}
|
||||
onMouseLeave={() => this.mouseLeave(bigScreen)}
|
||||
key={index}
|
||||
className={openedMenu === index ? 'primaryLink hasChildren selected' : 'primaryLink hasChildren'}
|
||||
>
|
||||
<Link to={to} onClick={() => this.toggleMenuOpen(index, true)}> {title} </Link>
|
||||
<ul className='subMenu'>
|
||||
{
|
||||
submenus.map(({ icon: Icon, to: subTo, title: subTitle, externalLink, authenticated: subAuthenticated }, subindex) => {
|
||||
if (subAuthenticated && !(this.state.user !== undefined && this.state.user !== null)) {
|
||||
return
|
||||
}
|
||||
if (externalLink) {
|
||||
const menus = allMenus.map(
|
||||
({ to, title, submenus, authenticated }, index) => {
|
||||
if (
|
||||
authenticated &&
|
||||
!(this.state.user !== undefined && this.state.user !== null)
|
||||
) {
|
||||
return
|
||||
}
|
||||
return (
|
||||
<li
|
||||
onMouseEnter={() => this.toggleMenuOpen(index, bigScreen)}
|
||||
onMouseLeave={() => this.mouseLeave(bigScreen)}
|
||||
key={index}
|
||||
className={
|
||||
openedMenu === index
|
||||
? 'primaryLink hasChildren selected'
|
||||
: 'primaryLink hasChildren'
|
||||
}
|
||||
>
|
||||
<Link to={to} onClick={() => this.toggleMenuOpen(index, true)}>
|
||||
{' '}
|
||||
{title}{' '}
|
||||
</Link>
|
||||
<ul className='subMenu'>
|
||||
{submenus.map(
|
||||
(
|
||||
{
|
||||
icon: Icon,
|
||||
to: subTo,
|
||||
title: subTitle,
|
||||
externalLink,
|
||||
authenticated: subAuthenticated
|
||||
},
|
||||
subindex
|
||||
) => {
|
||||
if (
|
||||
subAuthenticated &&
|
||||
!(this.state.user !== undefined && this.state.user !== null)
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (externalLink) {
|
||||
return (
|
||||
<li key={subindex}>
|
||||
<a href={subTo}>
|
||||
{' '}
|
||||
<Icon /> {subTitle}{' '}
|
||||
</a>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<li key={subindex}><a href={subTo}> <Icon /> {subTitle} </a></li>
|
||||
<li key={subindex}>
|
||||
<Link to={subTo} onClick={() => this.closeAll(index)}>
|
||||
{' '}
|
||||
<Icon /> {subTitle}{' '}
|
||||
</Link>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<li key={subindex}><Link to={subTo} onClick={() => this.closeAll(index)}> <Icon /> {subTitle} </Link></li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</ul>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
return (
|
||||
<header className={onTop ? 'menu' : 'menu notOnTop'}>
|
||||
<div className='container'>
|
||||
<Link to='/'> <img className='logo' src={AALogo} alt='Advanced Algos' /> </Link>
|
||||
<div className={mobileOpen ? 'mobileHandle openedMobile' : 'mobileHandle'} onClick={() => this.toggleMobileOpen()}>
|
||||
<Link to='/'>
|
||||
{' '}
|
||||
<img className='logo' src={AALogo} alt='Advanced Algos' />{' '}
|
||||
</Link>
|
||||
<div
|
||||
className={
|
||||
mobileOpen ? 'mobileHandle openedMobile' : 'mobileHandle'
|
||||
}
|
||||
onClick={() => this.toggleMobileOpen()}
|
||||
>
|
||||
Menu
|
||||
</div>
|
||||
<nav className={mobileOpen ? 'links openedMobile' : 'links'}>
|
||||
@@ -121,7 +167,10 @@ class Header extends Component {
|
||||
</li>
|
||||
{menus}
|
||||
<li className='primaryLink'>
|
||||
<a href='https://www.advancedalgos.net/documentation-quick-start.shtml'> Docs </a>
|
||||
<a href='https://www.advancedalgos.net/documentation-quick-start.shtml'>
|
||||
{' '}
|
||||
Docs{' '}
|
||||
</a>
|
||||
</li>
|
||||
{this.state.user !== undefined && this.state.user !== null ? (
|
||||
<LoggedIn
|
||||
@@ -129,14 +178,18 @@ class Header extends Component {
|
||||
auth={auth}
|
||||
bigScreen={bigScreen}
|
||||
openedMenu={openedMenu}
|
||||
toggleMenuOpen={(keyValue, allowedValue) => this.toggleMenuOpen(keyValue, allowedValue)}
|
||||
mouseLeave={(allowedValue) => this.mouseLeave(allowedValue)}
|
||||
toggleMenuOpen={(keyValue, allowedValue) =>
|
||||
this.toggleMenuOpen(keyValue, allowedValue)
|
||||
}
|
||||
mouseLeave={allowedValue => this.mouseLeave(allowedValue)}
|
||||
closeAll={() => this.closeAll()}
|
||||
/>
|
||||
) : (
|
||||
|
||||
<li className='primaryLink'>
|
||||
<a href='#' onClick={() => auth.login()}> Login / Sign Up </a>
|
||||
<a href='#' onClick={() => auth.login()}>
|
||||
{' '}
|
||||
Login / Sign Up{' '}
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
|
||||
@@ -11,9 +11,7 @@ class Index extends React.Component {
|
||||
return (
|
||||
<div className={this.props.classes.layout}>
|
||||
<Header auth={this.props.auth} />
|
||||
<div>
|
||||
{this.props.children}
|
||||
</div>
|
||||
<div>{this.props.children}</div>
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user