Skip to content

Commit

Permalink
refactored fonts and removed loading from all files (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWangY authored Apr 12, 2024
1 parent dcc7f5f commit c0597a6
Show file tree
Hide file tree
Showing 54 changed files with 41 additions and 249 deletions.
4 changes: 4 additions & 0 deletions client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import { AuthStore } from "./src/services/AuthStore";
import { NavigationContainer } from "@react-navigation/native";
import AppNavigator from "./src/navigation/AppNavigator";
import AuthNavigator from "./src/navigation/AuthNavigator";
import { useGlobalFonts } from "./src/styles/fonts";


const App = () => {
const { initialized, isLoggedin } = AuthStore.useState();
const { fontsLoaded, fontError } = useGlobalFonts();

if (!fontsLoaded && !fontError) return <Text>Error Loading Fonts!</Text>;

if (!initialized) return <Text>Loading...</Text>;

Expand Down
Binary file removed client/assets/airplaneSend.png
Binary file not shown.
Binary file removed client/assets/city_buildings.png
Binary file not shown.
Binary file removed client/assets/cute_tree_cropped.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed client/assets/paper-plane.png
Diff not rendered.
Binary file removed client/assets/temp_front_page_icon.png
Diff not rendered.
Binary file removed client/assets/transfer.png
Diff not rendered.
15 changes: 0 additions & 15 deletions client/src/app_DEPRECATED/(auth)/_layout.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/app_DEPRECATED/(auth)/login.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions client/src/app_DEPRECATED/(auth)/resetpass.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/app_DEPRECATED/(auth)/signup.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions client/src/app_DEPRECATED/(auth)/welcome.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions client/src/app_DEPRECATED/(home)/_layout.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions client/src/app_DEPRECATED/(home)/chatchannel.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/app_DEPRECATED/_layout.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions client/src/app_DEPRECATED/index.tsx

This file was deleted.

31 changes: 6 additions & 25 deletions client/src/components/auth/AuthButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,14 @@ import {
ImageSourcePropType,
Platform,
} from "react-native";
import { router, useRouter } from "expo-router";
import { useFonts } from "expo-font";
import { appSignOut } from "../../services/AuthStore";

interface SignOutButtonProps {}

export const SignOutButton: React.FC<SignOutButtonProps> = () => {
const router = useRouter();
const [loading, setLoading] = useState(false);

const [fontsLoaded, fontError] = useFonts({
"Gilroy-ExtraBold": require("../../../assets/fonts/Gilroy-ExtraBold.otf"),
"Gilroy-Light": require("../../../assets/fonts/Gilroy-Light.otf"),
"Quicksand-Medium": require("../../../assets/fonts/Quicksand-Medium.ttf"), // fixed loading this file!
});

const handleSignOut = async () => {
Alert.alert(
"Confirm Sign Out",
Expand All @@ -43,7 +35,7 @@ export const SignOutButton: React.FC<SignOutButtonProps> = () => {
setLoading(false);

if (response?.user === null) {
router.replace("/");
console.log("Sign out successful");
} else if (response?.error) {
console.log(response.error);
Alert.alert(
Expand All @@ -58,9 +50,6 @@ export const SignOutButton: React.FC<SignOutButtonProps> = () => {
);
};

if (!fontsLoaded && !fontError) {
return null;
}

return (
<TouchableOpacity
Expand All @@ -76,14 +65,6 @@ export const SignOutButton: React.FC<SignOutButtonProps> = () => {
export const LogInButton: React.FC<{ onPress?: () => void }> = ({
onPress,
}) => {
const [fontsLoaded, fontError] = useFonts({
"Gilroy-ExtraBold": require("../../../assets/fonts/Gilroy-ExtraBold.otf"),
"Gilroy-Light": require("../../../assets/fonts/Gilroy-Light.otf"),
});

if (!fontsLoaded && !fontError) {
return null;
}

return (
<TouchableOpacity style={styles.login_button} onPress={onPress}>
Expand Down Expand Up @@ -117,10 +98,10 @@ export const ExternalAuthButton: React.FC<{
imageSource?: ImageSourcePropType;
}> = ({ onPress, companyName, imageSource }) => {
const images: { [key: string]: ImageSourcePropType } = {
google: require("../../../assets/google_logo.png"),
apple: require("../../../assets/apple_logo.png"),
github: require("../../../assets/github_logo.png"),
facebook: require("../../../assets/facebook_logo.png"),
google: require("../../../assets/icons/auth/google_logo.png"),
apple: require("../../../assets/icons/auth/apple_logo.png"),
github: require("../../../assets/icons/auth/github_logo.png"),
facebook: require("../../../assets/icons/auth/facebook_logo.png"),
};

const clicked = () => {
Expand All @@ -132,7 +113,7 @@ export const ExternalAuthButton: React.FC<{
<Image
style={styles.login_logo}
source={
images[companyName] || require("../../../assets/adaptive-icon.png")
images[companyName] || require("../../../assets/icons/expo/adaptive-icon.png")
}
/>
</TouchableOpacity>
Expand Down
11 changes: 0 additions & 11 deletions client/src/components/auth/LogInButton.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import { router } from "expo-router";
import React from "react";
import { useFonts } from "expo-font";
import { StyleSheet, Text, TouchableOpacity, Dimensions } from "react-native";
import { LogInButtonProps } from "../../types/Props";


const LogInButton: React.FC<LogInButtonProps> = ({ onPress }) => {

const [fontsLoaded, fontError] = useFonts({
'Gilroy-ExtraBold': require('../../../assets/fonts/Gilroy-ExtraBold.otf'),
'Gilroy-Light': require('../../../assets/fonts/Gilroy-Light.otf'),
});

if (!fontsLoaded && !fontError) {
return null;
}

return (
<TouchableOpacity style={styles.button} onPress={onPress}>
<Text style={styles.button_text}>Log In</Text>
Expand Down
10 changes: 0 additions & 10 deletions client/src/components/auth/SignUpButton.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import { router } from "expo-router";
import React from "react";
import { useFonts } from "expo-font";
import { StyleSheet, Text, TouchableOpacity, Dimensions } from "react-native";
import { SignUpButtonProps } from "../../types/Props";

const SignUpButton: React.FC<SignUpButtonProps> = ({ onPress }) => {
const [fontsLoaded, fontError] = useFonts({
"Gilroy-ExtraBold": require("../../../assets/fonts/Gilroy-ExtraBold.otf"),
"Gilroy-Light": require("../../../assets/fonts/Gilroy-Light.otf"),
});

if (!fontsLoaded && !fontError) {
return null;
}

return (
<TouchableOpacity style={styles.button} onPress={onPress}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Message: React.FC<MessageProps> = ({ messageContent, time, author }) => {
<View style={styles.profileImageContainer}>
<Image
style={styles.profileImage}
source={require("../../../assets/user_icons/fake_pfp.jpg")}
source={require("../../../assets/icons/user/fake_pfp.jpg")}
/>
</View>
<View style={styles.contentContainer}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/chat/MessageChannel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Message from "./ChatMessage";
import { FlatList, StyleSheet, View } from "react-native";
import { FlatList } from "react-native";
import { MessageChannelProps } from "../../types/Props";

const MessageChannel: React.FC<MessageChannelProps> = ({ messages }) => {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/chat/NearbyHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { View, Text, StyleSheet, Dimensions, Image } from 'react-native'
import React from 'react'
import { CounterProps } from '../../utils/types'
import NearbyCount from './NearbyCount';
import { CounterProps } from '../../types/Props';

export const NearbyHeader: React.FC<CounterProps> = ({ count }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/common/CustomButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ChatSendButtonProps } from '../../types/Props';
export const ChatSendButton: React.FC<ChatSendButtonProps> = ({ onPress }) => {
return (
<TouchableOpacity style={styles.sendButton} onPress={onPress}>
<Image style={styles.sendButtonImage} source={require('../../../assets/transparentSend.png')}/>
<Image style={styles.sendButtonImage} source={require('../../../assets/icons/arrow/transparentSend.png')}/>
</TouchableOpacity>
)
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/settings/SettingsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const SettingsItem = ({id, title, type, setter, data}: SettingsProps) =>
{(type === 'select') && (
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<Text style={styles.rowValueText}>{data[id as keyof typeof data]}</Text>
<Image source={require('../../../assets/angle-right.png')} style={styles.rightArrow} />
<Image source={require('../../../assets/icons/arrow/angle-right.png')} style={styles.rightArrow} />
</View>

)}
Expand Down
5 changes: 4 additions & 1 deletion client/src/navigation/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const AppNavigator = () => {
<LocationProvider>
<SocketProvider>
<UserProvider>
<Tab.Navigator>
<Tab.Navigator screenOptions={{
headerShown: false,

}}>
<Tab.Screen name="Home" component={ChatScreen} />
<Tab.Screen name="Profile" component={SettingsScreen} />
</Tab.Navigator>
Expand Down
Loading

0 comments on commit c0597a6

Please sign in to comment.