Front: LoadingView Component
This commit is contained in:
@@ -14,8 +14,7 @@ import { useQuery } from 'react-query';
|
|||||||
import API from './API';
|
import API from './API';
|
||||||
import PlayView from './views/PlayView';
|
import PlayView from './views/PlayView';
|
||||||
import ScoreView from './views/ScoreView';
|
import ScoreView from './views/ScoreView';
|
||||||
import { Center } from 'native-base';
|
import { LoadingView } from './components/Loading';
|
||||||
import LoadingComponent from './components/Loading';
|
|
||||||
import ProfileView from './views/ProfileView';
|
import ProfileView from './views/ProfileView';
|
||||||
import useColorScheme from './hooks/colorScheme';
|
import useColorScheme from './hooks/colorScheme';
|
||||||
|
|
||||||
@@ -81,11 +80,7 @@ export const Router = () => {
|
|||||||
}>
|
}>
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
{ userProfile.isLoading && !userProfile.data ?
|
{ userProfile.isLoading && !userProfile.data ?
|
||||||
<Stack.Screen name="Loading" component={() =>
|
<Stack.Screen name="Loading" component={RouteToScreen(LoadingView)}/>
|
||||||
<Center style={{ flexGrow: 1 }}>
|
|
||||||
<LoadingComponent/>
|
|
||||||
</Center>
|
|
||||||
}/>
|
|
||||||
: routesToScreens(userProfile.isSuccess && accessToken
|
: routesToScreens(userProfile.isSuccess && accessToken
|
||||||
? protectedRoutes()
|
? protectedRoutes()
|
||||||
: publicRoutes())
|
: publicRoutes())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useQueries, useQuery } from "react-query";
|
import { useQueries, useQuery } from "react-query";
|
||||||
import API from "../API";
|
import API from "../API";
|
||||||
import LoadingComponent from "../components/Loading";
|
import { LoadingView } from "../components/Loading";
|
||||||
import { Center, Box, ScrollView, Flex, useBreakpointValue, Stack, Heading, Container, VStack, HStack } from 'native-base';
|
import { Center, Box, ScrollView, Flex, useBreakpointValue, Stack, Heading, Container, VStack, HStack } from 'native-base';
|
||||||
|
|
||||||
import { useNavigation } from "../Navigation";
|
import { useNavigation } from "../Navigation";
|
||||||
@@ -24,9 +24,7 @@ const HomeView = () => {
|
|||||||
)));
|
)));
|
||||||
|
|
||||||
if (!userQuery.data || !skillsQuery.data || !searchHistoryQuery.data || !playHistoryQuery.data) {
|
if (!userQuery.data || !skillsQuery.data || !searchHistoryQuery.data || !playHistoryQuery.data) {
|
||||||
return <Center style={{ flexGrow: 1 }}>
|
return <LoadingView/>
|
||||||
<LoadingComponent/>
|
|
||||||
</Center>
|
|
||||||
}
|
}
|
||||||
return <ScrollView p={10}>
|
return <ScrollView p={10}>
|
||||||
<Flex>
|
<Flex>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
|||||||
import { useNavigation } from "../Navigation";
|
import { useNavigation } from "../Navigation";
|
||||||
import { useQuery, useQueryClient } from 'react-query';
|
import { useQuery, useQueryClient } from 'react-query';
|
||||||
import API from '../API';
|
import API from '../API';
|
||||||
import LoadingComponent from '../components/Loading';
|
import { LoadingView } from '../components/Loading';
|
||||||
import Constants from 'expo-constants';
|
import Constants from 'expo-constants';
|
||||||
import { useStopwatch } from 'react-timer-hook';
|
import { useStopwatch } from 'react-timer-hook';
|
||||||
import SlideView from '../components/PartitionVisualizer/SlideView';
|
import SlideView from '../components/PartitionVisualizer/SlideView';
|
||||||
@@ -147,9 +147,7 @@ const PlayView = ({ songId }: RouteProps<PlayViewProps>) => {
|
|||||||
const score = 20;
|
const score = 20;
|
||||||
|
|
||||||
if (!song.data || !partitionRessources.data) {
|
if (!song.data || !partitionRessources.data) {
|
||||||
return <Center style={{ flexGrow: 1 }}>
|
return <LoadingView/>;
|
||||||
<LoadingComponent/>
|
|
||||||
</Center>
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flexGrow: 1, flexDirection: 'column' }}>
|
<SafeAreaView style={{ flexGrow: 1, flexDirection: 'column' }}>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { CardBorderRadius } from "../components/Card";
|
|||||||
import TextButton from "../components/TextButton";
|
import TextButton from "../components/TextButton";
|
||||||
import API from '../API';
|
import API from '../API';
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import LoadingComponent from "../components/Loading";
|
import { LoadingView } from "../components/Loading";
|
||||||
|
|
||||||
type ScoreViewProps = { songId: number }
|
type ScoreViewProps = { songId: number }
|
||||||
|
|
||||||
@@ -19,9 +19,7 @@ const ScoreView = ({ songId }: RouteProps<ScoreViewProps>) => {
|
|||||||
const recommendations = useQuery(['song', 'recommendations'], () => API.getUserRecommendations());
|
const recommendations = useQuery(['song', 'recommendations'], () => API.getUserRecommendations());
|
||||||
|
|
||||||
if (!recommendations.data) {
|
if (!recommendations.data) {
|
||||||
return <Center style={{ flexGrow: 1 }}>
|
return <LoadingView/>;
|
||||||
<LoadingComponent/>
|
|
||||||
</Center>;
|
|
||||||
}
|
}
|
||||||
return <ScrollView p={8} contentContainerStyle={{ alignItems: 'center' }}>
|
return <ScrollView p={8} contentContainerStyle={{ alignItems: 'center' }}>
|
||||||
<VStack width={{ base: '100%', lg: '50%' }} textAlign='center'>
|
<VStack width={{ base: '100%', lg: '50%' }} textAlign='center'>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Button, Divider, Box, Center, Image, Text, VStack, PresenceTransition, Icon } from "native-base";
|
import { Button, Divider, Box, Center, Image, Text, VStack, PresenceTransition, Icon } from "native-base";
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import LoadingComponent from "../components/Loading";
|
import LoadingComponent, { LoadingView } from "../components/Loading";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Translate, translate } from "../i18n/i18n";
|
import { Translate, translate } from "../i18n/i18n";
|
||||||
import formatDuration from "format-duration";
|
import formatDuration from "format-duration";
|
||||||
import { Ionicons } from '@expo/vector-icons';
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
import API from "../API";
|
import API from "../API";
|
||||||
import TextButton from "../components/TextButton";
|
import TextButton from "../components/TextButton";
|
||||||
import { useNavigation } from "../Navigation";
|
import { RouteProps, useNavigation } from "../Navigation";
|
||||||
|
|
||||||
interface SongLobbyProps {
|
interface SongLobbyProps {
|
||||||
// The unique identifier to find a song
|
// The unique identifier to find a song
|
||||||
@@ -26,9 +26,7 @@ const SongLobbyView = (props: RouteProps<SongLobbyProps>) => {
|
|||||||
}, [chaptersOpen]);
|
}, [chaptersOpen]);
|
||||||
useEffect(() => {}, [songQuery.isLoading]);
|
useEffect(() => {}, [songQuery.isLoading]);
|
||||||
if (songQuery.isLoading || scoresQuery.isLoading)
|
if (songQuery.isLoading || scoresQuery.isLoading)
|
||||||
return <Center style={{ flexGrow: 1 }}>
|
return <LoadingView/>;
|
||||||
<LoadingComponent/>
|
|
||||||
</Center>
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ padding: 30, flexDirection: 'column' }}>
|
<Box style={{ padding: 30, flexDirection: 'column' }}>
|
||||||
<Box style={{ flexDirection: 'row', height: '30%'}}>
|
<Box style={{ flexDirection: 'row', height: '30%'}}>
|
||||||
|
|||||||
Reference in New Issue
Block a user