Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding login and sign up pages #25

Merged
merged 2 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions app/forgotpassword.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import React from 'react';
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';

const ForgotPasswordScreen: React.FC = () => {
const [phoneNumber, setPhoneNumber] = React.useState('');
const [otp, setOtp] = React.useState('');
const [newPassword, setNewPassword] = React.useState('');
const [confirmNewPassword, setConfirmNewPassword] = React.useState('');

const handleResetPassword = () => {
if (newPassword !== confirmNewPassword) {
// Passwords don't match
console.log('Passwords do not match');
return;
}

// Add your reset password logic here
console.log('Phone Number:', phoneNumber);
console.log('OTP:', otp);
console.log('New Password:', newPassword);
};

return (
<View style={styles.container}>
<Text style={styles.title}>Forgot Password</Text>
<TextInput
style={styles.input}
placeholder="Phone Number"
onChangeText={setPhoneNumber}
value={phoneNumber}
keyboardType="phone-pad"
/>
<TextInput
style={styles.input}
placeholder="OTP"
onChangeText={setOtp}
value={otp}
keyboardType="numeric"
/>
<TextInput
style={styles.input}
placeholder="New Password"
onChangeText={setNewPassword}
value={newPassword}
secureTextEntry
/>
<TextInput
style={styles.input}
placeholder="Re-enter New Password"
onChangeText={setConfirmNewPassword}
value={confirmNewPassword}
secureTextEntry
/>
<TouchableOpacity style={styles.button} onPress={handleResetPassword}>
<Text style={styles.buttonText}>Reset Password</Text>
</TouchableOpacity>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 20,
},
input: {
width: '100%',
height: 40,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5,
paddingHorizontal: 10,
marginBottom: 10,
},
button: {
width: '100%',
height: 40,
backgroundColor: 'blue',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 5,
marginBottom: 10,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});

export default ForgotPasswordScreen;
53 changes: 53 additions & 0 deletions app/homepage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';

const Dashboard: React.FC = () => {
const handleNavigation = (page: string) => {
// Handle navigation logic here
console.log(`Navigating to ${page}`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redirect this page directly from
_layout.tsx that is you just need to change layout tsx one line

};

const handleFeatureClick = (feature: string) => {
// Handle feature click logic here
console.log(`Clicked on feature: ${feature}`);
};

return (
<View style={styles.container}>
<View style={styles.middleButtons}>
<Button title="Payment Due" onPress={() => handleFeatureClick('Payment Due')} />
<Button title="Visitors Update" onPress={() => handleFeatureClick('Visitors Update')} />
{/* Add more feature buttons as needed */}
</View>

<View style={styles.bottomButtons}>
<Button title="Home" onPress={() => handleNavigation('Home')} />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use of expo router will make it easier to navigate

<Button title="Profile" onPress={() => handleNavigation('Profile')} />
<Button title="Settings" onPress={() => handleNavigation('Settings')} />
<Button title="Logout" onPress={() => handleNavigation('Logout')} />
</View>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
middleButtons: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
bottomButtons: {
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
paddingBottom: 20,
width: '100%',
},
});

export default Dashboard;
100 changes: 100 additions & 0 deletions app/login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import React from 'react';
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';

const LoginScreen: React.FC = () => {
const [username, setUsername] = React.useState('');
const [password, setPassword] = React.useState('');

const handleLogin = () => {
// Add your login logic here
console.log('Username:', username);
console.log('Password:', password);
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redirect this page directly from
_layout.tsx that is you just need to change layout tsx one line

make this initial route


const handleForgotPassword = () => {
// Add your forgot password logic here
console.log('Forgot Password');
};

const handleRegister = () => {
// Add your register logic here
console.log('Register');
};

return (
<View style={styles.container}>
<Text style={styles.title}>RESIDENTRON</Text>
<TextInput
style={styles.input}
placeholder="Username"
onChangeText={setUsername}
value={username}
autoCapitalize="none"
/>
<TextInput
style={styles.input}
placeholder="Password"
onChangeText={setPassword}
value={password}
secureTextEntry
/>
<TouchableOpacity style={styles.button} onPress={handleLogin}>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently change onpress to href={"/(tabs)/main"}

<Text style={styles.buttonText}>Login</Text>
</TouchableOpacity>
<TouchableOpacity onPress={handleForgotPassword}>
<Text style={styles.forgotPasswordText}>Forgot Password?</Text>
</TouchableOpacity>
<TouchableOpacity onPress={handleRegister}>
<Text style={styles.registerText}>Register</Text>
</TouchableOpacity>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 20,
},
input: {
width: '100%',
height: 40,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5,
paddingHorizontal: 10,
marginBottom: 10,
},
button: {
width: '100%',
height: 40,
backgroundColor: 'blue',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 5,
marginBottom: 10,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
forgotPasswordText: {
marginTop: 10,
color: 'blue',
},
registerText: {
marginTop: 10,
color: 'blue',
fontWeight: 'bold',
},
});

export default LoginScreen;
92 changes: 92 additions & 0 deletions app/myaccount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React from 'react';
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native';

const MyAccountScreen: React.FC = () => {
const [fullName, setFullName] = React.useState('');
const [email, setEmail] = React.useState('');
const [phoneNumber, setPhoneNumber] = React.useState('');
const [address, setAddress] = React.useState('');

const handleSaveChanges = () => {
// Add your save changes logic here
console.log('Full Name:', fullName);
console.log('Email:', email);
console.log('Phone Number:', phoneNumber);
console.log('Address:', address);
};

return (
<View style={styles.container}>
<Text style={styles.title}>My Account</Text>
<TextInput
style={styles.input}
placeholder="Full Name"
onChangeText={setFullName}
value={fullName}
/>
<TextInput
style={styles.input}
placeholder="Email"
onChangeText={setEmail}
value={email}
keyboardType="email-address"
/>
<TextInput
style={styles.input}
placeholder="Phone Number"
onChangeText={setPhoneNumber}
value={phoneNumber}
keyboardType="phone-pad"
/>
<TextInput
style={styles.input}
placeholder="Address"
onChangeText={setAddress}
value={address}
multiline
/>
<TouchableOpacity style={styles.button} onPress={handleSaveChanges}>
<Text style={styles.buttonText}>Save Changes</Text>
</TouchableOpacity>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 20,
},
input: {
width: '100%',
height: 40,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 5,
paddingHorizontal: 10,
marginBottom: 10,
},
button: {
width: '100%',
height: 40,
backgroundColor: 'blue',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 5,
marginBottom: 10,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});

export default MyAccountScreen;
Loading