forked from EpamLifeSciencesTeam/cmwl_pipeline_fe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aleksei Litkovetc
committed
Feb 9, 2021
1 parent
2432ae1
commit 87d7b67
Showing
16 changed files
with
534 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DISABLE_NEW_JSX_TRANSFORM = true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,73 @@ | ||
import React, { Component } from 'react'; | ||
import Auth from './containers/AuthForm/Auth'; | ||
import { Redirect, Route, Switch } from 'react-router'; | ||
import { NavLink } from 'react-router-dom'; | ||
import Button from './components/UI/Button/Button'; | ||
import { Dispatch } from 'redux'; | ||
import { logOut } from './store/auth/actions'; | ||
import { connect } from 'react-redux'; | ||
import { RootState } from './store'; | ||
import { Fragment } from 'react'; | ||
|
||
interface StateProps { | ||
isAuthenticated: boolean | ||
} | ||
|
||
interface DispatchProps { | ||
onLogOut: () => void | ||
} | ||
|
||
type Props = StateProps & DispatchProps | ||
|
||
class App extends Component<Props> { | ||
|
||
logOutHandler = () => { | ||
this.props.onLogOut(); | ||
}; | ||
|
||
class App extends Component { | ||
render() { | ||
// ToDo: Create a navigation component | ||
|
||
const content = () => { | ||
if (this.props.isAuthenticated) { | ||
return ( | ||
<Fragment> | ||
{/*ToDo: rid off from the inline-style */} | ||
<NavLink style={{ margin: '10px' }} to='/'>Home</NavLink> | ||
<NavLink style={{ margin: '10px' }} to='/projects'>Projects</NavLink> | ||
<Button onClick={this.logOutHandler}>Log out</Button> | ||
<Redirect to='/' /> | ||
</Fragment> | ||
); | ||
} | ||
return <Redirect to='/auth' />; | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div style={{textAlign: 'center'}}> | ||
<h1>Cromwell Pipeline</h1> | ||
{content()} | ||
<Switch> | ||
{/*ToDo: rid off from the inline-renders */} | ||
<Route path='/auth' component={Auth} /> | ||
<Route path='/projects' render={() => <h2>Projects content</h2>} /> | ||
<Route path='/' exact render={() => <h2>Main content</h2>} /> | ||
</Switch> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; | ||
const mapStateToProps = (state: RootState) => { | ||
return { | ||
isAuthenticated: state.auth.isAuthenticated | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => { | ||
return { | ||
onLogOut: () => dispatch(logOut()) | ||
}; | ||
}; | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import axios from 'axios'; | ||
|
||
const axiosCromwell = axios.create({ | ||
baseURL: 'http://localhost:3001/' | ||
}); | ||
|
||
export default axiosCromwell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.Button { | ||
background-color: transparent; | ||
border: none; | ||
color: blue; | ||
outline: none; | ||
cursor: pointer; | ||
font: inherit; | ||
padding: 10px; | ||
margin: 10px; | ||
font-weight: bold; | ||
} |
Oops, something went wrong.