use VaultEvents model for TransfersGraph

This commit is contained in:
Barry Gitarts 2019-01-25 14:48:17 -05:00
parent 8b3e648448
commit 98c1f80942
3 changed files with 15 additions and 18 deletions

View File

@ -12,7 +12,7 @@ const Dashboard = ({ pledges }) => (
</div>
)
Dashboard.PropTypes = {
Dashboard.propTypes = {
pledges: PropTypes.array.isRequired
}

View File

@ -9,7 +9,6 @@ import { withDatabase } from '@nozbe/watermelondb/DatabaseProvider'
import { uniq, isNil } from 'ramda'
import { toEther } from '../utils/conversions'
import { getTokenLabel } from '../utils/currencies'
import { FundingContext } from '../context'
import { getAuthorizations } from '../selectors/vault'
@ -75,29 +74,27 @@ const createElements = (transfers, vaultEvents) => {
]
}
const TransfersGraph = ({ transfers }) => {
const TransfersGraph = ({ transfers, vaultEvents }) => {
return (
<FundingContext.Consumer>
{({ vaultEvents }) =>
<Fragment>
<CytoscapeComponent
elements={createElements(transfers, vaultEvents)}
style={ { width: '100vw', height: '100%', fontSize: '14px' } }
stylesheet={stylesheet}
layout={layout}
/>
</Fragment>
}
</FundingContext.Consumer>
<Fragment>
<CytoscapeComponent
elements={createElements(transfers, vaultEvents)}
style={ { width: '100vw', height: '100%', fontSize: '14px' } }
stylesheet={stylesheet}
layout={layout}
/>
</Fragment>
)
}
TransfersGraph.propTypes = {
transfers: PropTypes.array.isRequired
transfers: PropTypes.array.isRequired,
vaultEvents: PropTypes.array.isRequired
}
export default withDatabase(withObservables([], ({ database }) => ({
transfers: database.collections.get('lp_events').query(
Q.where('event', 'Transfer')
).observe()
).observe(),
vaultEvents : database.collections.get('vault_events').query().observe()
}))(TransfersGraph))

View File

@ -5,6 +5,7 @@ import { action, field, json } from '@nozbe/watermelondb/decorators'
const sanitizeValues = json => json
export default class VaultEvent extends Model {
static table = 'vault_events'
@field('address') address
@field('event_id') eventId
@ -25,4 +26,3 @@ export default class VaultEvent extends Model {
})
}
}