1- import { keys , makeAutoObservable , runInAction } from 'mobx' ;
2- import { NodeTier } from 'types/generated/auctioneer_pb' ;
1+ import { entries , makeAutoObservable , runInAction } from 'mobx' ;
2+ import { DurationBucketState , NodeTier } from 'types/generated/auctioneer_pb' ;
33import { LeaseDuration } from 'types/state' ;
44import { annualPercentRate , toBasisPoints , toPercent } from 'util/bigmath' ;
55import { BLOCKS_PER_DAY } from 'util/constants' ;
@@ -80,6 +80,14 @@ export default class OrderFormView {
8080 return '' ;
8181 }
8282
83+ /** the markets currently open or accepting orders */
84+ get marketsAcceptingOrders ( ) {
85+ const { MARKET_OPEN , ACCEPTING_ORDERS } = DurationBucketState ;
86+ return entries ( this . _store . batchStore . leaseDurations )
87+ . map ( ( [ duration , state ] ) => ( { duration, state } ) )
88+ . filter ( ( { state } ) => state === MARKET_OPEN || state === ACCEPTING_ORDERS ) ;
89+ }
90+
8391 /** the available options for the lease duration field */
8492 get durationOptions ( ) {
8593 // add a default option with a value of zero to signify that the duration
@@ -88,7 +96,7 @@ export default class OrderFormView {
8896 label : `${ l ( 'inView' ) } (${ this . _store . batchStore . selectedLeaseDuration } )` ,
8997 value : '0' ,
9098 } ;
91- const durations = keys ( this . _store . batchStore . leaseDurations ) . map ( duration => ( {
99+ const durations = this . marketsAcceptingOrders . map ( ( { duration } ) => ( {
92100 label : `${ duration } ` ,
93101 value : `${ duration } ` ,
94102 } ) ) ;
@@ -97,7 +105,7 @@ export default class OrderFormView {
97105
98106 /** determines if the lease duration field should be visible */
99107 get durationVisible ( ) {
100- return this . _store . batchStore . leaseDurations . size > 1 ;
108+ return this . marketsAcceptingOrders . length > 1 ;
101109 }
102110
103111 /** the chosen duration or the value selected in the batch store */
0 commit comments