@@ -12,9 +12,14 @@ import Typography from '@mui/material/Typography';
1212
1313import { ORCHESTRATION_BAR_CY } from '@/config/selectors' ;
1414import useSteps from '@/hooks/useSteps' ;
15- import { ActivityStep , ActivityType } from '@/interfaces/interactionProcess' ;
15+ import {
16+ ActivityStatus ,
17+ ActivityStep ,
18+ ActivityType ,
19+ } from '@/interfaces/interactionProcess' ;
1620
1721import useStepTimer from '../common/stepTimer/useStepTimer' ;
22+ import { useActivityContext } from '../context/ActivityContext' ;
1823import CommandButton from './CommandButton' ;
1924import WarningNextStepDialog from './WarningNextStepDialog' ;
2025import WarningPreviousStepDialog from './WarningPreviousStepDialog' ;
@@ -42,6 +47,9 @@ const StepsButton: FC<StepsButtonProps> = ({ enable }) => {
4247 moveToNextStep,
4348 } = useSteps ( ) ;
4449
50+ const { activityState } = useActivityContext ( ) ;
51+ const { status } = activityState . data ;
52+
4553 const stepHasTimeout = useStepTimer ( ) ;
4654 // const promise = useRef<Promise<void>>();
4755
@@ -53,13 +61,19 @@ const StepsButton: FC<StepsButtonProps> = ({ enable }) => {
5361 } , [ nbrOfSteps , stepIndex ] ) ;
5462
5563 const disablePreviousStep = useMemo (
56- ( ) => typeof previousStep === 'undefined' || isChangingStep ,
57- [ isChangingStep , previousStep ] ,
64+ ( ) =>
65+ typeof previousStep === 'undefined' ||
66+ isChangingStep ||
67+ status !== ActivityStatus . Play ,
68+ [ isChangingStep , previousStep , status ] ,
5869 ) ;
5970
6071 const disableNextStep = useMemo (
61- ( ) => typeof nextStep === 'undefined' || isChangingStep ,
62- [ isChangingStep , nextStep ] ,
72+ ( ) =>
73+ typeof nextStep === 'undefined' ||
74+ isChangingStep ||
75+ status !== ActivityStatus . Play ,
76+ [ isChangingStep , nextStep , status ] ,
6377 ) ;
6478
6579 const nextStepColor = useMemo ( ( ) => {
0 commit comments