Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cybermajeed authored Apr 17, 2024
1 parent 2ef3c38 commit d208f36
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 16 deletions.
35 changes: 29 additions & 6 deletions mobile/app/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { SafeAreaView, Button, Text } from "react-native";
import { StatusBar } from "expo-status-bar";
import { Text, View, Image, TouchableOpacity } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { styles } from "../style";
import { auth, signOut, onAuthStateChanged } from "../auth";
import { useState } from "react";
export default function App({ navigation }) {
const [name, setName] = useState("");
onAuthStateChanged(auth, (user) => {
if (user) {
const name = user.email.split("@")[0];
const name = user.email.split("@")[0].toUpperCase();
setName(name);
}
});
Expand All @@ -16,13 +18,34 @@ export default function App({ navigation }) {
console.log("signed out");
})
.catch((error) => {
console.log(error);
console.log("signout error: " + error);
});
};
return (
<SafeAreaView style={styles.container}>
<Text>Hello {name}</Text>
<Button title="Logout" onPress={LogoutUser} />
<SafeAreaView style={[styles.container, styles.dashBoard]}>
<StatusBar style="auto" />
<View style={styles.dashBoard.topNavBar}>
<View style={styles.dashBoard.topNavBar.ImgView}>
<Image
source={require("../assets/logo.png")}
style={styles.dashBoard.topNavBar.Img}
/>
</View>
<View style={styles.dashBoard.topNavBar.welcomeBtnView}>
<TouchableOpacity
onPress={LogoutUser}
style={styles.dashBoard.topNavBar.welcomeBtn}
>
<Text>Hi, {name}</Text>
</TouchableOpacity>
</View>
</View>
<View style={styles.dashBoard.timeTableArea}>
<Image
style={styles.dashBoard.timeTableArea.Img}
source={require("../assets/developer.png")}
/>
</View>
</SafeAreaView>
);
}
21 changes: 11 additions & 10 deletions mobile/app/login.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { StatusBar } from "expo-status-bar";
import {
View,
SafeAreaView,
Image,
TextInput,
Text,
TouchableOpacity,
Alert,
ToastAndroid,
Platform,
} from "react-native";
import { StatusBar } from "expo-status-bar";
import { styles } from "../style";
import { useState, useEffect } from "react";
import { auth, signInWithEmailAndPassword } from "../auth";
Expand Down Expand Up @@ -40,10 +43,12 @@ export default function App({ navigation }) {
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);
Platform.OS == "android"
? ToastAndroid.show(
error.code.split("/")[1].toUpperCase(),
ToastAndroid.SHORT
)
: Alert.alert("Alert", error.code.split("/")[1].toUpperCase());
});
};
//
Expand Down Expand Up @@ -96,11 +101,7 @@ export default function App({ navigation }) {
/>

<TouchableOpacity
onPress={() => {
if (username.trim() && password.trim()) {
LoginUser;
}
}}
onPress={LoginUser}
style={styles.loginScreen.loginInputs.loginBtn}
>
<Text>Login</Text>
Expand Down
48 changes: 48 additions & 0 deletions mobile/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,54 @@ const styles = StyleSheet.create({
},
}),
},
dashBoard: {
display: "flex",
alignContent: "center",
justifyContent: "center",
//
topNavBar: {
height: "10%",
width: "100%",
justifyContent: "space-between",
display: "flex",
flexDirection: "row",
backgroundColor: "#8300fd",
//
ImgView: {
height: "100%",
flex: 1,
paddingVertical: 3,
},
welcomeBtnView: {
height: "100%",
flex: 1,
justifyContent: "center",
paddingHorizontal: 10,
},
Img: {
height: "100%",
width: "40%",
resizeMode: "contain",
alignSelf: "flex-start",
},
welcomeBtn: {
paddingVertical: 10,
paddingHorizontal: 20,
borderRadius: 8,
alignSelf: "flex-end",
backgroundColor: "#fa373f",
},
},
timeTableArea: {
height: "90%",
width: "100%",
justifyContent: "center",
Img: {
width: "100%",
resizeMode: "contain",
},
},
},
});

export { styles };

0 comments on commit d208f36

Please sign in to comment.