7 files changed
+61
-43
No files matched your search
@@ -2,7 +2,7 @@ import Auth0Lock from 'auth0-lock'
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
import { getItem, setItem } from '../utils/local-storage'
|
||||
import { validObject, deleteCookie } from '../utils/js-helpers'
|
||||
import { validObject, deleteCookie, slugify, isEmpty } from '../utils/js-helpers'
|
||||
import Log from '../utils/log'
|
||||
|
||||
import { client } from '../graphql/apollo'
|
||||
@@ -28,6 +28,25 @@ const VERIFY_TEAM_INVITE = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
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,
|
||||
@@ -203,6 +222,32 @@ class Auth {
|
||||
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')
|
||||
}
|
||||
}
|
||||
setItem('user', JSON.stringify(user))
|
||||
window.location.href = '/'
|
||||
return response.data
|
||||
|
||||
@@ -76,7 +76,7 @@ const defaultOptions = {
|
||||
errorPolicy: 'all'
|
||||
},
|
||||
query: {
|
||||
fetchPolicy: 'cache-and-network',
|
||||
fetchPolicy: 'network-only',
|
||||
errorPolicy: 'all'
|
||||
},
|
||||
mutate: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import debug from 'debug'
|
||||
|
||||
const BASE = 'advanced-algos'
|
||||
const BASE = 'superalgos'
|
||||
const COLOURS = {
|
||||
info: 'blue',
|
||||
warn: 'orange',
|
||||
|
||||
@@ -20,35 +20,14 @@ class Home extends Component {
|
||||
if (this.state.user !== undefined && this.state.user !== null) {}
|
||||
return (
|
||||
<React.Fragment>
|
||||
{this.state.user !== undefined && this.state.user !== null && (
|
||||
<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='instructions'>
|
||||
<Typography align='center' variant='h4' />
|
||||
<Typography align='center' variant='subtitle1' ><Link to='/teams/manage-teams' /></Typography>
|
||||
<Typography align='center' variant='subtitle1' ><Link to='/strategizer' /></Typography>
|
||||
<Typography align='center' variant='subtitle1' ><Link to='/clones/add' /></Typography>
|
||||
<Typography align='center' variant='subtitle1' ><Link to='/charts' /></Typography>
|
||||
<Typography align='center' variant='subtitle1' ><Link to='/clones/add' /></Typography>
|
||||
<Typography align='center' variant='subtitle1' gutterBottom><Link to='/keys/addKey' /></Typography>
|
||||
</div>
|
||||
</BannerTopBar>
|
||||
)}
|
||||
{(this.state.user === undefined || this.state.user === null) && (
|
||||
<BannerTopBar
|
||||
size='big'
|
||||
title='Superalgos Platform'
|
||||
text='People and machines working together to create Superalgos'
|
||||
backgroundUrl='https://superalgos.org/img/photos/superalgos-platform.jpg'
|
||||
/>
|
||||
)}
|
||||
<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>
|
||||
<Typography variant='h2' align='center' className='subtitle'>TRY OUT THE STRATEGIZER DEMO</Typography>
|
||||
<div className='column'>
|
||||
<Typography align='justify'>
|
||||
Before you begin, please be aware this is an alpha stage deployment.
|
||||
@@ -56,20 +35,12 @@ class Home extends Component {
|
||||
However, you may encounter occasional instability and errors.
|
||||
</Typography>
|
||||
<Typography align='justify'>
|
||||
<strong>At this early stage, the focus of the Superalgos Platform is the Strategizer, a tool directed mostly at traders.</strong>
|
||||
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'>
|
||||
<strong>If you are a developer, trying out the Strategizer may open your eyes as of what may be achieved with the
|
||||
Strategizer and the Superalgos Platform in general.</strong>
|
||||
</Typography>
|
||||
<Typography align='justify'>
|
||||
The Strategizer is conceived to work with as many indicators and pre programmed strategies as developers are willing to program.
|
||||
</Typography>
|
||||
<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>
|
||||
|
||||
@@ -34,6 +34,7 @@ export const LoggedIn = props => {
|
||||
<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>
|
||||
|
||||
@@ -25,6 +25,7 @@ const usersMenus = {
|
||||
]
|
||||
}
|
||||
|
||||
/*
|
||||
const teamsMenus = {
|
||||
title: 'Teams',
|
||||
to: '/teams',
|
||||
@@ -36,6 +37,7 @@ const teamsMenus = {
|
||||
{ title: 'Report a Bug', to: 'https://github.com/Superalgos/TeamsModule/issues/new', icon: BugReport, externalLink: true }
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
const eventsMenus = {
|
||||
title: 'Events',
|
||||
@@ -85,6 +87,7 @@ const cockpitMenus = {
|
||||
]
|
||||
}
|
||||
|
||||
/*
|
||||
const strategizerMenus = {
|
||||
title: 'Strategizer',
|
||||
to: '/strategizer',
|
||||
@@ -92,14 +95,15 @@ const strategizerMenus = {
|
||||
authenticated: true,
|
||||
submenus: []
|
||||
}
|
||||
*/
|
||||
|
||||
const allMenus = [
|
||||
usersMenus,
|
||||
teamsMenus,
|
||||
// teamsMenus,
|
||||
eventsMenus,
|
||||
keyvaultMenus,
|
||||
operationsMenus,
|
||||
strategizerMenus,
|
||||
// strategizerMenus,
|
||||
cockpitMenus
|
||||
]
|
||||
|
||||
|
||||
@@ -115,9 +115,6 @@ class Header extends Component {
|
||||
</div>
|
||||
<nav className={mobileOpen ? 'links openedMobile' : 'links'}>
|
||||
<ul className='primaryMenu'>
|
||||
<li className='primaryLink'>
|
||||
<Link to='/'><TutorialIcon className='tutorialIcon' /></Link>
|
||||
</li>
|
||||
<li className='primaryLink'>
|
||||
<Link to='/charts'> Charts </Link>
|
||||
</li>
|
||||
|
||||
Reference in new issue
Block a user