Commit 444fea92 authored by Ishini Kiridena's avatar Ishini Kiridena

new menu and login completed

parent d396644d
......@@ -26,6 +26,7 @@ import PractitionerLogin from "./components/practitionerscreens/login";
import TreatingPatients from "./components/practitionerscreens/treatingPatients";
import ReceivedNFT from "./components/practitionerscreens/recievedNfts";
import NftView from "./components/practitionerscreens/nft-view";
import PatientMainMenu from "./components/patientscreens/patientMenu";
const Stack = createStackNavigator();
......@@ -136,6 +137,7 @@ export default function App() {
<Stack.Screen name="TreatingPatients" component={TreatingPatients} />
<Stack.Screen name="ReceivedNFT" component={ReceivedNFT} />
<Stack.Screen name="NftView" component={NftView} />
<Stack.Screen name="PatientMainMenu" component={PatientMainMenu} />
</Stack.Navigator>
) : (
<SplashScreenComponent />
......
import React from "react";
import { View, Button, StyleSheet } from "react-native";
export default function PatientMainMenu({ navigation }) {
const handlePractitioners = () => {
navigation.navigate("All Practitioners");
};
const handleNftRequests = () => {
navigation.navigate("PatientNFTRequests");
};
const handleChatView = () => {
navigation.navigate("PatientMainChatView");
};
const handleLogout = () => {
navigation.navigate("MainScreen");
};
return (
<View style={styles.container}>
<View style={styles.buttonContainer}>
<Button
title="View Practitioners"
onPress={() => handlePractitioners()}
/>
</View>
<View style={styles.buttonContainer}>
<Button title="Chat" onPress={() => handleChatView()} />
</View>
<View style={styles.buttonContainer}>
<Button title="NFT requests" onPress={() => handleNftRequests()} />
</View>
<View style={styles.buttonContainer}>
<Button title="Logout" onPress={() => handleLogout()} />
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
buttonContainer: {
marginVertical: 10,
width: "80%",
},
});
......@@ -24,7 +24,7 @@ export default function PatientLogin({ navigation, route }) {
});
if (response.ok) {
navigation.navigate("PatientMainChatView");
navigation.navigate("PatientMainMenu");
} else {
// Login failed, show an error message
Alert.alert("Login Failed", "Invalid username or password");
......
......@@ -149,7 +149,7 @@ export default function PatientRegEight({ navigation, route }) {
text: "Close",
style: "cancel",
onPress: () => {
navigation.navigate("PatientMainChatView");
navigation.navigate("PatientMainMenu");
},
},
]);
......
......@@ -14,6 +14,10 @@ export default function PractitionerMainView({ navigation }) {
navigation.navigate("ReceivedNFT");
};
const handleLogout = () => {
navigation.navigate("MainScreen");
};
return (
<View style={styles.container}>
<View style={styles.buttonContainer}>
......@@ -25,6 +29,9 @@ export default function PractitionerMainView({ navigation }) {
<View style={styles.buttonContainer}>
<Button title="View NFTs" onPress={() => handleView()} />
</View>
<View style={styles.buttonContainer}>
<Button title="Logout" onPress={() => handleLogout()} />
</View>
</View>
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment