@@ -6,10 +6,13 @@ import {
66 DialogActions ,
77 DialogContent ,
88 DialogTitle ,
9+ Menu ,
10+ MenuItem ,
911 Typography ,
1012 useTheme ,
1113} from '@mui/material' ;
1214import InfoIcon from '@mui/icons-material/Info' ;
15+ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown' ;
1316import usePassageDetailContext from '../../../context/usePassageDetailContext' ;
1417import { useGetGlobal } from '../../../context/useGlobal' ;
1518import { useSnackBar } from '../../../hoc/SnackBar' ;
@@ -20,6 +23,17 @@ import { useEffect, useMemo, useRef, useState } from 'react';
2023import { IWorkflowStepsStrings } from '../../../model' ;
2124import { toCamel } from '../../../utils/toCamel' ;
2225
26+ const mockPassages = [
27+ 'Passage 1' ,
28+ 'Passage 2' ,
29+ 'Passage 3' ,
30+ 'Passage 4' ,
31+ 'Passage 5' ,
32+ 'Passage 6' ,
33+ 'Passage 7' ,
34+ 'Passage 8' ,
35+ ] ;
36+
2337export default function MobileWorkflowSteps ( ) {
2438 const {
2539 workflow,
@@ -39,6 +53,9 @@ export default function MobileWorkflowSteps() {
3953 shallowEqual
4054 ) ;
4155 const [ tipOpen , setTipOpen ] = useState ( false ) ;
56+ const [ passageMenuAnchor , setPassageMenuAnchor ] =
57+ useState < HTMLElement | null > ( null ) ;
58+ const [ passageRef , setPassageRef ] = useState ( mockPassages [ 0 ] ) ;
4259
4360 const handleSelect = ( id : string ) => ( ) => {
4461 if ( getGlobal ( 'remoteBusy' ) ) {
@@ -84,50 +101,88 @@ export default function MobileWorkflowSteps() {
84101 < Box
85102 sx = { {
86103 display : 'flex' ,
87- justifyContent : 'flex-start' ,
88- overflowX : 'auto' ,
89- overflowY : 'hidden' ,
90- WebkitOverflowScrolling : 'touch' ,
91- pb : 0.25 ,
104+ alignItems : 'flex-start' ,
105+ width : '100%' ,
92106 } }
93107 >
94- { workflow . map ( ( step ) => {
95- const isCurrent = step . id === currentstep ;
96- return (
97- < ButtonBase
98- key = { step . id }
99- data-cy = "workflow-step"
100- role = "button"
101- onClick = { handleSelect ( step . id ) }
102- tabIndex = { 0 }
103- ref = { ( el ) => {
104- if ( el ) {
105- stepRefs . current . set ( step . id , el ) ;
106- } else {
107- stepRefs . current . delete ( step . id ) ;
108- }
109- } }
110- onKeyDown = { ( e ) => {
111- if ( e . key === 'Enter' || e . key === ' ' ) {
112- e . preventDefault ( ) ;
113- }
114- } }
115- sx = { {
116- flex : '0 0 80px' ,
117- height : 30 ,
118- mr : - 0.25 ,
119- backgroundColor : isCurrent
120- ? theme . palette . grey [ 700 ]
121- : stepComplete ( step . id )
122- ? theme . palette . grey [ 400 ]
123- : theme . palette . grey [ 200 ] ,
124- clipPath : 'polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%)' ,
125- cursor :
126- recording || commentRecording ? 'not-allowed' : 'pointer' ,
127- } }
128- />
129- ) ;
130- } ) }
108+ < Box sx = { { flexShrink : 0 , mr : 1 } } >
109+ < Button
110+ size = "small"
111+ endIcon = { < ArrowDropDownIcon /> }
112+ sx = { { whiteSpace : 'nowrap' , minWidth : 'auto' } }
113+ onClick = { ( e ) => setPassageMenuAnchor ( e . currentTarget ) }
114+ data-cy = "passage-dropdown"
115+ >
116+ { passageRef }
117+ </ Button >
118+ < Menu
119+ anchorEl = { passageMenuAnchor }
120+ open = { Boolean ( passageMenuAnchor ) }
121+ onClose = { ( ) => setPassageMenuAnchor ( null ) }
122+ >
123+ { mockPassages . map ( ( p ) => (
124+ < MenuItem
125+ key = { p }
126+ selected = { p === passageRef }
127+ onClick = { ( ) => {
128+ setPassageRef ( p ) ;
129+ setPassageMenuAnchor ( null ) ;
130+ } }
131+ >
132+ { p }
133+ </ MenuItem >
134+ ) ) }
135+ </ Menu >
136+ </ Box >
137+ < Box
138+ sx = { {
139+ flex : 1 ,
140+ display : 'flex' ,
141+ justifyContent : 'flex-start' ,
142+ overflowX : 'auto' ,
143+ overflowY : 'hidden' ,
144+ WebkitOverflowScrolling : 'touch' ,
145+ pb : 0.25 ,
146+ } }
147+ >
148+ { workflow . map ( ( step ) => {
149+ const isCurrent = step . id === currentstep ;
150+ return (
151+ < ButtonBase
152+ key = { step . id }
153+ data-cy = "workflow-step"
154+ role = "button"
155+ onClick = { handleSelect ( step . id ) }
156+ tabIndex = { 0 }
157+ ref = { ( el ) => {
158+ if ( el ) {
159+ stepRefs . current . set ( step . id , el ) ;
160+ } else {
161+ stepRefs . current . delete ( step . id ) ;
162+ }
163+ } }
164+ onKeyDown = { ( e ) => {
165+ if ( e . key === 'Enter' || e . key === ' ' ) {
166+ e . preventDefault ( ) ;
167+ }
168+ } }
169+ sx = { {
170+ flex : '0 0 80px' ,
171+ height : 30 ,
172+ mr : - 0.25 ,
173+ backgroundColor : isCurrent
174+ ? theme . palette . grey [ 700 ]
175+ : stepComplete ( step . id )
176+ ? theme . palette . grey [ 400 ]
177+ : theme . palette . grey [ 200 ] ,
178+ clipPath : 'polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%)' ,
179+ cursor :
180+ recording || commentRecording ? 'not-allowed' : 'pointer' ,
181+ } }
182+ />
183+ ) ;
184+ } ) }
185+ </ Box >
131186 </ Box >
132187 { currentLabel && (
133188 < Typography
0 commit comments