Client: refactor + minor changes
This commit is contained in:
parent
424df3b721
commit
c314c79f86
@ -9,31 +9,28 @@ import ActivityEdit from './ActivityEdit'
|
|||||||
import NotFound from './../Others/NotFound'
|
import NotFound from './../Others/NotFound'
|
||||||
import { isLoggedIn } from '../../utils'
|
import { isLoggedIn } from '../../utils'
|
||||||
|
|
||||||
class Activity extends React.Component {
|
function Activity () {
|
||||||
componentDidMount() {}
|
return (
|
||||||
render() {
|
<div>
|
||||||
return (
|
<Helmet>
|
||||||
<div>
|
<title>mpwo - Admin</title>
|
||||||
<Helmet>
|
</Helmet>
|
||||||
<title>mpwo - Admin</title>
|
{isLoggedIn() ? (
|
||||||
</Helmet>
|
<Switch>
|
||||||
{isLoggedIn() ? (
|
<Route exact path="/activities/add" component={ActivityAdd} />
|
||||||
<Switch>
|
<Route
|
||||||
<Route exact path="/activities/add" component={ActivityAdd} />
|
exact path="/activities/:activityId"
|
||||||
<Route
|
component={ActivityDisplay}
|
||||||
exact path="/activities/:activityId"
|
/>
|
||||||
component={ActivityDisplay}
|
<Route
|
||||||
/>
|
exact path="/activities/:activityId/edit"
|
||||||
<Route
|
component={ActivityEdit}
|
||||||
exact path="/activities/:activityId/edit"
|
/>
|
||||||
component={ActivityEdit}
|
<Route component={NotFound} />
|
||||||
/>
|
</Switch>
|
||||||
<Route component={NotFound} />
|
) : (<Redirect to="/login" />)}
|
||||||
</Switch>
|
</div>
|
||||||
) : (<Redirect to="/login" />)}
|
)
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
@ -1,45 +1,35 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
class AdminMenu extends React.Component {
|
export default function AdminMenu () {
|
||||||
componentDidMount() {}
|
return (
|
||||||
render() {
|
<div>
|
||||||
return (
|
<Helmet>
|
||||||
<div>
|
<title>mpwo - Admin</title>
|
||||||
<Helmet>
|
</Helmet>
|
||||||
<title>mpwo - Admin</title>
|
<h1 className="page-title">Administration</h1>
|
||||||
</Helmet>
|
<div className="container">
|
||||||
<h1 className="page-title">Administration</h1>
|
<div className="row">
|
||||||
<div className="container">
|
<div className="col-md-2" />
|
||||||
<div className="row">
|
<div className="col-md-8 card">
|
||||||
<div className="col-md-2" />
|
<div className="card-body">
|
||||||
<div className="col-md-8 card">
|
<ul className="admin-items">
|
||||||
<div className="card-body">
|
<li>
|
||||||
<ul className="admin-items">
|
<Link
|
||||||
<li>
|
to={{
|
||||||
<Link
|
pathname: '/admin/sports',
|
||||||
to={{
|
}}
|
||||||
pathname: '/admin/sports',
|
>
|
||||||
}}
|
Sports
|
||||||
>
|
</Link>
|
||||||
Sports
|
</li>
|
||||||
</Link>
|
</ul>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-2" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="col-md-2" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
</div>
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
|
||||||
state => ({
|
|
||||||
user: state.user,
|
|
||||||
})
|
|
||||||
)(AdminMenu)
|
|
||||||
|
@ -11,37 +11,34 @@ import AccessDenied from './../Others/AccessDenied'
|
|||||||
import NotFound from './../Others/NotFound'
|
import NotFound from './../Others/NotFound'
|
||||||
import { isLoggedIn } from '../../utils'
|
import { isLoggedIn } from '../../utils'
|
||||||
|
|
||||||
class Admin extends React.Component {
|
function Admin (props) {
|
||||||
componentDidMount() {}
|
const { user } = props
|
||||||
render() {
|
return (
|
||||||
const { user } = this.props
|
<div>
|
||||||
return (
|
<Helmet>
|
||||||
<div>
|
<title>mpwo - Admin</title>
|
||||||
<Helmet>
|
</Helmet>
|
||||||
<title>mpwo - Admin</title>
|
{isLoggedIn() ? (
|
||||||
</Helmet>
|
user.isAdmin ? (
|
||||||
{isLoggedIn() ? (
|
<Switch>
|
||||||
user.isAdmin ? (
|
<Route exact path="/admin" component={AdminMenu} />
|
||||||
<Switch>
|
<Route exact path="/admin/sports" component={AdminSports} />
|
||||||
<Route exact path="/admin" component={AdminMenu} />
|
<Route
|
||||||
<Route exact path="/admin/sports" component={AdminSports} />
|
exact path="/admin/sports/add"
|
||||||
<Route
|
component={AdminSportsAdd}
|
||||||
exact path="/admin/sports/add"
|
/>
|
||||||
component={AdminSportsAdd}
|
<Route
|
||||||
/>
|
exact path="/admin/sports/:sportId"
|
||||||
<Route
|
component={AdminSport}
|
||||||
exact path="/admin/sports/:sportId"
|
/>
|
||||||
component={AdminSport}
|
<Route component={NotFound} />
|
||||||
/>
|
</Switch>
|
||||||
<Route component={NotFound} />
|
) : (
|
||||||
</Switch>
|
<AccessDenied />
|
||||||
) : (
|
)
|
||||||
<AccessDenied />
|
) : (<Redirect to="/login" />)}
|
||||||
)
|
</div>
|
||||||
) : (<Redirect to="/login" />)}
|
)
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import ActivityCard from './ActivityCard'
|
import ActivityCard from './ActivityCard'
|
||||||
import Calendar from './../Others/Calendar'
|
import Calendar from './../Others/Calendar'
|
||||||
@ -56,7 +57,14 @@ class DashBoard extends React.Component {
|
|||||||
sports={sports}
|
sports={sports}
|
||||||
/>)
|
/>)
|
||||||
)) : (
|
)) : (
|
||||||
'No activities. Upload one !'
|
<div className="card text-center">
|
||||||
|
<div className="card-body">
|
||||||
|
No workouts. {' '}
|
||||||
|
<Link to={{ pathname: '/activities/add' }}>
|
||||||
|
Upload one !
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{!paginationEnd &&
|
{!paginationEnd &&
|
||||||
<input
|
<input
|
||||||
|
@ -1,26 +1,16 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { connect } from 'react-redux'
|
|
||||||
|
|
||||||
class AccessDenied extends React.Component {
|
export default function AccessDenied () {
|
||||||
componentDidMount() {}
|
return (
|
||||||
render() {
|
<div>
|
||||||
return (
|
<Helmet>
|
||||||
<div>
|
<title>mpwo - Access denied</title>
|
||||||
<Helmet>
|
</Helmet>
|
||||||
<title>mpwo - Access denied</title>
|
<h1 className="page-title">Access denied</h1>
|
||||||
</Helmet>
|
<p className="App-center">
|
||||||
<h1 className="page-title">Access denied</h1>
|
{'You don\'t have permissions to access this page.'}
|
||||||
<p className="App-center">
|
</p>
|
||||||
{'You don\'t have permissions to access this page.'}
|
</div>
|
||||||
</p>
|
)
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
|
||||||
state => ({
|
|
||||||
user: state.user,
|
|
||||||
})
|
|
||||||
)(AccessDenied)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user