@@ -36,6 +36,13 @@ interface State {
3636 tally ?: TallyInterface ;
3737}
3838
39+ interface HistoryState {
40+ done : boolean ;
41+ timestamp : moment . Moment ;
42+ outcome ?: string ;
43+ show : boolean ;
44+ }
45+
3946const benefitLabels : LabelInterface = {
4047 1 : 'Little Benefit' ,
4148 2 : 'Medium Benefit' ,
@@ -48,7 +55,7 @@ const riskLabels: LabelInterface = {
4855 3 : 'High Risk' ,
4956} ;
5057
51- type ProposalState = 'created' | ' active' | 'failed' | 'accepted ';
58+ type ProposalState = 'active' | 'finalized ' ;
5259
5360export class Governance extends React . Component < RouteComponentProps < any > > {
5461 public state : State = {
@@ -79,25 +86,16 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
7986 const outcome = getVoteOutcome ( tally ) ;
8087
8188 const proposalHistoryState = {
82- created : {
83- done : true ,
84- timestamp : voteStartDate ,
85- show : true ,
86- } ,
8789 active : {
8890 done : now . isAfter ( voteStartDate ) ,
8991 timestamp : voteStartDate ,
9092 show : true ,
9193 } ,
92- failed : {
93- done : hasVoteEnded && outcome === 'rejected' ,
94- timestamp : this . _proposalData ?. voteEndDate ,
95- show : hasVoteEnded && outcome === 'rejected' ,
96- } ,
97- accepted : {
98- done : hasVoteEnded && outcome === 'accepted' ,
94+ finalized : {
95+ done : hasVoteEnded && ( outcome === 'rejected' || outcome === 'accepted' ) ,
9996 timestamp : this . _proposalData ?. voteEndDate ,
100- show : ( hasVoteStarted && ! hasVoteEnded ) || ( hasVoteEnded && outcome === 'accepted' ) ,
97+ outcome,
98+ show : hasVoteEnded && ( outcome === 'rejected' || outcome === 'accepted' ) ,
10199 } ,
102100 } ;
103101
@@ -135,22 +133,25 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
135133 < ProposalHistory >
136134 < Ticks >
137135 { Object . keys ( proposalHistoryState ) . map ( ( state : string ) => {
138- const historyState = proposalHistoryState [ state as ProposalState ] ;
136+ const historyState : HistoryState = proposalHistoryState [ state as ProposalState ] ;
139137 if ( ! historyState . show ) {
140138 return null ;
141139 }
142140 return (
143141 < >
144- < Tick isActive = { historyState . done } isFailed = { state === 'failed' } >
142+ < Tick
143+ isActive = { historyState . done }
144+ isFailed = { historyState . outcome === 'rejected' }
145+ >
145146 < img
146147 src = {
147- state === 'failed '
148+ historyState . outcome === 'rejected '
148149 ? '/images/governance/cross.svg'
149150 : '/images/governance/tick_mark.svg'
150151 }
151152 />
152153 </ Tick >
153- { ! [ 'accepted' , 'failed' ] . includes ( state ) && (
154+ { ! [ 'accepted' , 'failed' , 'finalized' ] . includes ( state ) && (
154155 < Connector className = { state === 'active' ? 'small' : '' } />
155156 ) }
156157 </ >
@@ -159,7 +160,7 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
159160 </ Ticks >
160161 < HistoryCells >
161162 { Object . keys ( proposalHistoryState ) . map ( ( state : string ) => {
162- const historyState = proposalHistoryState [ state as ProposalState ] ;
163+ const historyState : HistoryState = proposalHistoryState [ state as ProposalState ] ;
163164 if ( ! historyState . show ) {
164165 return null ;
165166 }
@@ -172,6 +173,11 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
172173 fontWeight = { 400 }
173174 >
174175 { state }
176+ { historyState . done &&
177+ ( historyState . outcome === 'rejected' ||
178+ historyState . outcome === 'accepted' )
179+ ? ` - ${ historyState . outcome } `
180+ : '' }
175181 </ StateTitle >
176182 < Text
177183 fontColor = { colors . textDarkSecondary }
@@ -180,7 +186,7 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
180186 fontWeight = { 300 }
181187 >
182188 { historyState . done
183- ? historyState . timestamp . format ( 'MMMM Do, YYYY - hh:mm a' )
189+ ? ` ${ historyState . timestamp . format ( 'MMMM Do, YYYY - hh:mm a' ) } `
184190 : 'TBD' }
185191 </ Text >
186192 </ CellContent >
0 commit comments