-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from SotSF/playlist-page-updates
Playlist page updates
- Loading branch information
Showing
11 changed files
with
223 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,88 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import { HStack, IconButton } from "@chakra-ui/react"; | ||
import { ButtonGroup, HStack, IconButton, VStack } from "@chakra-ui/react"; | ||
import { FaPlay, FaPause, FaStepForward, FaStepBackward } from "react-icons/fa"; | ||
import { MAX_TIME } from "@/src/utils/time"; | ||
import { useStore } from "@/src/types/StoreContext"; | ||
import { action } from "mobx"; | ||
import { MdForward10, MdReplay10 } from "react-icons/md"; | ||
|
||
export const TimerControls = observer(function TimerControls() { | ||
const store = useStore(); | ||
const { audioStore } = store; | ||
const { audioStore, playlistStore } = store; | ||
const playing = audioStore.audioState === "playing"; | ||
|
||
return ( | ||
<HStack width="100%" justify="center" py={2} spacing={1} overflowX="clip"> | ||
<IconButton | ||
aria-label="Backward" | ||
title="Backward" | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<FaStepBackward size={10} />} | ||
onClick={action(() => audioStore.setTimeWithCursor(0))} | ||
/> | ||
<IconButton | ||
aria-label="Play" | ||
title="Play" | ||
color={playing ? "orange" : "green"} | ||
height={6} | ||
bgColor="gray.600" | ||
icon={playing ? <FaPause size={10} /> : <FaPlay size={10} />} | ||
onClick={action(store.togglePlaying)} | ||
/> | ||
<IconButton | ||
aria-label="Forward" | ||
title="Forward" | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<FaStepForward size={10} />} | ||
onClick={action(() => { | ||
audioStore.setTimeWithCursor(MAX_TIME); | ||
store.pause(); | ||
})} | ||
/> | ||
</HStack> | ||
<VStack pb={1} spacing={0}> | ||
<HStack width="100%" justify="center" overflowX="clip"> | ||
<ButtonGroup isAttached> | ||
<IconButton | ||
borderStyle="solid" | ||
borderWidth={1} | ||
aria-label={ | ||
store.context === "playlistEditor" | ||
? "Go to previous" | ||
: "Go to start" | ||
} | ||
title={ | ||
store.context === "playlistEditor" | ||
? "Go to previous" | ||
: "Go to start" | ||
} | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<FaStepBackward size={12} />} | ||
onClick={() => playlistStore.playPreviousExperience()} | ||
/> | ||
<IconButton | ||
borderStyle="solid" | ||
borderWidth={1} | ||
aria-label="Play" | ||
title="Play" | ||
color={playing ? "orange" : "green"} | ||
height={6} | ||
bgColor="gray.600" | ||
icon={playing ? <FaPause size={12} /> : <FaPlay size={12} />} | ||
onClick={action(store.togglePlaying)} | ||
/> | ||
<IconButton | ||
borderStyle="solid" | ||
borderWidth={1} | ||
aria-label={ | ||
store.context === "playlistEditor" ? "Go to next" : "Go to end" | ||
} | ||
title={ | ||
store.context === "playlistEditor" ? "Go to next" : "Go to end" | ||
} | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<FaStepForward size={12} />} | ||
onClick={() => playlistStore.playNextExperience()} | ||
/> | ||
</ButtonGroup> | ||
</HStack> | ||
<HStack width="100%" justify="center" overflowX="clip"> | ||
<ButtonGroup isAttached> | ||
<IconButton | ||
borderStyle="solid" | ||
borderWidth={1} | ||
aria-label="Go back 10 seconds " | ||
title="Go back 10 seconds " | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<MdReplay10 size={17} />} | ||
onClick={action(() => audioStore.skip(-10))} | ||
/> | ||
<IconButton | ||
borderStyle="solid" | ||
borderWidth={1} | ||
aria-label="Go forward 10 seconds" | ||
title="Go forward 10 seconds" | ||
height={6} | ||
bgColor="gray.600" | ||
icon={<MdForward10 size={17} />} | ||
onClick={action(() => audioStore.skip(10))} | ||
/> | ||
</ButtonGroup> | ||
</HStack> | ||
</VStack> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.