@@ -10,42 +10,23 @@ const Timeline: React.FC<{
1010 dispute : DisputeDetailsQuery [ "dispute" ] ;
1111 currentPeriodIndex : number ;
1212} > = ( { currentPeriodIndex, dispute } ) => {
13- const currentItemIndex = currentPeriodToCurrentItem (
14- currentPeriodIndex ,
15- dispute ?. ruled
16- ) ;
13+ const currentItemIndex = currentPeriodToCurrentItem ( currentPeriodIndex , dispute ?. ruled ) ;
1714 const items = useTimeline ( dispute , currentItemIndex , currentItemIndex ) ;
1815 return (
1916 < TimeLineContainer >
20- < StyledSteps
21- horizontal
22- { ...{ items, currentItemIndex, currentPeriodIndex } }
23- />
17+ < StyledSteps horizontal { ...{ items, currentItemIndex, currentPeriodIndex } } />
2418 </ TimeLineContainer >
2519 ) ;
2620} ;
2721
28- const currentPeriodToCurrentItem = (
29- currentPeriodIndex : number ,
30- ruled ?: boolean
31- ) : number => {
22+ const currentPeriodToCurrentItem = ( currentPeriodIndex : number , ruled ?: boolean ) : number => {
3223 if ( currentPeriodIndex <= Periods . commit ) return currentPeriodIndex ;
33- else if ( currentPeriodIndex < Periods . execution )
34- return currentPeriodIndex - 1 ;
24+ else if ( currentPeriodIndex < Periods . execution ) return currentPeriodIndex - 1 ;
3525 else return ruled ? 5 : currentPeriodIndex - 1 ;
3626} ;
3727
38- const useTimeline = (
39- dispute : DisputeDetailsQuery [ "dispute" ] ,
40- currentItemIndex : number ,
41- currentPeriodIndex : number
42- ) => {
43- const titles = [
44- "Evidence Period" ,
45- "Voting Period" ,
46- "Appeal Period" ,
47- "Executed" ,
48- ] ;
28+ const useTimeline = ( dispute : DisputeDetailsQuery [ "dispute" ] , currentItemIndex : number , currentPeriodIndex : number ) => {
29+ const titles = [ "Evidence Period" , "Voting Period" , "Appeal Period" , "Executed" ] ;
4930 const deadlineCurrentPeriod = getDeadline (
5031 currentPeriodIndex ,
5132 dispute ?. lastPeriodChange ,
@@ -77,15 +58,9 @@ const getDeadline = (
7758 lastPeriodChange ?: string ,
7859 timesPerPeriod ?: string [ ]
7960) : number | undefined => {
80- if (
81- lastPeriodChange &&
82- timesPerPeriod &&
83- currentPeriodIndex < timesPerPeriod . length
84- ) {
61+ if ( lastPeriodChange && timesPerPeriod && currentPeriodIndex < timesPerPeriod . length ) {
8562 const parsedLastPeriodChange = parseInt ( lastPeriodChange , 10 ) ;
86- const parsedTimeCurrentPeriod = parseInt (
87- timesPerPeriod [ currentPeriodIndex ]
88- ) ;
63+ const parsedTimeCurrentPeriod = parseInt ( timesPerPeriod [ currentPeriodIndex ] ) ;
8964 return parsedLastPeriodChange + parsedTimeCurrentPeriod ;
9065 }
9166 return 0 ;
0 commit comments