@symbolic/react-app
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "@symbolic/react-app", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -30,2 +30,4 @@ import React from 'react'; //eslint-disable-line | ||
render() { | ||
var {appKey} = this.props; | ||
return ( | ||
@@ -36,3 +38,3 @@ <Provider store={this.props.store}> | ||
<div className='sf-app-wrapper'> | ||
<Route component={Header}/> | ||
<Route render={(props) => <Header {...props} {...{appKey}}/>}/> | ||
<div className='sf-content'> | ||
@@ -39,0 +41,0 @@ {this.props.children} |
import {_, React, Component, className, lib} from 'components'; //eslint-disable-line | ||
import {connect} from 'react-redux'; | ||
import {Link} from 'react-router-dom'; | ||
import appsData from '../../apps-data'; | ||
import './header.scss'; | ||
var Header = ({appData, session, ...props}) => { | ||
var domain = ''; | ||
class Header extends Component { | ||
render() { | ||
var {appKey, session, ...props} = this.props; | ||
return ( | ||
<div className='sf-header'> | ||
<div className='app-name'> | ||
Accounts | ||
</div> | ||
<div className='menu-button'> | ||
var {accountsDomain} = this; | ||
var appData = appsData[appKey]; | ||
</div> | ||
<div className='inline-links'> | ||
return ( | ||
<div className='sf-header'> | ||
<div className='app-name'> | ||
<div style={{...appData.style}}>{appData.title}</div> | ||
</div> | ||
<div className='menu-button'> | ||
</div> | ||
<div className='inline-links'> | ||
</div> | ||
{session.isLoggedIn ? ( | ||
<> | ||
<div className='user-info'> | ||
{session.user.name} | ||
</div> | ||
<div className='session-links'> | ||
<a {...className([props.location.pathname === '/log-out' && 'active'])} href={`${accountsDomain}/log-out`}>Log out</a> | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
<div className='session-links'> | ||
<a {...className([props.location.pathname === '/log-out' && 'active'])} href={`${accountsDomain}/log-in`}>Log in</a> | ||
<a {...className([props.location.pathname === '/sign-up' && 'active'])} href={`${accountsDomain}/sign-up`}>Sign up</a> | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
); | ||
} | ||
{session.isLoggedIn ? ( | ||
<> | ||
<div className='user-info'> | ||
{session.user.name} | ||
</div> | ||
<div className='session-links'> | ||
<Link {...className([props.location.pathname === '/log-out' && 'active'])} to={`${domain}/log-out`}>Log out</Link> | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
<div className='session-links'> | ||
<Link {...className([props.location.pathname === '/log-out' && 'active'])} to={`${domain}/log-in`}>Log in</Link> | ||
<Link {...className([props.location.pathname === '/sign-up' && 'active'])} to={`${domain}/sign-up`}>Sign up</Link> | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
) | ||
get accountsDomain() { | ||
return process.env.NODE_ENV === 'development' ? 'http://localhost:3051' : 'https://accounts.symbolicframeworks.com'; | ||
} | ||
} | ||
export default connect(state => _.pick(state, ['session']))(Header); |
@@ -11,15 +11,13 @@ import {_, React, Component, className, lib} from 'components'; //eslint-disable-line | ||
return ( | ||
(!hasPermission ? ( | ||
<Redirect to={`${this.accountsDomain}/log-in`}/> | ||
) : ( | ||
<div {...className([`page ${_.kebabCase(this.key)}-page`, this.className])}> | ||
{content} | ||
</div> | ||
)) | ||
); | ||
if (!hasPermission) window.location = `${this.accountsDomain}/log-in`; | ||
return hasPermission ? ( | ||
<div {...className([`page ${_.kebabCase(this.key)}-page`, this.className])}> | ||
{content} | ||
</div> | ||
) : null; | ||
} | ||
get accountsDomain() { | ||
return ''; | ||
return process.env.NODE_ENV === 'development' ? 'http://localhost:3051' : 'https://accounts.symbolicframeworks.com'; | ||
} | ||
@@ -26,0 +24,0 @@ } |
import {connect, reducerAndActionsFor, createStore} from './redux/helpers/helpers'; | ||
import {logIn, logOut, signUp} from './redux/reducers/session/session-reducer'; | ||
import appsData from './apps-data'; | ||
@@ -12,3 +13,4 @@ import Page from './components/page/page'; | ||
connect, reducerAndActionsFor, createStore, | ||
logIn, logOut, signUp | ||
logIn, logOut, signUp, | ||
appsData | ||
}; | ||
@@ -15,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
11939
17
296
3