Commit ea78a259 authored by Kiridena I.T.K_IT19981840's avatar Kiridena I.T.K_IT19981840

Merge branch 'button-changes' into 'master'

Button changes

See merge request !51
parents 6ef167a5 27b5f190
...@@ -111,33 +111,63 @@ export default function App() { ...@@ -111,33 +111,63 @@ export default function App() {
<Stack.Screen <Stack.Screen
name="PatientMainChatView" name="PatientMainChatView"
component={PatientMainChatView} component={PatientMainChatView}
options={{ headerShown: false }}
/> />
<Stack.Screen <Stack.Screen
name="All Practitioners" name="All Practitioners"
component={PatientAllPractitioners} component={PatientAllPractitioners}
options={{ headerShown: false }}
/> />
<Stack.Screen <Stack.Screen
name="PatientNFTRequests" name="PatientNFTRequests"
component={PatientNFTRequests} component={PatientNFTRequests}
options={{ headerShown: false }}
/> />
<Stack.Screen <Stack.Screen
name="PractitionerRegistration" name="PractitionerRegistration"
component={PractitionerRegistration} component={PractitionerRegistration}
options={{ headerShown: false }}
/> />
<Stack.Screen <Stack.Screen
name="PractitionerMainView" name="PractitionerMainView"
component={PractitionerMainView} component={PractitionerMainView}
options={{ headerShown: false }}
/>
<Stack.Screen
name="PatientLogin"
component={PatientLogin}
options={{ headerShown: false }}
/>
<Stack.Screen
name="PatientRequests"
component={PatientRequests}
options={{ headerShown: false }}
/> />
<Stack.Screen name="PatientLogin" component={PatientLogin} />
<Stack.Screen name="PatientRequests" component={PatientRequests} />
<Stack.Screen <Stack.Screen
name="PractitionerLogin" name="PractitionerLogin"
component={PractitionerLogin} component={PractitionerLogin}
options={{ headerShown: false }}
/>
<Stack.Screen
name="TreatingPatients"
component={TreatingPatients}
options={{ headerShown: false }}
/>
<Stack.Screen
name="ReceivedNFT"
component={ReceivedNFT}
options={{ headerShown: false }}
/>
<Stack.Screen
name="NftView"
component={NftView}
options={{ headerShown: false }}
/>
<Stack.Screen
name="PatientMainMenu"
component={PatientMainMenu}
options={{ headerShown: false }}
/> />
<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> </Stack.Navigator>
) : ( ) : (
<SplashScreenComponent /> <SplashScreenComponent />
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { View, Text, StyleSheet, Button } from "react-native"; import {
View,
Text,
StyleSheet,
Button,
ActivityIndicator,
} from "react-native";
import { LOCALBACKEND } from "../../env"; import { LOCALBACKEND } from "../../env";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
export default function PatientAllPractitioners({ navigation, router }) { export default function PatientAllPractitioners({ navigation, router }) {
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [stellarPublicKey, setStellarPublicKey] = useState(""); const [stellarPublicKey, setStellarPublicKey] = useState("");
const [isRequested, setRequested] = useState(false);
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
...@@ -27,16 +34,21 @@ export default function PatientAllPractitioners({ navigation, router }) { ...@@ -27,16 +34,21 @@ export default function PatientAllPractitioners({ navigation, router }) {
const renderItem = (item) => { const renderItem = (item) => {
return ( return (
<View key={item._id}> <View style={styles.item} key={item._id}>
<Text>Full Name: {item.fullname}</Text> <Text>Full Name: {item.fullname}</Text>
<Text>Public Key: {item.publickey}</Text> <Text>Public Key: {item.publickey}</Text>
<Text>Workspace: {item.workspace}</Text> <Text>Workspace: {item.workspace}</Text>
<Button title="Request" onPress={() => handleRequest(item)} /> <Button
color="#703BE7"
title="Request"
onPress={() => handleRequest(item)}
/>
</View> </View>
); );
}; };
const handleRequest = async (item) => { const handleRequest = async (item) => {
setRequested(true);
try { try {
const value = await AsyncStorage.getItem("patientStellarPublicKey"); const value = await AsyncStorage.getItem("patientStellarPublicKey");
if (value != null) { if (value != null) {
...@@ -58,6 +70,7 @@ export default function PatientAllPractitioners({ navigation, router }) { ...@@ -58,6 +70,7 @@ export default function PatientAllPractitioners({ navigation, router }) {
}); });
const responseData = await reqResponse.json(); const responseData = await reqResponse.json();
setRequested(false);
} catch (errorWhenSendingReqObj) { } catch (errorWhenSendingReqObj) {
console.log("Error when sending request to practitioner"); console.log("Error when sending request to practitioner");
} }
...@@ -69,24 +82,34 @@ export default function PatientAllPractitioners({ navigation, router }) { ...@@ -69,24 +82,34 @@ export default function PatientAllPractitioners({ navigation, router }) {
"Error fetching public key from async storage data:", "Error fetching public key from async storage data:",
errorWhenPublicKey errorWhenPublicKey
); );
setRequested(false);
} }
// Handle the request for the specific item by requesting the practitioner // Handle the request for the specific item by requesting the practitioner
console.log("Requested:", item); console.log("Requested:", item);
}; };
return ( return (
<View style={styles.container}>{data.map((item) => renderItem(item))}</View> <View style={styles.container}>
{isRequested ? (
<ActivityIndicator size="large" color="#000" />
) : (
<>{data.map((item) => renderItem(item))}</>
)}
</View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: "center",
alignItems: "center", alignItems: "center",
padding: 20,
}, },
text: { text: {
fontSize: 24, fontSize: 24,
fontWeight: "bold", fontWeight: "bold",
}, },
item: {
padding: 10,
},
}); });
...@@ -97,7 +97,7 @@ export default function PatientConsentForm({ navigation, route }) { ...@@ -97,7 +97,7 @@ export default function PatientConsentForm({ navigation, route }) {
<Button title="Cancel" onPress={handleCancel} /> */} <Button title="Cancel" onPress={handleCancel} /> */}
<View style={{ marginTop: 10 }}> <View style={{ marginTop: 10 }}>
<Button title="Agree" onPress={handleAgree} /> <Button title="Agree" onPress={handleAgree} color="#703BE7" />
</View> </View>
<View style={{ marginTop: 10, marginBottom: 10 }}> <View style={{ marginTop: 10, marginBottom: 10 }}>
<Button title="Cancel" onPress={handleCancel} color="red" /> <Button title="Cancel" onPress={handleCancel} color="red" />
......
...@@ -44,7 +44,11 @@ export default function PatientNFTRequests({ navigation }) { ...@@ -44,7 +44,11 @@ export default function PatientNFTRequests({ navigation }) {
return ( return (
<View key={item._id}> <View key={item._id}>
<Text>Key: {item.requesterpk}</Text> <Text>Key: {item.requesterpk}</Text>
<Button title="Send NFT" onPress={() => handleSendNFT(item)}></Button> <Button
color="#703BE7"
title="Send NFT"
onPress={() => handleSendNFT(item)}
></Button>
</View> </View>
); );
}; };
......
...@@ -44,9 +44,9 @@ export default function PatientMainChatView({ route }) { ...@@ -44,9 +44,9 @@ export default function PatientMainChatView({ route }) {
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<View style={{ flexDirection: "row", alignItems: "center", padding: 10 }}> <View
<Text style={{ fontSize: 20, marginLeft: 10 }}>Chat</Text> style={{ flexDirection: "row", alignItems: "center", padding: 10 }}
</View> ></View>
{/* Chat messages */} {/* Chat messages */}
<View style={{ flex: 1, padding: 10 }}> <View style={{ flex: 1, padding: 10 }}>
{chatMessages.map((msg) => ( {chatMessages.map((msg) => (
...@@ -81,7 +81,7 @@ export default function PatientMainChatView({ route }) { ...@@ -81,7 +81,7 @@ export default function PatientMainChatView({ route }) {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
{/* Bottom buttons */} {/* Bottom buttons
<View <View
style={{ style={{
flexDirection: "row", flexDirection: "row",
...@@ -99,7 +99,7 @@ export default function PatientMainChatView({ route }) { ...@@ -99,7 +99,7 @@ export default function PatientMainChatView({ route }) {
<TouchableOpacity onPress={navigateToOthers}> <TouchableOpacity onPress={navigateToOthers}>
<Text>Others</Text> <Text>Others</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View> */}
</View> </View>
); );
} }
...@@ -20,18 +20,23 @@ export default function PatientMainMenu({ navigation }) { ...@@ -20,18 +20,23 @@ export default function PatientMainMenu({ navigation }) {
<View style={styles.container}> <View style={styles.container}>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button <Button
color="#703BE7"
title="View Practitioners" title="View Practitioners"
onPress={() => handlePractitioners()} onPress={() => handlePractitioners()}
/> />
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="Chat" onPress={() => handleChatView()} /> <Button color="#703BE7" title="Chat" onPress={() => handleChatView()} />
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="NFT requests" onPress={() => handleNftRequests()} /> <Button
color="#703BE7"
title="NFT requests"
onPress={() => handleNftRequests()}
/>
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="Logout" onPress={() => handleLogout()} /> <Button color="red" title="Logout" onPress={() => handleLogout()} />
</View> </View>
</View> </View>
); );
......
import React, { useState } from "react"; import React, { useState } from "react";
import { View, TextInput, Button, Alert } from "react-native"; import { View, TextInput, Button, Alert, StyleSheet } from "react-native";
import { LOCALBACKEND } from "../../../env"; import { LOCALBACKEND } from "../../../env";
import EncryptWithServerKey from "../../../services/encryptByServerKey"; import EncryptWithServerKey from "../../../services/encryptByServerKey";
...@@ -37,19 +37,51 @@ export default function PatientLogin({ navigation, route }) { ...@@ -37,19 +37,51 @@ export default function PatientLogin({ navigation, route }) {
}; };
return ( return (
<View> <View style={styles.container}>
<TextInput <TextInput
style={styles.input}
placeholder="Username" placeholder="Username"
value={username} value={username}
onChangeText={setUsername} onChangeText={setUsername}
/> />
<TextInput <TextInput
style={styles.input}
placeholder="Password" placeholder="Password"
value={password} value={password}
onChangeText={setPassword} onChangeText={setPassword}
secureTextEntry secureTextEntry
/> />
<Button title="Login" onPress={handleLogin} /> <Button title="Login" onPress={handleLogin} color="#703BE7" />
</View> </View>
); );
} }
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
input: {
width: "80%",
height: 40,
marginVertical: 10,
paddingHorizontal: 10,
borderColor: "gray",
borderWidth: 1,
borderRadius: 5,
},
button: {
width: "80%",
height: 60, // Adjust the height value to make the button taller
backgroundColor: "#560CCE",
justifyContent: "center",
alignItems: "center",
borderRadius: 30, // Adjust the border radius value to make the edges rounder
marginTop: 10,
},
buttonText: {
color: "white",
fontSize: 16,
fontWeight: "bold",
},
});
...@@ -184,7 +184,8 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -184,7 +184,8 @@ export default function PatientRegEight({ navigation, route }) {
<ActivityIndicator size="large" color="#560CCE" /> <ActivityIndicator size="large" color="#560CCE" />
) : ( ) : (
<> <>
<Text>Highest Education Level:</Text> <Text style={styles.label}>Highest Education Level:</Text>
<View style={styles.separator} />
<RadioForm animation={true}> <RadioForm animation={true}>
{educationLevelOptions.map((option, index) => ( {educationLevelOptions.map((option, index) => (
<RadioButton <RadioButton
...@@ -197,9 +198,9 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -197,9 +198,9 @@ export default function PatientRegEight({ navigation, route }) {
index={index} index={index}
isSelected={educationLevel === option.value} isSelected={educationLevel === option.value}
onPress={() => setEducationLevel(option.value)} onPress={() => setEducationLevel(option.value)}
buttonInnerColor={"#2196f3"} buttonInnerColor={"#703BE7"}
buttonOuterColor={ buttonOuterColor={
educationLevel === option.value ? "#2196f3" : "#000" educationLevel === option.value ? "#703BE7" : "#703BE7"
} }
buttonSize={15} buttonSize={15}
buttonOuterSize={25} buttonOuterSize={25}
...@@ -216,8 +217,9 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -216,8 +217,9 @@ export default function PatientRegEight({ navigation, route }) {
</RadioButton> </RadioButton>
))} ))}
</RadioForm> </RadioForm>
<View style={styles.separator} />
<Text>Employed:</Text> <Text style={styles.label}>Employed:</Text>
<View style={styles.separator} />
<RadioForm animation={true}> <RadioForm animation={true}>
{employedOptions.map((option, index) => ( {employedOptions.map((option, index) => (
<RadioButton <RadioButton
...@@ -230,9 +232,9 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -230,9 +232,9 @@ export default function PatientRegEight({ navigation, route }) {
index={index} index={index}
isSelected={employedStatus === option.value} isSelected={employedStatus === option.value}
onPress={() => setEmployedStatus(option.value)} onPress={() => setEmployedStatus(option.value)}
buttonInnerColor={"#2196f3"} buttonInnerColor={"#703BE7"}
buttonOuterColor={ buttonOuterColor={
employedStatus === option.value ? "#2196f3" : "#000" employedStatus === option.value ? "#703BE7" : "#703BE7"
} }
buttonSize={15} buttonSize={15}
buttonOuterSize={25} buttonOuterSize={25}
...@@ -249,8 +251,9 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -249,8 +251,9 @@ export default function PatientRegEight({ navigation, route }) {
</RadioButton> </RadioButton>
))} ))}
</RadioForm> </RadioForm>
<View style={styles.buttonContainer}>
<Button title="All Done" onPress={handleSave} /> <Button title="All Done" onPress={handleSave} color="#703BE7" />
</View>
</> </>
)} )}
</View> </View>
...@@ -259,7 +262,18 @@ export default function PatientRegEight({ navigation, route }) { ...@@ -259,7 +262,18 @@ export default function PatientRegEight({ navigation, route }) {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: "center", padding: 16,
justifyContent: "center", justifyContent: "center",
}, },
buttonContainer: {
width: "100%",
marginTop: 10,
},
separator: {
height: 20,
},
label: {
fontSize: 16,
marginBottom: 8,
},
}); });
...@@ -54,7 +54,8 @@ export default function PatientRegFive({ navigation, route }) { ...@@ -54,7 +54,8 @@ export default function PatientRegFive({ navigation, route }) {
onPress={handleRelationshipStatusChange} onPress={handleRelationshipStatusChange}
formHorizontal={false} formHorizontal={false}
labelHorizontal={true} labelHorizontal={true}
buttonColor={"#2196f3"} buttonColor={"#703BE7"}
selectedButtonColor={"#703BE7"}
/> />
<Text style={styles.label}>Number of Children:</Text> <Text style={styles.label}>Number of Children:</Text>
...@@ -64,8 +65,8 @@ export default function PatientRegFive({ navigation, route }) { ...@@ -64,8 +65,8 @@ export default function PatientRegFive({ navigation, route }) {
onChangeText={handleNumberOfChildrenChange} onChangeText={handleNumberOfChildrenChange}
keyboardType="numeric" keyboardType="numeric"
/> />
<View style={styles.buttonContainer}></View>
<Button title="Next" onPress={handleNext} /> <Button title="Next" onPress={handleNext} color="#703BE7"/>
</View> </View>
); );
} }
......
...@@ -43,26 +43,36 @@ export default function PatientRegFour({ navigation, route }) { ...@@ -43,26 +43,36 @@ export default function PatientRegFour({ navigation, route }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text>Did you grow up with parents?</Text> <Text style={styles.label}>Did you grow up with parents?</Text>
<RadioForm <RadioForm
radio_props={radioOptions} radio_props={radioOptions}
initial={parentStatus} initial={parentStatus}
onPress={handleParentStatusChange} onPress={handleParentStatusChange}
formHorizontal={false} formHorizontal={false}
labelHorizontal={true} labelHorizontal={true}
buttonColor={"#2196f3"} buttonColor={"#703BE7"}
selectedButtonColor={"#2196f3"} selectedButtonColor={"#703BE7"}
labelStyle={{ fontSize: 16, marginHorizontal: 10 }} labelStyle={{ fontSize: 16, marginHorizontal: 10 }}
style={{ marginVertical: 10 }} style={{ marginVertical: 10 }}
/> />
<Button title="Next" onPress={handleNext} /> <View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: "center", padding: 16,
justifyContent: "center", justifyContent: "center",
}, },
buttonContainer: {
width: "100%",
marginTop: 10,
},
label: {
fontSize: 16,
marginBottom: 8,
},
}); });
...@@ -21,31 +21,42 @@ export default function PatientRegFourOptional({ navigation, route }) { ...@@ -21,31 +21,42 @@ export default function PatientRegFourOptional({ navigation, route }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text>How many siblings did you have?</Text> <Text style={styles.label}>How many siblings did you have?</Text>
<TextInput <TextInput
style={styles.input} style={styles.input}
onChangeText={(text) => setSiblingCount(text)} onChangeText={(text) => setSiblingCount(text)}
value={siblingCount.toString()} value={siblingCount.toString()}
keyboardType="numeric" keyboardType="numeric"
/> />
<Button title="Next" onPress={handleNext} /> <View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: "center", padding: 16,
justifyContent: "center", justifyContent: "center",
}, },
inputContainer: { inputContainer: {
marginTop: 20, marginTop: 30,
}, },
input: { input: {
height: 40, height: 40,
width: 200, width: "100%",
borderColor: "gray", borderColor: "gray",
borderWidth: 1, borderWidth: 1,
paddingHorizontal: 10, paddingHorizontal: 10,
marginTop: 20,
},
buttonContainer: {
width: "100%",
marginTop: 20,
},
label: {
fontSize: 16,
marginBottom: 8,
}, },
}); });
import React, { useState } from "react"; import React, { useState } from "react";
import { View, TextInput, Button, StyleSheet,TouchableHighlight,Text } from "react-native"; import {
View,
TextInput,
Button,
StyleSheet,
TouchableHighlight,
Text,
} from "react-native";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
export default function PatientRegOne() { export default function PatientRegOne() {
...@@ -39,10 +46,7 @@ export default function PatientRegOne() { ...@@ -39,10 +46,7 @@ export default function PatientRegOne() {
secureTextEntry={true} secureTextEntry={true}
/> />
{/* <Button title="Next" onPress={handleNext} color="#703BE7"/> */} {/* <Button title="Next" onPress={handleNext} color="#703BE7"/> */}
<TouchableHighlight <TouchableHighlight style={styles.button} onPress={handleNext}>
style={styles.button}
onPress={handleNext}
>
<Text style={styles.buttonText}>Next</Text> <Text style={styles.buttonText}>Next</Text>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
......
...@@ -30,31 +30,32 @@ export default function PatientRegSeven({ navigation, route }) { ...@@ -30,31 +30,32 @@ export default function PatientRegSeven({ navigation, route }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text>Ethnicity:</Text>
<TextInput <TextInput
style={styles.input} style={styles.input}
placeholder="Ethnicity"
value={ethnicity} value={ethnicity}
onChangeText={setEthnicity} onChangeText={setEthnicity}
maxLength={64} maxLength={64}
/> />
<Text>Religion:</Text>
<TextInput <TextInput
placeholder="Religion"
style={styles.input} style={styles.input}
value={religion} value={religion}
onChangeText={setReligion} onChangeText={setReligion}
maxLength={64} maxLength={64}
/> />
<Text>Nationality:</Text>
<TextInput <TextInput
placeholder="Nationality"
style={styles.input} style={styles.input}
value={nationality} value={nationality}
onChangeText={setNationality} onChangeText={setNationality}
maxLength={64} maxLength={64}
/> />
<View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} /> <Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
...@@ -66,8 +67,16 @@ const styles = StyleSheet.create({ ...@@ -66,8 +67,16 @@ const styles = StyleSheet.create({
alignItems: "center", alignItems: "center",
}, },
input: { input: {
borderWidth: 1, width: "80%",
height: 40,
marginVertical: 10,
paddingHorizontal: 10,
borderColor: "gray", borderColor: "gray",
marginBottom: 10, borderWidth: 1,
borderRadius: 5,
},
buttonContainer: {
width: "80%",
marginTop: 10,
}, },
}); });
...@@ -49,9 +49,12 @@ export default function PatientRegSix({ navigation, route }) { ...@@ -49,9 +49,12 @@ export default function PatientRegSix({ navigation, route }) {
onPress={handleOptionSelect} onPress={handleOptionSelect}
formHorizontal={false} formHorizontal={false}
labelHorizontal={true} labelHorizontal={true}
buttonColor={"#2196f3"} buttonColor={"#703BE7"}
selectedButtonColor={"#703BE7"}
/> />
<Button title="Next" onPress={handleNext} /> <View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
...@@ -60,11 +63,14 @@ const styles = StyleSheet.create({ ...@@ -60,11 +63,14 @@ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: "center", justifyContent: "center",
alignItems: "center",
padding: 20, padding: 20,
}, },
label: { label: {
fontSize: 18, fontSize: 18,
marginBottom: 10, marginBottom: 10,
}, },
buttonContainer: {
width: "100%",
marginTop: 10,
},
}); });
...@@ -60,8 +60,14 @@ export default function PatientRegThree({ navigation, route }) { ...@@ -60,8 +60,14 @@ export default function PatientRegThree({ navigation, route }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text>Date of Birth</Text> <Text style={styles.label}>Date of Birth</Text>
<Button title="Pick a date" onPress={() => setShowDatePicker(true)} /> <View style={styles.buttonContainer}>
<Button
title="Pick a date"
onPress={() => setShowDatePicker(true)}
color="#703BE7"
/>
</View>
{showDatePicker && ( {showDatePicker && (
<DateTimePicker <DateTimePicker
value={birthday} value={birthday}
...@@ -71,26 +77,28 @@ export default function PatientRegThree({ navigation, route }) { ...@@ -71,26 +77,28 @@ export default function PatientRegThree({ navigation, route }) {
/> />
)} )}
<Text>Gender</Text> <Text style={styles.label}>Gender</Text>
<RadioForm <RadioForm
radio_props={radioOptions} radio_props={radioOptions}
initial={0} initial={0}
onPress={(value) => setGender(value)} onPress={(value) => setGender(value)}
formHorizontal={true} formHorizontal={true}
labelHorizontal={false} labelHorizontal={false}
buttonColor={"#2196f3"} buttonColor={"#703BE7"}
selectedButtonColor={"#2196f3"} selectedButtonColor={"#703BE7"}
labelStyle={{ fontSize: 16, marginHorizontal: 10 }} labelStyle={{ fontSize: 16, marginHorizontal: 10 }}
style={{ marginVertical: 10 }} style={{ marginVertical: 10 }}
/> />
<Button title="Next" onPress={handleNext} /> <View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: "center", padding: 16,
justifyContent: "center", justifyContent: "center",
}, },
input: { input: {
...@@ -129,4 +137,8 @@ const styles = StyleSheet.create({ ...@@ -129,4 +137,8 @@ const styles = StyleSheet.create({
btnTextCancel: { btnTextCancel: {
color: "#666", color: "#666",
}, },
buttonContainer: {
width: "100%",
marginTop: 10,
},
}); });
...@@ -47,12 +47,14 @@ export default function PatientRegTwo() { ...@@ -47,12 +47,14 @@ export default function PatientRegTwo() {
onPress={(value) => setPronoun(value)} onPress={(value) => setPronoun(value)}
formHorizontal={true} formHorizontal={true}
labelHorizontal={false} labelHorizontal={false}
buttonColor={"#2196f3"} buttonColor={"#703BE7"}
selectedButtonColor={"#2196f3"} selectedButtonColor={"#703BE7"}
labelStyle={{ fontSize: 16, marginHorizontal: 10 }} labelStyle={{ fontSize: 16, marginHorizontal: 10 }}
style={{ marginVertical: 10 }} style={{ marginVertical: 10 }}
/> />
<Button title="Next" onPress={handleNext} /> <View style={styles.buttonContainer}>
<Button title="Next" onPress={handleNext} color="#703BE7" />
</View>
</View> </View>
); );
} }
...@@ -77,4 +79,8 @@ const styles = StyleSheet.create({ ...@@ -77,4 +79,8 @@ const styles = StyleSheet.create({
fontWeight: "bold", fontWeight: "bold",
marginVertical: 10, marginVertical: 10,
}, },
buttonContainer: {
width: "80%",
marginTop: 10,
},
}); });
import React, { useState } from "react"; import React, { useState } from "react";
import { View, TextInput, Button, Alert } from "react-native"; import { View, TextInput, Button, Alert, StyleSheet } from "react-native";
import { LOCALBACKEND } from "../../env"; import { LOCALBACKEND } from "../../env";
import EncryptWithServerKey from "../../services/encryptByServerKey"; import EncryptWithServerKey from "../../services/encryptByServerKey";
...@@ -37,19 +37,51 @@ export default function PractitionerLogin({ navigation, route }) { ...@@ -37,19 +37,51 @@ export default function PractitionerLogin({ navigation, route }) {
}; };
return ( return (
<View> <View style={styles.container}>
<TextInput <TextInput
style={styles.input}
placeholder="Username" placeholder="Username"
value={username} value={username}
onChangeText={setUsername} onChangeText={setUsername}
/> />
<TextInput <TextInput
style={styles.input}
placeholder="Password" placeholder="Password"
value={password} value={password}
onChangeText={setPassword} onChangeText={setPassword}
secureTextEntry secureTextEntry
/> />
<Button title="Login" onPress={handleLogin} /> <Button color="#703BE7" title="Login" onPress={handleLogin} />
</View> </View>
); );
} }
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
input: {
width: "80%",
height: 40,
marginVertical: 10,
paddingHorizontal: 10,
borderColor: "gray",
borderWidth: 1,
borderRadius: 5,
},
button: {
width: "80%",
height: 60, // Adjust the height value to make the button taller
backgroundColor: "#560CCE",
justifyContent: "center",
alignItems: "center",
borderRadius: 30, // Adjust the border radius value to make the edges rounder
marginTop: 10,
},
buttonText: {
color: "white",
fontSize: 16,
fontWeight: "bold",
},
});
...@@ -21,16 +21,28 @@ export default function PractitionerMainView({ navigation }) { ...@@ -21,16 +21,28 @@ export default function PractitionerMainView({ navigation }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="User Requests" onPress={() => handleUserReq()} /> <Button
color="#703BE7"
title="User Requests"
onPress={() => handleUserReq()}
/>
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="Request EHRs" onPress={() => handleRequesting()} /> <Button
color="#703BE7"
title="Request EHRs"
onPress={() => handleRequesting()}
/>
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="View NFTs" onPress={() => handleView()} /> <Button
color="#703BE7"
title="View NFTs"
onPress={() => handleView()}
/>
</View> </View>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<Button title="Logout" onPress={() => handleLogout()} /> <Button color="red" title="Logout" onPress={() => handleLogout()} />
</View> </View>
</View> </View>
); );
......
...@@ -4,7 +4,14 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; ...@@ -4,7 +4,14 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import RSADecrypt from "../../services/decryptByRsaKey"; import RSADecrypt from "../../services/decryptByRsaKey";
import DecryptWithAssetKey from "../../services/decryptByAssetKey"; import DecryptWithAssetKey from "../../services/decryptByAssetKey";
import { WebView } from "react-native-webview"; import { WebView } from "react-native-webview";
import { View, Text, useWindowDimensions, ScrollView } from "react-native"; import {
View,
Text,
useWindowDimensions,
ScrollView,
ActivityIndicator,
StyleSheet,
} from "react-native";
import RenderHTML from "react-native-render-html"; import RenderHTML from "react-native-render-html";
export default function NftView({ navigation, route }) { export default function NftView({ navigation, route }) {
...@@ -14,12 +21,14 @@ export default function NftView({ navigation, route }) { ...@@ -14,12 +21,14 @@ export default function NftView({ navigation, route }) {
const [ipfsContent, setIpfsContent] = useState(""); const [ipfsContent, setIpfsContent] = useState("");
const [decryptedContent, setDecrypted] = useState(""); const [decryptedContent, setDecrypted] = useState("");
const { width } = useWindowDimensions(); const { width } = useWindowDimensions();
const [isLoaded, setLoaded] = useState(false);
useEffect(() => { useEffect(() => {
fetchRequests(); fetchRequests();
}, []); }, []);
const fetchRequests = async () => { const fetchRequests = async () => {
setLoaded(true);
console.log("Asset code ", assetCode); console.log("Asset code ", assetCode);
const assetCode = route.params.assetcode; const assetCode = route.params.assetcode;
...@@ -48,20 +57,54 @@ export default function NftView({ navigation, route }) { ...@@ -48,20 +57,54 @@ export default function NftView({ navigation, route }) {
); );
setDecrypted(decryptedIpfsContent); setDecrypted(decryptedIpfsContent);
console.log(decryptedIpfsContent); console.log(decryptedIpfsContent);
setLoaded(false);
} catch (errorWhenGGettingIPFSContent) { } catch (errorWhenGGettingIPFSContent) {
console.error( console.error(
"Error when getting IPFS content :", "Error when getting IPFS content :",
errorWhenGGettingIPFSContent errorWhenGGettingIPFSContent
); );
setLoaded(false);
} }
} catch (errorWhenGettingNftDetails) { } catch (errorWhenGettingNftDetails) {
console.log("Error when getting NFT details"); console.log("Error when getting NFT details");
setLoaded(false);
} }
}; };
return ( return (
<ScrollView> <ScrollView>
<RenderHTML contentWidth={width} source={{ html: decryptedContent }} /> {isLoaded ? (
<ActivityIndicator
style={styles.item}
color="#000"
size="large"
></ActivityIndicator>
) : (
<>
<RenderHTML
contentWidth={width}
source={{ html: decryptedContent }}
baseStyle={styles.container}
/>
</>
)}
</ScrollView> </ScrollView>
); );
} }
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
padding: 30,
},
text: {
fontSize: 24,
fontWeight: "bold",
},
item: {
padding: 100,
},
sep: {
height: 20,
},
});
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { LOCALBACKEND } from "../../env"; import { LOCALBACKEND } from "../../env";
import { Button, StyleSheet, View, Text } from "react-native"; import {
Button,
StyleSheet,
View,
Text,
ActivityIndicator,
} from "react-native";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import EncryptWithServerKey from "../../services/encryptByServerKey"; import EncryptWithServerKey from "../../services/encryptByServerKey";
export default function PatientRequests() { export default function PatientRequests() {
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [isAccepted, setAccepted] = useState(false);
useEffect(() => { useEffect(() => {
fetchRequests(); fetchRequests();
...@@ -43,13 +50,17 @@ export default function PatientRequests() { ...@@ -43,13 +50,17 @@ export default function PatientRequests() {
const renderItem = (item) => { const renderItem = (item) => {
return ( return (
<View key={item._id}> <View style={styles.item} key={item._id}>
<Text>Key: {item.patient}</Text> <Text>Key: {item.patient}</Text>
<View style={styles.sep}></View>
<Button <Button
color="#703BE7"
title="Accept" title="Accept"
onPress={() => handleAcceptance(item, "Accepted")} onPress={() => handleAcceptance(item, "Accepted")}
></Button> ></Button>
<View style={styles.sep}></View>
<Button <Button
color="red"
title="Reject" title="Reject"
onPress={() => handleAcceptance(item, "Rejected")} onPress={() => handleAcceptance(item, "Rejected")}
></Button> ></Button>
...@@ -58,6 +69,7 @@ export default function PatientRequests() { ...@@ -58,6 +69,7 @@ export default function PatientRequests() {
}; };
const handleAcceptance = async (item, status) => { const handleAcceptance = async (item, status) => {
setAccepted(true);
//get the practitioner keys //get the practitioner keys
try { try {
const practitionerKey = await AsyncStorage.getItem( const practitionerKey = await AsyncStorage.getItem(
...@@ -93,27 +105,42 @@ export default function PatientRequests() { ...@@ -93,27 +105,42 @@ export default function PatientRequests() {
const responseData = await acceptanceResponse.json(); const responseData = await acceptanceResponse.json();
console.log(responseData); console.log(responseData);
setAccepted(false);
} catch (errorWhenSendingAcceptance) { } catch (errorWhenSendingAcceptance) {
console.log("Error when sending payload"); console.log("Error when sending payload");
setAccepted(false);
} }
} catch (errorWheGettingKeyPair) { } catch (errorWheGettingKeyPair) {
console.log("Getting key pair from async failed"); console.log("Getting key pair from async failed");
setAccepted(false);
} }
}; };
return ( return (
<View style={styles.container}>{data.map((item) => renderItem(item))}</View> <View style={styles.container}>
{isAccepted ? (
<ActivityIndicator color="#000" size="large"></ActivityIndicator>
) : (
<>{data.map((item) => renderItem(item))}</>
)}
</View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: "center",
alignItems: "center", alignItems: "center",
padding: 30,
}, },
text: { text: {
fontSize: 24, fontSize: 24,
fontWeight: "bold", fontWeight: "bold",
}, },
item: {
padding: 10,
},
sep: {
height: 20,
},
}); });
...@@ -42,9 +42,13 @@ export default function ReceivedNFT({ navigation }) { ...@@ -42,9 +42,13 @@ export default function ReceivedNFT({ navigation }) {
const renderItem = (item) => { const renderItem = (item) => {
return ( return (
<View key={item._id}> <View style={styles.item} key={item._id}>
<Text>Key: {item.assetcode}</Text> <Text>Key: {item.assetcode}</Text>
<Button title="View NFT" onPress={() => handleViewNFT(item)}></Button> <Button
color="#703BE7"
title="View NFT"
onPress={() => handleViewNFT(item)}
></Button>
</View> </View>
); );
}; };
...@@ -62,11 +66,12 @@ export default function ReceivedNFT({ navigation }) { ...@@ -62,11 +66,12 @@ export default function ReceivedNFT({ navigation }) {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: "center",
alignItems: "center",
}, },
text: { text: {
fontSize: 24, fontSize: 24,
fontWeight: "bold", fontWeight: "bold",
}, },
item: {
padding: 20,
},
}); });
...@@ -153,7 +153,7 @@ export default function PractitionerRegistration() { ...@@ -153,7 +153,7 @@ export default function PractitionerRegistration() {
value={email} value={email}
onChangeText={(text) => setEmail(text)} onChangeText={(text) => setEmail(text)}
/> />
<Button title="Register" onPress={handleNext} /> <Button color="#703BE7" title="Register" onPress={handleNext} />
</> </>
)} )}
</View> </View>
......
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { LOCALBACKEND } from "../../env"; import { LOCALBACKEND } from "../../env";
import { Button, StyleSheet, View, Text, Alert } from "react-native"; import {
Button,
StyleSheet,
View,
Text,
Alert,
ActivityIndicator,
} from "react-native";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import EncryptWithServerKey from "../../services/encryptByServerKey"; import EncryptWithServerKey from "../../services/encryptByServerKey";
import Toast from "react-native-toast-message"; import Toast from "react-native-toast-message";
export default function TreatingPatients({ navigation }) { export default function TreatingPatients({ navigation }) {
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [isRequested, setRequested] = useState(false);
useEffect(() => { useEffect(() => {
fetchRequests(); fetchRequests();
...@@ -43,10 +51,11 @@ export default function TreatingPatients({ navigation }) { ...@@ -43,10 +51,11 @@ export default function TreatingPatients({ navigation }) {
const renderItem = (item) => { const renderItem = (item) => {
return ( return (
<View key={item._id}> <View style={styles.item} key={item._id}>
<Text>Key: {item.patient}</Text> <Text>Key: {item.patient}</Text>
<Button <Button
title="Request EHR" title="Request EHR"
color="#703BE7"
onPress={() => handleRequesting(item)} onPress={() => handleRequesting(item)}
></Button> ></Button>
</View> </View>
...@@ -54,6 +63,7 @@ export default function TreatingPatients({ navigation }) { ...@@ -54,6 +63,7 @@ export default function TreatingPatients({ navigation }) {
}; };
const handleRequesting = async (item) => { const handleRequesting = async (item) => {
setRequested(true);
//get the practitioner keys //get the practitioner keys
try { try {
const practitionerKey = await AsyncStorage.getItem( const practitionerKey = await AsyncStorage.getItem(
...@@ -92,7 +102,7 @@ export default function TreatingPatients({ navigation }) { ...@@ -92,7 +102,7 @@ export default function TreatingPatients({ navigation }) {
}, },
body: JSON.stringify(requestOj), body: JSON.stringify(requestOj),
}); });
setRequested(false);
Toast.show({ Toast.show({
type: "success", // 'success', 'error', 'info', 'warning' type: "success", // 'success', 'error', 'info', 'warning'
text1: "Request added", text1: "Request added",
...@@ -100,17 +110,28 @@ export default function TreatingPatients({ navigation }) { ...@@ -100,17 +110,28 @@ export default function TreatingPatients({ navigation }) {
autoHide: true, autoHide: true,
}); });
const responseData = await nftRequestResponse.json(); const responseData = await nftRequestResponse.json();
setRequested(false);
} catch (error) { } catch (error) {
setRequested(false);
console.error("Error when calling the request NFT"); console.error("Error when calling the request NFT");
} }
} catch (errorWheGettingKeyPair) { } catch (errorWheGettingKeyPair) {
setRequested(false);
console.error("Error when getting keypair"); console.error("Error when getting keypair");
} }
}; };
return ( return (
<View style={styles.container}> <View style={styles.container}>
{data.map((item) => renderItem(item))} {isRequested ? (
<ActivityIndicator color="#000" size="large"></ActivityIndicator>
) : (
<>
<View>{data.map((item) => renderItem(item))}</View>
</>
)}
<Toast ref={(ref) => Toast.setRef(ref)} /> <Toast ref={(ref) => Toast.setRef(ref)} />
</View> </View>
); );
...@@ -119,11 +140,14 @@ export default function TreatingPatients({ navigation }) { ...@@ -119,11 +140,14 @@ export default function TreatingPatients({ navigation }) {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: "center", padding: 30,
alignItems: "center", alignItems: "center",
}, },
text: { text: {
fontSize: 24, fontSize: 24,
fontWeight: "bold", fontWeight: "bold",
}, },
item: {
padding: 20,
},
}); });
...@@ -8,11 +8,13 @@ export default function SharedLogin({ navigation }) { ...@@ -8,11 +8,13 @@ export default function SharedLogin({ navigation }) {
<Button <Button
title="I am here to get help" title="I am here to get help"
onPress={() => navigation.navigate("PatientLogin")} onPress={() => navigation.navigate("PatientLogin")}
color="#703BE7"
/> />
<View style={styles.separator} /> <View style={styles.separator} />
<Button <Button
title="I am here to help" title="I am here to help"
onPress={() => navigation.navigate("PractitionerLogin")} onPress={() => navigation.navigate("PractitionerLogin")}
color="#703BE7"
/> />
</View> </View>
</View> </View>
...@@ -26,10 +28,10 @@ const styles = StyleSheet.create({ ...@@ -26,10 +28,10 @@ const styles = StyleSheet.create({
justifyContent: "center", justifyContent: "center",
}, },
buttonContainer: { buttonContainer: {
flexDirection: "row",
marginVertical: 20, marginVertical: 20,
}, },
separator: { separator: {
width: 10, width: 10,
height: 20,
}, },
}); });
...@@ -11,6 +11,7 @@ export default function SharedRegisterScreen({ navigation }) { ...@@ -11,6 +11,7 @@ export default function SharedRegisterScreen({ navigation }) {
console.log("Patient registration"); console.log("Patient registration");
navigation.navigate("PatientConsentForm"); navigation.navigate("PatientConsentForm");
}} }}
color="#703BE7"
/> />
<View style={styles.separator} /> <View style={styles.separator} />
<Button <Button
...@@ -19,6 +20,7 @@ export default function SharedRegisterScreen({ navigation }) { ...@@ -19,6 +20,7 @@ export default function SharedRegisterScreen({ navigation }) {
console.log("PractitionerRegistration"); console.log("PractitionerRegistration");
navigation.navigate("PractitionerRegistration"); navigation.navigate("PractitionerRegistration");
}} }}
color="#703BE7"
/> />
</View> </View>
</View> </View>
...@@ -31,10 +33,10 @@ const styles = StyleSheet.create({ ...@@ -31,10 +33,10 @@ const styles = StyleSheet.create({
justifyContent: "center", justifyContent: "center",
}, },
buttonContainer: { buttonContainer: {
flexDirection: "row",
marginVertical: 20, marginVertical: 20,
}, },
separator: { separator: {
width: 10, width: 10,
height:20,
}, },
}); });
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