Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellebr22 committed Dec 7, 2023
1 parent 143922e commit 1ce38be
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 73 deletions.
2 changes: 1 addition & 1 deletion TaskTerriers/src/Screens/Auth/AuthAddProfileScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AuthAddProfileScreen = ({ navigation, route }) => {
* life cycles
**************/

// Effect hook to log route params on component mount
// Effect hook to log route params on component mount
useEffect(() => {
console.log(route?.params)
console.log(route?.params?.firstName)
Expand Down
18 changes: 9 additions & 9 deletions TaskTerriers/src/Screens/Auth/AuthLoginMainScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const AuthLoginMainScreen = () => {
const baseApiUrl = process.env.EXPO_PUBLIC_API_URL

// Configuration for Google Sign-In
GoogleSignin.configure({
GoogleSignin.configure({
webClientId: process.env.EXPO_PUBLIC_WEB_CLIENT_ID,
forceCodeForRefreshToken: true,
})
Expand All @@ -39,7 +39,7 @@ const AuthLoginMainScreen = () => {
* life cycles
**************/

// Subscribe to authentication state changes
// Subscribe to authentication state changes
useEffect(() => {
const subscriber = Auth().onAuthStateChanged(onAuthStateChanged)
return subscriber // unsubscribe on unmount
Expand All @@ -49,7 +49,7 @@ const AuthLoginMainScreen = () => {
* life cycles
*************/

// Redirect authenticated users
// Redirect authenticated users
useEffect(() => {
if (currentUser) {
const userData = {
Expand Down Expand Up @@ -83,7 +83,7 @@ const AuthLoginMainScreen = () => {
* functions
************/

// Fetch user information from the database
// Fetch user information from the database
const GET_User_info_from_DB = async (userId: string) => {
try {
const response = await fetch(`${baseApiUrl}/api/userExists/${userId}`)
Expand Down Expand Up @@ -138,14 +138,14 @@ const AuthLoginMainScreen = () => {
}

// Handle user state changes
// Update user state on authentication state change
// Update user state on authentication state change
const onAuthStateChanged = user => {
setUser(user)
console.log(user)
if (initializing) setInitializing(false)
}

// Parse name implementation
// Parse name implementation
const parseName = () => {
if (currentUser) {
const displayName = currentUser?.displayName.split(' ')
Expand All @@ -166,12 +166,12 @@ const AuthLoginMainScreen = () => {
)
}

// Render Google Sign-In button
// Render Google Sign-In button
const renderGoogleSignIn = () => {
return (
<GoogleSigninButton
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Light}
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Light}
onPress={onGoogleButtonPress}
// disabled={this.state.isSigninInProgress}
/>
Expand Down
15 changes: 8 additions & 7 deletions TaskTerriers/src/Screens/MessagesDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ const MessagesDetailScreen = ({ navigation, route }) => {
* props, navigation prams
**************************/

// Extracting the chat room details from the navigation route parameters
// Extracting the chat room details from the navigation route parameters
const { chatRoom } = route?.params

/*************
* state, ref
*************/

// States for managing rendering, user info, messages, and message text input
// States for managing rendering, user info, messages, and message text input
const [isRendering, setIsRendering] = useState<boolean>(true)
const [userInfo, setUserInfo] = useState<userData>()
const [messages, setMessages] = useState([])
Expand Down Expand Up @@ -79,7 +79,7 @@ const MessagesDetailScreen = ({ navigation, route }) => {
console.log(userData.userId)
}

// Function to send a message
// Function to send a message
const sendMessage = async () => {
const msg = messageText.trim()
if (!msg) return
Expand Down Expand Up @@ -120,7 +120,7 @@ const MessagesDetailScreen = ({ navigation, route }) => {
.catch(err => console.error('An error occurred', err))
}

// Function to display time in a readable format
// Function to display time in a readable format
const displayTime = ({ item }) => {
return new Date(parseInt(item?.createdAt?.seconds) * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true })
}
Expand Down Expand Up @@ -200,7 +200,8 @@ const MessagesDetailScreen = ({ navigation, route }) => {
)
}

const renderFlatList = () => { // FlatList for displaying messages
const renderFlatList = () => {
// FlatList for displaying messages
return (
<FlatList
data={messages}
Expand All @@ -218,10 +219,10 @@ const MessagesDetailScreen = ({ navigation, route }) => {
***********/

// Rendering the UI
return (
return (
<TaskTerriersSafeAreaView style={{ flex: 1 }}>
{renderNavBar()}
{renderPaymentBar()}
{renderPaymentBar()}
<Col p16 flex>
{renderFlatList()}
{/* {renderMyMessageBubble('afjdlasjfkdjs;kafjkdsjafkdjkfj;dlsajf;kj;dsk;afjkdsjfkjdskajfkldsjfkdsj;afjdkafjd;kjsa;fkldjsafj;djafkdjsafkdjslkfj;lj')}
Expand Down
21 changes: 7 additions & 14 deletions TaskTerriers/src/Screens/MessagesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { MaterialIcons } from '@expo/vector-icons'
import { BUColor, NeutralColor } from '../Libs'
import { Span } from '../StyleToProps'

interface Props { }
interface Props {}

const MessagesTab = ({ navigation, route }) => {
/*********
Expand All @@ -36,7 +36,7 @@ const MessagesTab = ({ navigation, route }) => {
/*************
* state, ref
*************/
// Sample profile picture for mock data
// Sample profile picture for mock data
const profilePicture: any = require('../assets/images/profile/aleks.png')

// Mock data for messages, to be replaced with real data
Expand Down Expand Up @@ -89,17 +89,17 @@ const MessagesTab = ({ navigation, route }) => {
// Effect hook for fetching user information and setting up real-time chat updates
useEffect(() => {
getUserInfo()
// Firestore query to fetch chat data
// Firestore query to fetch chat data
const chatQuery = query(collection(FIRESTORE_DB, 'messageRooms'), orderBy('_id', 'desc'))

// Subscribing to chat updates
// Subscribing to chat updates
const unsubscribe = onSnapshot(chatQuery, querySnapShot => {
const chatRooms = querySnapShot.docs.map(doc => doc.data())
setChats(chatRooms)
setIsLoading(false)
})

// Cleanup function to unsubscribe from the updates
// Cleanup function to unsubscribe from the updates
return unsubscribe
}, [])

Expand Down Expand Up @@ -127,16 +127,9 @@ const MessagesTab = ({ navigation, route }) => {
return <NavigationBar iconName={IconNames['Message']} title={route.name} />
}

// Renders each item in the FlatList
// Renders each item in the FlatList
const renderItem = ({ item }) => {
return (
<MessagesCard
chatName={item?.chatName}
messagePreview={'Message Preview'}
profilePicPath={''}
onPress={() => onPressCard(item)}
/>
)
return <MessagesCard chatName={item?.chatName} messagePreview={'Message Preview'} profilePicPath={''} onPress={() => onPressCard(item)} />
}

// Renders a message when the list is empty
Expand Down
10 changes: 5 additions & 5 deletions TaskTerriers/src/Screens/Services/ServiceAddScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const ServiceAddScreen = ({ navigation, route }) => {
* functions
************/

// Function to retrieve user data from AsyncStorage
// Function to retrieve user data from AsyncStorage
const getUserInfo = async () => {
const userData = await AsyncStorageModule.GET_asyncStorage('USER_DATA')
setUserInfo(userData)
Expand Down Expand Up @@ -96,9 +96,9 @@ const ServiceAddScreen = ({ navigation, route }) => {
}
}

// Function to handle the 'Post Service' button press
// Function to handle the 'Post Service' button press
const onPressPostButton = async () => {
// Call the POST function and navigate back
// Call the POST function and navigate back
POST_service()
return TaskTerriersNavigationModule.goBack()
}
Expand Down Expand Up @@ -251,7 +251,7 @@ const ServiceAddScreen = ({ navigation, route }) => {
)
}

// Render the 'Add Service' button
// Render the 'Add Service' button
const renderAddButton = () => {
return (
<FloatingButton
Expand Down Expand Up @@ -285,6 +285,6 @@ const ServiceAddScreen = ({ navigation, route }) => {
)
}

const styles = StyleSheet.create({})
const styles = StyleSheet.create({})

export default ServiceAddScreen
16 changes: 8 additions & 8 deletions TaskTerriers/src/Screens/Services/ServiceDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
console.log(serviceDetail?.serviceName)
}, [])

// Fetching user details after getting service details
// Fetching user details after getting service details
useEffect(() => {
GET_user_details()

}, [serviceDetail])

/************
Expand Down Expand Up @@ -104,8 +103,7 @@ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
}
}


// Function to handle navigation return
// Function to handle navigation return
const onPressReturn = () => {
TaskTerriersNavigationModule.goBack()
}
Expand Down Expand Up @@ -152,7 +150,7 @@ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
return <NavigationBar title={serviceName} iconName={IconNames['Return']} hasDivider iconAction={onPressReturn} />
}

// Render the profile section
// Render the profile section
const renderProfileSection = () => {
return (
<Col mb20>
Expand Down Expand Up @@ -217,7 +215,7 @@ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
)
}

// Render the loading indicator
// Render the loading indicator
const renderActivityIndicator = () => {
return (
<Col mt20>
Expand All @@ -232,14 +230,16 @@ Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
return (
<TaskTerriersSafeAreaView style={{ flex: 1, backgroundColor: NeutralColor['neutral-100'] }}>
{renderNavBar()}
{isLoading ? renderActivityIndicator() :
{isLoading ? (
renderActivityIndicator()
) : (
<Col flex p16>
{renderProfileSection()}
<Divider />
{renderInfo()}
{renderLocation()}
</Col>
}
)}
{renderMessageButton()}
</TaskTerriersSafeAreaView>
)
Expand Down
11 changes: 6 additions & 5 deletions TaskTerriers/src/Screens/Services/ServicesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Ionicons, MaterialIcons } from '@expo/vector-icons'
import { NeutralColor } from '../../Libs'
import ServiceAddScreen from './ServiceAddScreen'

interface Props { }
interface Props {}

const ServicesTab = ({ route }) => {
/*********
Expand All @@ -35,7 +35,7 @@ const ServicesTab = ({ route }) => {
const [services, setServices] = useState([])
const [refreshing, setRefreshing] = useState(false)

// Base URL for API calls
// Base URL for API calls
const baseApiUrl = process.env.EXPO_PUBLIC_API_URL

// Function to fetch services from the API
Expand Down Expand Up @@ -85,7 +85,7 @@ const ServicesTab = ({ route }) => {
* render
*********/

// Render the navigation bar
// Render the navigation bar
const renderNavigationBar = () => {
return <NavigationBar iconName={IconNames['Service']} title={route.name} />
}
Expand Down Expand Up @@ -114,11 +114,12 @@ const ServicesTab = ({ route }) => {
serviceRate={item?.price}
postPreview={item?.description}
serviceType={item?.serviceType}
onPress={() => onPressCard(item)} />
onPress={() => onPressCard(item)}
/>
)
}

// Render UI when there are no services
// Render UI when there are no services
const renderListEmptyComponent = () => {
return (
<Col alignCenter>
Expand Down
2 changes: 0 additions & 2 deletions TaskTerriers/src/Screens/SettingsTabScreen/SettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const SettingsTab = ({ navigation, route }) => {
console.log(userData)
}, [])


/************
* functions
************/
Expand All @@ -104,7 +103,6 @@ const SettingsTab = ({ navigation, route }) => {
setIsRendering(true)
}


/*********
* render
*********/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { userData } from '../../navigation'
import AsyncStorageModule from '../../modules/AsyncStorageModule'
import { FloatingButton } from '../../components/Buttons/FloatingButton'

interface Props { }
interface Props {}

const SettingsTabAboutScreen = ({ navigation, route }) => {
/*********
Expand Down Expand Up @@ -88,7 +88,7 @@ const SettingsTabAboutScreen = ({ navigation, route }) => {
// Function to handle bio update
const onPressDoneButton = async () => {
try {
// API call to update bio
// API call to update bio
setIsSetting(true)
const response = await fetch(`${baseApiUrl}/api/userChange/${userInfo?.userId}`, {
method: 'PUT',
Expand Down Expand Up @@ -123,7 +123,9 @@ const SettingsTabAboutScreen = ({ navigation, route }) => {
}

const renderUpdateButton = () => {
return <FloatingButton size={'medium'} onPress={onPressDoneButton} text={{ value: 'Update Bio' }} hasBorder isFullWithBtn isProgress={isSetting} />
return (
<FloatingButton size={'medium'} onPress={onPressDoneButton} text={{ value: 'Update Bio' }} hasBorder isFullWithBtn isProgress={isSetting} />
)
}

const renderBioInput = () => {
Expand Down Expand Up @@ -154,11 +156,14 @@ const SettingsTabAboutScreen = ({ navigation, route }) => {
return (
<TaskTerriersSafeAreaView style={{ flex: 1, backgroundColor: 'white' }}>
{renderNavBar()}
{isLoading ? renderActivityIndicator() :
{isLoading ? (
renderActivityIndicator()
) : (
<Col p16>
<Col alignSelfEnd>{renderEditButton()}</Col>
{renderBioInput()}
</Col>}
</Col>
)}
{renderUpdateButton()}
</TaskTerriersSafeAreaView>
)
Expand Down
Loading

0 comments on commit 1ce38be

Please sign in to comment.