Skip to content

Commit

Permalink
Loading page refactor (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlotacb authored Dec 30, 2023
1 parent 27df532 commit b565257
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 36 deletions.
6 changes: 2 additions & 4 deletions organizator/app/(tabs)/(home)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from "react";
import {
ActivityIndicator,
Image,
Pressable,
SafeAreaView,
Expand All @@ -14,6 +13,7 @@ import { router } from "expo-router";
import { EventAllInformation } from "../../../utils/interfaces/Events";
import { getAllEvents } from "../../../utils/api/axiosEvents";
import Card from "../../../components/Card";
import LoadingPage from "../../../components/LodingPage";

const Container = styled(SafeAreaView)`
background-color: white;
Expand Down Expand Up @@ -64,9 +64,7 @@ export default function Home() {
<Container>
<ScrollView contentContainerStyle={{ padding: 10 }}>
{loading ? (
<View style={{ flex: 1, justifyContent: "center", marginTop: 30 }}>
<ActivityIndicator size="large" />
</View>
<LoadingPage />
) : (
<View style={{ justifyContent: "center" }}>
{events.length === 0 ? (
Expand Down
14 changes: 3 additions & 11 deletions organizator/app/(tabs)/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import React, { useEffect, useState } from "react";
import {
ActivityIndicator,
Pressable,
SafeAreaView,
ScrollView,
Text,
View,
} from "react-native";
import { Pressable, SafeAreaView, ScrollView, Text, View } from "react-native";
import { router } from "expo-router";
// @ts-ignore
import styled from "styled-components/native";
Expand All @@ -21,6 +14,7 @@ import { getToken, removeToken } from "../../utils/sessionCalls";
import { UserInformation } from "../../utils/interfaces/Users";
import Input from "../../components/Input";
import Button from "../../components/StyledButton";
import LoadingPage from "../../components/LodingPage";

const Container = styled(SafeAreaView)`
padding: 30px;
Expand Down Expand Up @@ -156,9 +150,7 @@ export default function Profile() {
<Container>
<ScrollView contentContainerStyle={{ padding: 20 }}>
{loading ? (
<View style={{ flex: 1, justifyContent: "center" }}>
<ActivityIndicator size="large" />
</View>
<LoadingPage />
) : (
<>
<TitleContainer>
Expand Down
13 changes: 2 additions & 11 deletions organizator/app/login.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React, { useEffect, useState } from "react";
// @ts-ignore
import styled from "styled-components/native";
import {
SafeAreaView,
Text,
ScrollView,
ActivityIndicator,
View,
Pressable,
} from "react-native";
import { SafeAreaView, Text, ScrollView, View, Pressable } from "react-native";

import { Link, router } from "expo-router";
import Toast from "react-native-toast-message";
Expand Down Expand Up @@ -141,9 +134,7 @@ export default function LoginPage() {
>
<Toast />
{loading ? (
<View style={{ flex: 1, justifyContent: "center" }}>
<ActivityIndicator size="large" />
</View>
<LoginPage />
) : (
<>
<Title>Welcome back!</Title>
Expand Down
13 changes: 3 additions & 10 deletions organizator/app/register.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import React, { useEffect, useState } from "react";
// @ts-ignore
import styled from "styled-components/native";
import {
SafeAreaView,
Text,
ScrollView,
ActivityIndicator,
View,
} from "react-native";
import { SafeAreaView, Text, ScrollView, View } from "react-native";

import { router } from "expo-router";
import Toast from "react-native-toast-message";
Expand All @@ -16,6 +10,7 @@ import Button from "../components/StyledButton";
import { registerUser } from "../utils/api/axiosUsers";
import { RegisterResponse } from "../utils/interfaces/Users";
import { getToken } from "../utils/sessionCalls";
import LoadingPage from "../components/LodingPage";

const Container = styled(SafeAreaView)`
padding: 50px 40px;
Expand Down Expand Up @@ -167,9 +162,7 @@ export default function RegisterPage() {
<Container>
<ScrollView contentContainerStyle={{ padding: 20 }}>
{loading ? (
<View style={{ flex: 1, justifyContent: "center" }}>
<ActivityIndicator size="large" />
</View>
<LoadingPage />
) : (
<>
<Title>Welcome!</Title>
Expand Down

0 comments on commit b565257

Please sign in to comment.