Merge Complete
No files matched your search
@@ -0,0 +1,101 @@
|
||||
import { ApolloProvider } from 'react-apollo'
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter, Switch } from 'react-router-dom'
|
||||
import { hot } from 'react-hot-loader'
|
||||
|
||||
import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider'
|
||||
import CssBaseline from '@material-ui/core/CssBaseline'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import { theme, globalStyles } from './styles'
|
||||
import './styles/styles.scss'
|
||||
|
||||
import { client } from './graphql/apollo'
|
||||
import Auth from './auth'
|
||||
|
||||
import { Layout, Home, Charts, Callback, EmailSignupConfirm } from './views'
|
||||
|
||||
import Users from '@superalgos/users-client'
|
||||
import Teams from '@superalgos/teams-client'
|
||||
import Events from '@superalgos/events-client'
|
||||
import KeyVault from '@superalgos/key-vault-client'
|
||||
import Operations from '@superalgos/operations-client'
|
||||
import Strategizer from '@superalgos/strategizer-client'
|
||||
import Logs from '@superalgos/logs-client'
|
||||
import Cockpit from '@superalgos/cockpit-client'
|
||||
|
||||
export const auth = new Auth(
|
||||
result => console.log('Authentication successful.'),
|
||||
client
|
||||
)
|
||||
|
||||
export const MasterApp = props => (
|
||||
<BrowserRouter>
|
||||
<ApolloProvider client={client}>
|
||||
<MuiThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<Layout auth={auth}>
|
||||
<Switch>
|
||||
<Route exact path='/' component={Home} />
|
||||
<Route
|
||||
path='/callback'
|
||||
render={props => {
|
||||
return <Callback {...props} />
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path='/email-verification'
|
||||
render={props => {
|
||||
console.log(props.location)
|
||||
return (
|
||||
<EmailSignupConfirm
|
||||
{...props}
|
||||
tokenParam={props.location.search}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<Route
|
||||
path='/charts'
|
||||
render={props => <Charts {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/users'
|
||||
render={props => <Users {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/teams'
|
||||
render={props => <Teams {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/events'
|
||||
render={props => <Events {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/keys'
|
||||
render={props => <KeyVault {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/clones'
|
||||
render={props => <Operations {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/strategizer'
|
||||
render={props => <Strategizer {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/logs'
|
||||
render={props => <Logs {...props} auth={auth} />}
|
||||
/>
|
||||
<Route
|
||||
path='/cockpit'
|
||||
render={props => <Cockpit {...props} auth={auth} />}
|
||||
/>
|
||||
</Switch>
|
||||
</Layout>
|
||||
</MuiThemeProvider>
|
||||
</ApolloProvider>
|
||||
</BrowserRouter>
|
||||
)
|
||||
|
||||
const StyledMasterApp = withStyles(globalStyles)(MasterApp)
|
||||
export default hot(module)(StyledMasterApp)
|
||||
|
After Width: | Height: | Size: 436 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 96"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#e3493c;}</style></defs><title>Superalgos-logo-horz-dark</title><g id="Layer_4" data-name="Layer 4"><path class="cls-1" d="M105.33,66.86a30.85,30.85,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11.06,11.06,0,0,0,2.47-.21,2.63,2.63,0,0,0,1.37-.78,3.4,3.4,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.16,2.16,0,0,0-.8-1.45,6.77,6.77,0,0,0-2.24-.81l-4.41-.88a3.53,3.53,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.86-3.17,11.16,11.16,0,0,1,4.91-.93,25.48,25.48,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.19,2.19,0,0,0-1.37.93,3.69,3.69,0,0,0-.63,1.59,17.44,17.44,0,0,0-.15,2.57,20.72,20.72,0,0,0,.15,3,2.29,2.29,0,0,0,.6,1.3,3.23,3.23,0,0,0,1.48.59l3.9.83a7.33,7.33,0,0,1,2.78,1.15,4.9,4.9,0,0,1,1.63,2.59,19.4,19.4,0,0,1,.57,5.77,21.38,21.38,0,0,1-.85,6.83,5.84,5.84,0,0,1-2.68,3.38,10.64,10.64,0,0,1-4.93,1A36.1,36.1,0,0,1,105.33,66.86Z"/><path class="cls-1" d="M143.91,30.93V51a72.1,72.1,0,0,1-.5,10.12,6.77,6.77,0,0,1-2.31,4.52q-1.82,1.41-6,1.41t-6-1.41a6.68,6.68,0,0,1-2.29-4.49A77.15,77.15,0,0,1,126.3,51V30.93h5.3V53.27c0,2.91.06,4.93.18,6.08a3.46,3.46,0,0,0,.88,2.31,3.76,3.76,0,0,0,2.42.6,3.83,3.83,0,0,0,2.46-.6,3.51,3.51,0,0,0,.89-2.31c.12-1.15.18-3.17.18-6.08V30.93Z"/><path class="cls-1" d="M153.51,30.93h9.19a8.12,8.12,0,0,1,5.15,1.38,6.6,6.6,0,0,1,2.26,3.82,31.56,31.56,0,0,1,.54,6.54,31.4,31.4,0,0,1-.52,6.39,6.7,6.7,0,0,1-2.26,3.9,7.89,7.89,0,0,1-5.17,1.45h-3.89V66.67h-5.3Zm8.36,18.71a3.57,3.57,0,0,0,2.32-.6,3.32,3.32,0,0,0,.93-2,28.88,28.88,0,0,0,.23-4.37,28.19,28.19,0,0,0-.23-4.33,3.29,3.29,0,0,0-.93-2,3.63,3.63,0,0,0-2.32-.6h-3.06V49.64Z"/><path class="cls-1" d="M179.28,66.67V30.93h14.07v4.83h-8.73V46.21h7.64V51h-7.64v10.8h8.73v4.83Z"/><path class="cls-1" d="M214.78,66.67l-3.27-13.29h-4V66.67h-5.29V30.93h9.4a8.5,8.5,0,0,1,5.14,1.3A6.17,6.17,0,0,1,219,35.89a29.17,29.17,0,0,1,.55,6.27,26.68,26.68,0,0,1-.63,6.44,5.71,5.71,0,0,1-2.59,3.63l3.89,14.44Zm-1.69-18.54a3,3,0,0,0,.93-1.87,24.61,24.61,0,0,0,.24-4,24.07,24.07,0,0,0-.24-4,2.87,2.87,0,0,0-1-1.87,3.67,3.67,0,0,0-2.28-.58H207.5V48.7h3.28A3.69,3.69,0,0,0,213.09,48.13Z"/><path class="cls-2" d="M243.19,66.67l-1.51-8.57h-7l-1.46,8.57H228l6.44-35.74h7.68l6.45,35.74Zm-4.84-29.92H238l-2.75,16.63h5.82Z"/><path class="cls-2" d="M257,66.67V30.93h5.35V61.79h7.84v4.88Z"/><path class="cls-2" d="M286.87,51.4V46.73H295V66.05a22.89,22.89,0,0,1-3.64.75,30.25,30.25,0,0,1-4,.29q-4.05,0-6-1.43t-2.76-5.25a63.23,63.23,0,0,1-.77-11.61,60.57,60.57,0,0,1,.8-11.58q.81-3.8,2.88-5.25c1.39-1,3.5-1.45,6.34-1.45a26,26,0,0,1,3.66.28,27.48,27.48,0,0,1,3.46.71V36c-1-.17-2.05-.32-3.12-.44a23.88,23.88,0,0,0-2.44-.18,9.28,9.28,0,0,0-4.24.68c-.77.44-1.32,1.56-1.63,3.35A63.63,63.63,0,0,0,283,48.8q0,6.35.29,9a6.46,6.46,0,0,0,1.17,3.64,3.93,3.93,0,0,0,3,.93,10.23,10.23,0,0,0,2.7-.31V51.4Z"/><path class="cls-2" d="M306.66,65.58q-1.91-1.5-2.39-5a95.6,95.6,0,0,1-.5-11.74,95.52,95.52,0,0,1,.5-11.73,7.43,7.43,0,0,1,2.39-5q1.89-1.5,6.26-1.5t6.31,1.5a7.52,7.52,0,0,1,2.39,5,98.19,98.19,0,0,1,.49,11.73,98.27,98.27,0,0,1-.49,11.74q-.5,3.54-2.39,5t-6.31,1.51Q308.55,67.09,306.66,65.58Zm8.9-4c.49-.45.82-1.56,1-3.32s.26-4.92.26-9.46-.09-7.69-.26-9.45-.5-2.88-1-3.32a3.9,3.9,0,0,0-2.64-.68,3.83,3.83,0,0,0-2.63.68c-.47.44-.79,1.55-1,3.32s-.26,4.92-.26,9.45.09,7.69.26,9.46.49,2.87,1,3.32a3.83,3.83,0,0,0,2.63.68A3.9,3.9,0,0,0,315.56,61.58Z"/><path class="cls-2" d="M334.69,66.86a30.48,30.48,0,0,1-3.58-.6V61.84a49.59,49.59,0,0,0,5.92.42,11,11,0,0,0,2.46-.21,2.66,2.66,0,0,0,1.38-.78,3.5,3.5,0,0,0,.65-1.64,17.68,17.68,0,0,0,.18-2.83,24.15,24.15,0,0,0-.18-3.61,2.13,2.13,0,0,0-.81-1.45,6.69,6.69,0,0,0-2.23-.81l-4.41-.88a3.51,3.51,0,0,1-2.78-2.62,23,23,0,0,1-.7-6.57,16.26,16.26,0,0,1,1-6.24,6,6,0,0,1,2.85-3.17,11.19,11.19,0,0,1,4.91-.93,25.52,25.52,0,0,1,4,.28c1.19.2,2,.36,2.57.5v4.46a17,17,0,0,0-2.08-.28c-1-.09-2-.13-3-.13a11.47,11.47,0,0,0-2.78.26,2.24,2.24,0,0,0-1.38.93,3.56,3.56,0,0,0-.62,1.59,17.23,17.23,0,0,0-.16,2.57,20.35,20.35,0,0,0,.16,3,2.17,2.17,0,0,0,.6,1.3,3.19,3.19,0,0,0,1.48.59l3.89.83a7.26,7.26,0,0,1,2.78,1.15,4.91,4.91,0,0,1,1.64,2.59,19.4,19.4,0,0,1,.57,5.77,21.33,21.33,0,0,1-.86,6.83,5.79,5.79,0,0,1-2.67,3.38,10.66,10.66,0,0,1-4.94,1A35.92,35.92,0,0,1,334.69,66.86Z"/><path class="cls-2" d="M46.72,59c1.23-.38,9.08.88,10.13,1.62,3.3,2.33,8.14,3.58,10.08,1.2s-.09-6.47-3.19-9.59c-.92-.94-3.89-8.18-3.75-9.47.44-4.09-.9-9-3.94-9.46s-5.91,3.86-6.64,7.56c-.25,1.29-5.32,7.5-6.48,8-3.67,1.7-7.14,5.24-6,8.11S43.15,60.05,46.72,59Z"/><path class="cls-2" d="M60.38,16.76c4.93.21,7,10.25,6.21,18.12-.25,2.5,5.56,16.57,6.58,18.88A7.82,7.82,0,0,0,76.37,57C72.61,46.77,72.28,38.6,73,36.69c3.21-8.85,1.8-20.77-3-23.53-3.25-1.87-10.33-2.62-14.85,4.8A7.33,7.33,0,0,1,60.38,16.76Z"/><path class="cls-2" d="M20.91,59.57c-2.28-4.39,5.38-11.2,12.6-14.45C35.8,44.09,45.07,32,46.57,30a7.77,7.77,0,0,0,1.17-4.37c-7,8.35-13.86,Line truncated
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
|
After Width: | Height: | Size: 502 B |
|
After Width: | Height: | Size: 758 B |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,9 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#e3493c">
|
||||
<meta name="apple-mobile-web-app-title" content="Superalgos">
|
||||
<meta name="application-name" content="Superalgos">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1 @@
|
||||
<svg version="1" xmlns="http://www.w3.org/2000/svg" width="1365.333" height="1365.333" viewBox="0 0 1024.000000 1024.000000"><path d="M685.9 27.4c-.2.2-3 .7-6.1 1-12.6 1.5-34.6 8.5-45.2 14.5-2 1.2-5.3 3.1-7.3 4.2-14.3 8.1-30.2 22.3-43.5 38.8-5.9 7.4-16.2 22.1-15.5 22.1.2 0 3.6-1.7 7.5-3.9 17.4-9.6 28.8-12.1 52.2-11.7 13.4.3 17.7.8 23.1 2.5 25.1 8 45.2 36.6 58.9 83.7 1.8 6 3.3 11.6 3.5 12.4 2.3 10.8 3.5 17.1 4 20 .3 1.9 1 6 1.5 9 1.2 7.3 1.8 11.3 2.5 18.5.4 3.3.8 7.6 1.1 9.5 1.6 14.3 2.2 51.4 1 69.5-1.4 21.3-1.5 26-.5 31 .5 2.7 1.2 6.3 1.5 8 2.3 12.9 20.6 69 33.4 102.5 1.6 4.1 4.8 12.4 7.1 18.5 17.1 45.2 47.3 118.6 49.1 119.3.4.2.8.9.8 1.5.1 3.8 18.3 22 29.2 29.1 4.7 3.1 8.8 5.6 9 5.6.3 0-3.2-10.9-7.7-24.3-4.5-13.3-8.4-25.3-8.7-26.7-.4-1.4-2-7.2-3.7-13-4.3-14.5-12.2-45.3-13.7-54-.3-1.4-.7-3.3-1-4.2-.3-1-.7-3-1-4.5-.2-1.6-.9-4.8-1.4-7.3-.5-2.5-1.4-7.2-2-10.5-.5-3.3-1.2-7.1-1.5-8.5-.3-1.4-1-5.7-1.5-9.5-.6-3.9-1.2-8.1-1.5-9.5-.3-2.3-.7-5.4-2-16.3-3.1-25.8-3.8-58.6-1.5-73.2.7-4.4 2.2-10.7 3.5-14 2.3-6.1 9-28.9 9.9-33.5.3-1.4 1.2-5.2 2-8.5s1.7-7.4 1.9-9c.3-1.7 1.4-8.2 2.6-14.6 1.1-6.3 2.3-14.7 2.6-18.5.4-3.8.9-8.3 1.1-9.9 2.2-16.2 2.2-69.4 0-83.5-.2-1.4-.7-5-1.1-8-6.7-56.6-26.4-102.4-53.1-123.1-11.1-8.5-31-16.4-49.9-19.7-9.6-1.7-38.4-2.9-39.6-1.8zM465 215.4c-2.3 3-9.7 11.7-14.5 17-1.1 1.2-5.6 6.2-10 11.1-8.3 9.3-43.9 45.2-53.5 54-51.1 46.9-108.8 86-132.5 90-2.2.4-4.4.8-5 .9-.5.2-2.8.6-5 1.1-24.5 4.7-70 20.4-91 31.3-2.7 1.4-5.2 2.6-5.5 2.7-.7.1-12.3 6.2-16.7 8.7-2.1 1.2-5.4 3.1-7.5 4.2C62.4 471.4 16.3 519 4.3 559.8.9 571.3.5 590 3.4 603.5c2.6 12.1 7.2 25.6 11.8 35 19.6 39.1 52.7 65.8 95.3 76.8 5.5 1.4 12 2.9 14.5 3.2 2.5.4 5.4.9 6.5 1.1 2.8.5 11.7 1.4 19.5 1.9l6.4.4-3.4-2.1c-20.8-12.5-29.7-21.3-39-38.3-1.8-3.3-4.3-7.8-5.5-10-6.1-11.2-8.2-22.8-6.4-35.1 7.4-48 72.3-111.2 159.4-155 10.5-5.3 21-11.2 23.5-13.1 8.7-6.7 26.9-25.3 45.4-46.3 1.7-2 4.9-5.6 7.1-8.1 2.2-2.4 6-6.9 8.5-9.8 2.5-3 5-5.9 5.5-6.5.6-.6 3-3.6 5.5-6.6 6.5-8 7.1-8.6 15.2-18.5 12.7-15.4 51.5-64.5 61.3-77.6 1.1-1.5 5.9-7.8 10.6-14 11.5-15.2 13.3-18.1 16.8-26.9 3-7.7 3.5-9.3 5.1-19 1.2-7.1 1.9-21.9 1.1-22.4-.3-.2-1.7 1.1-3.1 2.8zM563.9 315c-21.5 5.4-43.9 28.6-59.4 61.3-5.2 11-10.1 24.9-12.5 35.7-2 8.8-6.1 16.2-21 37.4-1.8 2.6-17.8 23.2-20.7 26.6-14.7 17.6-22.4 26.2-31.2 35.1-8.7 8.6-12.2 11.3-19.6 15.2-16.7 8.7-25.6 14.5-37 23.8-22.2 18.1-36.8 38.2-41 56.4-1.6 6.6-2.2 17.6-1.1 19.3.3.5.7 2.1 1 3.7.8 4.3 5.3 12.7 9.1 16.8 10.1 11.1 27.7 18.5 50.5 21.3 12.2 1.5 36.1.8 49-1.6 11.6-2 12.6-2.3 20.5-4.5s31.7-2.2 43.5 0c.8.2 4.4.6 8 1 3.6.4 7.4.9 8.4 1.1 1.1.2 4.2.6 6.9.9 2.8.3 5.3.8 5.6.9.3.2 2.9.7 5.6 1 9.1 1.3 39 7.5 47.9 10.1 8.9 2.6 18.5 7 20.6 9.6 1.9 2.3 30.1 16.5 39.5 20 9.1 3.3 26.6 7.7 33.7 8.6 9.2 1.1 23.9.7 30-.7 19.5-4.6 33.3-18.5 36.3-36.7.7-4.2.8-19 .1-20.1-.2-.4-.7-2.4-1-4.6-1-6.1-5.5-18.3-10.3-28.1-4.2-8.3-15.4-26.1-20.1-31.6-5.8-7-14.5-17-18.6-21.4-2.6-2.8-6.5-8-8.7-11.7-6.3-10.8-17.6-35.1-25.4-55.3-1.5-3.9-3.3-8.4-4-10-1.4-3.5-4.9-12.8-5-13.5 0-.3-1.2-3.7-2.5-7.5-1.3-3.9-2.5-7.5-2.6-8-.1-.6-.9-3.5-1.8-6.6-2.6-8.9-2.8-10-2.6-17.4.7-25.5.3-39.3-1.3-49.5-.3-1.4-.8-4.5-1.2-7-.3-2.4-.8-4.7-1-5.1-.2-.3-.7-2.1-1-4-.9-5.4-6.3-20.6-9.7-27.3-7.5-14.9-16.6-24.9-27.5-30.3-6.3-3.1-8.3-3.6-16-3.9-4.8-.2-10.4.1-12.4.6zM340 752.1c-12.3 2.1-18.9 4.4-31.5 10.7-10.5 5.3-11.8 4.4 13 9.2 69 13.5 135.5 34.9 186.8 60.2 24.5 12.1 41 22.8 49.7 32.3 24.3 26.6 37.9 39.4 60 56.6 50.3 39.2 116.2 69.8 162.5 75.5 2.8.3 6.8.9 9 1.3 4.8.9 28.3.6 34-.3 23.2-4 37.1-11.8 56.6-31.7 33-33.8 46.8-81.2 37.4-128.4-3.2-16-8-29.9-16.2-46.5l-4.2-8.5-.1 8c-.1 4.4-.3 8.7-.4 9.5-.2.8-.6 3.8-1 6.6-1.8 14.4-15.1 40.8-26.4 52.7-17.8 18.7-53.6 23.1-99.2 12.2-5.8-1.4-11.5-2.7-12.6-3-1.2-.3-7.7-2.3-14.5-4.6-36.3-12-78-32.8-111.4-55.7-6-4.1-13-8.4-15.5-9.4-2.5-1.1-5.4-2.3-6.5-2.8-5.6-2.4-39.7-11.2-52.5-13.5-1.9-.3-4.2-.7-5-.9-.8-.1-4-.8-7-1.4-9.8-2-26.4-5.1-30-5.6-3-.5-29.1-4.8-37-6.1-1.4-.2-4.3-.7-6.5-1-6.9-1.1-9.8-1.5-15.5-2.5-3-.5-8.2-1.2-11.5-1.6-3.3-.3-6.2-.7-6.5-.9-.3-.2-4.4-.9-9-1.5-4.7-.6-9.6-1.3-11-1.5-1.4-.2-6.3-.9-11-1.5s-9.6-1.3-11-1.5c-5.9-.8-10.8-1.5-15-2-5.1-.6-9.4-1.2-16-2.1-7.1-.9-20.1-1.1-25-.3z"/></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Superalgos",
|
||||
"short_name": "Superalgos",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export const AUTH_CONFIG = {
|
||||
api_audience: process.env.AUTH0_AUDIENCE,
|
||||
domain: process.env.AUTH0_DOMAIN,
|
||||
clientId: process.env.AUTH0_CLIENTID,
|
||||
callbackUrl: process.env.AUTH0_CALLBACK_URL,
|
||||
logoutUrl: process.env.AUTH0_LOGOUT_URL
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
import Auth0Lock from 'auth0-lock'
|
||||
import gql from 'graphql-tag'
|
||||
import { getItem, setItem } from '../utils/local-storage'
|
||||
import { validObject, deleteCookie, slugify, isEmpty } from '../utils/js-helpers'
|
||||
import Log from '../utils/log'
|
||||
import { client } from '../graphql/apollo'
|
||||
import { AUTH_CONFIG } from './Auth0' // create by renaming Auth0.sample.js to Auth0.js and setting vars
|
||||
|
||||
const AUTHENTICATE = gql`
|
||||
mutation authenticate($idToken: String!) {
|
||||
users_Authenticate(idToken: $idToken) {
|
||||
alias
|
||||
authId
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const VERIFY_TEAM_INVITE = gql`
|
||||
mutation verifyTeamInvite($token: String!) {
|
||||
verifyTeamInvite(token: $token) {
|
||||
email
|
||||
team {
|
||||
slug
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
const GET_TEAMS_BY_OWNER = gql`
|
||||
query teamsByOwnerQuery {
|
||||
teams_TeamsByOwner {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const CREATE_TEAM = gql`
|
||||
mutation CreateTeamMutation($name: String!, $slug: String!, $botName: String!, $botSlug: String!) {
|
||||
teams_CreateTeam(name: $name, slug: $slug, botName: $botName, botSlug: $botSlug) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const defaultOptions = {
|
||||
oidcConformant: true,
|
||||
autoclose: true,
|
||||
allowedConnections: ['Username-Password-Authentication', 'github'],
|
||||
auth: {
|
||||
sso: true,
|
||||
redirectUrl: window.location.origin + '/callback',
|
||||
responseType: 'token id_token',
|
||||
audience: `${AUTH_CONFIG.api_audience}`,
|
||||
params: {
|
||||
scope: `openid profile email user_metadata app_metadata picture`
|
||||
}
|
||||
},
|
||||
theme: {
|
||||
logo: 'https://aadevelop.blob.core.windows.net/module-master/assets/logos/Superalgos-mark-auth0-lock.png',
|
||||
primaryColor: '#e3493c'
|
||||
},
|
||||
languageDictionary: {
|
||||
title: 'Superalgos Platform'
|
||||
},
|
||||
avatar: null,
|
||||
mustAcceptTerms: true
|
||||
}
|
||||
|
||||
export const inviteOptions = {
|
||||
oidcConformant: true,
|
||||
autoclose: false,
|
||||
allowedConnections: ['Username-Password-Authentication', 'github'],
|
||||
allowShowPassword: true,
|
||||
auth: {
|
||||
sso: false,
|
||||
redirectUrl: window.location.origin + '/callback',
|
||||
responseType: 'token id_token',
|
||||
audience: `${AUTH_CONFIG.api_audience}`,
|
||||
params: {
|
||||
state: '',
|
||||
scope: `email`
|
||||
}
|
||||
},
|
||||
prefill: { email: '' },
|
||||
languageDictionary: {
|
||||
title: 'Superalgos Platform'
|
||||
},
|
||||
avatar: null,
|
||||
mustAcceptTerms: true
|
||||
}
|
||||
|
||||
let lock = new Auth0Lock(
|
||||
AUTH_CONFIG.clientId,
|
||||
AUTH_CONFIG.domain,
|
||||
defaultOptions
|
||||
)
|
||||
|
||||
class Auth {
|
||||
constructor(cb, apolloClient) {
|
||||
this.handleAuthentication()
|
||||
// binds functions to keep this context
|
||||
this.apolloClient = apolloClient
|
||||
this.cb = cb.bind(this)
|
||||
this.login = this.login.bind(this)
|
||||
this.loginInvite = this.loginInvite.bind(this)
|
||||
this.logout = this.logout.bind(this)
|
||||
this.isAuthenticated = this.isAuthenticated.bind(this)
|
||||
this.checkSession = this.checkSession.bind(this)
|
||||
}
|
||||
|
||||
login() {
|
||||
// Call the show method to display the widget.
|
||||
Log.info('logging in')
|
||||
lock.show()
|
||||
}
|
||||
|
||||
async loginInvite(jwt) {
|
||||
let email
|
||||
let team
|
||||
try {
|
||||
const data = await client.mutate({
|
||||
mutation: VERIFY_TEAM_INVITE,
|
||||
variables: { token: jwt }
|
||||
})
|
||||
|
||||
Log.info('auth.loginInvite')
|
||||
Log.info(await data.data.verifyTeamInvite)
|
||||
|
||||
setItem('invite', JSON.stringify(data.data.verifyTeamInvite))
|
||||
|
||||
email = data.data.verifyTeamInvite.email
|
||||
team = data.data.verifyTeamInvite.team.slug
|
||||
} catch (err) {
|
||||
return Log.error(err, 'loginInvite err: ')
|
||||
}
|
||||
inviteOptions.prefill.email = email
|
||||
inviteOptions.auth.params.state = `${email}|${team}`
|
||||
let lockInvite = new Auth0Lock(
|
||||
AUTH_CONFIG.clientId,
|
||||
AUTH_CONFIG.domain,
|
||||
inviteOptions
|
||||
)
|
||||
lockInvite.show()
|
||||
}
|
||||
|
||||
handleAuthentication() {
|
||||
// Add a callback for Lock's `authenticated` event
|
||||
lock.on('authenticated', async (authResult) => {
|
||||
if (authResult && authResult.accessToken && authResult.idToken) {
|
||||
// Set the time that the access token will expire at
|
||||
let expiresAt = JSON.stringify(
|
||||
authResult.expiresIn * 1000 + new Date().getTime()
|
||||
)
|
||||
const data = {
|
||||
status: `success`,
|
||||
accessToken: authResult.accessToken,
|
||||
idToken: authResult.idToken,
|
||||
expiresAt
|
||||
}
|
||||
Log.info('setSession idTokenPayload:')
|
||||
Log.info(authResult.idTokenPayload)
|
||||
|
||||
try {
|
||||
setItem('access_token', authResult.accessToken)
|
||||
setItem('id_token', authResult.idToken)
|
||||
setItem('expires_at', expiresAt)
|
||||
setItem('user', JSON.stringify(user))
|
||||
await this.signinOrCreateAccount({ ...data })
|
||||
this.cb(data)
|
||||
const user = {
|
||||
authId: authResult.idTokenPayload.sub,
|
||||
alias: authResult.idTokenPayload.nickname
|
||||
}
|
||||
|
||||
setItem('access_token', authResult.accessToken)
|
||||
setItem('id_token', authResult.idToken)
|
||||
setItem('expires_at', expiresAt)
|
||||
setItem('user', JSON.stringify(user))
|
||||
window.location.href = '/'
|
||||
return true
|
||||
} catch (err) {
|
||||
console.log('Sign in or create account error.')
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('id_token')
|
||||
window.localStorage.removeItem('expires_at')
|
||||
window.localStorage.removeItem('user')
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
// Add a callback for Lock's `authorization_error` event
|
||||
lock.on('authorization_error', err => {
|
||||
const data = { status: `error`, errMessage: err.error }
|
||||
this.cb(data)
|
||||
})
|
||||
}
|
||||
|
||||
checkSession() {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Add a callback for Lock's `authenticated` event
|
||||
lock.checkSession(
|
||||
{
|
||||
responseType: 'token id_token',
|
||||
audience: AUTH_CONFIG.api_audience,
|
||||
scope: 'openid email profile',
|
||||
connection: 'github',
|
||||
prompt: 'none'
|
||||
},
|
||||
function (err, authResult) {
|
||||
if (!err) {
|
||||
resolve(authResult)
|
||||
} else {
|
||||
reject(err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async signinOrCreateAccount({ accessToken, idToken, expiresAt }) {
|
||||
const response = await client.mutate({
|
||||
mutation: AUTHENTICATE,
|
||||
variables: { idToken }
|
||||
})
|
||||
Log.info('auth.signinOrCreateAccount data:')
|
||||
Log.info(response)
|
||||
const user = {
|
||||
authId: response.data.users_Authenticate.authId,
|
||||
alias: response.data.users_Authenticate.alias
|
||||
}
|
||||
if (validObject(user, 'alias')) {
|
||||
Log.info(user.alias)
|
||||
const existingTeam = await client.query({
|
||||
query: GET_TEAMS_BY_OWNER
|
||||
})
|
||||
Log.info(existingTeam)
|
||||
Log.info(existingTeam.data.teams_TeamsByOwner)
|
||||
if (validObject(existingTeam.data, 'teams_TeamsByOwner') && isEmpty(existingTeam.data.teams_TeamsByOwner)) {
|
||||
const slug = slugify(user.alias)
|
||||
const newTeam = await client.mutate({
|
||||
mutation: CREATE_TEAM,
|
||||
variables: {
|
||||
name: slug,
|
||||
slug: slug,
|
||||
botName: `bot-${slug}`,
|
||||
botSlug: `bot-${slug}`
|
||||
}
|
||||
})
|
||||
Log.info(newTeam)
|
||||
Log.info(newTeam.data.teams_CreateTeam)
|
||||
if (!validObject(newTeam.data, 'teams_CreateTeam') || isEmpty(newTeam.data.teams_CreateTeam)) {
|
||||
throw newTeam.data.error
|
||||
}
|
||||
Log.info('Team and Bot Creation Success')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logout() {
|
||||
// Clear access token and ID token from local storage
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('user')
|
||||
window.localStorage.removeItem('name')
|
||||
window.localStorage.removeItem('ecosystem')
|
||||
deleteCookie('ajs_anonymous_id')
|
||||
deleteCookie('ajs_user_id')
|
||||
deleteCookie('current_tenant')
|
||||
|
||||
lock.logout({ returnTo: AUTH_CONFIG.logoutUrl })
|
||||
}
|
||||
|
||||
async isAuthenticated() {
|
||||
// check session and run Auth0 SS0
|
||||
const getUser = await getItem('authUser')
|
||||
const getExpires = await getItem('expires_at')
|
||||
let user = JSON.parse(getUser)
|
||||
|
||||
if (new Date().getTime() < getExpires * 1000) {
|
||||
console.log(
|
||||
'handleAuth.user exp: ',
|
||||
user,
|
||||
getExpires,
|
||||
window.location.href
|
||||
)
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
// TODO improve to check the session validation on client side
|
||||
const checkSSO = await this.checkSession()
|
||||
.then(result => {
|
||||
console.log('handleAuth.checksessions: ', result)
|
||||
const user = {
|
||||
authId: result.idTokenPayload.sub,
|
||||
alias: result.idTokenPayload.nickname
|
||||
}
|
||||
setItem('authUser', JSON.stringify(user))
|
||||
// user confirmed, log into client
|
||||
this.setSession(result)
|
||||
return result.idTokenPayload
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.error === 'login_required') {
|
||||
// If graphql error, update session
|
||||
// otherwise send to login
|
||||
// return this.login()
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
||||
if (/manage|profile|create|dashboard/.test(window.location.href) && !user) {
|
||||
this.login()
|
||||
}
|
||||
|
||||
if (validObject(checkSSO, 'error')) {
|
||||
return false
|
||||
} else {
|
||||
return checkSSO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Auth
|
||||
@@ -0,0 +1,121 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const ECOSYSTEM_QUERY = gql`
|
||||
query {
|
||||
web_GetEcosystem {
|
||||
id
|
||||
devTeams {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
bots {
|
||||
codeName
|
||||
displayName
|
||||
type
|
||||
profilePicture
|
||||
repo
|
||||
configFile
|
||||
products{
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
dataSets{
|
||||
codeName
|
||||
type
|
||||
validPeriods
|
||||
filePath
|
||||
fileName
|
||||
dataRange{
|
||||
filePath
|
||||
fileName
|
||||
}
|
||||
}
|
||||
exchangeList{
|
||||
name
|
||||
}
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
}
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
hosts {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
competitions {
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
startDatetime
|
||||
finishDatetime
|
||||
formula
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
host{
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
rules
|
||||
prizes
|
||||
participants
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -0,0 +1,92 @@
|
||||
import { ApolloClient } from 'apollo-client'
|
||||
import { HttpLink } from 'apollo-link-http'
|
||||
import { InMemoryCache } from 'apollo-cache-inmemory'
|
||||
import { ApolloLink, Observable } from 'apollo-link'
|
||||
import { onError } from 'apollo-link-error'
|
||||
import { setContext } from 'apollo-link-context'
|
||||
|
||||
import { getItem } from '../utils/local-storage'
|
||||
|
||||
const httpLink = new HttpLink({ uri: process.env.PLATFORM_API_URL })
|
||||
|
||||
const authRetryLink = onError(
|
||||
({ graphQLErrors, networkError, operation, forward }) => {
|
||||
if (graphQLErrors) {
|
||||
// User access token has expired
|
||||
// console.log('authLink: ', graphQLErrors) // check for error message to intercept and resend with Auth0 access token
|
||||
if (graphQLErrors[0].message === 'Context creation failed: jwt expired') {
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('user')
|
||||
window.localStorage.removeItem('name')
|
||||
location.reload()
|
||||
} else if (graphQLErrors[0].message === 'Not logged in') {
|
||||
// We assume we have auth0 access token needed to run the async request
|
||||
// Let's refresh token through async request
|
||||
return new Observable(observer => {
|
||||
getItem('access_token')
|
||||
.then(accessToken => {
|
||||
operation.setContext(({ headers = {} }) => ({
|
||||
headers: {
|
||||
// Re-add old headers
|
||||
...headers,
|
||||
// Switch out old access token for new one
|
||||
Authorization: `Bearer ${accessToken}` || null
|
||||
}
|
||||
}))
|
||||
})
|
||||
.then(() => {
|
||||
const subscriber = {
|
||||
next: observer.next.bind(observer),
|
||||
error: observer.error.bind(observer),
|
||||
complete: observer.complete.bind(observer)
|
||||
}
|
||||
|
||||
// Retry last failed request
|
||||
forward(operation).subscribe(subscriber)
|
||||
|
||||
// TODO improve with redux
|
||||
location.reload()
|
||||
})
|
||||
.catch(error => {
|
||||
// No auth0 access token available, we force user to login
|
||||
observer.error(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const authLink = setContext((_, { headers }) => {
|
||||
// get the authentication token from local storage if it exists
|
||||
const token = localStorage.getItem('access_token')
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
Authorization: token ? `Bearer ${token}` : ``
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const cache = new InMemoryCache({ addTypename: false }).restore(window.__APOLLO_STATE__)
|
||||
|
||||
const defaultOptions = {
|
||||
watchQuery: {
|
||||
fetchPolicy: 'cache-and-network',
|
||||
errorPolicy: 'all'
|
||||
},
|
||||
query: {
|
||||
fetchPolicy: 'network-only',
|
||||
errorPolicy: 'all'
|
||||
},
|
||||
mutate: {
|
||||
errorPolicy: 'all'
|
||||
}
|
||||
}
|
||||
|
||||
export const client = new ApolloClient({
|
||||
link: ApolloLink.from([authRetryLink, authLink, httpLink]), // replaced link with httpLink
|
||||
cache,
|
||||
defaultOptions,
|
||||
connectToDevTools: true
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import MasterApp from './App'
|
||||
import { createStore } from 'redux'
|
||||
import { Provider } from 'react-redux'
|
||||
import rootReducer from './reducers/rootReducer'
|
||||
|
||||
const store = createStore(rootReducer)
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
window.localStorage.setItem('debug', 'advanced-algos:*')
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<MasterApp />
|
||||
</Provider>,
|
||||
document.getElementById('masterApp')
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
const initState = {
|
||||
context: {
|
||||
masterApp: {
|
||||
footer: {
|
||||
visible: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rootReducer = (state = initState, action) => {
|
||||
if (action.type === 'HIDE_FOOTER') {
|
||||
let newState = JSON.parse(JSON.stringify(state))
|
||||
newState.context.masterApp.footer.visible = false
|
||||
return newState
|
||||
}
|
||||
|
||||
if (action.type === 'SHOW_FOOTER') {
|
||||
let newState = JSON.parse(JSON.stringify(state))
|
||||
newState.context.masterApp.footer.visible = true
|
||||
return newState
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
|
||||
export default rootReducer
|
||||
@@ -0,0 +1,81 @@
|
||||
import { createMuiTheme } from '@material-ui/core/styles'
|
||||
|
||||
export const theme = createMuiTheme({
|
||||
breakpoints: {
|
||||
values: {
|
||||
xs: 0,
|
||||
sm: 768,
|
||||
md: 992,
|
||||
lg: 1200,
|
||||
xl: 1920
|
||||
}
|
||||
},
|
||||
palette: {
|
||||
primary: {
|
||||
main: '#303036',
|
||||
light: '#acb4b6'
|
||||
},
|
||||
secondary: {
|
||||
main: '#CC5835',
|
||||
light: '#e3493c'
|
||||
} // <--RUSTED_RED ~ GOLDEN_ORANGE --> #F0A202
|
||||
},
|
||||
typography: {
|
||||
fontFamily: '"Saira","Saira Condensed", sans-serif',
|
||||
useNextVariants: true
|
||||
},
|
||||
overrides: {
|
||||
Paper: {
|
||||
root: {
|
||||
backgroundColor: '#ffffff'
|
||||
},
|
||||
elevation: 0,
|
||||
square: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export const globalStyles = theme => ({
|
||||
'@global': {
|
||||
body: {
|
||||
backgroundColor: theme.palette.common.white
|
||||
}
|
||||
},
|
||||
appBar: {
|
||||
position: 'relative'
|
||||
},
|
||||
toolbarTitle: {
|
||||
flex: 1
|
||||
},
|
||||
layout: {
|
||||
width: 'auto',
|
||||
marginLeft: theme.spacing.unit * 3,
|
||||
marginRight: theme.spacing.unit * 3,
|
||||
[theme.breakpoints.up(900 + theme.spacing.unit * 3 * 2)]: {
|
||||
width: 900,
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto'
|
||||
}
|
||||
},
|
||||
heroContent: {
|
||||
maxWidth: 600,
|
||||
margin: '0 auto',
|
||||
padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px`
|
||||
},
|
||||
cardHeader: {
|
||||
backgroundColor: theme.palette.grey[200]
|
||||
},
|
||||
cardPricing: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'baseline',
|
||||
marginBottom: theme.spacing.unit * 2
|
||||
},
|
||||
cardActions: {
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
paddingBottom: theme.spacing.unit * 2
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default theme
|
||||
@@ -0,0 +1,495 @@
|
||||
$break-lg: 1200px;
|
||||
$break-md: 992px;
|
||||
$break-sm: 768px;
|
||||
$break-xs: 540px;
|
||||
|
||||
$height-nav-bar: 131px;
|
||||
|
||||
$height-not-top: 87px;
|
||||
|
||||
$image-height-big: 60px;
|
||||
$image-height-small: 45px;
|
||||
|
||||
$text-height: 25px;
|
||||
|
||||
$mobile-handle-height: 45px;
|
||||
|
||||
$transition-time: 0.3s;
|
||||
|
||||
$advanced-algos-red: rgb(245,88,88);
|
||||
|
||||
@function strip-unit($value) {
|
||||
@return $value / ($value * 0 + 1);
|
||||
}
|
||||
|
||||
@mixin fluid-type($min-vw, $max-vw, $min-font-size, $max-font-size) {
|
||||
$u1: unit($min-vw);
|
||||
$u2: unit($max-vw);
|
||||
$u3: unit($min-font-size);
|
||||
$u4: unit($max-font-size);
|
||||
|
||||
@if $u1 == $u2 and $u1 == $u3 and $u1 == $u4 {
|
||||
& {
|
||||
|
||||
font-size: $min-font-size;
|
||||
@media screen and (min-width: $min-vw) {
|
||||
font-size: calc(#{$min-font-size} + #{strip-unit($max-font-size - $min-font-size)} * ((100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)}));
|
||||
}
|
||||
|
||||
@media screen and (min-width: $max-vw) {
|
||||
font-size: $max-font-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body{
|
||||
padding-right: 0 !important;
|
||||
overflow-y: scroll;
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
border: 1px solid #000;
|
||||
padding: 2px 0;
|
||||
background-color: #404040;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 6px rgba(0,0,0,.3);
|
||||
background-color: #737272;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.container{
|
||||
padding: 15px 15px 15px 15px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
width: 100%;
|
||||
@media screen and (min-width: $break-sm) {
|
||||
width: 768px;
|
||||
}
|
||||
@media screen and (min-width: $break-md) {
|
||||
width: 970px;
|
||||
}
|
||||
@media screen and (min-width: $break-lg) {
|
||||
width: 1170px;
|
||||
}
|
||||
}
|
||||
|
||||
header.menu{
|
||||
transition: $transition-time;
|
||||
&.notOnTop{
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
border-bottom: 1px solid rgba(210, 217, 224, 0.5);
|
||||
height: $height-not-top;
|
||||
.container{
|
||||
border-bottom: 0px;
|
||||
img.logo{
|
||||
margin-top: ( $height-not-top - $image-height-small ) / 2;
|
||||
height: $image-height-small;
|
||||
}
|
||||
.mobileHandle{
|
||||
margin-top: ( $height-not-top - $mobile-handle-height ) / 2 ;
|
||||
margin-bottom: ( $height-not-top - $mobile-handle-height ) / 2 ;
|
||||
}
|
||||
nav.links{
|
||||
@media screen and (min-width: $break-lg) {
|
||||
ul.primaryMenu{
|
||||
li.primaryLink{
|
||||
padding-top: ( $height-not-top - $text-height ) / 2;
|
||||
padding-bottom: ( $height-not-top - $text-height ) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
position: fixed;
|
||||
height: $height-nav-bar;
|
||||
width: 100vw;
|
||||
z-index: 125;
|
||||
|
||||
.container{
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
height: 100%;
|
||||
border-bottom: 1px solid rgba(142, 144, 146, 0.3);
|
||||
img.logo{
|
||||
transition: $transition-time;
|
||||
margin-top: ( $height-nav-bar - $image-height-big ) / 2 ;
|
||||
height: $image-height-big;
|
||||
@media screen and (max-width: $break-xs) {
|
||||
height: $image-height-small;
|
||||
margin-top: ( $height-nav-bar - $image-height-small ) / 2 ;
|
||||
}
|
||||
}
|
||||
.mobileHandle.openedMobile{
|
||||
&:before{
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
top: 17px;
|
||||
width: 1em;
|
||||
height: 0.15em;
|
||||
background: $advanced-algos-red;
|
||||
box-shadow:
|
||||
0 0.25em 0 0 $advanced-algos-red,
|
||||
0 0.5em 0 0 $advanced-algos-red;
|
||||
}
|
||||
}
|
||||
.mobileHandle:not(.openedMobile){
|
||||
&:before{
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
top: 17px;
|
||||
width: 1em;
|
||||
height: 0.15em;
|
||||
background: rgba(210, 217, 224, 0.9);
|
||||
box-shadow:
|
||||
0 0.25em 0 0 rgba(210, 217, 224, 0.9),
|
||||
0 0.5em 0 0 rgba(210, 217, 224, 0.9);
|
||||
}
|
||||
}
|
||||
.mobileHandle{
|
||||
&.openedMobile{
|
||||
color: $advanced-algos-red;
|
||||
border: 1px solid $advanced-algos-red;
|
||||
}
|
||||
transition: $transition-time;
|
||||
display: block;
|
||||
height: $mobile-handle-height;
|
||||
line-height: $mobile-handle-height;
|
||||
border: 1px solid rgba(210, 217, 224, 0.5);
|
||||
text-transform: uppercase;
|
||||
color: rgba(210, 217, 224, 0.9);
|
||||
text-align: center;
|
||||
float: right;
|
||||
width: auto;
|
||||
clear: none;
|
||||
margin-top: ( $height-nav-bar - $mobile-handle-height ) / 2 ;
|
||||
margin-bottom: ( $height-nav-bar - $mobile-handle-height ) / 2 ;
|
||||
margin-left: 0 !important;
|
||||
margin-right: 20px;
|
||||
margin: 41px 0 42px 20px;
|
||||
padding: 0 18px 0 40px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
border-radius: 31px;
|
||||
@media screen and (min-width: $break-lg) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
nav.links{
|
||||
@media screen and (max-width: $break-lg - 1) {
|
||||
display: none;
|
||||
&.openedMobile{
|
||||
display: block;
|
||||
}
|
||||
ul.primaryMenu{
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
font-family: 'Saira';
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: $text-height;
|
||||
text-transform: uppercase;
|
||||
list-style: none;
|
||||
li.primaryLink{
|
||||
min-width: 240px;
|
||||
min-height: 50px;
|
||||
border-bottom: 1px solid white;
|
||||
&.hasChildren{
|
||||
&:after{
|
||||
content: '';
|
||||
float: right;
|
||||
border: solid white;
|
||||
border-width: 0 2px 2px 0;
|
||||
padding: 3px;
|
||||
margin-top: -32px;
|
||||
margin-right: 7px;
|
||||
transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
&:last-child{
|
||||
border-bottom: 0;
|
||||
}
|
||||
a{
|
||||
text-transform: uppercase;
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
padding: 0 40px 0 30px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
&:hover{
|
||||
color: $advanced-algos-red;
|
||||
}
|
||||
svg{
|
||||
padding-top: 10px;
|
||||
}
|
||||
}
|
||||
ul.subMenu{
|
||||
display: none;
|
||||
list-style: none;
|
||||
}
|
||||
&.selected{
|
||||
ul.subMenu{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: $break-lg) {
|
||||
display: block;
|
||||
float: right;
|
||||
ul.primaryMenu{
|
||||
margin: 0 4px 0 0;
|
||||
list-style: none;
|
||||
|
||||
font-family: 'Saira';
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: $text-height;
|
||||
text-transform: uppercase;
|
||||
li.primaryLink{
|
||||
transition: $transition-time;
|
||||
display: block;
|
||||
float: left;
|
||||
position: relative;
|
||||
padding-top: ( $height-nav-bar - $text-height ) / 2;
|
||||
padding-bottom: ( $height-nav-bar - $text-height ) / 2;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
&.hasChildren{
|
||||
&:after{
|
||||
content: '';
|
||||
border: solid white;
|
||||
border-width: 0 2px 2px 0;
|
||||
display: inline-block;
|
||||
padding: 3px;
|
||||
margin-bottom: 2px;
|
||||
transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
}
|
||||
>a{
|
||||
margin-right:6px;
|
||||
}
|
||||
}
|
||||
a{
|
||||
color: white;
|
||||
&:hover{
|
||||
color: $advanced-algos-red;
|
||||
}
|
||||
text-decoration: none;
|
||||
&.selected{
|
||||
color: $advanced-algos-red;
|
||||
}
|
||||
svg{
|
||||
padding-top: 10px;
|
||||
margin-bottom: -2px;
|
||||
&.tutorialIcon {
|
||||
padding-top: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
ul.subMenu{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
|
||||
padding: 18px 30px;
|
||||
list-style: none;
|
||||
font-family: 'Saira';
|
||||
font-size: 12px;
|
||||
font-weight: 300;
|
||||
line-height: $text-height;
|
||||
|
||||
min-width: 240px;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
li{
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
&.selected{
|
||||
&>a{
|
||||
color: $advanced-algos-red;
|
||||
}
|
||||
ul.subMenu{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bannerTopBar{
|
||||
background-position: center center;
|
||||
background-size: cover;
|
||||
background-image: url(https://superalgos.org/img/photos/teams.jpg);
|
||||
width: 100%;
|
||||
height: 220px;
|
||||
&.big{
|
||||
height: 100vh;
|
||||
.caption{
|
||||
display: block;
|
||||
top: 42%;
|
||||
}
|
||||
&.landing {
|
||||
.caption{
|
||||
display: block;
|
||||
top: 25%;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.medium{
|
||||
height: 50vh;
|
||||
.caption{
|
||||
display: block;
|
||||
top: 46%;
|
||||
}
|
||||
}
|
||||
.caption{
|
||||
display: none;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
font-family: Saira;
|
||||
.title{
|
||||
color: white;
|
||||
font-size: 64px;
|
||||
line-height: 78px;
|
||||
font-weight: 100;
|
||||
@include fluid-type($break-xs, $break-lg, 26px, 64px);
|
||||
}
|
||||
.text{
|
||||
color: white;
|
||||
line-height: 30px;
|
||||
font-weight: 600;
|
||||
padding: 2em 20% 0.5em;
|
||||
@include fluid-type($break-xs, $break-lg, 18px, 20px);
|
||||
}
|
||||
.instructions{
|
||||
h4{
|
||||
color: white;
|
||||
margin-top: 25px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 1.6em;
|
||||
a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-size: 0.9em;
|
||||
&:hover {
|
||||
color: #f55858;
|
||||
}
|
||||
}
|
||||
}
|
||||
h5{
|
||||
color: white;
|
||||
margin-top:25px;
|
||||
}
|
||||
h6{
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: #f55858;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.homePage.container{
|
||||
padding-top: 70px;
|
||||
padding-bottom: 70px;
|
||||
.title{
|
||||
padding: 0 0 10px 0;
|
||||
@include fluid-type($break-xs, $break-lg, 24px, 45px);
|
||||
line-height: 55px;
|
||||
padding: 40px 0 0.5em 0;
|
||||
font-weight: 100;
|
||||
}
|
||||
.subtitle{
|
||||
padding-bottom: 5px;
|
||||
@include fluid-type($break-xs, $break-lg, 18px, 20px);
|
||||
line-height: 19px;
|
||||
font-weight: 100;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 1em;
|
||||
|
||||
}
|
||||
.column{
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
@media screen and (min-width: $break-sm) {
|
||||
width: 50%;
|
||||
}
|
||||
p{
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
margin-bottom: 0.75em;
|
||||
margin-top: 0.75em;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
color: #5a6266;
|
||||
text-size-adjust: 100%;
|
||||
a{
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease-in-out 0s;
|
||||
color: #CC5835;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.toTop{
|
||||
position: fixed;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
z-index: 1;
|
||||
background-color: #1a1a1a;
|
||||
border-radius: 100%;
|
||||
&:after{
|
||||
content: '';
|
||||
float: right;
|
||||
border: solid white;
|
||||
border-width: 0 3px 3px 0;
|
||||
padding: 3px;
|
||||
margin-top: 18px;
|
||||
margin-right: 15px;
|
||||
transform: rotate(-135deg);
|
||||
-webkit-transform: rotate(-135deg);
|
||||
}
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, p, a, ul li, ol li, blockquote {
|
||||
font-family: "Saira","Saira Condensed", sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { client } from '../graphql/apollo'
|
||||
import { ECOSYSTEM_QUERY } from '../graphql/EcosystemQuery'
|
||||
import Log from './log'
|
||||
|
||||
export async function setInitialEcosystem() {
|
||||
try {
|
||||
const ecosystem = await client.query({ query: ECOSYSTEM_QUERY })
|
||||
window.localStorage.setItem('ecosystem', JSON.stringify(ecosystem.data.web_GetEcosystem))
|
||||
} catch (error) {
|
||||
Log.error('Error getting the ecosystem: ' + error)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
export function isDefined (d) {
|
||||
return d !== null && typeof d !== 'undefined'
|
||||
}
|
||||
|
||||
export function isNotDefined (d) {
|
||||
return !isDefined(d)
|
||||
}
|
||||
|
||||
export const isArray = Array.isArray
|
||||
|
||||
export function isObject (d) {
|
||||
return isDefined(d) && typeof d === 'object' && !Array.isArray(d)
|
||||
}
|
||||
|
||||
export function isEmpty (obj) {
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
export function isString (value) {
|
||||
return typeof value === 'string' || value instanceof String
|
||||
}
|
||||
|
||||
export function validObject (object, ...keys) {
|
||||
return keys.reduce((a, b) => (a || {})[b], object) !== undefined
|
||||
}
|
||||
|
||||
export function mergeDeep (target, ...sources) {
|
||||
if (!sources.length) return target
|
||||
const source = sources.shift()
|
||||
|
||||
if (isObject(target) && isObject(source)) {
|
||||
for (const key in source) {
|
||||
if (isObject(source[key])) {
|
||||
if (!target[key]) Object.assign(target, { [key]: {} })
|
||||
mergeDeep(target[key], source[key])
|
||||
} else {
|
||||
Object.assign(target, { [key]: source[key] })
|
||||
}
|
||||
}
|
||||
}
|
||||
return mergeDeep(target, ...sources)
|
||||
}
|
||||
|
||||
export function deleteCookie (c) {
|
||||
document.cookie.split(';').forEach(function (c) {
|
||||
document.cookie = c
|
||||
.replace(/^ +/, '')
|
||||
.replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')
|
||||
})
|
||||
}
|
||||
|
||||
export function slugify (string) {
|
||||
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
|
||||
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
|
||||
const p = new RegExp(a.split('').join('|'), 'g')
|
||||
|
||||
return string
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-') // Replace spaces with -
|
||||
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
|
||||
.replace(/&/g, '-and-') // Replace & with 'and'
|
||||
.replace(/[^\w-]+/g, '') // Remove all non-word characters
|
||||
.replace(/--+/g, '-') // Replace multiple - with single -
|
||||
.replace(/^-+/, '') // Trim - from start of text
|
||||
.replace(/-+$/, '') // Trim - from end of text
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
const getItem = async name => window.localStorage.getItem(name)
|
||||
const setItem = async (name, value) => window.localStorage.setItem(name, value)
|
||||
const removeItem = async name => window.localStorage.removeItem(name)
|
||||
|
||||
export { getItem, setItem, removeItem }
|
||||
@@ -0,0 +1,39 @@
|
||||
import debug from 'debug'
|
||||
|
||||
const BASE = 'superalgos'
|
||||
const COLOURS = {
|
||||
info: 'blue',
|
||||
warn: 'orange',
|
||||
error: 'red'
|
||||
}
|
||||
|
||||
class Log {
|
||||
generateMessage (level, message, source) {
|
||||
// Set the prefix which will cause debug to enable the message
|
||||
const namespace = `${BASE}:${level}`
|
||||
const createDebug = debug(namespace)
|
||||
|
||||
// Set the colour of the message based on the level
|
||||
createDebug.color = COLOURS[level]
|
||||
|
||||
if (source) {
|
||||
createDebug(source, message)
|
||||
} else {
|
||||
createDebug(message)
|
||||
}
|
||||
}
|
||||
|
||||
info (message, source) {
|
||||
return this.generateMessage('info', message, source)
|
||||
}
|
||||
|
||||
warn (message, source) {
|
||||
return this.generateMessage('warn', message, source)
|
||||
}
|
||||
|
||||
error (message, source) {
|
||||
return this.generateMessage('error', message, source)
|
||||
}
|
||||
}
|
||||
|
||||
export default new Log()
|
||||
@@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
|
||||
import { BannerTopBar } from '../common'
|
||||
|
||||
const Callback = () => <BannerTopBar
|
||||
size='big'
|
||||
title=''
|
||||
text='Authenticating...'
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
|
||||
export default Callback
|
||||
@@ -0,0 +1,77 @@
|
||||
import React, { Component } from 'react'
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import { connect } from 'react-redux'
|
||||
import { BannerTopBar } from '../common'
|
||||
|
||||
const styles = theme => ({
|
||||
'@global': {
|
||||
body: {
|
||||
backgroundColor: theme.palette.common.white
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
heroContent: {
|
||||
textColor: theme.palette.common.white,
|
||||
maxWidth: 600,
|
||||
height: 800,
|
||||
margin: '0 auto',
|
||||
padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px`
|
||||
}
|
||||
})
|
||||
|
||||
class Charts extends Component {
|
||||
componentDidMount () {
|
||||
if (window.canvasApp.visible === undefined) {
|
||||
loadCanvas() // This happens only once.
|
||||
}
|
||||
|
||||
window.canvasApp.visible = true
|
||||
let body = document.getElementById('body')
|
||||
body.style = 'margin: 0px; padding: 0px; border: 0px; overflow:hidden;'
|
||||
this.props.hideFooter()
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
window.canvasApp.visible = false
|
||||
let body = document.getElementById('body')
|
||||
body.style = ''
|
||||
this.props.showFooter()
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<BannerTopBar
|
||||
size='medium'
|
||||
title=''
|
||||
text='Charts loading...'
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
context: state.context
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
hideFooter: () => {
|
||||
dispatch({ type: 'HIDE_FOOTER' })
|
||||
},
|
||||
showFooter: () => {
|
||||
dispatch({ type: 'SHOW_FOOTER' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withStyles(styles)(Charts))
|
||||
@@ -0,0 +1,30 @@
|
||||
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})` } : {}}
|
||||
>
|
||||
<div className='caption'>
|
||||
<Typography className='title' variant='h1' align='center'>
|
||||
{title}
|
||||
</Typography>
|
||||
<Typography className='text' variant='h2' align='center'>
|
||||
{text}
|
||||
</Typography>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
BannerTopBar.propTypes = {
|
||||
children: PropTypes.node,
|
||||
backgroundUrl: PropTypes.string,
|
||||
size: PropTypes.string,
|
||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
||||
text: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
|
||||
}
|
||||
|
||||
export default BannerTopBar
|
||||
@@ -0,0 +1,3 @@
|
||||
import BannerTopBar from './components/BannerTopBar'
|
||||
|
||||
export { BannerTopBar }
|
||||
@@ -0,0 +1,139 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import classNames from 'classnames'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import withWidth from '@material-ui/core/withWidth'
|
||||
import { Mutation } from 'react-apollo'
|
||||
|
||||
import Typography from '@material-ui/core/Typography'
|
||||
import Grid from '@material-ui/core/Grid'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import InputBase from '@material-ui/core/InputBase'
|
||||
|
||||
import styles from './styles'
|
||||
|
||||
import NEWSLETTER_SIGNUP from '../graphql/NewsletterSignup'
|
||||
|
||||
import { isEmpty } from '../../../utils/js-helpers'
|
||||
|
||||
export class SignupForm extends Component {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
|
||||
this.handleChange = this.handleChange.bind(this)
|
||||
this.handleSubmit = this.handleSubmit.bind(this)
|
||||
this.validate = this.validate.bind(this)
|
||||
|
||||
this.state = {
|
||||
email: '',
|
||||
emailError: '',
|
||||
success: false
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const {
|
||||
classes,
|
||||
width,
|
||||
alignCenter,
|
||||
displayTitle,
|
||||
displayIntro
|
||||
} = this.props
|
||||
return (
|
||||
<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={classNames(classes.textWhite, classes.signupTitle)} gutterBottom>Stay in touch!</Typography>}
|
||||
{displayIntro && <Typography variant='subtitle1' className={classNames(classes.textWhite, classes.signupText)} gutterBottom>Opt-in our mailing list to stay up to date with the Superalgos Project.</Typography>}
|
||||
<form id='email-signup' action='#' className='form-inline' autoComplete='off'>
|
||||
<Typography
|
||||
variant='subtitle1'
|
||||
className={classes.textSuccess}
|
||||
gutterBottom
|
||||
style={{
|
||||
display: this.state.success ? 'block' : 'none',
|
||||
textAlign: alignCenter ? 'center' : 'inherit'
|
||||
}}
|
||||
>
|
||||
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'}>
|
||||
<InputBase
|
||||
id='email'
|
||||
placeholder='Enter your email'
|
||||
classes={{
|
||||
root: classes.signupInputRoot,
|
||||
input: classes.signupInput
|
||||
}}
|
||||
onChange={this.handleChange}
|
||||
value={this.state.email}
|
||||
/>
|
||||
<Button
|
||||
id='email-submit'
|
||||
className={classes.signupInputSubmit}
|
||||
onClick={e => {
|
||||
this.handleSubmit(e, NewsletterSignup)
|
||||
}}
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</Grid>
|
||||
</form>
|
||||
</Grid>
|
||||
)
|
||||
}}
|
||||
</Mutation>
|
||||
)
|
||||
}
|
||||
|
||||
validate (data) {
|
||||
const errors = {}
|
||||
switch (data.id) {
|
||||
case 'email':
|
||||
if (data.value === '') {
|
||||
this.setState({ emailError: 'Please enter an email address' })
|
||||
} else {
|
||||
this.setState({ emailError: '' })
|
||||
}
|
||||
break
|
||||
default:
|
||||
}
|
||||
return errors
|
||||
}
|
||||
|
||||
handleChange (e) {
|
||||
let id = e.target.id
|
||||
let value = e.target.value
|
||||
let error = this.validate({ id, value })
|
||||
switch (id) {
|
||||
case 'email':
|
||||
if (!isEmpty(error)) this.setState({ emailError: error })
|
||||
this.setState({ email: value })
|
||||
break
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
async handleSubmit (e, NewsletterSignup) {
|
||||
e.preventDefault()
|
||||
console.log('NewsletterSignup handleSubmit: ', this.state.email)
|
||||
const signupResponse = await NewsletterSignup({ variables: { email: this.state.email } })
|
||||
console.log('NewsletterSignup: ', signupResponse)
|
||||
if (signupResponse.data.notifications_Master_NewsletterSignup === 'SUCCESS') this.setState({ email: '', success: true })
|
||||
}
|
||||
}
|
||||
|
||||
SignupForm.propTypes = {
|
||||
classes: PropTypes.object,
|
||||
width: PropTypes.string,
|
||||
alignCenter: PropTypes.bool,
|
||||
displayTitle: PropTypes.bool,
|
||||
displayIntro: PropTypes.bool
|
||||
}
|
||||
|
||||
const SignupFormWithStyles = withStyles(styles)(SignupForm)
|
||||
|
||||
export default withWidth()(SignupFormWithStyles)
|
||||
@@ -0,0 +1,93 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import { BannerTopBar } from '../../common'
|
||||
import SignupForm from './SignupForm'
|
||||
|
||||
export class SignupVerifyResponse extends React.Component {
|
||||
componentDidMount () {
|
||||
const { mutate } = this.props
|
||||
mutate()
|
||||
}
|
||||
|
||||
render () {
|
||||
const { loading, error, data } = this.props
|
||||
let BannerTitle = ''
|
||||
let BannerText = ''
|
||||
let displayForm = false
|
||||
console.log('SignupVerifyResponse:', loading, error, data)
|
||||
if (error) {
|
||||
if (
|
||||
error.message ===
|
||||
'GraphQL error: Error: Token Expired. Please resubmit email address.'
|
||||
) {
|
||||
BannerText = [
|
||||
<strong key='EmailSignupConfirm-error-b1'>
|
||||
Newsletter Signup Error: Verification Token Expired
|
||||
</strong>,
|
||||
<br key='EmailSignupConfirm-error-br' />,
|
||||
'Please resubmit your email address and a new token will be emailed to you.',
|
||||
<br key='EmailSignupConfirm-error-br2' />,
|
||||
' We apologize for the inconvenience, but we highly value your seurity and privacy.'
|
||||
]
|
||||
displayForm = true
|
||||
} else {
|
||||
BannerText = [
|
||||
'Newsletter Signup Error: ',
|
||||
<br key='EmailSignupConfirm-error-br' />,
|
||||
error.message
|
||||
]
|
||||
}
|
||||
return (
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title={BannerTitle}
|
||||
text={BannerText}
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)
|
||||
}
|
||||
if (loading && !error) {
|
||||
BannerText = [
|
||||
'Processing newsletter sign-up...',
|
||||
<br key='EmailSignupConfirm-br' />,
|
||||
'Thank you for opting-in to recieve updates about the Superalgos project!'
|
||||
]
|
||||
}
|
||||
if (data !== undefined && data !== null) {
|
||||
console.log(data)
|
||||
if (data.notifications_Master_NewsletterSignupVerify === 'SUCCESS') {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title='Mailing Sign-Up Complete!'
|
||||
text='We look forward to keeping you up-to-date on the Superalgos project.'
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
>
|
||||
{displayForm && <SignupForm alignCenter />}
|
||||
</BannerTopBar>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
} else {
|
||||
return (
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title='Processing...'
|
||||
text=''
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SignupVerifyResponse.propTypes = {
|
||||
mutate: PropTypes.function,
|
||||
loading: PropTypes.bool,
|
||||
error: PropTypes.object,
|
||||
data: PropTypes.object
|
||||
}
|
||||
|
||||
export default SignupVerifyResponse
|
||||
@@ -0,0 +1,72 @@
|
||||
import lightGreen from '@material-ui/core/colors/lightGreen'
|
||||
|
||||
const styles = theme => ({
|
||||
textLight: {
|
||||
color: theme.palette.primary.light
|
||||
},
|
||||
textWhite: {
|
||||
color: theme.palette.common.white
|
||||
},
|
||||
textSuccess: {
|
||||
color: lightGreen[400]
|
||||
},
|
||||
copyright: {
|
||||
paddingTop: theme.spacing.unit * 3
|
||||
},
|
||||
linkLight: {
|
||||
color: theme.palette.secondary.main,
|
||||
textDecoration: 'none'
|
||||
},
|
||||
signupRight: {
|
||||
marginTop: theme.spacing.unit * 2,
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
signupContainer: {
|
||||
marginBottom: theme.spacing.unit * 2,
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
signupTitle: {
|
||||
fontSize: '25px',
|
||||
marginBottom: theme.spacing.unit * 5
|
||||
},
|
||||
signupText: {
|
||||
fontSize: '16px'
|
||||
},
|
||||
signupInput: {
|
||||
borderRadius: 4,
|
||||
backgroundColor: theme.palette.common.white,
|
||||
border: '1px solid #ced4da',
|
||||
fontSize: 20,
|
||||
padding: '10px 12px',
|
||||
transition: theme.transitions.create(['border-color', 'box-shadow']),
|
||||
marginRight: theme.spacing.unit * 1
|
||||
},
|
||||
signupInputSubmit: {
|
||||
boxShadow: 'none',
|
||||
textTransform: 'none',
|
||||
fontSize: 20,
|
||||
lineHeight: '1.1875em',
|
||||
color: theme.palette.common.white,
|
||||
padding: '10px 12px',
|
||||
backgroundColor: '#5bc0de',
|
||||
borderColor: '#46b8da',
|
||||
'&:hover': {
|
||||
backgroundColor: '#31b0d5',
|
||||
borderColor: '#269abc'
|
||||
},
|
||||
'&:active': {
|
||||
boxShadow: 'none',
|
||||
backgroundColor: '#0062cc',
|
||||
borderColor: '#005cbf'
|
||||
},
|
||||
'&:focus': {
|
||||
boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default styles
|
||||
@@ -0,0 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const NEWSLETTER_SIGNUP = gql`
|
||||
mutation NewsletterSignup($email: String!) {
|
||||
notifications_Master_NewsletterSignup(email: $email)
|
||||
}
|
||||
`
|
||||
|
||||
export default NEWSLETTER_SIGNUP
|
||||
@@ -0,0 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const NEWSLETTER_SIGNUP_VERIFY = gql`
|
||||
mutation NewsletterSignupVerify($token: String!){
|
||||
notifications_Master_NewsletterSignupVerify(token: $token)
|
||||
}
|
||||
`
|
||||
|
||||
export default NEWSLETTER_SIGNUP_VERIFY
|
||||
@@ -0,0 +1,55 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import queryString from 'query-string'
|
||||
import { Mutation } from 'react-apollo'
|
||||
|
||||
import { BannerTopBar } from '../common'
|
||||
import SignupVerifyResponse from './components/SignupVerifyResponse'
|
||||
|
||||
import NEWSLETTER_SIGNUP_VERIFY from './graphql/NewsletterSignupVerify'
|
||||
|
||||
export const EmailSignupConfirm = ({ tokenParam }) => {
|
||||
let token
|
||||
let BannerText = ''
|
||||
if (tokenParam !== '' && tokenParam !== null) {
|
||||
const values = queryString.parse(tokenParam)
|
||||
token = values.token
|
||||
} else {
|
||||
BannerText = [
|
||||
'Newsletter Signup Error: Invalid Token',
|
||||
<br key='EmailSignupConfirm-error-br' />,
|
||||
'Please try signing up again! We apologize for the inconvenience,',
|
||||
<br key='EmailSignupConfirm-error-br2' />,
|
||||
'but we highly value your seurity and privacy.'
|
||||
]
|
||||
return (
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title=''
|
||||
text={BannerText}
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)
|
||||
}
|
||||
console.log(token)
|
||||
return (
|
||||
<Mutation mutation={NEWSLETTER_SIGNUP_VERIFY} variables={{ token: token }}>
|
||||
{(NewsletterSignupVerify, { loading, error, data }) => {
|
||||
return (
|
||||
<SignupVerifyResponse
|
||||
mutate={NewsletterSignupVerify}
|
||||
loading={loading}
|
||||
error={error}
|
||||
data={data}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
</Mutation>
|
||||
)
|
||||
}
|
||||
|
||||
EmailSignupConfirm.propTypes = {
|
||||
tokenParam: PropTypes.string
|
||||
}
|
||||
|
||||
export default EmailSignupConfirm
|
||||
@@ -0,0 +1,54 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import { BannerTopBar } from '../common'
|
||||
import { Typography } from '@material-ui/core'
|
||||
|
||||
class Home extends Component {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
user: null
|
||||
}
|
||||
}
|
||||
componentDidMount () {
|
||||
const user = window.localStorage.getItem('user')
|
||||
this.setState({ user })
|
||||
}
|
||||
render () {
|
||||
let user = JSON.parse(this.state.user)
|
||||
if (this.state.user !== undefined && this.state.user !== null) {}
|
||||
return (
|
||||
<React.Fragment>
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title='Superalgos Platform'
|
||||
text='People and machines working together to create Superalgos'
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
<div className='homePage container'>
|
||||
<Typography variant='h1' align='center' className='title'>Welcome to the Superalgos Platform!</Typography>
|
||||
<div className='column'>
|
||||
<Typography align='justify'>
|
||||
Before you begin, please be aware this is an alpha stage deployment.
|
||||
The features available as of today are limited but already functional.
|
||||
However, you may encounter occasional instability and errors.
|
||||
</Typography>
|
||||
<Typography align='justify'>
|
||||
To try out the Demo version hosted here you will need to Sign Up / Login.
|
||||
Once you are logged in, you will find basic instructions on how to proceed,
|
||||
at this home page (click the Superalgos logo to return to this home page).
|
||||
</Typography>
|
||||
</div>
|
||||
<div className='column'>
|
||||
<Typography align='justify'>
|
||||
If you wish to set up your own indicators and strategies, please get in touch with us and we'll show you how (give us a shout in the Community Telegram)
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
||||
@@ -0,0 +1,7 @@
|
||||
import Home from './home'
|
||||
import Charts from './charts'
|
||||
import Callback from './callback'
|
||||
import Layout from './layout'
|
||||
import EmailSignupConfirm from './email-verification'
|
||||
|
||||
export { Layout, Home, Charts, Callback, EmailSignupConfirm }
|
||||
@@ -0,0 +1,94 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import classNames from 'classnames'
|
||||
import { NavLink, Link } from 'react-router-dom'
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import withWidth from '@material-ui/core/withWidth'
|
||||
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 styles from './styles'
|
||||
|
||||
import SignupForm from '../../email-verification/components/SignupForm'
|
||||
|
||||
import aalogo from '../../../assets/superalgos/Superalgos-logo-horz-dark.svg'
|
||||
|
||||
class Footer extends Component {
|
||||
render () {
|
||||
let { classes, width } = this.props
|
||||
|
||||
const masterApp = this.props.context.masterApp
|
||||
if (masterApp.footer.visible === false) {
|
||||
return (<div />)
|
||||
} else {
|
||||
return (
|
||||
<footer className={classNames(classes.darkSection, classes.footer)}>
|
||||
<Grid
|
||||
container
|
||||
spacing={8}
|
||||
justify='space-evenly'
|
||||
className={classes.footerContainer}
|
||||
>
|
||||
<Grid item xs={12} sm={4} md={4}>
|
||||
<a target='_blank' href='https://superalgos.org/' className={classes.linkStrong}>
|
||||
<img alt='' src={aalogo} width={'100%'} height={'auto'} className={classes.footerLogo} />
|
||||
</a>
|
||||
<Grid container className={classes.descriptionLeft} direction='column'>
|
||||
<Typography className={classNames(classes.textLight, classes.descriptionText)} ><strong>Superalgos Ltd.</strong></Typography>
|
||||
<Typography className={classNames(classes.textLight, classes.descriptionText)} gutterBottom>Ground Floor, Palace Court, Church Street,<br />St. Julians STJ3049, Malta</Typography>
|
||||
<Typography className={classNames(classes.textLight, classes.descriptionText)}>
|
||||
<a target='_blank' href='https://www.superalgos.org/legal-privacy-statement.shtml' className={classes.linkLight}>Privacy Statement</a> | <a target='_blank' href='https://www.superalgos.org/legal-terms-of-service.shtml' className={classes.linkLight}>Terms of Service</a>
|
||||
</Typography>
|
||||
<Typography variant='body2' className={classNames(classes.textLight, classes.copyright)} gutterBottom>© Superalgos, 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'}>
|
||||
<a target='_blank' href='https://t.me/superalgoscommunity' title='Join us on Telgram' className={classes.linkLight}>
|
||||
<FontAwesomeIcon
|
||||
icon={faTelegramPlane}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
/>
|
||||
</a>
|
||||
<a target='_blank' href='https://twitter.com/superalgos' title='Follow us on Twitter' className={classes.linkLight}>
|
||||
<FontAwesomeIcon
|
||||
icon={faTwitter}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
/>
|
||||
</a>
|
||||
<a target='_blank' href='https://www.facebook.com/Superalgos-375022859724428/' title='Meet us on Facebook' className={classes.linkLight}>
|
||||
<FontAwesomeIcon
|
||||
icon={faFacebookF}
|
||||
className={classNames(classes.icon, classes.iconHover)}
|
||||
/>
|
||||
</a>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Footer.propTypes = {
|
||||
classes: PropTypes.object.isRequired,
|
||||
width: PropTypes.string
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
context: state.context
|
||||
}
|
||||
}
|
||||
|
||||
const FooterWithStyles = withStyles(styles)(Footer)
|
||||
|
||||
export default connect(mapStateToProps)(withWidth()(FooterWithStyles))
|
||||
@@ -0,0 +1,116 @@
|
||||
import lightGreen from '@material-ui/core/colors/lightGreen'
|
||||
|
||||
const styles = theme => ({
|
||||
textLight: {
|
||||
color: theme.palette.primary.light
|
||||
},
|
||||
textWhite: {
|
||||
color: theme.palette.common.white
|
||||
},
|
||||
textSuccess: {
|
||||
color: lightGreen[400]
|
||||
},
|
||||
copyright: {
|
||||
paddingTop: theme.spacing.unit * 9,
|
||||
fontSize: '16px'
|
||||
},
|
||||
linkLight: {
|
||||
color: theme.palette.secondary.main,
|
||||
textDecoration: 'none'
|
||||
},
|
||||
descriptionLeft: {
|
||||
marginLeft: 0,
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
descriptionText: {
|
||||
fontSize: '16px'
|
||||
},
|
||||
signupRight: {
|
||||
marginTop: theme.spacing.unit * 2,
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
signupContainer: {
|
||||
marginBottom: theme.spacing.unit * 2,
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
footer: {
|
||||
borderTop: `4px solid ${theme.palette.secondary.light}`,
|
||||
padding: `${theme.spacing.unit * 6}px 0`,
|
||||
backgroundColor: '#19191C' /* #29292c */,
|
||||
color: theme.palette.primary.light
|
||||
},
|
||||
footerContainer: {
|
||||
width: 'auto',
|
||||
[theme.breakpoints.up(1200 + theme.spacing.unit * 3 * 2)]: {
|
||||
width: 1200,
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto'
|
||||
}
|
||||
},
|
||||
footerLogo: {
|
||||
marginBottom: theme.spacing.unit * 2
|
||||
},
|
||||
footerLink: {
|
||||
textDecoration: 'none',
|
||||
'&:hover': {
|
||||
color: theme.palette.secondary.light
|
||||
}
|
||||
},
|
||||
footerInputRoot: {
|
||||
'label + &': {
|
||||
marginTop: theme.spacing.unit * 3
|
||||
},
|
||||
[theme.breakpoints.down('xs')]: {
|
||||
textAlign: 'center'
|
||||
}
|
||||
},
|
||||
footerInput: {
|
||||
borderRadius: 4,
|
||||
backgroundColor: theme.palette.common.white,
|
||||
border: '1px solid #ced4da',
|
||||
fontSize: 16,
|
||||
padding: '10px 12px',
|
||||
transition: theme.transitions.create(['border-color', 'box-shadow']),
|
||||
marginRight: theme.spacing.unit * 1
|
||||
},
|
||||
footerInputSubmit: {
|
||||
boxShadow: 'none',
|
||||
textTransform: 'none',
|
||||
fontSize: 16,
|
||||
lineHeight: '1.1875em',
|
||||
color: theme.palette.common.white,
|
||||
padding: '10px 12px',
|
||||
backgroundColor: '#5bc0de',
|
||||
borderColor: '#46b8da',
|
||||
'&:hover': {
|
||||
backgroundColor: '#31b0d5',
|
||||
borderColor: '#269abc'
|
||||
},
|
||||
'&:active': {
|
||||
boxShadow: 'none',
|
||||
backgroundColor: '#0062cc',
|
||||
borderColor: '#005cbf'
|
||||
},
|
||||
'&:focus': {
|
||||
boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)'
|
||||
}
|
||||
},
|
||||
icon: {
|
||||
margin: theme.spacing.unit * 1,
|
||||
fontSize: 30
|
||||
},
|
||||
iconHover: {
|
||||
margin: theme.spacing.unit * 1,
|
||||
'&:hover': {
|
||||
color: theme.palette.secondary.light
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default styles
|
||||
@@ -0,0 +1,46 @@
|
||||
import React from 'react'
|
||||
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 displayName = 'No Display Name'
|
||||
|
||||
if (isDefined(user.alias)) {
|
||||
displayName = user.alias
|
||||
}
|
||||
|
||||
if (isDefined(user.nickname)) {
|
||||
displayName = user.nickname
|
||||
}
|
||||
|
||||
if (isDefined(user.firstName)) {
|
||||
displayName = user.firstName
|
||||
}
|
||||
|
||||
displayName = displayName.split('-')[0]
|
||||
displayName = displayName.split('.')[0]
|
||||
displayName = displayName.split('_')[0]
|
||||
displayName = displayName.split(' ')[0]
|
||||
|
||||
return (
|
||||
|
||||
<li
|
||||
onMouseEnter={() => toggleMenuOpen(42, bigScreen)}
|
||||
onMouseLeave={() => mouseLeave(bigScreen)}
|
||||
className={openedMenu === 42 ? 'selected primaryLink hasChildren' : 'primaryLink hasChildren'}
|
||||
>
|
||||
<Link to='/users/user' onClick={() => toggleMenuOpen(42, true)}> {displayName} </Link>
|
||||
<ul className='subMenu'>
|
||||
<li><Link to='/users/user' onClick={() => closeAll()}> Your Profile </Link></li>
|
||||
<li><Link to='/teams/manage-teams' onClick={() => closeAll()}> Your Team </Link></li>
|
||||
<li><a href='#' onClick={() => auth.logout()}> Logout </a></li>
|
||||
<li><a href='https://www.superalgos.org/documentation-quick-start.shtml'> Docs </a></li>
|
||||
<li><a href='https://superalgos.org'> Exit Platform </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default LoggedIn
|
||||
@@ -0,0 +1,110 @@
|
||||
import {
|
||||
Search,
|
||||
GamepadRounded,
|
||||
AccessibilityNew,
|
||||
LibraryAdd,
|
||||
ImportContacts,
|
||||
BugReport,
|
||||
People,
|
||||
Group,
|
||||
VpnKey,
|
||||
Home,
|
||||
AddCircleOutline,
|
||||
ViewModule
|
||||
} from '@material-ui/icons'
|
||||
|
||||
const usersMenus = {
|
||||
title: 'Users',
|
||||
to: '/users',
|
||||
icon: Home,
|
||||
submenus: [
|
||||
{ title: 'Directory', to: '/users/browse', icon: ImportContacts },
|
||||
{ title: 'Search', to: '/users/search', icon: Search },
|
||||
{ title: 'Your Profile', to: '/users/user', icon: People, authenticated: true },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/UsersModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
|
||||
/*
|
||||
const teamsMenus = {
|
||||
title: 'Teams',
|
||||
to: '/teams',
|
||||
icon: Home,
|
||||
submenus: [
|
||||
{ title: 'Directory', to: '/teams/explore', icon: ImportContacts },
|
||||
{ title: 'Your teams', to: '/teams/manage-teams', icon: Group, authenticated: true },
|
||||
{ title: 'Team members', to: '/teams/team-members', icon: People, authenticated: true },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/TeamsModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
const eventsMenus = {
|
||||
title: 'Events',
|
||||
to: '/events',
|
||||
icon: Home,
|
||||
submenus: [
|
||||
{ title: 'Directory', to: '/events', icon: ImportContacts },
|
||||
{ title: 'Your hosted events', to: '/events/host', icon: AccessibilityNew, authenticated: true },
|
||||
{ title: 'Host an event', to: '/events/create', icon: LibraryAdd, authenticated: true },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/EventsClientModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
|
||||
const keyvaultMenus = {
|
||||
title: 'Keys',
|
||||
to: '/keys',
|
||||
icon: Home,
|
||||
authenticated: true,
|
||||
submenus: [
|
||||
{ title: 'Your keys', to: '/keys/browse', icon: VpnKey },
|
||||
{ title: 'Add key', to: '/keys/addKey', icon: AddCircleOutline },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/KeyVaultModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
|
||||
const operationsMenus = {
|
||||
title: 'Clones',
|
||||
to: '/clones',
|
||||
icon: Home,
|
||||
authenticated: true,
|
||||
submenus: [
|
||||
{ title: 'Active Clones', to: '/clones/browse', icon: ImportContacts },
|
||||
{ title: 'History Clones', to: '/clones/history', icon: LibraryAdd },
|
||||
{ title: 'Create Clone', to: '/clones/add', icon: AddCircleOutline },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/OperationsModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
|
||||
const cockpitMenus = {
|
||||
title: 'Cockpit',
|
||||
to: '/cockpit',
|
||||
icon: Home,
|
||||
authenticated: true,
|
||||
submenus: [
|
||||
{ title: 'Signals', to: '/cockpit/signals', icon: GamepadRounded },
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/CockpitClientModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
|
||||
/*
|
||||
const strategizerMenus = {
|
||||
title: 'Strategizer',
|
||||
to: '/strategizer',
|
||||
icon: Home,
|
||||
authenticated: true,
|
||||
submenus: []
|
||||
}
|
||||
*/
|
||||
|
||||
const allMenus = [
|
||||
usersMenus,
|
||||
// teamsMenus,
|
||||
eventsMenus,
|
||||
keyvaultMenus,
|
||||
operationsMenus,
|
||||
// strategizerMenus,
|
||||
cockpitMenus
|
||||
]
|
||||
|
||||
export default allMenus
|
||||
@@ -0,0 +1,181 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Link } from 'react-router-dom'
|
||||
import jwtDecode from 'jwt-decode'
|
||||
import withWidth from '@material-ui/core/withWidth'
|
||||
import { NotListedLocation as TutorialIcon } from '@material-ui/icons'
|
||||
|
||||
// components
|
||||
import { LoggedIn } from './LoggedIn'
|
||||
|
||||
import allMenus from './imports'
|
||||
import AALogo from '../../../assets/superalgos/Superalgos-logo-horz-dark.svg'
|
||||
|
||||
class Header extends Component {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.renderSubMenu = this.renderSubMenu.bind(this)
|
||||
this.state = {
|
||||
onTop: true,
|
||||
mobileOpen: false,
|
||||
openedMenu: null,
|
||||
user: null
|
||||
}
|
||||
}
|
||||
|
||||
handleScroll () {
|
||||
if (window.pageYOffset > 0) {
|
||||
this.setState({ onTop: false })
|
||||
} else {
|
||||
this.setState({ onTop: true })
|
||||
}
|
||||
}
|
||||
|
||||
scrollToTop () {
|
||||
document.body.scrollTop = 0 // For Safari
|
||||
document.documentElement.scrollTop = 0 // For Chrome, Firefox, IE and Opera
|
||||
}
|
||||
|
||||
toggleMobileOpen () {
|
||||
this.setState({ mobileOpen: !this.state.mobileOpen })
|
||||
}
|
||||
|
||||
toggleMenuOpen (index, allowed) {
|
||||
if (allowed) {
|
||||
if (this.state.openedMenu === index) {
|
||||
this.setState({ openedMenu: null })
|
||||
} else {
|
||||
this.setState({ openedMenu: index })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mouseLeave (allowed) {
|
||||
if (allowed) {
|
||||
this.setState({ openedMenu: null })
|
||||
}
|
||||
}
|
||||
|
||||
closeAll () {
|
||||
this.setState({ openedMenu: null, mobileOpen: false })
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
window.addEventListener('scroll', () => this.handleScroll())
|
||||
const user = window.localStorage.getItem('user')
|
||||
this.setState({ user })
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
window.removeEventListener('scroll', () => this.handleScroll())
|
||||
}
|
||||
|
||||
render () {
|
||||
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) {
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('user')
|
||||
window.localStorage.removeItem('name')
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
let user = JSON.parse(this.state.user)
|
||||
|
||||
const menus = allMenus.map(({ icon: Icon, to, title, submenus, authenticated }, index) => {
|
||||
if (authenticated && !(this.state.user !== undefined && this.state.user !== null)) {
|
||||
return
|
||||
}
|
||||
let cssChildren = submenus.length === 0 ? null : 'hasChildren'
|
||||
return (
|
||||
<li
|
||||
onMouseEnter={() => this.toggleMenuOpen(index, bigScreen)}
|
||||
onMouseLeave={() => this.mouseLeave(bigScreen)}
|
||||
key={index}
|
||||
className={openedMenu === index ? `primaryLink ${cssChildren} selected` : `primaryLink ${cssChildren}`}
|
||||
>
|
||||
{ bigScreen
|
||||
? <Link to={to} onClick={() => this.toggleMenuOpen(index, true)}> {title} </Link>
|
||||
: <a onClick={() => this.toggleMenuOpen(index, true)}> {title} </a>
|
||||
}
|
||||
{this.renderSubMenu(Icon, to, title, submenus, authenticated, index, bigScreen)}
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<header className={onTop ? 'menu' : 'menu notOnTop'}>
|
||||
<div className='container'>
|
||||
<Link to='/'> <img className='logo' src={AALogo} alt='Superalgos' /> </Link>
|
||||
<div className={mobileOpen ? 'mobileHandle openedMobile' : 'mobileHandle'} onClick={() => this.toggleMobileOpen()}>
|
||||
Menu
|
||||
</div>
|
||||
<nav className={mobileOpen ? 'links openedMobile' : 'links'}>
|
||||
<ul className='primaryMenu'>
|
||||
<li className='primaryLink'>
|
||||
<Link to='/charts'> Charts </Link>
|
||||
</li>
|
||||
{menus}
|
||||
{this.state.user !== undefined && this.state.user !== null ? (
|
||||
<LoggedIn
|
||||
user={user}
|
||||
auth={auth}
|
||||
bigScreen={bigScreen}
|
||||
openedMenu={openedMenu}
|
||||
toggleMenuOpen={(keyValue, allowedValue) => this.toggleMenuOpen(keyValue, allowedValue)}
|
||||
mouseLeave={(allowedValue) => this.mouseLeave(allowedValue)}
|
||||
closeAll={() => this.closeAll()}
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<li className='primaryLink'>
|
||||
<a href='https://www.superalgos.org/documentation-quick-start.shtml'> Docs </a>
|
||||
</li>
|
||||
<li className='primaryLink'>
|
||||
<a href='#' onClick={() => auth.login()}> Login / Sign Up </a>
|
||||
</li>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
{onTop ? '' : <div className='toTop' onClick={() => { this.scrollToTop() }} />}
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
||||
renderSubMenu (Icon, to, title, submenus, authenticated, index, bigScreen) {
|
||||
return submenus.length === 0 ? null : (
|
||||
<ul className='subMenu'>
|
||||
{ bigScreen
|
||||
? ''
|
||||
: <li key={index + 'home'}><Link to={to}> <Icon /> Module Home Page </Link></li>
|
||||
}
|
||||
{ submenus.length > 0 &&
|
||||
submenus.map(({ icon: SubIcon, 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} target='_blank'> <SubIcon /> {subTitle} </a></li>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<li key={subindex}><Link to={subTo} onClick={() => this.closeAll(index)}> <SubIcon /> {subTitle} </Link></li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Header.propTypes = {
|
||||
auth: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
export default withWidth()(Header)
|
||||
@@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import Footer from './footer'
|
||||
import Header from './header'
|
||||
|
||||
// styles
|
||||
import styles from './styles'
|
||||
|
||||
class Index extends React.Component {
|
||||
render () {
|
||||
return (
|
||||
<div className={this.props.classes.layout}>
|
||||
<Header auth={this.props.auth} />
|
||||
<div>{this.props.children}</div>
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(styles)(Index)
|
||||
@@ -0,0 +1,10 @@
|
||||
const styles = theme => ({
|
||||
layout: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-between',
|
||||
minHeight: 'calc(100vh)'
|
||||
}
|
||||
})
|
||||
|
||||
export default styles
|
||||