Skip to content

Commit 085fc1b

Browse files
committed
Amelioration du cote Front-end
1 parent 4758b3a commit 085fc1b

10 files changed

+213
-368
lines changed

package-lock.json

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"react-native-maps": "^1.15.6",
3232
"react-native-qrcode-svg": "^6.3.1",
3333
"react-native-safe-area-context": "4.10.1",
34-
"react-native-screens": "3.31.1"
34+
"react-native-screens": "3.31.1",
35+
"react-native-swiper": "^1.6.0"
3536
},
3637
"devDependencies": {
3738
"@babel/core": "^7.20.0",

src/components/AppHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const styles = StyleSheet.create({
4949
alignItems: "center",
5050
justifyContent: "center",
5151
borderRadius: BORDERRADIUS.radius_20,
52-
backgroundColor: COLORS.Orange,
52+
backgroundColor: COLORS.Green,
5353
},
5454
});
5555

src/navigator/TabNavigator.tsx

+45-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1-
import React from "react";
2-
import { View, StyleSheet } from "react-native";
1+
import React, { useEffect, useState } from "react";
2+
import { View, StyleSheet, Image } from "react-native";
33
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
44
import HomeScreen from "../screens/HomeScreen";
55
import SearchScreen from "../screens/SearchScreen";
66
import TicketScreen from "../screens/TicketScreen";
77
import HomeScreenConcert from "../screens/HomeScreenConcert";
88
import UserAccountScreen from "../screens/UserAccountScreen";
99
import { COLORS, FONTSIZE, SPACING } from "../theme/Theme";
10-
import {
11-
Entypo,
12-
MaterialCommunityIcons,
13-
Feather,
14-
AntDesign,
15-
Ionicons,
16-
} from "@expo/vector-icons";
10+
import { Ionicons, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
11+
import { getFirestore, doc, getDoc } from "firebase/firestore";
12+
import { getAuth } from "firebase/auth";
13+
import { initializeApp } from "firebase/app";
14+
import { firebaseConfig } from "../../firebase-config";
15+
16+
const app = initializeApp(firebaseConfig);
17+
const db = getFirestore(app);
18+
const auth = getAuth();
1719

1820
const Tab = createBottomTabNavigator();
1921

2022
const TabNavigator = () => {
23+
const [photoURL, setPhotoURL] = useState<string | null>(null);
24+
25+
useEffect(() => {
26+
const fetchUserProfile = async () => {
27+
const user = auth.currentUser;
28+
if (user) {
29+
const userDoc = doc(db, "users", user.uid);
30+
const userSnapshot = await getDoc(userDoc);
31+
if (userSnapshot.exists()) {
32+
const userData = userSnapshot.data();
33+
setPhotoURL(userData.photoURL || null);
34+
}
35+
}
36+
};
37+
38+
fetchUserProfile();
39+
}, []);
40+
2141
return (
2242
<Tab.Navigator
2343
screenOptions={{
@@ -45,7 +65,7 @@ const TabNavigator = () => {
4565
<Ionicons
4666
name="home-sharp"
4767
size={FONTSIZE.size_30}
48-
color={focused ? COLORS.White : COLORS.White}
68+
color={COLORS.White}
4969
/>
5070
</View>
5171
),
@@ -66,7 +86,7 @@ const TabNavigator = () => {
6686
<Feather
6787
name="search"
6888
size={FONTSIZE.size_30}
69-
color={focused ? COLORS.White : COLORS.White}
89+
color={COLORS.White}
7090
/>
7191
</View>
7292
),
@@ -87,7 +107,7 @@ const TabNavigator = () => {
87107
<MaterialCommunityIcons
88108
name="ticket-confirmation-outline"
89109
size={FONTSIZE.size_30}
90-
color={focused ? COLORS.White : COLORS.White}
110+
color={COLORS.White}
91111
/>
92112
</View>
93113
),
@@ -105,11 +125,15 @@ const TabNavigator = () => {
105125
focused ? { backgroundColor: COLORS.Green } : {},
106126
]}
107127
>
108-
<AntDesign
109-
name="user"
110-
size={FONTSIZE.size_30}
111-
color={focused ? COLORS.White : COLORS.White}
112-
/>
128+
{photoURL ? (
129+
<Image source={{ uri: photoURL }} style={styles.userImage} />
130+
) : (
131+
<Ionicons
132+
name="person-circle"
133+
size={FONTSIZE.size_30}
134+
color={COLORS.White}
135+
/>
136+
)}
113137
</View>
114138
),
115139
}}
@@ -124,8 +148,10 @@ const styles = StyleSheet.create({
124148
padding: SPACING.space_18,
125149
borderRadius: SPACING.space_18 * 10,
126150
},
127-
tabBackground: {
128-
padding: SPACING.space_18,
151+
userImage: {
152+
width: FONTSIZE.size_30,
153+
height: FONTSIZE.size_30,
154+
borderRadius: FONTSIZE.size_16, // make it circular
129155
},
130156
});
131157

src/screens/HomeScreen.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ import {
1919
BORDERRADIUS,
2020
} from "../theme/Theme";
2121

22-
import InputHeader from "../components/InputHeader";
2322
import CategoryHeader from "../components/CategoryHeader";
24-
import SubMovieCard from "../components/SubMovieCard";
23+
2524
import MovieCard from "../components/MovieCard";
2625
import { firebaseConfig } from "../../firebase-config";
2726
import { initializeApp } from "firebase/app";

0 commit comments

Comments
 (0)