Skip to content
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
2 changes: 2 additions & 0 deletions www-src/js/actions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import * as Web3Actions from './web3'
import * as ChainActions from './chain'
import * as ConfigActions from './config'
import * as PackageIndexActions from './package_index'
import * as ThingActions from './thing'

export default {
...PaginationActions,
...Web3Actions,
...ChainActions,
...ConfigActions,
...PackageIndexActions,
...ThingActions,
}
10 changes: 10 additions & 0 deletions www-src/js/actions/thing.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import TYPES from './types'



export function setThing(value) {
return {
type: TYPES.SET_THING,
value: value,
}
}
2 changes: 2 additions & 0 deletions www-src/js/actions/types.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ export default {
SET_RELEASE_HASH: 'SET_RELEASE_HASH',
// release data
SET_RELEASE_DATA: 'SET_RELEASE_DATA',
// Thing Setter
SET_THING: 'SET_THING'
}
10 changes: 9 additions & 1 deletion www-src/js/components/pages/SiteIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import { Link } from 'react-router'
import BSCard from '../bootstrap/BSCard'
import FAIcon from '../common/FAIcon'
import layoutStyles from '../../../css/layout.css'
import actions from '../../actions'

function mapStateToProps(state) {
return {}
return {
thing: state.thing.get('thingValue')
}
}

export default connect(mapStateToProps)(React.createClass({
setThing() {
this.props.dispatch(actions.setThing(5))
},
render() {
return (
<div id="landing-page">
Expand All @@ -22,6 +28,8 @@ export default connect(mapStateToProps)(React.createClass({
<h1 className="card-title">The Ethereum Package Registry</h1>
<p className="card-text">A package index for Ethereum smart contract packages.</p>
<Link className="btn btn-primary pull-right" to="registry"><FAIcon icon="database" /> Registry</Link>
<p>Thing is {this.props.thing}</p>
<button type="button" onClick={this.setThing}>Set Thing</button>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions www-src/js/reducers/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import config from './config'
import pagination from './pagination'
import web3 from './web3'
import packageIndex from './package_index'
import thing from './thing'


export default combineReducers({
Expand All @@ -15,6 +16,7 @@ export default combineReducers({
pagination,
web3,
packageIndex,
thing,
routing: routerReducer,
form: formReducer,
})
22 changes: 22 additions & 0 deletions www-src/js/reducers/thing.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Immutable from 'immutable'
import TYPES from '../actions/types'

var initialState = Immutable.fromJS({
thingValue: 'initial-value'
})

export default function(state, action) {
if (state === undefined) {
return initialState
}

var newState = state

switch (action.type) {
case TYPES.SET_THING:
newState = newState.set('thingValue', action.value)
break
}

return newState
}