Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12/`1 #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions client/components/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router-dom'
import Head from './head'

const Dashboard = () => {
return (
<div>
<Head title="Hello" />
<div id="title">Dashboard</div>
<div className="flex items-center justify-center h-screen">
<div className="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
<Link to="/dashboard/profile/e7aec42d-a611-47cc-a5c8-93e75ce35f1c"> Go To Profile </Link>
<Link to="/dashboard/main"> Go To Main </Link>
</div>
</div>
</div>
)
}

Dashboard.propTypes = {}

const mapStateToProps = () => ({})

const mapDispatchToProps = (dispatch) => bindActionCreators({}, dispatch)

export default connect(mapStateToProps, mapDispatchToProps)(Dashboard)
7 changes: 6 additions & 1 deletion client/components/dummy-view.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link, useParams } from 'react-router-dom'
import Head from './head'

const Dummy = () => {
const { planetId } = useParams()
return (
<div>
<Head title="Hello" />
<div id="title">Dashboard</div>
<div className="flex items-center justify-center h-screen">
<div className="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
This is dummy component
This is dummy component{planetId}
<Link to="/dashboard/profile/e7aec42d-a611-47cc-a5c8-93e75ce35f1c"> Go To Profile </Link>
<Link to="/dashboard/main"> Go To Main </Link>
</div>
</div>
</div>
Expand Down
23 changes: 15 additions & 8 deletions client/components/home.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import React, { useState } from 'react'
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Switch, Route } from 'react-router-dom'
import Head from './head'
import Main from './main'
import User from './user'
import Dashboard from './dashboard'

const Home = () => {
const [counter, setCounterNew] = useState(0)

return (
<div>
<Head title="Hello" />
<button type="button" onClick={() => setCounterNew(counter + 1)}>
updateCounter
</button>
<div> Hello World Dashboard {counter} </div>
<Head />
<div className="flex items-center justify-center h-screen">
<div className="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
<Switch>
<Route exact path="/dashboard/profile/:user" component={() => <User />} />
<Route exact path="/dashboard/main" component={() => <Main />} />
<Route exact path="/dashboard" component={() => <Dashboard />} />
</Switch>
</div>
</div>
</div>
)
}
Expand Down
28 changes: 28 additions & 0 deletions client/components/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router-dom'
import Head from './head'

const Main = () => {
return (
<div>
<Head title="Hello" />
<div id="title">Main</div>
<div className="flex items-center justify-center h-screen">
<div className="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
<Link to="/dashboard/profile/e7aec42d-a611-47cc-a5c8-93e75ce35f1c"> Go To Profile </Link>
<Link to="/dashboard"> Go To Root </Link>
</div>
</div>
</div>
)
}

Main.propTypes = {}

const mapStateToProps = () => ({})

const mapDispatchToProps = (dispatch) => bindActionCreators({}, dispatch)

export default connect(mapStateToProps, mapDispatchToProps)(Main)
30 changes: 30 additions & 0 deletions client/components/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Link, useParams } from 'react-router-dom'
import Head from './head'

const User = () => {
const { user } = useParams()
return (
<div>
<Head title="Hello" />
<div id="title">Profile</div>
<div className="flex items-center justify-center h-screen">
<div className="bg-indigo-800 text-white font-bold rounded-lg border shadow-lg p-10">
<div id="username">{user}</div>
<Link to="/dashboard/main"> Go To Main </Link>
<Link to="/dashboard"> Go To Roor </Link>
</div>
</div>
</div>
)
}

User.propTypes = {}

const mapStateToProps = () => ({})

const mapDispatchToProps = (dispatch) => bindActionCreators({}, dispatch)

export default connect(mapStateToProps, mapDispatchToProps)(User)
2 changes: 2 additions & 0 deletions client/config/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export default (props) => {
<StartupConnected>
<Switch>
<Route exact path="/" component={() => <DummyView />} />
<Route exact path="/dashboard/profile/:user" component={() => <Home />} />
<Route exact path="/dashboard/main" component={() => <Home />} />
<Route exact path="/dashboard" component={() => <Home />} />
<PrivateRouteConnected exact path="/hidden-route" component={() => <DummyView />} />
<Route component={() => <NotFound />} />
Expand Down