-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/iw 43 create song view #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0ffe86c
Implement song view
WWarzecha 7900dc6
hotfix: add cors to backend
WWarzecha 6968c9c
code refactor
WWarzecha 15d52c0
linter changes
WWarzecha 5593591
fix CorsConfig for Spotless
WWarzecha db6c2b0
Merge remote-tracking branch 'origin/develop' into feature/IW-43-Crea…
WWarzecha 3d99b6d
code refactor
WWarzecha f3276d4
remove unnecessary comments
WWarzecha 99d4348
code fixes
WWarzecha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.wo.karaoke; // Or whatever package you choose for configurations | ||
|
|
||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
|
||
| @Configuration | ||
| public class CorsConfig implements WebMvcConfigurer { | ||
|
|
||
| @Override | ||
| public void addCorsMappings(CorsRegistry registry) { | ||
| registry | ||
| .addMapping("/api/**") // Adjust this to match your API base path | ||
| .allowedOrigins("http://localhost:8081") | ||
| .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") | ||
| .allowedHeaders("*") | ||
| .allowCredentials(true) // If you need to handle credentials | ||
| .maxAge(3600); | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ | |
| "trailingComma": "all", | ||
| "semi": true, | ||
| "useTabs": false | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
| import ViewLayout from '@/components/wrappers/view-laytout'; | ||
| import SongViewText from '@/components/karaoke/KaraokeText'; | ||
| import ControlPanel from '@/components/karaoke/ControlPanel'; | ||
|
|
||
|
|
||
| const KaraokeScreen = () => { | ||
| return ( | ||
| <ViewLayout> | ||
| <SongViewText /> | ||
| <ControlPanel /> | ||
| </ViewLayout> | ||
| ); | ||
| }; | ||
|
|
||
| export default KaraokeScreen; |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import React, { useRef, useState } from 'react'; | ||
| import { View, TouchableOpacity, Text, Animated } from 'react-native'; | ||
| import { ChevronDown, ChevronUp } from 'lucide-react-native'; | ||
| import { useTrackPlayer } from '@/context/trackPlayerContext'; | ||
| import SongSpinner from '@/components/karaoke/SongSpinner'; | ||
| import Controls from '@/components/karaoke/Controls'; | ||
|
|
||
| export default function ControlPanel() { | ||
| const { currentTrack } = useTrackPlayer(); | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const animation = useRef(new Animated.Value(0)).current; | ||
|
|
||
| const togglePanel = () => { | ||
| setIsOpen(!isOpen); | ||
| Animated.timing(animation, { | ||
| toValue: isOpen ? 0 : 1, | ||
| duration: 300, | ||
| useNativeDriver: false, | ||
| }).start(); | ||
| }; | ||
|
|
||
| const animatedHeight = animation.interpolate({ | ||
| inputRange: [0, 1], | ||
| outputRange: [0, 150], // Adjust the height range as needed | ||
| }); | ||
|
|
||
| return ( | ||
| <View className="pt-1 bg-gray-300 border-t border-gray-400 justify-around items-center flex flex-col absolute w-full bottom-0 left-0"> | ||
| <View className="px-3 w-full flex flex-row justify-between items-center"> | ||
| <Text className="text-base font-roboto-mono truncate"> | ||
| {currentTrack ? currentTrack.title : ' '} | ||
| </Text> | ||
| <TouchableOpacity className="items-center h-[30px] w-[30px] flex justify-center align-center" onPress={togglePanel}> | ||
| {isOpen ? <ChevronDown /> : <ChevronUp />} | ||
| </TouchableOpacity> | ||
| </View> | ||
| <Animated.View | ||
| style={{ | ||
| height: animatedHeight, | ||
| overflow: 'hidden', | ||
| width: '100%', | ||
| }} | ||
| > | ||
| <View className="w-full items-center justify-around flex flex-col h-full"> | ||
| <View className='w-full h-[1px] my-0 bg-slate-gray'/> | ||
| <SongSpinner /> | ||
| <View className="px-3 w-full flex flex-row justify-around"> | ||
| <Text>Vocal Volume</Text> | ||
| <Text>VocalSpinner</Text> | ||
| </View> | ||
| </View> | ||
| </Animated.View> | ||
| <View className='w-full h-[1px] mb-2 bg-slate-gray'/> | ||
| <Controls /> | ||
| <View className='w-full h-[1px] my-0 bg-slate-gray'/> | ||
| </View> | ||
| ); | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { useTrackPlayer } from "@/context/trackPlayerContext"; | ||
| import { Pause, Play, SkipBack, SkipForward } from "lucide-react-native"; | ||
| import { TouchableOpacity, View } from "react-native"; | ||
|
|
||
|
|
||
| export default function Controls() { | ||
| const { playNextSong, toggleSong, playPreviousSong, isPlaying } = useTrackPlayer(); | ||
| return ( | ||
| <View className="flex flex-row justify-around items-center w-full pb-2"> | ||
| <TouchableOpacity className="items-center" onPress={playPreviousSong}> | ||
| <SkipBack size={32} color="black" /> | ||
| </TouchableOpacity> | ||
| <TouchableOpacity className="items-center" onPress={toggleSong}> | ||
| {isPlaying ? <Pause size={32} color="black" /> : <Play size={32} color="black" />} | ||
| </TouchableOpacity> | ||
| <TouchableOpacity className="items-center" onPress={playNextSong}> | ||
| <SkipForward size={32} color="black" /> | ||
| </TouchableOpacity> | ||
| </View> | ||
| ) | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { View, Text } from 'react-native'; | ||
| import { useTrackPlayer } from '@/context/trackPlayerContext'; | ||
|
|
||
| export default function SongViewText() { | ||
| const { songLines } = useTrackPlayer(); | ||
| return ( | ||
| <View className="w-full h-full flex justify-center items-center bg-[#191414]"> | ||
| <View className="relative w-full flex justify-center items-center"> | ||
| <Text className="text-[22px] font-roboto-mono text-white text-center my-2 z-0"> | ||
| {songLines.previousLine} | ||
| </Text> | ||
| <View className="absolute w-full h-full top-0 left-0 z-1 bg-gradient-to-b from-[rgba(25,20,20,1)] from-[75%_rgba(25,20,20,0.5)] to-[rgba(0,0,0,0)]" /> | ||
| </View> | ||
| <Text className="text-[22px] font-roboto-mono text-lime text-center my-2"> | ||
| {songLines.currentLine} | ||
| </Text> | ||
| <View className="relative w-full flex justify-center items-center"> | ||
| <Text className="text-[22px] font-roboto-mono text-white text-center my-2 z-0"> | ||
| {songLines.nextLine} | ||
| </Text> | ||
| <View className="absolute w-full h-full top-0 left-0 z-1 bg-gradient-to-t from-[rgba(25,20,20,1)] from-[75%_rgba(25,20,20,0.5)] to-[rgba(0,0,0,0)]" /> | ||
| </View> | ||
| </View> | ||
| ); | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import React from 'react'; | ||
| import { View } from 'react-native'; | ||
| import { Text } from 'react-native'; | ||
| import { useProgress } from 'react-native-track-player'; | ||
|
|
||
| export default function SongSpinner() { | ||
| const progress = useProgress(); | ||
|
|
||
| return ( | ||
| <> | ||
| <View> | ||
| <Text> | ||
| Elapsed Time: {Math.floor(progress.position)}/{Math.floor(progress.duration)}s | ||
| </Text> | ||
| <View | ||
| style={{ height: 10, backgroundColor: '#e0e0e0', borderRadius: 5, overflow: 'hidden' }}> | ||
| <View | ||
| style={{ | ||
| height: '100%', | ||
| width: `${(progress.duration > 0 ? progress.position / progress.duration : 0) * 100}%`, | ||
| backgroundColor: '#3b5998', | ||
| }} | ||
| /> | ||
| </View> | ||
| </View> | ||
| </> | ||
| ); | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| const API_ROUTES = { | ||
| API_AUDIO_URL: 'http://localhost:8080/api/audio', | ||
| API_BASE_URL: 'http://localhost:8080' | ||
| }; | ||
|
|
||
| export default API_ROUTES; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the colors.