Skip to content

Commit

Permalink
Merge 445efb2 into 5c35f33
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lee authored Aug 21, 2019
2 parents 5c35f33 + 445efb2 commit eab1b17
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
11 changes: 6 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const App = ({
handleInitializeShipLocation,
handleSetPlanets,
planets,
shipLocation
userCash
}) => {
useEffect(() => {
if (planets.length === 0) {
Expand All @@ -35,6 +35,8 @@ const App = ({
<div>
<h1>hermes</h1>
<ItemTimer />
<h2>Cash:</h2>
<span>{userCash}</span>
<br />
<br />
<ViewSelector />
Expand All @@ -48,13 +50,12 @@ const App = ({
App.propTypes = {
handleInitializeShipLocation: PropTypes.func.isRequired,
handleSetPlanets: PropTypes.func.isRequired,
planets: PropTypes.array.isRequired,
shipLocation: PropTypes.object
planets: PropTypes.array.isRequired
}

const mapStateToProps = ({ ship, world }) => ({
const mapStateToProps = ({ user, world }) => ({
planets: world.planets,
shipLocation: ship.location
userCash: user.cash
})

const mapDispatchToProps = dispatch => ({
Expand Down
7 changes: 7 additions & 0 deletions src/redux/actions/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// * ACTION TYPES

// * ACTION GENERATORS

// * PROMISES

// * THUNKS
14 changes: 0 additions & 14 deletions src/redux/actions/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,5 @@ export const clearItems = () => ({ type: CLEAR_ITEMS })
export const refreshItems = () => ({ type: REFRESH_ITEMS })

// * PROMISES
// const thing = () => {
// return new Promise((resolve, reject) => {
// console.log('Promise timer started.')
// setTimeout(() => {
// resolve(true)
// }, 3000)
// })
// }

// * THUNKS
// export const generatePlanet = () => {
// return async dispatch => {
// const thingy = await thing()
// console.log(thingy)
// }
// }
10 changes: 10 additions & 0 deletions src/redux/reducers/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const userDefaultState = {
cash: 100
}

export default (state = userDefaultState, action) => {
switch (action.type) {
default:
return state
}
}
2 changes: 2 additions & 0 deletions src/redux/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createStore, compose, combineReducers, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import shipReducer from '../reducers/ship'
import uiReducer from '../reducers/ui'
import userReducer from '../reducers/user'
import worldReducer from '../reducers/world'
import { loadState, saveState } from '../../util'
import throttle from 'lodash/throttle'
Expand All @@ -14,6 +15,7 @@ const store = createStore(
combineReducers({
ship: shipReducer,
ui: uiReducer,
user: userReducer,
world: worldReducer
}),
persistedState,
Expand Down
2 changes: 0 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const getPlanetName = () => {
export const generateItems = possibleDestinations => {
const items = []

console.log({ possibleDestinations })

for (let i = 0; i < 5; i++) {
const destinationPlanet =
possibleDestinations[
Expand Down

0 comments on commit eab1b17

Please sign in to comment.