@@ -88,19 +88,35 @@ export default class OrderFormView {
88
88
. filter ( ( { state } ) => state === MARKET_OPEN || state === ACCEPTING_ORDERS ) ;
89
89
}
90
90
91
+ /** the mapping of market states to user-friendly labels */
92
+ get marketStateLabels ( ) : Record < number , string > {
93
+ return {
94
+ [ DurationBucketState . MARKET_OPEN ] : l ( 'marketOpen' ) ,
95
+ [ DurationBucketState . ACCEPTING_ORDERS ] : l ( 'marketAccepting' ) ,
96
+ [ DurationBucketState . MARKET_CLOSED ] : l ( 'marketClosed' ) ,
97
+ [ DurationBucketState . NO_MARKET ] : l ( 'noMarket' ) ,
98
+ } ;
99
+ }
100
+
91
101
/** the available options for the lease duration field */
92
102
get durationOptions ( ) {
93
- // add a default option with a value of zero to signify that the duration
94
- // currently being displayed should be used
95
- const current = {
96
- label : `${ l ( 'inView' ) } (${ this . _store . batchStore . selectedLeaseDuration } )` ,
97
- value : '0' ,
98
- } ;
99
- const durations = this . marketsAcceptingOrders . map ( ( { duration } ) => ( {
100
- label : `${ duration } ` ,
103
+ const labels = this . marketStateLabels ;
104
+ const durations = this . marketsAcceptingOrders . map ( ( { duration, state } ) => ( {
105
+ label : `${ duration } (${ labels [ state ] } )` ,
101
106
value : `${ duration } ` ,
102
107
} ) ) ;
103
- return [ current , ...durations ] ;
108
+
109
+ const selectedDuration = this . _store . batchStore . selectedLeaseDuration ;
110
+ const selectedState = this . _store . batchStore . leaseDurations . get ( selectedDuration ) ;
111
+ if ( selectedState ) {
112
+ // add a default option with a value of zero to signify that the duration
113
+ // currently being displayed should be used
114
+ durations . unshift ( {
115
+ label : `${ l ( 'inView' ) } (${ selectedDuration } , ${ labels [ selectedState ] } )` ,
116
+ value : '0' ,
117
+ } ) ;
118
+ }
119
+ return durations ;
104
120
}
105
121
106
122
/** determines if the lease duration field should be visible */
0 commit comments