add proposals terms change name on proposals page
This commit is contained in:
parent
d75218afa6
commit
0c9dcfed31
@ -1,7 +1,24 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
import { gql, useQuery } from '@apollo/client';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SyntaxHighlighter } from '../../components/syntax-highlighter';
|
import { SyntaxHighlighter } from '../../components/syntax-highlighter';
|
||||||
import { ProposalsQuery } from './__generated__/ProposalsQuery';
|
import {
|
||||||
|
ProposalsQuery,
|
||||||
|
ProposalsQuery_proposals_terms_change,
|
||||||
|
} from './__generated__/ProposalsQuery';
|
||||||
|
|
||||||
|
export function getProposalName(change: ProposalsQuery_proposals_terms_change) {
|
||||||
|
if (change.__typename === 'NewAsset') {
|
||||||
|
return `New asset: ${change.symbol}`;
|
||||||
|
} else if (change.__typename === 'NewMarket') {
|
||||||
|
return `New market: ${change.instrument.name}`;
|
||||||
|
} else if (change.__typename === 'UpdateMarket') {
|
||||||
|
return `Update market: ${change.marketId}`;
|
||||||
|
} else if (change.__typename === 'UpdateNetworkParameter') {
|
||||||
|
return `Update network: ${change.networkParameter.key}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Unknown proposal';
|
||||||
|
}
|
||||||
|
|
||||||
const PROPOSAL_QUERY = gql`
|
const PROPOSAL_QUERY = gql`
|
||||||
query ProposalsQuery {
|
query ProposalsQuery {
|
||||||
@ -90,7 +107,7 @@ const Governance = () => {
|
|||||||
{data.proposals.map((p) => (
|
{data.proposals.map((p) => (
|
||||||
<React.Fragment key={p.id}>
|
<React.Fragment key={p.id}>
|
||||||
{/* TODO get proposal name generator from console */}
|
{/* TODO get proposal name generator from console */}
|
||||||
<h2>{p.id}</h2>
|
<h2>{getProposalName(p.terms.change)}</h2>
|
||||||
<SyntaxHighlighter data={p} />
|
<SyntaxHighlighter data={p} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
Loading…
Reference in New Issue
Block a user