8000 Example for tim by pipermerriam · Pull Request #12 · ethpm/escape · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Example for tim #12

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

Open
wants to merge 1 commit 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
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" 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
}
0