Skip to content

Feature/iw 43 create song view#8

Merged
WWarzecha merged 9 commits intodevelopfrom
feature/IW-43-Create-song-view
May 19, 2025
Merged

Feature/iw 43 create song view#8
WWarzecha merged 9 commits intodevelopfrom
feature/IW-43-Create-song-view

Conversation

@WWarzecha
Copy link
Collaborator

No description provided.

@WWarzecha WWarzecha requested a review from Galaktikkon May 8, 2025 18:16
Copy link
Collaborator

@Galaktikkon Galaktikkon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions after live-review:

  • group over-segmented types into one file
  • change design of the control-panel
  • remove unnecessary console.logs

Copy link
Collaborator

@Galaktikkon Galaktikkon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job migrating to NativeWind. Please consider my architectural suggestions and investigate the possible code-smells that caught my eye. Try to clean the classes - especially colors. Propose a fix for the API route placement, so that it's easy to translate to production.

Comment on lines 7 to 25
<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-[#95E558] 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>
);
}; No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These colors should be added to the project if they are not already present.

Comment on lines 6 to 13
const KaraokeScreen = () => {
return (
<SafeAreaView className="h-full">
<SongViewText />
<ControlPanel />
</SafeAreaView>
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ViewLayout component for uniform view layout.

Comment on lines 33 to 35
<TouchableOpacity className="items-center" onPress={togglePanel}>
{isOpen ? <ChevronDown /> : <ChevronUp />}
</TouchableOpacity>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clickable area covered by the button is too small. It should be a bit bigger than the icon itself (eg. 30x30 or 40x40).

image

});

return (
<View className="bg-gray-300 py-2 border-t border-gray-400 justify-around items-center flex flex-col absolute w-full bottom-0">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gray color stands out too much. Also there is no line between the NavigationBar and the ControlPanel which just looks bad.
image

Comment on lines 12 to 21
<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-[#95E558] 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)]" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the colors (they should be added to the project scope). Also you use from-* two times which is unnecessary and may cause unexpected behaviour.

Comment on lines 7 to 19
const { playNextSong, playPauseSong, playPreviousSong, isPlaying } = useTrackPlayer();
return (
<View className="flex flex-row justify-around items-center w-full">
<TouchableOpacity className="items-center" onPress={playPreviousSong}>
<SkipBack size={32} color="black" />
</TouchableOpacity>
<TouchableOpacity className="items-center" onPress={playPauseSong}>
{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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could also be a dedicated component (like IconButton). Again try to make the button clickable area bigger for better UX.

Comment on lines 89 to 100
const playPauseSong = async () => {
if (!isTrackPlayerReady) {
console.warn('TrackPlayer is not ready yet!');
return;
}
const state = await TrackPlayer.getState();
if (state === State.Playing) {
TrackPlayer.pause();
} else {
TrackPlayer.play();
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe toggleSong would be a bettter name?

Comment on lines 50 to 56
const fetchedSongText = await fetchSongLyrics(youtubeUrl);
const fetchedAudioSplitterResponse = await splitAudio(youtubeUrl);
const songUrl = 'http://localhost:8080' + fetchedAudioSplitterResponse.instrumentsPath;

track.url = songUrl; // provide url of the file location to the track
track.songText = fetchedSongText; // provide song text to the track

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a code-smell to me. I do not know the backend architecture, so please explain the songUrl purpose. Does the backend expose a specific route for this? What for? Also the root route should be saved in some file (not hardcoded), so that it can be easily swapped for the production.

Comment on lines +127 to +157
const currentSegmentIndex = songText.segments.findIndex(
(segment: SongSegment) =>
currentTime >= segment.start - 0.5 && currentTime < segment.end - 0.5,
);

// initial text
if (currentTime < 0.1 && currentSegmentIndex === -1) {
setSongLines({
previousSegmentIndex: -1,
previousLine: '',
currentLine: '',
nextLine: songText.segments[0]?.text,
});
// normal case
} else if (currentSegmentIndex !== -1) {
setSongLines({
previousSegmentIndex: currentSegmentIndex,
previousLine: songText.segments[currentSegmentIndex - 1]?.text || '',
currentLine: songText.segments[currentSegmentIndex]?.text || '',
nextLine: songText.segments[currentSegmentIndex + 1]?.text || '',
});
// between lines (silence) case
} else {
setSongLines({
previousSegmentIndex: songLines.previousSegmentIndex,
previousLine: songText.segments[songLines.previousSegmentIndex]?.text || '',
currentLine: ' ',
nextLine: songText.segments[songLines.previousSegmentIndex + 1]?.text || '',
});
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is not straightforward. (e.g. the boolean comparison that transfers into an index - is it really an index? not a flag or state?) Please try to simplify it so that it follows KISS.

@WWarzecha WWarzecha requested a review from Vemtor May 19, 2025 19:00
@Vemtor Vemtor dismissed Galaktikkon’s stale review May 19, 2025 19:03

nice review, thanks for it but Wiktor done gr8 job

@WWarzecha WWarzecha merged commit d5870af into develop May 19, 2025
@Galaktikkon Galaktikkon deleted the feature/IW-43-Create-song-view branch May 29, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants