diff --git a/.expo/packager-info.json b/.expo/packager-info.json index 92db722..ced9713 100644 --- a/.expo/packager-info.json +++ b/.expo/packager-info.json @@ -1,10 +1,10 @@ { "devToolsPort": 19002, - "expoServerPort": null, - "packagerPort": null, - "packagerPid": null, - "expoServerNgrokUrl": null, - "packagerNgrokUrl": null, - "ngrokPid": null, + "expoServerPort": 19000, + "packagerPort": 19001, + "packagerPid": 24496, + "expoServerNgrokUrl": "https://3f-pii.williamluke.giza-native.exp.direct", + "packagerNgrokUrl": "https://packager.3f-pii.williamluke.giza-native.exp.direct", + "ngrokPid": 14344, "webpackServerPort": null } \ No newline at end of file diff --git a/.expo/settings.json b/.expo/settings.json index 45ad40f..2540290 100644 --- a/.expo/settings.json +++ b/.expo/settings.json @@ -1,5 +1,5 @@ { - "hostType": "lan", + "hostType": "tunnel", "lanType": "ip", "dev": true, "minify": false, diff --git a/App.js b/App.js new file mode 100644 index 0000000..3aff1ee --- /dev/null +++ b/App.js @@ -0,0 +1,2 @@ +import App from './src/App'; +export default App \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..1d06793 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,38 @@ +# Giza + +Open Source Power Outage Tracker + +[![version-badge][version-badge]][versions] +[![license-badge][license-badge]][license] +[![PRs Welcome][prs-badge]][prs] +[![Donate][donate-badge]][donate] +[![Code of Conduct][coc-badge]][coc] + +## Reason + +- Improved fault finding +- Better distribution of public infomation + +## Features + +- [ ] Planed Outages +- [ ] Reporting +- [ ] Outage Heatmap + - [ ] Customizable Date Range +- [ ] User Account + - [ ] KPLC Acc No. + +## LICENSE + +MIT + +[versions]: https://github.com/kentcdodds/custom-badges/releases +[version-badge]: https://img.shields.io/badge/-Proudly--Kenyan-red.svg?style=flat-square&logoPosition=-5&logoWidth=35&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd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ggaWQ9ImRlY29fciIgZD0iTTE5LDI0YzMsLTggNSwtMTYgNSwtMjRzLTIsLTE2IC01LC0yNGMtMyw4IC01LDE2IC01LDI0czIsMTYgNSwyNHoiIGZpbGw9IiMwMDAiLz48dXNlIHhsaW5rOmhyZWY9IiNkZWNvX3IiIHRyYW5zZm9ybT0ic2NhbGUoLTEsMSkiLz48ZyBmaWxsPSIjZmZmIj48ZWxsaXBzZSByeD0iNCIgcnk9IjYiLz48cGF0aCBpZD0iZGVjb19iciIgZD0iTTEsNS44NWMwLDAgNCw4IDQsMjFzLTQsMjEgLTQsMjF6Ii8+PHVzZSB4bGluazpocmVmPSIjZGVjb19iciIgdHJhbnNmb3JtPSJzY2FsZSgtMSkiLz48dXNlIHhsaW5rOmhyZWY9IiNkZWNvX2JyIiB0cmFuc2Zvcm09InNjYWxlKC0xLDEpIi8+PHVzZSB4bGluazpocmVmPSIjZGVjb19iciIgdHJhbnNmb3JtPSJzY2FsZSgxLC0xKSIvPjwvZz48L2c+PC9zdmc+ +[license-badge]: https://img.shields.io/badge/license-MIT%20License-blue.svg?style=flat-square +[license]: https://github.com/kentcdodds/custom-badges/blob/master/LICENSE +[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square +[prs]: http://makeapullrequest.com +[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square +[donate]: http://kcd.im/donate +[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square +[coc]: https://github.com/kentcdodds/custom-badges/blob/master/CODE_OF_CONDUCT.md \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index b8ac6f7..7ff20e6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ +import { AppLoading, Asset, Font, Icon } from 'expo'; import React from 'react'; import { Platform, StatusBar, StyleSheet, View } from 'react-native'; -import { AppLoading, Asset, Font, Icon } from 'expo'; import AppNavigator from './navigation/AppNavigator'; export default class App extends React.Component { @@ -30,15 +30,15 @@ export default class App extends React.Component { _loadResourcesAsync = async () => { return Promise.all([ Asset.loadAsync([ - require('./assets/images/homescreen192.png'), - require('./assets/images/robot-prod.png'), + require('../assets/images/homescreen192.png'), + require('../assets/images/robot-prod.png'), ]), Font.loadAsync({ // This is the font that we are using for our tab bar ...Icon.Ionicons.font, // We include SpaceMono because we use it in HomeScreen.js. Feel free // to remove this if you are not using it in your app - 'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'), + 'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'), }), ]); }; diff --git a/src/components/Map.tsx b/src/components/Map.tsx index e798353..4579d5c 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -1,19 +1,341 @@ import React from 'react'; -import { MapView } from 'expo'; +import { Platform } from 'react-native'; +import { Constants, Location, Permissions } from 'expo'; +import MapView, { Circle } from 'react-native-maps'; -export default class App extends React.Component { +interface IState { + location: Location.LocationData; + errorMessage: string | null; +} +const mapStyles = [ + { + elementType: 'geometry', + stylers: [ + { + color: '#ebe3cd' + } + ] + }, + { + elementType: 'labels.text.fill', + stylers: [ + { + color: '#523735' + } + ] + }, + { + elementType: 'labels.text.stroke', + stylers: [ + { + color: '#f5f1e6' + } + ] + }, + { + featureType: 'administrative', + elementType: 'geometry.stroke', + stylers: [ + { + color: '#c9b2a6' + } + ] + }, + { + featureType: 'administrative.land_parcel', + elementType: 'geometry.stroke', + stylers: [ + { + color: '#dcd2be' + } + ] + }, + { + featureType: 'administrative.land_parcel', + elementType: 'labels', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'administrative.land_parcel', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#ae9e90' + } + ] + }, + { + featureType: 'landscape.natural', + elementType: 'geometry', + stylers: [ + { + color: '#dfd2ae' + } + ] + }, + { + featureType: 'poi', + elementType: 'geometry', + stylers: [ + { + color: '#dfd2ae' + } + ] + }, + { + featureType: 'poi', + elementType: 'labels.text', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'poi', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#93817c' + } + ] + }, + { + featureType: 'poi.business', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'poi.park', + elementType: 'geometry.fill', + stylers: [ + { + color: '#a5b076' + } + ] + }, + { + featureType: 'poi.park', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#447530' + } + ] + }, + { + featureType: 'road', + elementType: 'geometry', + stylers: [ + { + color: '#f5f1e6' + } + ] + }, + { + featureType: 'road', + elementType: 'labels.icon', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'road.arterial', + elementType: 'geometry', + stylers: [ + { + color: '#fdfcf8' + } + ] + }, + { + featureType: 'road.highway', + elementType: 'geometry', + stylers: [ + { + color: '#f8c967' + } + ] + }, + { + featureType: 'road.highway', + elementType: 'geometry.stroke', + stylers: [ + { + color: '#e9bc62' + } + ] + }, + { + featureType: 'road.highway.controlled_access', + elementType: 'geometry', + stylers: [ + { + color: '#e98d58' + } + ] + }, + { + featureType: 'road.highway.controlled_access', + elementType: 'geometry.stroke', + stylers: [ + { + color: '#db8555' + } + ] + }, + { + featureType: 'road.local', + elementType: 'labels', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'road.local', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#806b63' + } + ] + }, + { + featureType: 'transit', + stylers: [ + { + visibility: 'off' + } + ] + }, + { + featureType: 'transit.line', + elementType: 'geometry', + stylers: [ + { + color: '#dfd2ae' + } + ] + }, + { + featureType: 'transit.line', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#8f7d77' + } + ] + }, + { + featureType: 'transit.line', + elementType: 'labels.text.stroke', + stylers: [ + { + color: '#ebe3cd' + } + ] + }, + { + featureType: 'transit.station', + elementType: 'geometry', + stylers: [ + { + color: '#dfd2ae' + } + ] + }, + { + featureType: 'water', + elementType: 'geometry.fill', + stylers: [ + { + color: '#b9d3c2' + } + ] + }, + { + featureType: 'water', + elementType: 'labels.text.fill', + stylers: [ + { + color: '#92998d' + } + ] + } +] +export default class Map extends React.Component<{},IState> { + state = { + region: { latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }, + location: {coords: { latitude: 37.78825, longitude: -122.4324, accuracy: 1000}}, + errorMessage: null + } + componentWillMount() { + if (Platform.OS === 'android' && !Constants.isDevice) { + this.setState({ + errorMessage: 'Oops, this will not work on Sketch in an Android emulator. Try it on your device!', + }); + } else { + this._getLocationAsync(); + } + } + + _getLocationAsync = async () => { + let { status } = await Permissions.askAsync(Permissions.LOCATION); + if (status !== 'granted') { + this.setState({ + errorMessage: 'Permission to access location was denied', + }); + } + + let location = await Location.getCurrentPositionAsync({accuracy: Location.Accuracy.Low}); + this.setState({ location }); + }; render() { + const {location} = this.state; + const region = (location && location.coords) ? { + latitude: location.coords.latitude, + longitude: location.coords.longitude, + latitudeDelta: 0.0922, + longitudeDelta: 0.0421 + } : undefined return ( + > + { + location + ? + : 'Nope' + } + ); } } diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index bf7ceb1..bbb9c20 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -1,16 +1,12 @@ import * as React from 'react'; import { - Image, Platform, - ScrollView, StyleSheet, Text, - TouchableOpacity, View, } from 'react-native'; import { WebBrowser } from 'expo'; import Map from '../components/Map' -import { MonoText } from '../components/StyledText'; export default class HomeScreen extends React.Component { static navigationOptions = { diff --git a/src/screens/LinksScreen.tsx b/src/screens/LinksScreen.tsx index 949120d..cf738dc 100644 --- a/src/screens/LinksScreen.tsx +++ b/src/screens/LinksScreen.tsx @@ -4,7 +4,7 @@ import { ExpoLinksView } from '@expo/samples'; export default class LinksScreen extends React.Component { static navigationOptions = { - title: 'Links', + title: 'Outages', }; render() {