diff --git a/client/src/actions/postActions.js b/client/src/actions/postActions.js deleted file mode 100644 index a3d838e2a..000000000 --- a/client/src/actions/postActions.js +++ /dev/null @@ -1,6 +0,0 @@ -export const deletePost = (id) => { - return { - type: 'DELETE_POST', - id - } -} \ No newline at end of file diff --git a/client/src/assets/logos/advanced-algos/aa-logo-dark.svg b/client/src/assets/logos/advanced-algos/aa-logo-dark.svg deleted file mode 100644 index 479feeb86..000000000 --- a/client/src/assets/logos/advanced-algos/aa-logo-dark.svg +++ /dev/null @@ -1 +0,0 @@ -aa-logo-dark \ No newline at end of file diff --git a/client/src/assets/logos/advanced-algos/aa-logo-vert.svg b/client/src/assets/logos/advanced-algos/aa-logo-vert.svg deleted file mode 100644 index 442e9a7fd..000000000 --- a/client/src/assets/logos/advanced-algos/aa-logo-vert.svg +++ /dev/null @@ -1 +0,0 @@ -aa-logo-vert \ No newline at end of file diff --git a/client/src/assets/logos/advanced-algos/aa-logo.png b/client/src/assets/logos/advanced-algos/aa-logo.png deleted file mode 100644 index 9701ee1c0..000000000 Binary files a/client/src/assets/logos/advanced-algos/aa-logo.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/android-chrome-192x192.png b/client/src/assets/logos/advanced-algos/favicon/android-chrome-192x192.png deleted file mode 100644 index 150043a06..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/android-chrome-192x192.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/android-chrome-512x512.png b/client/src/assets/logos/advanced-algos/favicon/android-chrome-512x512.png deleted file mode 100644 index d98b9ce8d..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/android-chrome-512x512.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/apple-touch-icon.png b/client/src/assets/logos/advanced-algos/favicon/apple-touch-icon.png deleted file mode 100644 index 95ec62746..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/apple-touch-icon.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/browserconfig.xml b/client/src/assets/logos/advanced-algos/favicon/browserconfig.xml deleted file mode 100644 index b3930d0f0..000000000 --- a/client/src/assets/logos/advanced-algos/favicon/browserconfig.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - #da532c - - - diff --git a/client/src/assets/logos/advanced-algos/favicon/favicon-16x16.png b/client/src/assets/logos/advanced-algos/favicon/favicon-16x16.png deleted file mode 100644 index 99bda00af..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/favicon-16x16.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/favicon-32x32.png b/client/src/assets/logos/advanced-algos/favicon/favicon-32x32.png deleted file mode 100644 index 08c2369b0..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/favicon-32x32.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/favicon.ico b/client/src/assets/logos/advanced-algos/favicon/favicon.ico deleted file mode 100644 index cd2c5d6af..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/favicon.ico and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/html_code.html b/client/src/assets/logos/advanced-algos/favicon/html_code.html deleted file mode 100644 index a66b72bb6..000000000 --- a/client/src/assets/logos/advanced-algos/favicon/html_code.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/client/src/assets/logos/advanced-algos/favicon/mstile-150x150.png b/client/src/assets/logos/advanced-algos/favicon/mstile-150x150.png deleted file mode 100644 index 78a06c05a..000000000 Binary files a/client/src/assets/logos/advanced-algos/favicon/mstile-150x150.png and /dev/null differ diff --git a/client/src/assets/logos/advanced-algos/favicon/safari-pinned-tab.svg b/client/src/assets/logos/advanced-algos/favicon/safari-pinned-tab.svg deleted file mode 100644 index db3ba7cde..000000000 --- a/client/src/assets/logos/advanced-algos/favicon/safari-pinned-tab.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/assets/logos/advanced-algos/favicon/site.webmanifest b/client/src/assets/logos/advanced-algos/favicon/site.webmanifest deleted file mode 100644 index 002445914..000000000 --- a/client/src/assets/logos/advanced-algos/favicon/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "Advanced Algos", - "short_name": "Advanced Algos", - "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" -} diff --git a/client/src/auth/Auth.js b/client/src/auth/Auth.js deleted file mode 100644 index 4a62b8251..000000000 --- a/client/src/auth/Auth.js +++ /dev/null @@ -1,207 +0,0 @@ -import Auth0Lock from 'auth0-lock' -import gql from 'graphql-tag' - -import { getItem, setItem, removeItem } from '../utils/local-storage' -import { validObject, deleteCookie } from '../utils/js-helpers' - -import { client } from '../App' - -import { AUTH_CONFIG } from './Auth0' // create by renaming Auth0.sample.js to Auth0.js and setting vars - -const AUTHENTICATE = gql` - mutation authenticate($idToken: String!) { - authenticate(idToken: $idToken) { - alias - authId - } - } -` -const lock = new Auth0Lock(AUTH_CONFIG.clientId, AUTH_CONFIG.domain, { - oidcConformant: true, - autoclose: true, - 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` - } - } -}) - -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.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. - lock.show() - } - - handleAuthentication () { - // Add a callback for Lock's `authenticated` event - lock.on('authenticated', this.setSession.bind(this)) - // Add a callback for Lock's `authorization_error` event - lock.on('authorization_error', err => { - console.log(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 read:teams write:teams read:member write:member', - connection: 'github', - prompt: 'none' - }, - function (err, authResult) { - if (!err) { - resolve(authResult) - } else { - reject(err) - } - } - ) - }) - } - - setSession (authResult) { - console.log('setSession') - 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() - ) - setItem('access_token', authResult.accessToken) - setItem('id_token', authResult.idToken) - setItem('expires_at', expiresAt) - const data = { - status: `success`, - accessToken: authResult.accessToken, - idToken: authResult.idToken, - expiresAt - } - console.log('setSession idTokenPayload: ', authResult.idTokenPayload) - - this.signinOrCreateAccount({ ...data }) - this.cb(data) - console.log('idTokenPayload', authResult.idTokenPayload) - setItem('authUser', JSON.stringify(authResult.idTokenPayload)) - setItem('authId', authResult.idTokenPayload.sub) - if (window.location.href.includes(`callback`)) { - window.location.href = '/' - } - return true - } - } - - async signinOrCreateAccount ({ accessToken, idToken, expiresAt }) { - console.log( - 'signinOrCreateAccount: ', - client, - this.apolloClient, - accessToken, - idToken, - expiresAt - ) - try { - const data = await client.mutate({ - mutation: AUTHENTICATE, - variables: { idToken } - }) - - console.log('signinOrCreateAccount auth: ', await data) - setItem('authUser', JSON.stringify(data.data.authenticate)) - setItem('authId', data.data.authenticate.authId) - if (window.location.href.includes(`callback`)) { - window.location.href = '/' - } else { - window.location.reload() - } - return data - } catch (err) { - return console.log('Sign in or create account error: ', err) - } - } - - logout () { - // Clear access token and ID token from local storage - removeItem('access_token') - removeItem('id_token') - removeItem('expires_at') - removeItem('authUser') - removeItem('auth0.ssodata') - window.localStorage.clear() - deleteCookie('ajs_anonymous_id') - deleteCookie('ajs_user_id') - deleteCookie('current_tenant') - - lock.logout({ returnTo: AUTH_CONFIG.logoutUrl }) - console.log('logout') - } - - async isAuthenticated () { - // check session and run Auth0 SS0 - const getUser = await getItem('authUser') - let user = JSON.parse(getUser) - - if (validObject(user, 'exp') && new Date().getTime() < (user.exp * 1000)) { - console.log('handleAuth.user exp: ', user, window.location.href) - - return user - } - - const checkSSO = await this.checkSession() - .then(result => { - console.log('handleAuth.checksessions: ', result) - setItem('authUser', result.idTokenPayload.sub) - setItem('authId', result.idTokenPayload.sub) - // user confirmed, log into client - this.setSession(result) - return result.idTokenPayload - }) - .catch(err => { - console.log('handleAuth.checksessions err: ', err) - if (err.error === 'login_required') { - // return this.login() - } - return err - }) - if ( - (window.location.href.includes(`manage`) || - window.location.href.includes(`profile`)) && - !user - ) { - window.location.href = '/' - } - - if (/manage|profile|create|dashboard/.test(window.location.href) && !user) { - this.login() - } - - console.log('handleAuth.isAuthenticated 2: ', checkSSO, user) - if (validObject(checkSSO, 'error')) { - return false - } else { - return checkSSO - } - } -} - -export default Auth diff --git a/client/src/auth/Auth0.sample.js b/client/src/auth/Auth0.sample.js deleted file mode 100644 index 4c501d872..000000000 --- a/client/src/auth/Auth0.sample.js +++ /dev/null @@ -1,7 +0,0 @@ -export const AUTH_CONFIG = { - api_audience: '', - domain: '', - clientId: '', - callbackUrl: '', - logoutUrl: '' -} diff --git a/client/src/components/Logout.js b/client/src/components/Logout.js deleted file mode 100644 index 0989985f7..000000000 --- a/client/src/components/Logout.js +++ /dev/null @@ -1,14 +0,0 @@ -import React, { Component } from 'react'; -import {Redirect} from 'react-router'; -import {auth} from '../App'; - -class Logout extends Component { - render() { - //window.localStorage.removeItem("user"); - auth.logout(); - - return - } -} - -export default Logout diff --git a/client/src/components/Modules.js b/client/src/components/Modules.js deleted file mode 100644 index aa69c80cb..000000000 --- a/client/src/components/Modules.js +++ /dev/null @@ -1,48 +0,0 @@ -import React from 'react'; -import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; - -class Modules extends React.Component { - state = { - open: true, - }; - - handleClickOpen = () => { - this.setState({ open: true }); - }; - - handleClose = () => { - this.setState({ open: false }); - }; - - render() { - return ( -
- - {"Section under development."} - - - The functionality of this section has not been developed yet. We expect to have it for November 2018. Thanks for your understanding. - - - - - - -
- ); - } -} - -export default Modules; diff --git a/client/src/components/Post.js b/client/src/components/Post.js deleted file mode 100644 index 8ae8e1de1..000000000 --- a/client/src/components/Post.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, { Component } from 'react' -import { connect } from 'react-redux' -import { deletePost } from '../actions/postActions' - -class Post extends Component { - handleClick = () => { - this.props.deletePost(this.props.post.id); - this.props.history.push('/'); - } - render() { - - const post = this.props.post ? ( -
-

{this.props.post.title}

-

{this.props.post.body}

-
- -
-
- ) : ( -
Loading post...
- ); - - return ( -
- {post} -
- ) - } -} - -const mapStateToProps = (state, ownProps) => { - let id = ownProps.match.params.post_id; - return { - post: state.posts.find(post => post.id === id) - } -} - -const mapDispatchToProps = (dispatch) => { - return { - deletePost: (id) => dispatch(deletePost(id)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Post) diff --git a/client/src/components/index.js b/client/src/components/index.js deleted file mode 100644 index 195ec74ff..000000000 --- a/client/src/components/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import NavBar from './navbar' -import Footer from './footer' -import Callback from './callback' -import Home from './home' -import About from './about' -import Dashboard from './dashboard' -import Teams from './teams' - -import { theme, globalStyles } from './theme' - -export { - NavBar, - Footer, - Callback, - Home, - About, - Dashboard, - Teams, - theme, - globalStyles -} diff --git a/client/src/components/index0.js b/client/src/components/index0.js deleted file mode 100644 index 195ec74ff..000000000 --- a/client/src/components/index0.js +++ /dev/null @@ -1,21 +0,0 @@ -import NavBar from './navbar' -import Footer from './footer' -import Callback from './callback' -import Home from './home' -import About from './about' -import Dashboard from './dashboard' -import Teams from './teams' - -import { theme, globalStyles } from './theme' - -export { - NavBar, - Footer, - Callback, - Home, - About, - Dashboard, - Teams, - theme, - globalStyles -} diff --git a/client/src/registerServiceWorker.js b/client/src/registerServiceWorker.js deleted file mode 100644 index a3e6c0cfc..000000000 --- a/client/src/registerServiceWorker.js +++ /dev/null @@ -1,117 +0,0 @@ -// In production, we register a service worker to serve assets from local cache. - -// This lets the app load faster on subsequent visits in production, and gives -// it offline capabilities. However, it also means that developers (and users) -// will only see deployed updates on the "N+1" visit to a page, since previously -// cached resources are updated in the background. - -// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. -// This link also includes instructions on opting out of this behavior. - -const isLocalhost = Boolean( - window.location.hostname === 'localhost' || - // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || - // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) -); - -export default function register() { - if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { - // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL, window.location); - if (publicUrl.origin !== window.location.origin) { - // Our service worker won't work if PUBLIC_URL is on a different origin - // from what our page is served on. This might happen if a CDN is used to - // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 - return; - } - - window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; - - if (isLocalhost) { - // This is running on localhost. Lets check if a service worker still exists or not. - checkValidServiceWorker(swUrl); - - // Add some additional logging to localhost, pointing developers to the - // service worker/PWA documentation. - navigator.serviceWorker.ready.then(() => { - console.log( - 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit https://goo.gl/SC7cgQ' - ); - }); - } else { - // Is not local host. Just register service worker - registerValidSW(swUrl); - } - }); - } -} - -function registerValidSW(swUrl) { - navigator.serviceWorker - .register(swUrl) - .then(registration => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - // At this point, the old content will have been purged and - // the fresh content will have been added to the cache. - // It's the perfect time to display a "New content is - // available; please refresh." message in your web app. - console.log('New content is available; please refresh.'); - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); - } - } - }; - }; - }) - .catch(error => { - console.error('Error during service worker registration:', error); - }); -} - -function checkValidServiceWorker(swUrl) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl) - .then(response => { - // Ensure service worker exists, and that we really are getting a JS file. - if ( - response.status === 404 || - response.headers.get('content-type').indexOf('javascript') === -1 - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl); - } - }) - .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); - }); -} - -export function unregister() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then(registration => { - registration.unregister(); - }); - } -} diff --git a/client/src/theme.js b/client/src/theme.js index 1d7900e4a..96492c48c 100644 --- a/client/src/theme.js +++ b/client/src/theme.js @@ -59,11 +59,6 @@ export const globalStyles = theme => ({ [theme.breakpoints.up('sm')]: { paddingBottom: theme.spacing.unit * 2 } - }, - footer: { - marginTop: theme.spacing.unit * 8, - borderTop: `1px solid ${theme.palette.divider}`, - padding: `${theme.spacing.unit * 6}px 0` } }) diff --git a/client/src/utils/js-helpers.js b/client/src/utils/js-helpers.js deleted file mode 100644 index 55dc73320..000000000 --- a/client/src/utils/js-helpers.js +++ /dev/null @@ -1,60 +0,0 @@ -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 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 -} diff --git a/client/src/utils/local-storage.js b/client/src/utils/local-storage.js deleted file mode 100644 index 98220f61d..000000000 --- a/client/src/utils/local-storage.js +++ /dev/null @@ -1,35 +0,0 @@ -const getStateFromStorage = version => { - const localState = JSON.parse(window.localStorage.getItem('aa-team')) - - try { - if (localState !== undefined && localState !== null) { - if ( - localState.appVersion !== undefined && - localState.appVersion !== null - ) { - if (localState.appVersion === version) { - return localState - } - } - } else { - throw new Error() - } - } catch (error) { - return false - } -} - -const storeStateInStorage = state => - window.localStorage.setItem('aa-team', JSON.stringify(state)) - -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 { - getStateFromStorage, - storeStateInStorage, - getItem, - setItem, - removeItem -}