Skip to content

Commit

Permalink
finished
Browse files Browse the repository at this point in the history
  • Loading branch information
medomy committed Jan 31, 2023
1 parent 7fb0624 commit f4d6508
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/screens/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScrollView, StyleSheet, Text, View } from 'react-native'
import { ScrollView, StyleSheet, Text, View, ActivityIndicator } from 'react-native'
import React, { useState } from 'react'
import HomeHeader from '../../components/HomeComponents/header'
import HeaderTitle from '../../components/HomeComponents/headerTitle'
Expand All @@ -8,7 +8,7 @@ import { useGetAllProductsQuery } from '../../store/slices/productSlice'
import ProductsList from '../../components/HomeComponents/productsList'
import { filterProducts } from '../../utils/filterProducts'
import MostPopular from '../../components/HomeComponents/mostPopularSec/mostPopuler'
import { COLORS } from '../../constants'
import { COLORS, SIZES } from '../../constants'
import { useInitCartItems } from '../../hooks/useInitializeCartItems'

const Home = () => {
Expand All @@ -27,8 +27,12 @@ const Home = () => {
<HeaderTitle title='Find Your Clothes' />
<DiscountSec />
<CategoriesList selected={selectedCategory} setSelected={changeSelectedCategory} />
{data && <ProductsList products={filterProducts(selectedCategory, data)} />}
{data && <MostPopular />}
{data ? <ProductsList products={filterProducts(selectedCategory, data)} /> : <View style={{ flex: 1, justifyContent: "center", alignItems: "center", marginVertical: SIZES.margin2 }}>
<ActivityIndicator color={COLORS.tintColor} size={SIZES.iconSize} />
</View>}
{data ? <MostPopular /> : <View style={{ flex: 1, justifyContent: "center", alignItems: "center" , marginVertical: SIZES.margin2 }}>
<ActivityIndicator color={COLORS.tintColor} size={SIZES.iconSize} />
</View>}
<View style={styles.emptyViewFooter}></View>
</ScrollView>
</View>
Expand Down
7 changes: 5 additions & 2 deletions src/screens/profile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleSheet, Text, View } from 'react-native'
import { StyleSheet, Text, View, ActivityIndicator } from 'react-native'
import React, { useEffect, useState } from 'react'
import SignedUser from '../../types/user'
import { changeUserProfilePic, getUserAsyncStorage, logOutAsyncStorage } from '../../services/asyncStorageUser';
Expand Down Expand Up @@ -40,12 +40,15 @@ const ProfileScreen = () => {
<View style={{ flex: 1 }}>
<ProfileCircle profilePic={user.img!} changeProfilePic={setProfilePic} />
<ProfileInfoSec userName={user.userName} />
{data && <View style={{ marginVertical: SIZES.margin }}>
{data ? <View style={{ marginVertical: SIZES.margin }}>
<InfoRowProfile title={"email"} subTitle={data.email} />
<InfoRowProfile title='city' subTitle={data.address.city} />
<InfoRowProfile title='street' subTitle={data.address.street} />
<InfoRowProfile title='mobile number' subTitle={data.phone} />
</View> : <View style={{ flex: 1, justifyContent: "center", alignItems: "center", marginVertical: SIZES.margin2 }}>
<ActivityIndicator color={COLORS.tintColor} size={SIZES.iconSize} />
</View>}

<View style={styles.btnWrap}>
<Btn bgColor={COLORS.tintColor} txtColor={COLORS.white} txt={"log out"} width={SIZES.fullWidth} onPress={logOut} />
</View>
Expand Down

0 comments on commit f4d6508

Please sign in to comment.