From e783fd48b82724efdead7e119d5d1c7d74bb72e7 Mon Sep 17 00:00:00 2001 From: Aadit Kamat <30969577+aaditkamat@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:20:17 -0500 Subject: [PATCH 1/4] Move types to dedicated file --- client/src/components/Common/ChatMessage.tsx | 7 +--- .../src/components/Common/CustomButtons.tsx | 5 +-- client/src/components/Common/CustomInputs.tsx | 8 +--- client/src/components/Common/LogInButton.tsx | 5 +-- .../src/components/Common/MessageChannel.tsx | 5 +-- client/src/components/Common/NearbyHeader.tsx | 7 +--- .../src/components/Common/SafeAreaWrapper.tsx | 5 +-- client/src/components/Common/SignUpButton.tsx | 8 +--- client/src/utils/types.ts | 39 ++++++++++++++++++- 9 files changed, 46 insertions(+), 43 deletions(-) diff --git a/client/src/components/Common/ChatMessage.tsx b/client/src/components/Common/ChatMessage.tsx index cb56d8b80..872803b4a 100644 --- a/client/src/components/Common/ChatMessage.tsx +++ b/client/src/components/Common/ChatMessage.tsx @@ -1,12 +1,7 @@ import React, { useContext } from "react"; import { View, StyleSheet, Text, Image, Dimensions } from "react-native"; import { useSettings } from "../../contexts/SettingsContext"; - -interface MessageProps { - messageContent: string; - // timestamp: Date, (This will be added later inside the message object passed in) - author: string; -} +import { MessageProps } from "../../utils/types"; const Message: React.FC = ({ messageContent, author }) => { const settings = useSettings(); diff --git a/client/src/components/Common/CustomButtons.tsx b/client/src/components/Common/CustomButtons.tsx index 5c944dfa2..6f4169a7c 100644 --- a/client/src/components/Common/CustomButtons.tsx +++ b/client/src/components/Common/CustomButtons.tsx @@ -1,9 +1,6 @@ import React from 'react' import { View, StyleSheet, Text, TouchableOpacity, Image, Dimensions } from 'react-native' - -interface ChatSendButtonProps { - onPress?: () => void, -} +import { ChatSendButtonProps } from '../../utils/types'; export const ChatSendButton: React.FC = ({ onPress }) => { return ( diff --git a/client/src/components/Common/CustomInputs.tsx b/client/src/components/Common/CustomInputs.tsx index aebf07f5e..d839d9a63 100644 --- a/client/src/components/Common/CustomInputs.tsx +++ b/client/src/components/Common/CustomInputs.tsx @@ -1,12 +1,6 @@ import React from 'react' import { TextInput, View, StyleSheet, Dimensions, Platform } from 'react-native' - -interface ChatInputProps { - value?: string, - onChangeText?: (text: string) => void -} - - +import { ChatInputProps } from '../../types/CommonComponentProps'; export const WelcomeEmailInput: React.FC = ({ value, onChangeText }) => { return ( diff --git a/client/src/components/Common/LogInButton.tsx b/client/src/components/Common/LogInButton.tsx index b87448d65..d62849a77 100644 --- a/client/src/components/Common/LogInButton.tsx +++ b/client/src/components/Common/LogInButton.tsx @@ -2,11 +2,8 @@ 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 "../../utils/types"; -// Interface for props function onPress -interface LogInButtonProps { - onPress?: () => void; -} const LogInButton: React.FC = ({ onPress }) => { diff --git a/client/src/components/Common/MessageChannel.tsx b/client/src/components/Common/MessageChannel.tsx index e40cadda7..aac7c686b 100644 --- a/client/src/components/Common/MessageChannel.tsx +++ b/client/src/components/Common/MessageChannel.tsx @@ -1,11 +1,8 @@ import React from 'react' import Message from './ChatMessage' import { FlatList, StyleSheet, View } from 'react-native' -import { MessageType } from '../../utils/types'; +import { MessageChannelProps } from '../../utils/types'; -interface MessageChannelProps { - messages: MessageType[], -} const MessageChannel: React.FC = ({ messages }) => { const reverseMessages = [...messages].reverse() diff --git a/client/src/components/Common/NearbyHeader.tsx b/client/src/components/Common/NearbyHeader.tsx index 0e2cdd853..5864168a8 100644 --- a/client/src/components/Common/NearbyHeader.tsx +++ b/client/src/components/Common/NearbyHeader.tsx @@ -1,10 +1,7 @@ import { View, Text, StyleSheet, Dimensions, Image } from 'react-native' import React from 'react' - -interface CounterProps { - count: number; - } +import { CounterProps } from '../../utils/types' export const NearbyHeader: React.FC = ({ count }) => { return ( @@ -35,8 +32,6 @@ export const NearbyHeader: React.FC = ({ count }) => { ) } - - const styles = StyleSheet.create({ nearbyContainer: { paddingTop: Dimensions.get('window').height * 0.01, diff --git a/client/src/components/Common/SafeAreaWrapper.tsx b/client/src/components/Common/SafeAreaWrapper.tsx index 391dcdcba..ba4b574bc 100644 --- a/client/src/components/Common/SafeAreaWrapper.tsx +++ b/client/src/components/Common/SafeAreaWrapper.tsx @@ -1,10 +1,7 @@ import React from "react"; import { useSettings } from "../../contexts/SettingsContext"; import { SafeAreaView, Platform, StyleSheet, StatusBar } from "react-native"; - -interface SafeAreaWrapperProps { - children: React.ReactNode; -} +import { SafeAreaWrapperProps } from "../../utils/types"; const SafeAreaWrapper: React.FC = ({ children }) => { const settings = useSettings(); diff --git a/client/src/components/Common/SignUpButton.tsx b/client/src/components/Common/SignUpButton.tsx index bed41ed8f..499fe6ba8 100644 --- a/client/src/components/Common/SignUpButton.tsx +++ b/client/src/components/Common/SignUpButton.tsx @@ -2,11 +2,7 @@ import { router } from "expo-router"; import React from "react"; import { useFonts } from "expo-font"; import { StyleSheet, Text, TouchableOpacity, Dimensions } from "react-native"; - -// Interface for props function onPress -interface SignUpButtonProps { - onPress?: () => void; -} +import { SignUpButtonProps } from "../../utils/types"; const SignUpButton: React.FC = ({ onPress }) => { @@ -27,8 +23,6 @@ const SignUpButton: React.FC = ({ onPress }) => { }; const styles = StyleSheet.create({ - - button: { backgroundColor: "#5dbea3", width: Dimensions.get("window").width * 0.5, diff --git a/client/src/utils/types.ts b/client/src/utils/types.ts index dcac06740..a0abf3b0b 100644 --- a/client/src/utils/types.ts +++ b/client/src/utils/types.ts @@ -1,5 +1,42 @@ +import React from "react"; + export type MessageType = { messageContent: string; author: string; msgID: string; -}; \ No newline at end of file +}; + +export type MessageProps = { + messageContent: string; + // timestamp: Date, (This will be added later inside the message object passed in) + author: string; +} + +export type ChatSendButtonProps = { + onPress?: () => void, +} + +export type ChatInputProps = { + value?: string, + onChangeText?: (text: string) => void +} + +export type LogInButtonProps = { + onPress?: () => void; +} + +export type MessageChannelProps = { + messages: MessageType[], +} + +export type CounterProps = { + count: number; +} + +export type SafeAreaWrapperProps = { + children: React.ReactNode; +} + +export type SignUpButtonProps = { + onPress?: () => void; +} \ No newline at end of file From 6449518aac31a5e4dcef4f413f76371279edd07f Mon Sep 17 00:00:00 2001 From: Aadit Kamat <30969577+aaditkamat@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:23:51 -0500 Subject: [PATCH 2/4] Add newline to the end of file --- client/src/utils/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/types.ts b/client/src/utils/types.ts index a0abf3b0b..f834c4dc3 100644 --- a/client/src/utils/types.ts +++ b/client/src/utils/types.ts @@ -39,4 +39,4 @@ export type SafeAreaWrapperProps = { export type SignUpButtonProps = { onPress?: () => void; -} \ No newline at end of file +} From cfd15841f234a1af020805d4ff427c28b11ac8ff Mon Sep 17 00:00:00 2001 From: Aadit Kamat <30969577+aaditkamat@users.noreply.github.com> Date: Sun, 25 Feb 2024 09:54:54 -0500 Subject: [PATCH 3/4] Reorganize props and add comments to identify groups --- client/src/types/Props.ts | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/client/src/types/Props.ts b/client/src/types/Props.ts index ab65af043..7784a15b4 100644 --- a/client/src/types/Props.ts +++ b/client/src/types/Props.ts @@ -1,29 +1,37 @@ import React from "react"; import { MessageType } from "./Message"; -export type MessageProps = { - messageContent: string; - time: number; - author: string; +/* button props */ +export type LogInButtonProps = { + onPress?: () => void; } -export type ChatSendButtonProps = { - onPress?: () => void, +export type SignUpButtonProps = { + onPress?: () => void; } +export type ChatSendButtonProps = { + onPress?: () => void, +} + +/* input props */ export type ChatInputProps = { - value?: string, - onChangeText?: (text: string) => void + value?: string, + onChangeText?: (text: string) => void } -export type LogInButtonProps = { - onPress?: () => void; +/* message related props */ +export type MessageProps = { + messageContent: string; + time: number; + author: string; } export type MessageChannelProps = { messages: MessageType[], } +/* misc props*/ export type CounterProps = { count: number; } @@ -32,6 +40,4 @@ export type SafeAreaWrapperProps = { children: React.ReactNode; } -export type SignUpButtonProps = { - onPress?: () => void; -} + From 0630ec4b826c1e91a0bd46d0ed545ddc5628f7ac Mon Sep 17 00:00:00 2001 From: h1divp <71522316+h1divp@users.noreply.github.com> Date: Tue, 19 Mar 2024 18:07:09 -0400 Subject: [PATCH 4/4] Re-added env import --- client/src/configs/firebaseConfig.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/configs/firebaseConfig.ts b/client/src/configs/firebaseConfig.ts index 7ebe6845b..30f89f090 100644 --- a/client/src/configs/firebaseConfig.ts +++ b/client/src/configs/firebaseConfig.ts @@ -1,6 +1,7 @@ import { initializeApp, getApp, getApps } from "firebase/app"; import { initializeAuth, getReactNativePersistence, getAuth, Auth } from "firebase/auth"; import AsyncStorage from "@react-native-async-storage/async-storage"; +import {API_KEY, AUTH_DOMAIN} from "@env"; // Don't worry about this env error! const firebaseConfig = { apiKey: API_KEY || "Mock-Key",