diff --git a/front/components/Play/PlayViewControlBar.tsx b/front/components/Play/PlayViewControlBar.tsx new file mode 100644 index 0000000..aca7c6d --- /dev/null +++ b/front/components/Play/PlayViewControlBar.tsx @@ -0,0 +1,183 @@ +import { View } from 'react-native'; +import * as React from 'react'; +import { Row, Image, Text, Icon, useBreakpointValue } from 'native-base'; +import IconButton from '../IconButton'; +import { Ionicons } from '@expo/vector-icons'; +import { MetronomeControls } from '../Metronome'; +import StarProgress from '../StarProgress'; +import Song from '../../models/Song'; +import useColorScheme from '../../hooks/colorScheme'; +import { useTheme } from 'native-base'; + +type PlayViewControlBarProps = { + song: Song; + time: number; + paused: boolean; + score: number; + onResume: () => void; + onPause: () => void; + onEnd: () => void; +}; + +const PlayViewControlBar = ({ + song, + time, + paused, + score, + onResume, + onPause, + onEnd, +}: PlayViewControlBarProps) => { + const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); + const isPhone = screenSize === 'small'; + const bpm = React.useRef(60); + const colorScheme = useColorScheme(); + const { colors } = useTheme(); + const textColor = colors.text; + const statColor = colors.lightText; + return ( + + + + cover + + + {song.name} + + + {song.artistId} + + + + + + + } + onPress={() => { + if (paused) { + onResume(); + } else { + onPause(); + } + }} + /> + {true && ( + <> + } + onPress={() => { + onEnd(); + }} + /> + + )} + + {time < 0 + ? paused + ? '0:00' + : Math.floor((time % 60000) / 1000) + .toFixed(0) + .toString() + : `${Math.floor(time / 60000)}:${Math.floor((time % 60000) / 1000) + .toFixed(0) + .toString() + .padStart(2, '0')}`} + + + + + + + + ); +}; + +export default PlayViewControlBar; diff --git a/front/components/StarProgress.tsx b/front/components/StarProgress.tsx index 7f85e95..8746e27 100644 --- a/front/components/StarProgress.tsx +++ b/front/components/StarProgress.tsx @@ -14,20 +14,20 @@ const StarProgress = (props: StarProgressProps) => { return ( { style={{ position: 'absolute', left: `${(step / props.max) * 100}%`, - top: '45%', - transform: 'translate(-50%, -55%)', + // top: '50%', + // transform: 'translate(-50%, -55%)', }} /> ); diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index ebfb9aa..7d9179e 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -36,6 +36,8 @@ import { useTheme } from 'native-base'; import PopupCC from '../components/UI/PopupCC'; import ButtonBase from '../components/UI/ButtonBase'; import { Clock, Cup } from 'iconsax-react-native'; +import PlayViewControlBar from '../components/Play/PlayViewControlBar'; +import { PlageHandler } from '../models/Plage'; type PlayViewProps = { songId: number; @@ -79,6 +81,7 @@ export const PianoCC = createContext({ }); const PlayView = ({ songId, route }: RouteProps) => { + songId = 1; const [type, setType] = useState<'practice' | 'normal'>(); const accessToken = useSelector((state: RootState) => state.user.accessToken); const navigation = useNavigation(); @@ -332,7 +335,7 @@ const PlayView = ({ songId, route }: RouteProps) => { zIndex: 100, }} > - ) => { onPress={async () => setType('normal')} /> - + */} {( [ [ @@ -479,10 +482,21 @@ const PlayView = ({ songId, route }: RouteProps) => { {!partitionRendered && } + {}} + onPause={() => {}} + onResume={() => {}} + /> - ) => { marginBottom: 10, minWidth: 200, }} - /> + /> ) => { > - + */} {colorScheme === 'dark' && (