dummy home screen

This commit is contained in:
Jaanu423
2025-09-16 16:21:01 +05:30
parent 66b509e58e
commit 6ed8163d25
7 changed files with 551 additions and 171 deletions
+54 -33
View File
@@ -240,6 +240,40 @@ const Profile = () => {
}
};
const handleLogout = (navigation: any) => {
Alert.alert(
"Logout",
"Are you sure you want to logout?",
[
{
text: "Cancel",
style: "cancel",
},
{
text: "Yes, Logout",
style: "destructive",
onPress: async () => {
try {
// Clear saved credentials from Keychain
await Keychain.resetGenericPassword();
// Navigate to login screen
navigation.reset({
index: 0,
routes: [{ name: "Login" }],
});
} catch (error) {
console.error("Logout error:", error);
Alert.alert("Error", "Failed to logout. Please try again.");
}
},
},
],
{ cancelable: true }
);
};
useFocusEffect(
useCallback(() => {
userStatus();
@@ -267,7 +301,7 @@ const Profile = () => {
if (fetching || !user) {
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color={colors.Profile} />
<ActivityIndicator size="large" color={colors.pastelBlue} />
<Text style={styles.loadingText}>Loading profile...</Text>
</View>
);
@@ -281,7 +315,7 @@ const Profile = () => {
<View style={styles.header}>
<Text style={styles.headerTitle}>User Profile</Text>
<TouchableOpacity onPress={fetchUserProfile} style={styles.refreshButton}>
<Ionicons name="refresh" size={24} color={colors.Profile} />
<Ionicons name="refresh" size={24} color={'#000'} />
</TouchableOpacity>
</View>
<KeyboardAvoidingView
@@ -309,7 +343,7 @@ const Profile = () => {
onError={() => console.log("Error loading image")}
/>
<TouchableOpacity style={styles.cameraIcon} onPress={pickImage}>
<Ionicons name="camera" size={18} color="white" />
<Ionicons name="camera" size={18} color="#000" />
</TouchableOpacity>
</View>
@@ -318,7 +352,7 @@ const Profile = () => {
onPress={handleUpdateImage}
icon={imageUpdating ? undefined : "cloud-upload"}
style={styles.updateImageButton}
buttonBackground={colors.Profile}
buttonBackground={colors.pastelBlue}
/>
</View>
@@ -334,7 +368,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="person" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="person" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Name</Text>
<Text style={styles.detailText}>{user.firstName} {user.lastName}</Text>
@@ -342,7 +376,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="mail" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="mail" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Email</Text>
<Text style={styles.detailText}>{user.email || "Not provided"}</Text>
@@ -350,7 +384,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="call" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="call" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Mobile</Text>
<Text style={styles.detailText}>{user.mobile || "Not provided"}</Text>
@@ -358,7 +392,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="at-circle" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="at-circle" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Username</Text>
<Text style={styles.detailText}>{user.username}</Text>
@@ -366,7 +400,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="location" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="location" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Address</Text>
<Text style={styles.detailText}>{user.address || "Not provided"}</Text>
@@ -374,7 +408,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="male-female" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="male-female" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Gender</Text>
<Text style={styles.detailText}>{user.gender || "Not specified"}</Text>
@@ -382,7 +416,7 @@ const Profile = () => {
</View>
<View style={styles.detailRow}>
<Ionicons name="key" size={20} color={colors.Profile} style={styles.detailIcon} />
<Ionicons name="key" size={20} color={colors.pastelBlue} style={styles.detailIcon} />
<View>
<Text style={styles.detailLabel}>Role</Text>
<Text style={styles.detailText}>{user.role || "User"}</Text>
@@ -395,7 +429,7 @@ const Profile = () => {
onPress={() => setEditing(true)}
icon="create"
style={styles.editButton}
buttonBackground={colors.Profile}
buttonBackground={colors.pastelBlue}
/>
</>
) : (
@@ -521,13 +555,13 @@ const styles = StyleSheet.create({
profileCard: {
borderRadius: 20,
margin: 16,
backgroundColor: "#fff",
padding: 20,
shadowColor: "#000",
shadowOpacity: 0.1,
shadowRadius: 10,
shadowOffset: { width: 0, height: 4 },
elevation: 5,
// backgroundColor: "#fff",
// padding: 20,
// shadowColor: "#000",
// shadowOpacity: 0.1,
// shadowRadius: 10,
// shadowOffset: { width: 0, height: 4 },
// elevation: 5,
},
profileImageSection: {
alignItems: "center",
@@ -551,7 +585,7 @@ const styles = StyleSheet.create({
position: "absolute",
right: 0,
bottom: 0,
backgroundColor: "#6366f1",
backgroundColor: colors.pastelBlue,
borderRadius: 20,
width: 40,
height: 40,
@@ -645,19 +679,6 @@ const styles = StyleSheet.create({
inputWithIcon: {
paddingLeft: 40,
},
button: {
backgroundColor: "#6366f1",
paddingVertical: 14,
borderRadius: 12,
alignItems: "center",
justifyContent: "center",
flexDirection: "row",
shadowColor: "#6366f1",
shadowOpacity: 0.3,
shadowRadius: 6,
shadowOffset: { width: 0, height: 3 },
elevation: 4,
},
buttonSecondary: {
backgroundColor: "#f1f5f9",
},