Skip to content

Commit

Permalink
fix(contact): add contact screen
Browse files Browse the repository at this point in the history
• remove the contact from the infos screen
  • Loading branch information
tangimds committed Oct 29, 2021
1 parent 7f6fad8 commit 42c5b31
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 32 deletions.
18 changes: 18 additions & 0 deletions assets/svg/Phone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import Svg, {Path} from 'react-native-svg';

function SvgComponent(props) {
return (
<Svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 202.592 202.592"
{...props}>
<Path
d="M198.048 160.105l-31.286-31.29c-6.231-6.206-16.552-6.016-23.001.433L128 145.009a649.985 649.985 0 01-3.11-1.732c-9.953-5.515-23.577-13.074-37.914-27.421C72.599 101.48 65.03 87.834 59.5 77.874c-.587-1.056-1.145-2.072-1.696-3.038l10.579-10.565 5.2-5.207c6.46-6.46 6.639-16.778.419-23.001L42.715 4.769c-6.216-6.216-16.541-6.027-23.001.433l-8.818 8.868.243.24c-2.956 3.772-5.429 8.124-7.265 12.816-1.696 4.466-2.752 8.729-3.235 12.998-4.13 34.25 11.52 65.55 53.994 108.028 58.711 58.707 106.027 54.273 108.067 54.055 4.449-.53 8.707-1.593 13.038-3.275 4.652-1.818 9.001-4.284 12.769-7.233l.193.168 8.933-8.747c6.446-6.459 6.632-16.777.415-23.015zm-7.365 16.059l-3.937 3.93-1.568 1.507c-2.469 2.387-6.743 5.74-12.984 8.181-3.543 1.364-7.036 2.24-10.59 2.663-.447.043-44.95 3.84-100.029-51.235C14.743 94.38 7.238 67.395 10.384 41.259c.394-3.464 1.263-6.95 2.652-10.593 2.462-6.277 5.812-10.547 8.181-13.02l5.443-5.497c2.623-2.63 6.714-2.831 9.112-.433l31.286 31.286c2.394 2.401 2.205 6.492-.422 9.13L45.507 73.24l1.95 3.282c1.084 1.829 2.23 3.879 3.454 6.106 5.812 10.482 13.764 24.83 29.121 40.173 15.317 15.325 29.644 23.27 40.094 29.067 2.258 1.249 4.32 2.398 6.17 3.5l3.289 1.95 21.115-21.122c2.634-2.623 6.739-2.817 9.137-.426l31.272 31.279c2.391 2.397 2.201 6.488-.426 9.115z"
fill="currentColor"
/>
</Svg>
);
}

export default SvgComponent;
2 changes: 2 additions & 0 deletions src/components/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import CrossSvg from '../../assets/svg/cross.svg';
import BinSvg from '../../assets/svg/bin.svg';
import NotesSvg from '../../assets/svg/notes.svg';
import Text from '../components/MyText';
import PhoneSvg from '../../assets/svg/Phone';

import {
StyleSheet,
Expand Down Expand Up @@ -59,6 +60,7 @@ const mapIconToSvg = (icon) => {
CrossSvg,
BinSvg,
NotesSvg,
PhoneSvg,
};
return iconMap[icon];
};
Expand Down
7 changes: 7 additions & 0 deletions src/components/drawer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ export default ({navigation, visible, onClick}) => {
onClick={onClick}
icon="InfoSvg"
/>
<DrawerItem
title="Parler à quelqu'un"
path="contact"
navigation={navigation}
onClick={onClick}
icon="PhoneSvg"
/>
<DrawerItem
title="Protection des données"
path="privacy"
Expand Down
2 changes: 2 additions & 0 deletions src/navigation/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Infos from '../scenes/infos';
import ActivateBeck from '../scenes/beck/activate';
import ViewBeck from '../scenes/beck/view';
import Beck from '../scenes/beck';
import Contact from '../scenes/contact';

const Stack = createStackNavigator();

Expand Down Expand Up @@ -99,6 +100,7 @@ class Router extends React.Component {
<Stack.Screen name="too-late" component={TooLate} />
<Stack.Screen name="news" component={News} />
<Stack.Screen name="infos" component={Infos} />
<Stack.Screen name="contact" component={Contact} />
<Stack.Screen name="contribute-pro" component={ContributePro} />
<Stack.Screen name="activate-beck" component={ActivateBeck} />
<Stack.Screen name="view-beck" component={ViewBeck} />
Expand Down
112 changes: 112 additions & 0 deletions src/scenes/contact/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import React, {useEffect} from 'react';
import {StyleSheet, SafeAreaView, ScrollView, Linking} from 'react-native';
import Text from '../../components/MyText';
import {colors} from '../../utils/colors';
import logEvents from '../../services/logEvents';
import BackButton from '../../components/BackButton';

const Contact = ({navigation}) => {
useEffect(() => {
const unsubscribe = navigation.addListener('tabPress', (e) => {
logEvents.logContactOpen();
});

return unsubscribe;
}, [navigation]);

return (
<SafeAreaView style={styles.safe}>
<BackButton onPress={navigation.goBack} />
<ScrollView
style={styles.cgu}
contentContainerStyle={styles.scrollContainer}>
<Text style={styles.title}>Pour simplement parler à quelqu’un :</Text>
<Text style={styles.content}>
Numéro national de prévention du suicide, Gratuit, 24h/24 et 7j/7
{'\n\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick(
'Numéro national de prévention du suicide',
);
Linking.openURL('tel:3114');
}}>
3114
</Text>
{'\n\n\n'}
SOS-amitiés, 24h/24 et 7j/7{'\n\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:09 72 39 40 50');
}}>
09 72 39 40 50
</Text>
{'\n\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:01 40 09 15 22');
}}>
01 40 09 15 22
</Text>
{'\n\n\n'}
Fil Santé Jeune, Tous les jours, 9h-23h {'\n\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:0 800 235 236');
}}>
0 800 235 236
</Text>
</Text>
</ScrollView>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
safe: {
flex: 1,
},
title: {
color: colors.BLUE,
fontSize: 20,
padding: 20,
fontWeight: '700',
},
cgu: {
paddingVertical: 5,
paddingHorizontal: 15,
},
content: {
color: colors.DARK_BLUE,
padding: 10,
fontSize: 16,
},
scrollContainer: {
paddingBottom: 80,
},
container: {
flexDirection: 'row',
alignItems: 'center',
},
button: {
width: 45,
height: 45,
alignItems: 'center',
justifyContent: 'center',
},
link: {
margin: 100,
color: colors.LIGHT_BLUE,
fontWeight: '700',
textDecorationLine: 'underline',
},
});

export default Contact;
32 changes: 0 additions & 32 deletions src/scenes/infos/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,6 @@ const LegalScreen = ({navigation, title, content}) => {
}}>
santepsy.etudiant.gouv.fr{' '}
</Text>
{'\n\n\n'}
Pour simplement parler à quelqu’un :{'\n'}
{'\n'}
SOS-amitiés 24h/24 et 7j/7{'\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:09 72 39 40 50');
}}>
09 72 39 40 50
</Text>
{'\n\n'}
SOS Suicide Phénix 13h-23h00 {'\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:01 40 44 46 45');
}}>
01 40 44 46 45
</Text>
{'\n\n'}
Fil Santé Jeune Tous les jours, 9h-23h {'\n'}
<Text
style={styles.link}
onPress={() => {
logEvents.logInfoClick('SOS-amitiés');
Linking.openURL('tel:0 800 235 236');
}}>
0 800 235 236
</Text>
</Text>
</ScrollView>
</SafeAreaView>
Expand Down
7 changes: 7 additions & 0 deletions src/services/logEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ const logInfosOpen = async () => {
action: 'INFOS_OPEN',
});
};
const logContactOpen = async () => {
await logEvent({
category: 'CONTACT',
action: 'CONTACT_OPEN',
});
};

const logDataExport = async () => {
await logEvent({
Expand Down Expand Up @@ -365,6 +371,7 @@ export default {
getUserId,
logNPSOpen,
logNPSSend,
logContactOpen,
logSupportedSelect,
logCustomSymptomAdd,
logInfoClick,
Expand Down

0 comments on commit 42c5b31

Please sign in to comment.