Front: Remove Old Lobby Page

This commit is contained in:
Arthur Jamet
2023-11-19 09:13:22 +01:00
parent 384fb10f54
commit 617d31cb22
10 changed files with 12 additions and 18 deletions

View File

@@ -10,7 +10,6 @@ import { DarkTheme, DefaultTheme, NavigationContainer } from '@react-navigation/
import { RootState, useSelector } from './state/Store';
import { useDispatch } from 'react-redux';
import { Translate, translate } from './i18n/i18n';
import SongLobbyView from './views/SongLobbyView';
import HomeView from './views/HomeView';
import SearchView from './views/SearchView';
import SettingsTab from './views/settings/SettingsView';
@@ -65,11 +64,6 @@ const protectedRoutes = () =>
screen: removeMe,
},
},
Song: {
component: SongLobbyView,
options: { title: translate('play') },
link: '/song/:songId',
},
Artist: {
component: ArtistDetailsView,
options: { title: translate('artistFilter') },

View File

@@ -140,7 +140,7 @@ const SongsSearchComponent = (props: SongsSearchComponentProps) => {
}
onPress={() => {
API.createSearchHistoryEntry(comp.name, 'song');
navigation.navigate('Song', { songId: comp.id });
navigation.navigate('Play', { songId: comp.id });
}}
/>
))
@@ -253,7 +253,7 @@ const FavoritesComponent = () => {
FavSong={songData}
onPress={() => {
API.createSearchHistoryEntry(songData.details!.name, 'song'); //todo
navigation.navigate('Song', { songId: songData.details!.id }); //todo
navigation.navigate('Play', { songId: songData.details!.id });
}}
/>
))}

View File

@@ -13,7 +13,7 @@ const SongCard = (props: SongCardProps) => {
const { cover, name, artistName, songId } = props;
const navigation = useNavigation();
return (
<Card shadow={3} onPress={() => navigation.navigate('Song', { songId })}>
<Card shadow={3} onPress={() => navigation.navigate('Play', { songId })}>
<VStack m={1.5} space={3}>
<Image
style={{ zIndex: 0, aspectRatio: 1, borderRadius: CardBorderRadius }}

View File

@@ -50,7 +50,7 @@ const SongHistory = (props: { quantity: number }) => {
flex: 1,
}}
>
<TouchableOpacity onPress={() => navigation.navigate('Song', { songId: song.id })}>
<TouchableOpacity onPress={() => navigation.navigate('Play', { songId: song.id })}>
<Text numberOfLines={1}>{song.name}</Text>
</TouchableOpacity>
</View>

View File

@@ -58,7 +58,7 @@ const ArtistDetailsView = ({ artistId }: RouteProps<ArtistDetailsViewProps>) =>
}
onPress={() => {
API.createSearchHistoryEntry(comp.name, 'song');
navigation.navigate('Song', { songId: comp.id });
navigation.navigate('Play', { songId: comp.id });
}}
/>
))}

View File

@@ -61,7 +61,7 @@ const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
songId: songData.id,
onPress: () => {
API.createSearchHistoryEntry(songData.name, 'song');
navigation.navigate('Song', { songId: songData.id });
navigation.navigate('Play', { songId: songData.id });
},
}))}
cardComponent={SongCard}

View File

@@ -59,7 +59,7 @@ export const FavoritesMusic = () => {
onLike: () => {
console.log('onLike');
},
onPlay: () => navigation.navigate('Song', { songId: song.id }),
onPlay: () => navigation.navigate('Play', { songId: song.id }),
})) ?? [];
if (isLoading) {

View File

@@ -36,7 +36,6 @@ import { useTheme } from 'native-base';
type PlayViewProps = {
songId: number;
type: 'practice' | 'normal';
};
type ScoreMessage = {
@@ -97,7 +96,8 @@ const infoCardInfos = [
},
] as const;
const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
const PlayView = ({ songId, route }: RouteProps<PlayViewProps>) => {
const [type, setType] = useState<'practice' | 'normal'>('normal');
const accessToken = useSelector((state: RootState) => state.user.accessToken);
const navigation = useNavigation();
const song = useQuery(API.getSong(songId), { staleTime: Infinity });

View File

@@ -163,7 +163,7 @@ const ScoreView = (props: RouteProps<ScoreViewProps>) => {
onPress={() => navigation.navigate('Home', {})}
/>
<TextButton
onPress={() => navigation.navigate('Song', { songId })}
onPress={() => navigation.navigate('Play', { songId })}
translate={{ translationKey: 'playAgain' }}
/>
</Row>

View File

@@ -72,7 +72,7 @@ const HomeView = (props: RouteProps<{}>) => {
(artistQuery) => artistQuery.data?.id === song.artistId
)!.data!.name;
cards[index]!.onPress = () => {
navigation.navigate('Song', { songId: song.id });
navigation.navigate('Play', { songId: song.id });
};
});
}, [artistsQueries]);
@@ -195,7 +195,7 @@ const HomeView = (props: RouteProps<{}>) => {
key={song.id}
song={song}
onPress={() => {
navigation.navigate('Song', { songId: song.id });
navigation.navigate('Play', { songId: song.id });
}}
onPlay={() => {
console.log('play');