Skip to content

Commit af45f54

Browse files
committed
Code review TravelContainer
1 parent 1e74e4c commit af45f54

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/app/containers/TravelContainer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import {
1111
resetSlider,
1212
} from '../RTKslices';
1313
import { useDispatch, useSelector } from 'react-redux';
14+
//Commented out useStoreContext
1415
// import { useStoreContext } from '../store';
1516
import { TravelContainerProps } from '../FrontendTypes';
1617
import { Button } from '@mui/material';
1718
import FastRewindIcon from '@mui/icons-material/FastRewind';
1819
import FastForwardIcon from '@mui/icons-material/FastForward';
1920

20-
//Pause, plsayForward, startPlaying, moveForward, moveBackward
21-
2221
/*
2322
This container renders the time-travel play button, seek bar, playback controls, and the playback speed dropdown, located towards the bottom of the application, above the locked, download, upload, and tutorial buttons
2423
*/
@@ -37,10 +36,10 @@ const speeds: {
3736
function play( // function that will start/pause slider movement
3837
speed: number,
3938
playing: boolean,
39+
dispatch: (a: any) => void,
4040
snapshotsLength: number,
4141
sliderIndex: number,
4242
): void {
43-
const dispatch = useDispatch();
4443
if (playing) { // if already playing, clicking the button will pause the slider
4544
dispatch(pause());
4645
} else {
@@ -81,7 +80,7 @@ function TravelContainer(props: TravelContainerProps): JSX.Element {
8180
// data-testid, prop for testing in RTL
8281
data-testid='play-button-test'
8382
//REMOVED DISPATCH FROM PLAY
84-
onClick={() => play(selectedSpeed.value, playing, snapshotsLength, sliderIndex)}
83+
onClick={() => play(selectedSpeed.value, playing, dispatch, snapshotsLength, sliderIndex)}
8584
>
8685
{playing ? 'Pause' : 'Play'}
8786
</Button>

0 commit comments

Comments
 (0)