|
|
@ -34,6 +34,13 @@ export function reducer (state = initialState, action) { |
|
|
|
channelDisconnected: true |
|
|
|
channelDisconnected: true |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case 'COUNTERS_FETCHED': { |
|
|
|
|
|
|
|
console.log(action) |
|
|
|
|
|
|
|
return Object.assign({}, state, { |
|
|
|
|
|
|
|
transactionCount: action.transactionCount, |
|
|
|
|
|
|
|
validationCount: action.validationCount |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
case 'RECEIVED_NEW_BLOCK': { |
|
|
|
case 'RECEIVED_NEW_BLOCK': { |
|
|
|
if (state.channelDisconnected) return state |
|
|
|
if (state.channelDisconnected) return state |
|
|
|
|
|
|
|
|
|
|
@ -81,8 +88,13 @@ const elements = { |
|
|
|
return { transactionCount: numeral($el.text()).value() } |
|
|
|
return { transactionCount: numeral($el.text()).value() } |
|
|
|
}, |
|
|
|
}, |
|
|
|
render ($el, state, oldState) { |
|
|
|
render ($el, state, oldState) { |
|
|
|
|
|
|
|
if (state.transactionCount) { |
|
|
|
if (oldState.transactionCount === state.transactionCount) return |
|
|
|
if (oldState.transactionCount === state.transactionCount) return |
|
|
|
$el.empty().append(numeral(state.transactionCount).format()) |
|
|
|
$el.empty().append('>= ' + numeral(state.transactionCount).format() + ' Transactions') |
|
|
|
|
|
|
|
$el.show() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$el.hide() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
'[data-selector="fetched-coin-balance-block-number"]': { |
|
|
|
'[data-selector="fetched-coin-balance-block-number"]': { |
|
|
@ -99,12 +111,29 @@ const elements = { |
|
|
|
return { validationCount: numeral($el.text()).value() } |
|
|
|
return { validationCount: numeral($el.text()).value() } |
|
|
|
}, |
|
|
|
}, |
|
|
|
render ($el, state, oldState) { |
|
|
|
render ($el, state, oldState) { |
|
|
|
|
|
|
|
if (state.validationCount) { |
|
|
|
if (oldState.validationCount === state.validationCount) return |
|
|
|
if (oldState.validationCount === state.validationCount) return |
|
|
|
$el.empty().append(numeral(state.validationCount).format()) |
|
|
|
$el.empty().append(numeral(state.validationCount).format() + ' Blocks Validated') |
|
|
|
|
|
|
|
$el.show() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$el.hide() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadCounters (store) { |
|
|
|
|
|
|
|
const $element = $('[data-async-counters]') |
|
|
|
|
|
|
|
const path = $element.data().asyncCounters |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fetchCounters () { |
|
|
|
|
|
|
|
$.getJSON(path) |
|
|
|
|
|
|
|
.done(response => store.dispatch(Object.assign({type: 'COUNTERS_FETCHED'}, humps.camelizeKeys(response)))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fetchCounters() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const $addressDetailsPage = $('[data-page="address-details"]') |
|
|
|
const $addressDetailsPage = $('[data-page="address-details"]') |
|
|
|
if ($addressDetailsPage.length) { |
|
|
|
if ($addressDetailsPage.length) { |
|
|
|
const store = createStore(reducer) |
|
|
|
const store = createStore(reducer) |
|
|
@ -149,4 +178,6 @@ if ($addressDetailsPage.length) { |
|
|
|
type: 'RECEIVED_UPDATED_BALANCE', |
|
|
|
type: 'RECEIVED_UPDATED_BALANCE', |
|
|
|
msg: humps.camelizeKeys(msg) |
|
|
|
msg: humps.camelizeKeys(msg) |
|
|
|
})) |
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadCounters(store) |
|
|
|
} |
|
|
|
} |
|
|
|