diff --git a/mobile/src/Activity/Activity.js b/mobile/src/Activity/Activity.js index ae641b8..7f209a5 100644 --- a/mobile/src/Activity/Activity.js +++ b/mobile/src/Activity/Activity.js @@ -97,16 +97,14 @@ export class Activity extends React.Component { .getActivity(id) .then((activity) => { if (activity) { - const [lng, lat] = activity.location.coordinates - activity.location = formatLatLng(lat, lng) this.setState({ binder: new FormBinder(activity, Activity.bindings), - region: { - latitude: lat, - longitude: lng, - latitudeDelta: 0.01, - longitudeDelta: 0.01, - }, + // region: { + // latitude: lat, + // longitude: lng, + // latitudeDelta: 0.01, + // longitudeDelta: 0.01, + // }, }) } }) diff --git a/mobile/src/Auth/DefaultRoute.js b/mobile/src/Auth/DefaultRoute.js index 6735acf..43027b5 100644 --- a/mobile/src/Auth/DefaultRoute.js +++ b/mobile/src/Auth/DefaultRoute.js @@ -3,5 +3,5 @@ import { Route, Redirect } from "react-router-native" export const DefaultRoute = () => { // NOTE: When working on the app, change this to the page you are working on - return } /> + return } /> } diff --git a/mobile/src/Auth/Login.js b/mobile/src/Auth/Login.js index 1c7c644..7ccd2d1 100644 --- a/mobile/src/Auth/Login.js +++ b/mobile/src/Auth/Login.js @@ -96,7 +96,7 @@ export class Login extends React.Component { let { history } = this.props if (obj) { - this.setState({ waitModal: { message: "Loggin In..." } }) + this.setState({ waitModal: { message: "Logging In..." } }) api .login(obj.email.trim(), obj.password, obj.rememberMe) .then((user) => { diff --git a/mobile/src/Home/Home.js b/mobile/src/Home/Home.js index b8b62c7..ba1bd74 100644 --- a/mobile/src/Home/Home.js +++ b/mobile/src/Home/Home.js @@ -22,6 +22,7 @@ import { workItemTypeText, pad, regionContainingPoints, + dotify, } from "../util" import { ensurePermissions } from "../App" import { versionInfo } from "../version" @@ -79,7 +80,7 @@ export class Home extends React.Component { results[PermissionsAndroid.PERMISSIONS.CAMERA] === PermissionsAndroid.RESULTS.GRANTED ) { - this.setState({ haveCameraPerm: true }) + this.setState({ haveCameraPermission: true }) } }, () => { @@ -141,15 +142,15 @@ export class Home extends React.Component { if (this.state.positionInfo) { const coords = this.state.positionInfo.coords - const workItem = this.sections[sectionIndex] - const [lng, lat] = workItem.location.coordinates + const workItem = this.state.sections[sectionIndex] + const { latitude, longitude } = workItem.coordinate this.setState({ workItemDistance: geoDistance( coords.latitude, coords.longitude, - lat, - lng, + latitude, + longitude, "K" ).toFixed(2), }) @@ -183,13 +184,17 @@ export class Home extends React.Component { @autobind handleGlassesPress() { - const { lat: lat1, lng: lng1 } = this.state.positionInfo.coords + const { + latitude: latitude1, + longitude: longitude1, + } = this.state.positionInfo.coords let closestWorkItem = null let shortestDistance = config.minDistanceToItem this.state.sections.forEach((workItem) => { - const [lng2, lat2] = workItem.location.coordinates - const distance = geoDistance(lat1, lng1, lat2, lng2, "K") * 1000 + const { latitude: latitude2, longitude: longitude2 } = workItem.coordinate + const distance = + geoDistance(latitude1, longitude1, latitude2, longitude2, "K") * 1000 if (distance <= shortestDistance) { closestWorkItem = workItem @@ -290,14 +295,14 @@ export class Home extends React.Component { {pad(workItem.ticketNumber, 4) + ": " + - workItemTypeText[workItem.workItemType]} - - - {workItem.address} ({this.workItemDistance > 0 - ? this.workItemDistance.toString() - : "?"}{" "} - km) + workItemTypeText[workItem.workItemType] + + " (" + + (workItemDistance > 0 + ? workItemDistance.toString() + : "?") + + " km)"} + {dotify(workItem.address)} @@ -311,6 +316,8 @@ export class Home extends React.Component { flexBasis: 0, width: "100%", }}> + {/* + // TODO: Search feature - + */} (this.sectionList = ref)} style={{ width: "100%", flexGrow: 1 }} @@ -374,7 +381,7 @@ export class Home extends React.Component { @@ -399,6 +406,7 @@ export class Home extends React.Component { flexGrow: 1, flexBasis: 0, flexDirection: "column", + marginLeft: 10, }}> {activity.resolution}