From 3dea5a0865f44ae5f01c4e2e88b835dbf387019f Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Wed, 21 Jun 2023 14:49:22 +0100 Subject: [PATCH] Front: Prettier --- front/Navigation.tsx | 78 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/front/Navigation.tsx b/front/Navigation.tsx index b806bb8..c6c9d47 100644 --- a/front/Navigation.tsx +++ b/front/Navigation.tsx @@ -30,22 +30,64 @@ import TextButton from './components/TextButton'; const protectedRoutes = () => ({ - Home: { component: HomeView, options: { title: translate('welcome'), headerLeft: null }, link: '/' }, + Home: { + component: HomeView, + options: { title: translate('welcome'), headerLeft: null }, + link: '/', + }, Play: { component: PlayView, options: { title: translate('play') }, link: '/play' }, - Settings: { component: SetttingsNavigator, options: { title: 'Settings' }, link: '/settings' }, - Song: { component: SongLobbyView, options: { title: translate('play') }, link: '/song/:songId' }, - Artist: { component: ArtistDetailsView, options: { title: translate('artistFilter') }, link: '/artist/:artistId' }, - Score: { component: ScoreView, options: { title: translate('score'), headerLeft: null }, link: undefined }, - Search: { component: SearchView, options: { title: translate('search') }, link: '/search/:query?' }, + Settings: { + component: SetttingsNavigator, + options: { title: 'Settings' }, + link: '/settings', + }, + Song: { + component: SongLobbyView, + options: { title: translate('play') }, + link: '/song/:songId', + }, + Artist: { + component: ArtistDetailsView, + options: { title: translate('artistFilter') }, + link: '/artist/:artistId', + }, + Score: { + component: ScoreView, + options: { title: translate('score'), headerLeft: null }, + link: undefined, + }, + Search: { + component: SearchView, + options: { title: translate('search') }, + link: '/search/:query?', + }, User: { component: ProfileView, options: { title: translate('user') }, link: '/user' }, } as const); const publicRoutes = () => ({ - Start: { component: StartPageView, options: { title: 'Chromacase', headerShown: false }, link: '/' }, - Login: { component: (params: RouteProps<{}>) => AuthenticationView({ isSignup: false, ...params }), options: { title: translate('signInBtn') }, link: '/login' }, - Signup: { component: (params: RouteProps<{}>) => AuthenticationView({ isSignup: true, ...params }), options: { title: translate('signUpBtn') }, link: '/signup' }, - Oops: { component: ProfileErrorView, options: { title: 'Oops', headerShown: false }, link: undefined }, + Start: { + component: StartPageView, + options: { title: 'Chromacase', headerShown: false }, + link: '/', + }, + Login: { + component: (params: RouteProps<{}>) => + AuthenticationView({ isSignup: false, ...params }), + options: { title: translate('signInBtn') }, + link: '/login', + }, + Signup: { + component: (params: RouteProps<{}>) => + AuthenticationView({ isSignup: true, ...params }), + options: { title: translate('signUpBtn') }, + link: '/signup', + }, + Oops: { + component: ProfileErrorView, + options: { title: 'Oops', headerShown: false }, + link: undefined, + }, } as const); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -91,7 +133,9 @@ const routesToScreens = (routes: Partial>) = /> )); -const routesToLinkingConfig = (routes: Partial>) => { +const routesToLinkingConfig = ( + routes: Partial> +) => { const pagesToRoute = {} as Record; Object.keys(routes).forEach((route) => { const index = route as keyof AppRouteParams; @@ -101,9 +145,9 @@ const routesToLinkingConfig = (routes: Partial void }) => { const dispatch = useDispatch(); @@ -148,7 +192,7 @@ export const Router = () => { if (userProfile.isSuccess && accessToken) { return 'authed'; } - return 'noAuth' + return 'noAuth'; }, [userProfile, accessToken]); const routes = useMemo(() => { if (authStatus == 'authed') { @@ -165,13 +209,13 @@ export const Router = () => { if (authStatus == 'loading') { // We dont want this to be a screen, as this lead to a navigator without the requested route, and fallback. - return ; + return ; } return ( } + fallback={} theme={colorScheme == 'light' ? DefaultTheme : DarkTheme} >