diff --git a/package.json b/package.json
index f640372..3813d17 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,6 @@
"react-native-screens": "~2.2.0",
"react-native-unimodules": "~0.8.1",
"react-native-web": "^0.11.7",
- "react-native-web-swiper": "^2.1.1",
"zipcodes": "^8.0.0"
},
"devDependencies": {
diff --git a/src/api/firebase/index.js b/src/api/firebase/index.js
index 9df6a7e..a980b08 100644
--- a/src/api/firebase/index.js
+++ b/src/api/firebase/index.js
@@ -10,12 +10,15 @@ import config from './config';
firebase.initializeApp(config);
// firebase.analytics();
+// Uncomment this while running firebase emulator.
+if (process.env.NODE_ENV === 'development') {
+ firebase.firestore().settings({
+ host: 'localhost:8080',
+ ssl: false,
+ });
+}
+
// Export firebase stuff.
export const { auth, firestore, storage, functions } = firebase;
-// Uncomment this while running firebase emulator.
-// if (process.env.NODE_ENV === 'development') {
-// firebase.functions().useFunctionsEmulator('http://localhost:5001');
-// }
-
export default firebase;
diff --git a/src/components/Jobs/index.js b/src/components/Jobs/index.js
index 4cfa099..0234fec 100644
--- a/src/components/Jobs/index.js
+++ b/src/components/Jobs/index.js
@@ -1,20 +1,19 @@
-import React, { useEffect } from 'react';
+import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Button } from 'react-native-elements';
import * as WebBrowser from 'expo-web-browser';
import { AppContext } from '../../context';
const JOBS_URL = 'https://bit.ly/covid19-contact-tracers';
+const TRAINING_URL =
+ 'https://www.coursera.org/learn/covid-19-contact-tracing?edocomorp=covid-19-contact-tracing';
const Jobs = () => {
const { t } = React.useContext(AppContext);
- useEffect(() => {
- // openBrowser();
- }, []);
- const openBrowser = async () => {
+ const openBrowser = async (url) => {
try {
- await WebBrowser.openBrowserAsync(JOBS_URL);
+ await WebBrowser.openBrowserAsync(url);
} catch (error) {
console.log(error);
}
@@ -22,11 +21,28 @@ const Jobs = () => {
return (
+
+ What is Contact Tracing?
+
+
+ Contact tracing is the process of identification of persons who may
+ have come into contact with an infected person and subsequent
+ collection of further information about these contacts. To learn more
+ about contact tracing, you can complete the COVID-19 Contact Tracing
+ below.
+
+
+
);
@@ -36,4 +52,9 @@ export default Jobs;
const styles = StyleSheet.create({
container: { flex: 1, alignItems: 'center', justifyContent: 'center' },
+ titleStyle: {
+ fontSize: 15,
+ fontWeight: 'bold',
+ marginBottom: 5,
+ },
});
diff --git a/src/components/Stats/Card.js b/src/components/Stats/Card.js
index 76c0bbc..56fdbab 100644
--- a/src/components/Stats/Card.js
+++ b/src/components/Stats/Card.js
@@ -1,8 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Text, View } from 'react-native';
-import FontAwesome5Icon from '@expo/vector-icons/FontAwesome5';
-import EntypoIcon from '@expo/vector-icons/Entypo';
+
+import {
+ MaterialCommunityIcons,
+ FontAwesome5,
+ Entypo,
+} from '@expo/vector-icons';
import styles from './Card.style';
const Card = (props) => {
@@ -20,10 +24,10 @@ const Card = (props) => {
>
- {icon === 'swap' ? (
-
+ {icon === 'gas-cylinder' ? (
+
) : (
-
+
)}
{stat}
diff --git a/src/components/Stats/Card.style.js b/src/components/Stats/Card.style.js
index f624ec7..b26be0e 100644
--- a/src/components/Stats/Card.style.js
+++ b/src/components/Stats/Card.style.js
@@ -10,14 +10,12 @@ export default StyleSheet.create({
contentWrapper: {
marginHorizontal: 10,
paddingVertical: 10,
- textAlign: 'center',
alignItems: 'center',
justifyContent: 'center',
},
cardIcon: {
paddingVertical: 10,
marginTop: 10,
- textAlign: 'center',
alignSelf: 'center',
},
cardTitleText: {
diff --git a/src/components/Stats/Grid.js b/src/components/Stats/Grid.js
index 9d0a7a4..4084c43 100644
--- a/src/components/Stats/Grid.js
+++ b/src/components/Stats/Grid.js
@@ -129,6 +129,8 @@ class Grid extends React.Component {
this.renderRow({
rowItems: item,
diff --git a/src/components/Stats/index.js b/src/components/Stats/index.js
index e5c3bf2..be83391 100644
--- a/src/components/Stats/index.js
+++ b/src/components/Stats/index.js
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
-import { firestore } from '../../api/firebase';
+import { isEmpty } from 'lodash';
import Grid from './Grid';
import Card from './Card';
@@ -8,37 +8,88 @@ import Loading from '../Loading';
// Context.
import { AppContext } from '../../context';
+import useCurrentLocation from '../../hooks/useCurrentLocation';
const Stats = () => {
+ const [deviceLocation, setDeviceLocation] = useState({});
const [statsData, setStatsData] = useState([]);
const [dataAvailability, setDataAvailability] = useState(true);
- const { locale } = React.useContext(AppContext);
+ const { currentLocation } = useCurrentLocation();
+ const { t } = React.useContext(AppContext);
useEffect(() => {
- const unsubscribe = firestore()
- .collection('stats/app-stat-cards/data')
- .onSnapshot(handleOnSnapshot, handleError);
+ const getData = async () => {
+ try {
+ const location = await currentLocation();
- // Stop listening for updates when no longer required
- return () => unsubscribe();
- }, []);
+ console.log(location);
- const handleOnSnapshot = (snapshot) => {
- if (!snapshot.empty) {
- let list = [];
- snapshot.forEach((doc) => {
- if (doc.exists) list = [...list, { id: doc.id, ...doc.data() }];
- });
+ setDeviceLocation(location);
+ if (!isEmpty(location) && location.state) {
+ const state = location.state.toLowerCase();
+ if (!state) return;
+ const response = await fetch(
+ `https://covidtracking.com/api/v1/states/${state}/current.json`
+ );
+ const data = await response.json();
+ const {
+ positive,
+ death,
+ hospitalizedCurrently,
+ recovered,
+ inIcuCurrently,
+ onVentilatorCurrently,
+ } = data;
+ const stats = [
+ {
+ label: t('STATS_LABEL_POSITIVE'),
+ stat: positive || 0,
+ cardColor: '#9c27b0',
+ icon: 'users',
+ },
+ {
+ label: t('STATS_LABEL_DEATH'),
+ stat: death || 0,
+ cardColor: '#000000',
+ icon: 'user',
+ },
+ {
+ label: t('STATS_LABEL_HOSPITALIZED'),
+ stat: hospitalizedCurrently || 0,
+ cardColor: '#2196f3',
+ icon: 'hospital',
+ },
+ {
+ label: t('STATS_LABEL_RECOVERED'),
+ stat: recovered || 0,
+ cardColor: '#4caf50',
+ icon: 'heartbeat',
+ },
+ {
+ label: t('STATS_LABEL_ICU'),
+ stat: inIcuCurrently || 0,
+ cardColor: '#f44336',
+ icon: 'bed',
+ },
+ {
+ label: t('STATS_LABEL_VENTILATOR'),
+ stat: onVentilatorCurrently || 0,
+ cardColor: '#fdd835',
+ icon: 'gas-cylinder',
+ },
+ ];
- setStatsData(list);
- }
- };
+ setStatsData(stats);
+ }
+ } catch (error) {
+ console.log(error);
+ dataAvailability(false);
+ }
+ };
- const handleError = (error) => {
- console.log(error.message);
- setDataAvailability(false);
- };
+ getData();
+ }, []);
return (
@@ -48,18 +99,25 @@ const Stats = () => {
) : (
{`${deviceLocation.city}, ${deviceLocation.state}`}
+ )
+ }
itemDimension={150}
items={statsData}
numofLoadingItems={6}
spacing={10}
isLoading={statsData.length < 1 ? true : false}
- renderItem={(item) => {
+ renderItem={({ item }) => {
return (
);
}}
@@ -93,4 +151,10 @@ const styles = StyleSheet.create({
paddingHorizontal: 14,
height: Dimensions.get('window').height - 50,
},
+ locationText: {
+ textAlign: 'center',
+ fontWeight: 'bold',
+ fontSize: 20,
+ paddingVertical: 10,
+ },
});
diff --git a/src/hooks/useCurrentLocation.js b/src/hooks/useCurrentLocation.js
new file mode 100644
index 0000000..06cbf91
--- /dev/null
+++ b/src/hooks/useCurrentLocation.js
@@ -0,0 +1,34 @@
+import * as Location from 'expo-location';
+import ZIPCodes from 'zipcodes';
+
+const useCurrentLocation = () => {
+ const currentLocation = async () => {
+ let { status } = await Location.requestPermissionsAsync();
+ if (status !== 'granted') {
+ onError('Permission to access location was denied');
+ currentLocation();
+ }
+
+ try {
+ const location = await Location.getCurrentPositionAsync({});
+
+ const coords = location.coords || {};
+
+ if (coords && coords.latitude && coords.longitude) {
+ const address = ZIPCodes.lookupByCoords(
+ coords.latitude,
+ coords.longitude
+ );
+
+ return { ...address, ...coords };
+ }
+ } catch (error) {
+ console.log(error);
+ return null;
+ }
+ };
+
+ return { currentLocation };
+};
+
+export default useCurrentLocation;
diff --git a/src/localization/amh/translation.json b/src/localization/amh/translation.json
index e8e90dc..3729b35 100644
--- a/src/localization/amh/translation.json
+++ b/src/localization/amh/translation.json
@@ -27,5 +27,11 @@
"TITLE_INSTRUCTION": "Instruction",
"INSTRUCTION": "Hi, we are here to guide you through the Coronavirus Self-Checker.\r\n\r\nIf you are experiencing a life-threatening emergency, please call 911 immediately.\r\n\r\nThis app does not replace the judgment of healthcare professionals or the performance of any clinical assessment.\r\n\r\nTo provide information on the right level of care, we are going to ask you a series of questions.",
"ALERT_QUESTION_MISSING": "Next question is missing",
- "ALERT_MISSING_CHOICE": "Please select an option to continue"
+ "ALERT_MISSING_CHOICE": "Please select an option to continue",
+ "STATS_LABEL_POSITIVE": "Positive",
+ "STATS_LABEL_RECOVERED": "Recovered",
+ "STATS_LABEL_HOSPITALIZED": "Hospitalized",
+ "STATS_LABEL_DEATH": "Death",
+ "STATS_LABEL_ICU": "ICU",
+ "STATS_LABEL_VENTILATOR": "Ventilator"
}
\ No newline at end of file
diff --git a/src/localization/eng/translation.json b/src/localization/eng/translation.json
index 1587f7d..b5454b3 100644
--- a/src/localization/eng/translation.json
+++ b/src/localization/eng/translation.json
@@ -27,5 +27,11 @@
"TITLE_INSTRUCTION": "Instruction",
"INSTRUCTION": "Hi, we are here to guide you through the Coronavirus Self-Checker.\r\n\r\nIf you are experiencing a life-threatening emergency, please call 911 immediately.\r\n\r\nThis app does not replace the judgment of healthcare professionals or the performance of any clinical assessment.\r\n\r\nTo provide information on the right level of care, we are going to ask you a series of questions.",
"ALERT_QUESTION_MISSING": "Next question is missing",
- "ALERT_MISSING_CHOICE": "Please select an option to continue"
+ "ALERT_MISSING_CHOICE": "Please select an option to continue",
+ "STATS_LABEL_POSITIVE": "Positive",
+ "STATS_LABEL_RECOVERED": "Recovered",
+ "STATS_LABEL_HOSPITALIZED": "Hospitalized",
+ "STATS_LABEL_DEATH": "Death",
+ "STATS_LABEL_ICU": "ICU",
+ "STATS_LABEL_VENTILATOR": "Ventilator"
}
\ No newline at end of file
diff --git a/src/localization/orm/translation.json b/src/localization/orm/translation.json
index e621b45..a00a554 100644
--- a/src/localization/orm/translation.json
+++ b/src/localization/orm/translation.json
@@ -27,5 +27,11 @@
"TITLE_INSTRUCTION": "Instruction",
"INSTRUCTION": "Hi, we are here to guide you through the Coronavirus Self-Checker.\r\n\r\nIf you are experiencing a life-threatening emergency, please call 911 immediately.\r\n\r\nThis app does not replace the judgment of healthcare professionals or the performance of any clinical assessment.\r\n\r\nTo provide information on the right level of care, we are going to ask you a series of questions.",
"ALERT_QUESTION_MISSING": "Next question is missing",
- "ALERT_MISSING_CHOICE": "Please select an option to continue"
+ "ALERT_MISSING_CHOICE": "Please select an option to continue",
+ "STATS_LABEL_POSITIVE": "Positive",
+ "STATS_LABEL_RECOVERED": "Recovered",
+ "STATS_LABEL_HOSPITALIZED": "Hospitalized",
+ "STATS_LABEL_DEATH": "Death",
+ "STATS_LABEL_ICU": "ICU",
+ "STATS_LABEL_VENTILATOR": "Ventilator"
}
\ No newline at end of file
diff --git a/src/localization/tig/translation.json b/src/localization/tig/translation.json
index e621b45..a00a554 100644
--- a/src/localization/tig/translation.json
+++ b/src/localization/tig/translation.json
@@ -27,5 +27,11 @@
"TITLE_INSTRUCTION": "Instruction",
"INSTRUCTION": "Hi, we are here to guide you through the Coronavirus Self-Checker.\r\n\r\nIf you are experiencing a life-threatening emergency, please call 911 immediately.\r\n\r\nThis app does not replace the judgment of healthcare professionals or the performance of any clinical assessment.\r\n\r\nTo provide information on the right level of care, we are going to ask you a series of questions.",
"ALERT_QUESTION_MISSING": "Next question is missing",
- "ALERT_MISSING_CHOICE": "Please select an option to continue"
+ "ALERT_MISSING_CHOICE": "Please select an option to continue",
+ "STATS_LABEL_POSITIVE": "Positive",
+ "STATS_LABEL_RECOVERED": "Recovered",
+ "STATS_LABEL_HOSPITALIZED": "Hospitalized",
+ "STATS_LABEL_DEATH": "Death",
+ "STATS_LABEL_ICU": "ICU",
+ "STATS_LABEL_VENTILATOR": "Ventilator"
}
\ No newline at end of file
diff --git a/src/navigation/index.js b/src/navigation/index.js
index fcd8ee3..3bf65ee 100644
--- a/src/navigation/index.js
+++ b/src/navigation/index.js
@@ -21,7 +21,7 @@ import SelfCheckScreen from '../screens/SelfCheckScreen';
import LanguageSelect from '../components/LanguageSelect';
// Screens
-import HomeScreen from '../screens/HomeScreen';
+// import HomeScreen from '../screens/HomeScreen';
import StatsScreen from '../screens/StatsScreen';
import SignInScreen from '../screens/SignInScreen';
import SignUpScreen from '../screens/SignUpScreen';
@@ -94,12 +94,12 @@ const AuthStackScreen = () => (
);
-const HomeStack = createStackNavigator();
-const HomeStackScreen = () => (
- headerOptions(props)}>
-
-
-);
+// const HomeStack = createStackNavigator();
+// const HomeStackScreen = () => (
+// headerOptions(props)}>
+//
+//
+// );
const SelfCheckStack = createStackNavigator();
const SelfCheckStackScreen = () => (
@@ -141,7 +141,7 @@ const AppTabsScreen = () => {
tabStyle: { backgroundColor: '#fdd30e' },
}}
>
- {
),
}}
- />
+ /> */}
{
),
}}
/>
- (
-
- ),
- }}
- />
+
{
),
}}
/>
+
+ (
+
+ ),
+ }}
+ />
);
};
diff --git a/src/screens/StatsScreen.js b/src/screens/StatsScreen.js
index 568b304..911e8da 100644
--- a/src/screens/StatsScreen.js
+++ b/src/screens/StatsScreen.js
@@ -18,6 +18,5 @@ const styles = StyleSheet.create({
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'flex-start',
- padding: 16,
},
});
diff --git a/yarn.lock b/yarn.lock
index b2bcf03..ec7d45c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6608,13 +6608,6 @@ react-native-view-shot@3.1.2:
resolved "https://registry.yarnpkg.com/react-native-view-shot/-/react-native-view-shot-3.1.2.tgz#8c8e84c67a4bc8b603e697dbbd59dbc9b4f84825"
integrity sha512-9u9fPtp6a52UMoZ/UCPrCjKZk8tnkI9To0Eh6yYnLKFEGkRZ7Chm6DqwDJbYJHeZrheCCopaD5oEOnRqhF4L2Q==
-react-native-web-swiper@^2.1.1:
- version "2.1.1"
- resolved "https://registry.yarnpkg.com/react-native-web-swiper/-/react-native-web-swiper-2.1.1.tgz#aba2391deb534c28bf52ae3ac2a2532822224f6e"
- integrity sha512-uwBl9YDfAQGAwLb24JeZ42P65FJVpcQWm2GkHrmnGdEW0X1HkrkQ7v8Os/YecqizrnFV0LYZBCvMI7qPIKFosA==
- dependencies:
- prop-types "^15.6.2"
-
react-native-web@^0.11.7:
version "0.11.7"
resolved "https://registry.yarnpkg.com/react-native-web/-/react-native-web-0.11.7.tgz#d173d5a9b58db23b6d442c4bc4c81e9939adac23"