Skip to content

Commit 62baf7c

Browse files
committed
Updated Screens
1 parent 3f0c35a commit 62baf7c

File tree

6 files changed

+269
-243
lines changed

6 files changed

+269
-243
lines changed

assets/person.jpg

-48.3 KB
Binary file not shown.

config/keys.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const localIPS = {
22
kartik : "http://192.168.43.5:5000",
3-
aman : "http://192.168.43.205:5000"
3+
aman : "http://192.168.43.65:5000"
44
}
55

66
const prodAddress = "https://salyd.herokuapp.com"
77

8-
export const localapiUrl = localIPS.kartik;
8+
export const localapiUrl = localIPS.aman;
99
export const apiUrl = prodAddress;

screens/MainApp/Profile/Contact.js

Lines changed: 87 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import React, { useContext } from 'react';
2-
import { StyleSheet, Text, View, Dimensions, Linking, KeyboardAvoidingView, TouchableOpacity } from 'react-native';
1+
import React from 'react';
2+
import { StyleSheet, Text, View, Linking, Image, Dimensions } from 'react-native';
33
import Header from '../../../components/Header';
4-
import { Button } from 'react-native-paper'
5-
import { MaterialCommunityIcons, FontAwesome } from '@expo/vector-icons'
6-
import { GlobalContext } from '../../../context/GlobalState';
4+
import Button from '../../../components/Button';
75
import { colors } from '../../../constants/constant';
8-
const width = Dimensions.get("window").width;
6+
import { FontAwesome5 } from '@expo/vector-icons';
7+
8+
const Contact = ({ navigation }) => {
9+
const details = {
10+
phone: "8077XXXXXX",
11+
12+
address: "Esteria Towers\n Times Square Callison Lane\n Portland, DE 97205",
13+
};
914

10-
const Contact = ({navigation}) => {
11-
const phone = 7017666017
12-
const email = "[email protected]"
1315
const openDial = () => {
1416
if (Platform.OS === "android") {
1517
Linking.openURL(`tel:${phone}`)
@@ -18,55 +20,94 @@ const Contact = ({navigation}) => {
1820
Linking.openURL(`telprompt:${phone}`)
1921
}
2022
}
21-
const { restro } = React.useContext(GlobalContext)
22-
return (
23-
<View style={styles.container}>
24-
<KeyboardAvoidingView behavior="position">
25-
<Header navigation={navigation} isBack>Contact Us</Header>
2623

27-
<Text style={styles.title}> Contact</Text>
28-
29-
<View style={styles.cardContainer}>
24+
return (
25+
<React.Fragment>
26+
<Header navigation={navigation} isBack>Contact Us</Header>
27+
<View style={styles.container}>
28+
{/* TOP SECTION */}
29+
<View style={{
30+
margin: 50,
31+
flexDirection: "column",
32+
alignItems: "center"
33+
}}>
34+
<Image style={{
35+
height: 150, width: 150
36+
}} source={require('../../../assets/logo_col.png')} />
37+
<Text style={{
38+
fontFamily: "ProductSansBold",
39+
fontSize: 32,
40+
marginTop: 15,
41+
color: colors.accentPrimary
42+
}}>Salyd</Text>
43+
</View >
3044

31-
<TouchableOpacity>
32-
<View style={styles.mycard}>
45+
{/* MIDDLE SECTION */}
46+
<View style={{
47+
margin: 30,
48+
padding: 20,
49+
borderRadius: 20,
50+
flexDirection: "column",
51+
backgroundColor: "white",
52+
shadowColor: '#000',
53+
shadowOffset: { width: 0, height: 1 },
54+
shadowOpacity: 0.8,
55+
shadowRadius: 2,
56+
elevation: 5
57+
}}>
58+
<Text style={{
59+
fontFamily: "ProductSansBold",
60+
fontSize: 22,
61+
textAlign: "center"
62+
}}> Details </Text>
3363

34-
<View style={styles.cardContent}>
35-
<FontAwesome name="address-card" style={styles.icon} />
36-
<Text style={styles.mytext}>{ restro && (restro.name + " ," + restro.address)}</Text>
37-
</View>
64+
<View style={{ flexDirection: "row", marginTop: 15, alignItems: "center" }}>
65+
<FontAwesome5 name="phone" size={24} color="#54cfff" />
66+
<Text style={{
67+
fontFamily: "ProductSansBold",
68+
marginLeft: 10
69+
}}> {details.phone} </Text>
70+
</View>
3871

39-
</View>
40-
</TouchableOpacity>
72+
<View style={{ flexDirection: "row", marginTop: 15, alignItems: "center" }}>
73+
<FontAwesome5 name="at" size={24} color="#ffaa54" />
74+
<Text style={{
75+
fontFamily: "ProductSansBold",
76+
marginLeft: 10
77+
}}> {details.email} </Text>
78+
</View>
79+
<View style={{ flexDirection: "row", marginTop: 15, alignItems: "flex-start" }}>
80+
<FontAwesome5 name="home" size={24} color="#ff707e" />
81+
<Text style={{
82+
fontFamily: "ProductSansBold",
83+
marginLeft: 10
84+
}}> {details.address} </Text>
85+
</View>
4186

42-
<TouchableOpacity onPress={() => {
43-
Linking.openURL(`mailto:${email}`)
44-
}}>
45-
<View style={styles.mycard}>
46-
<View style={styles.cardContent}>
47-
<MaterialCommunityIcons name="email" style={styles.icon} />
48-
<Text style={styles.mytext}>{email}</Text>
49-
</View>
50-
</View>
51-
</TouchableOpacity>
87+
</View >
5288

53-
<Button
54-
mode="contained"
55-
onPress={() => openDial()}
56-
style={styles.button}>
57-
Call Us
58-
</Button>
5989

60-
</View>
61-
</KeyboardAvoidingView>
62-
</View>
90+
{/* BITTOM SECTION */}
91+
<View style={{
92+
width: "100%",
93+
alignItems: "center",
94+
position: "absolute",
95+
bottom: 30
96+
}}>
97+
<Text style={{
98+
fontSize: 18,
99+
fontFamily: "ProductSans"
100+
}}>Made with <FontAwesome5 name="heart" size={18} color="red" /> by Salyd Team</Text>
101+
</View>
102+
</View >
103+
</React.Fragment >
63104
)
64105
}
65106

66107
const styles = StyleSheet.create({
67108
container: {
68-
flex: 1,
69-
backgroundColor: "#ffffff"
109+
backgroundColor: "#ffffff",
110+
height: Dimensions.get("screen").height - 110
70111
},
71112
title: {
72113
fontFamily: "DMSansRegular",

screens/MainApp/Profile/EditProfile.js

Lines changed: 107 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,89 @@
1-
import React, { useContext } from 'react'
2-
import { View, Text, StyleSheet, Dimensions } from 'react-native';
3-
import { Button } from 'react-native-paper';
1+
import React, { useContext, useState } from 'react'
2+
import { View, Text, StyleSheet, Dimensions, TouchableOpacity, Modal, Alert } from 'react-native';
3+
import * as ImagePicker from 'expo-image-picker';
4+
import * as Permissions from 'expo-permissions';
5+
import { MaterialCommunityIcons, FontAwesome, Feather, Ionicons } from '@expo/vector-icons'
6+
import { Button as ButtonPaper } from "react-native-paper";
47

58
//Components
69
import Header from '../../../components/Header'
10+
import Button from '../../../components/Button'
711

812
//Context
913
import { GlobalContext } from '../../../context/GlobalState';
1014
import { colors } from '../../../constants/constant';
15+
import { localapiUrl } from '../../../config/keys';
16+
import Axios from 'axios';
1117

1218
const heightOfScreen = Dimensions.get("window").height;
1319

1420
const ViewProfile = ({ navigation }) => {
15-
const { user } = useContext(GlobalContext);
16-
21+
22+
//Definning states
23+
const [modal, setModal] = useState(false);
24+
const { user, token } = useContext(GlobalContext);
25+
1726
const saveProfile = () => {
1827
console.log("Updated Profile");
1928
navigation.navigate('ViewProfile')
2029
}
30+
const uploadPic = (file) => {
31+
Axios({
32+
url: `${localapiUrl}/uploadpic`,
33+
method: 'post',
34+
headers: {
35+
"Content-type": `application/json`,
36+
"Authorization": `Bearer ${token}`,
37+
"Accept": `application/json`
38+
},
39+
body: {imgb64: file}
40+
}).then((response) => {
41+
console.log("i am herrrr");
42+
console.log(response)
43+
}).catch((err) => {
44+
console.error(err)
45+
})
46+
}
47+
48+
const pickFromGallery = async () => {
49+
const { granted } = await Permissions.askAsync(Permissions.CAMERA_ROLL)
50+
if (granted) {
51+
let data = await ImagePicker.launchImageLibraryAsync({
52+
mediaTypes: ImagePicker.MediaTypeOptions.Images,
53+
allowsEditing: true,
54+
aspect: [1, 1],
55+
quality: 0.5,
56+
base64: true,
57+
})
58+
59+
if (!data.cancelled) {
60+
uploadPic(data.base64)
61+
}
62+
}
63+
}
64+
65+
const pickFromCamera = async () => {
66+
const { granted } = await Permissions.askAsync(Permissions.CAMERA)
67+
68+
if (granted) {
69+
let data = await ImagePicker.launchCameraAsync({
70+
mediaTypes: ImagePicker.MediaTypeOptions.Images,
71+
allowsEditing: true,
72+
aspect: [1, 1],
73+
quality: 0.5
74+
})
75+
76+
if (!data.cancelled) {
77+
let newfile = {
78+
uri: data.uri,
79+
type: `test/${data.uri.split(".")[1]}`,
80+
name: `test.${data.uri.split(".")[1]}`
81+
}
82+
83+
uploadPic(newfile.uri);
84+
}
85+
}
86+
}
2187

2288
return (
2389
<View>
@@ -26,18 +92,49 @@ const ViewProfile = ({ navigation }) => {
2692
<Text style={{
2793
fontSize: 20, fontWeight: "bold"
2894
}}>Hello {user.name}</Text>
95+
<TouchableOpacity onPress={() => setModal(true)}>
96+
<Text style={styles.changedp}> Change your profile picture</Text>
97+
</TouchableOpacity>
2998
<Button
30-
mode="contained"
31-
color={colors.accentPrimary}
32-
style={styles.button}
33-
onPress={() => saveProfile()}
99+
onPressFunction={() => saveProfile()}
34100
>
35101
Save
36102
</Button>
37103
<View style={styles.recentOrders}>
38104
<Text>Recent Orders </Text>
39105
</View>
40-
</View >
106+
<Modal
107+
animationType="slide"
108+
transparent={true}
109+
visible={modal}
110+
onRequestClose={() => {
111+
setModal(false)
112+
}}
113+
>
114+
<View style={styles.modalView}>
115+
<View style={styles.modalButtonView}>
116+
<ButtonPaper
117+
icon="camera"
118+
mode="contained"
119+
style={styles.buttonpaper}
120+
onPress={() => pickFromCamera()}>
121+
Camera
122+
</ButtonPaper>
123+
124+
<ButtonPaper
125+
icon="image-area"
126+
mode="contained"
127+
style={styles.buttonpaper}
128+
onPress={() => pickFromGallery()}>
129+
Gallery
130+
</ButtonPaper>
131+
132+
</View>
133+
134+
</View>
135+
136+
</Modal>
137+
</View>
41138
</View>
42139
)
43140
}

screens/MainApp/Profile/RecentOrders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const RecentOrders = (props) => {
165165
const styles = StyleSheet.create({
166166
container: {
167167
backgroundColor: "#ffffff",
168-
height: Dimensions.get("screen").height
168+
height: Dimensions.get("screen").height - 120
169169
},
170170
image: {
171171
height: height * 0.2,

0 commit comments

Comments
 (0)