You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
9 years ago
|
const render = require('react-dom').render
|
||
|
const h = require('react-hyperscript')
|
||
9 years ago
|
const Root = require('./ui/app/root')
|
||
|
const configureStore = require('./development/mockStore')
|
||
|
const states = require('./development/states')
|
||
|
const Selector = require('./development/selector')
|
||
9 years ago
|
|
||
|
// Query String
|
||
9 years ago
|
const qs = require('qs')
|
||
9 years ago
|
let queryString = qs.parse(window.location.href.split('#')[1])
|
||
9 years ago
|
let selectedView = queryString.view || 'account detail'
|
||
9 years ago
|
const firstState = states[selectedView]
|
||
|
updateQueryParams(selectedView)
|
||
9 years ago
|
|
||
9 years ago
|
// CSS
|
||
9 years ago
|
const MetaMaskUiCss = require('./ui/css')
|
||
9 years ago
|
const injectCss = require('inject-css')
|
||
|
|
||
|
|
||
9 years ago
|
function updateQueryParams(newView) {
|
||
|
queryString.view = newView
|
||
|
const params = qs.stringify(queryString)
|
||
|
window.location.href = window.location.href.split('#')[0] + `#${params}`
|
||
9 years ago
|
}
|
||
|
|
||
|
const actions = {
|
||
|
_setAccountManager(){},
|
||
|
update: function(stateName) {
|
||
|
selectedView = stateName
|
||
9 years ago
|
updateQueryParams(stateName)
|
||
9 years ago
|
const newState = states[selectedView]
|
||
|
return {
|
||
|
type: 'GLOBAL_FORCE_UPDATE',
|
||
|
value: newState,
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
|
||
|
var css = MetaMaskUiCss()
|
||
|
injectCss(css)
|
||
|
|
||
|
const container = document.querySelector('#app-content')
|
||
|
|
||
|
// parse opts
|
||
|
var store = configureStore(states[selectedView])
|
||
|
|
||
|
// start app
|
||
|
render(
|
||
|
h('.super-dev-container', [
|
||
|
|
||
9 years ago
|
h(Selector, { actions, selectedKey: selectedView, states, store }),
|
||
9 years ago
|
|
||
9 years ago
|
h('.mock-app-root', {
|
||
|
style: {
|
||
|
height: '500px',
|
||
|
width: '360px',
|
||
9 years ago
|
boxShadow: '2px 2px 5px grey',
|
||
|
margin: '20px',
|
||
9 years ago
|
},
|
||
|
}, [
|
||
|
h(Root, {
|
||
|
store: store,
|
||
|
}),
|
||
|
]),
|
||
9 years ago
|
|
||
|
]
|
||
|
), container)
|
||
|
|