Skip to content

Commit

Permalink
Matic bridge url (#426)
Browse files Browse the repository at this point in the history
* Add Matic bridge

* Add governance summary

* skip SNAPSHOT_VOTES_SUBGRAPH_QUERY if no users
  • Loading branch information
makoto authored Aug 22, 2021
1 parent 0026cd0 commit 662e692
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/components/SingleEvent/Approve.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ const Approve = ({
} else if (!hasBalance) {
return (
<GlobalConsumer>
{({ wallet }) => {
{({ wallet, networkState }) => {
const networkId = networkState && networkState.networkId
let bridgeurl
if (networkId === '137') {
bridgeurl = 'https://wallet.matic.network/bridge'
} else if (networkId === '100') {
bridgeurl = 'https://dai-bridge.poa.network'
}
return (
<WarningBox>
<p>
Expand All @@ -51,10 +58,10 @@ const Approve = ({
your wallet. Please top up your wallet and come back again.
<br />
To bridge from Ethereum mainnet, please use{' '}
<a href="https://dai-bridge.poa.network">the Mainnet bridge</a>.
<a href={bridgeurl}>the Mainnet bridge</a>.
<br />
If you have DAI on BSC or Matic/Polygon, please use{' '}
<a href="https://www.xpollinate.io">the Crosschain bridge</a>
If you have assets on other sidechains, please use{' '}
<a href="https://li.finance/swap">the Crosschain bridge</a>
</p>

{wallet && wallet.url && (
Expand Down
42 changes: 40 additions & 2 deletions src/components/SingleEvent/EventParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,33 @@ const EventParticipants = props => {
const handleSearch = search => {
setSearch((search || '').toLowerCase())
}
const userAddresses = participants.map(p => p.user.address)
const { data: snapshotData } = useQuery(SNAPSHOT_VOTES_SUBGRAPH_QUERY, {
variables: { userAddresses: participants.map(p => p.user.address) },
variables: { userAddresses },
skip: userAddresses.length === 0,
client: graphClient
})

console.log({ snapshotData })
const spaces = {}
snapshotData &&
snapshotData.votes.map(s => {
if (spaces[s.space.id]) {
spaces[s.space.id].voters.push(s.voter)
} else {
spaces[s.space.id] = {
voters: [s.voter],
avatar: s.space.avatar
}
}
})
console.log({ spaces })
const stats = Object.keys(spaces)
.map(k => {
return [k, _.uniq(spaces[k].voters).length]
})
.sort((a, b) => {
return b[1] - a[1]
})
return (
<SafeQuery
query={GET_CONTRIBUTIONS_BY_PARTY}
Expand Down Expand Up @@ -141,6 +163,22 @@ const EventParticipants = props => {
<NoParticipants>No one is attending.</NoParticipants>
)}
</EventParticipantsContainer>
<div>
{stats.length > 0 && (
<div>
<h3>Top Governance participations</h3>
<ul>
{stats.slice(0, 10).map(([k, v]) => {
return (
<li>
{k} has {v} participant{parseInt(v) > 1 && 's'}
</li>
)
})}
</ul>
</div>
)}
</div>
</Fragment>
)
}}
Expand Down

0 comments on commit 662e692

Please sign in to comment.