Pre release tweaks

This commit is contained in:
John Lyon-Smith
2018-05-14 18:50:08 -07:00
parent 82f2828441
commit 5d67cb69b0
6 changed files with 38 additions and 40 deletions

View File

@@ -90,6 +90,7 @@ export class Activity extends React.Component {
waitModal: null, waitModal: null,
messageModal: null, messageModal: null,
progressModal: null, progressModal: null,
uploadPercent: 0,
} }
const { search } = this.props.location const { search } = this.props.location
@@ -261,10 +262,12 @@ export class Activity extends React.Component {
const { const {
binder, binder,
messageModal, messageModal,
progressModal,
waitModal, waitModal,
region, region,
dateTime, dateTime,
location, location,
uploadPercent,
} = this.state } = this.state
return ( return (

View File

@@ -65,7 +65,7 @@ export default class App extends React.Component {
path="/workItemList" path="/workItemList"
component={WorkItemList} component={WorkItemList}
/> />
<DefaultRoute redirect="/workItem" /> <DefaultRoute redirect="/home" />
</Switch> </Switch>
</View> </View>
</NativeRouter> </NativeRouter>

View File

@@ -80,6 +80,10 @@ export class WorkItem extends React.Component {
isValid: (r, v) => v !== "", isValid: (r, v) => v !== "",
alwaysGet: true, alwaysGet: true,
}, },
addActivity: {
noValue: true,
isDisabled: (r, v) => r.anyModified,
},
} }
constructor(props) { constructor(props) {
@@ -277,8 +281,8 @@ export class WorkItem extends React.Component {
@autobind @autobind
handleAddActivity() { handleAddActivity() {
if (this.history) { if (this.props.history) {
this.history.push(`/activity?workItemId=${this.binder._id}`) this.props.history.push(`/activity?workItemId=${this.state.binder._id}`)
} }
} }
@@ -375,21 +379,12 @@ export class WorkItem extends React.Component {
{api.loggedInUser.administrator && {api.loggedInUser.administrator &&
binder._id && ( binder._id && (
<View style={styles.panel}> <View style={styles.panel}>
<TouchableOpacity <BoundButton
name="addActivity"
title="Add Activity"
binder={binder}
onPress={this.handleAddActivity} onPress={this.handleAddActivity}
style={{ />
alignSelf: "center",
backgroundColor: "blue",
justifyContent: "center",
paddingHorizontal: 10,
height: 40,
width: "100%",
backgroundColor: "#3BB0FD",
}}>
<Text style={{ alignSelf: "center", color: "black" }}>
Add Activity
</Text>
</TouchableOpacity>
</View> </View>
)} )}
{isIphoneX ? <View style={{ height: 30, width: "100%" }} /> : null} {isIphoneX ? <View style={{ height: 30, width: "100%" }} /> : null}

View File

@@ -2,31 +2,31 @@ import React from "react"
import { Platform } from "react-native" import { Platform } from "react-native"
export const config = { export const config = {
localIPAddr: "192.168.1.175", //localIPAddr: "192.168.1.175",
//localIPAddr: "192.168.1.14", localIPAddr: "192.168.1.14",
viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46", viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46",
googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI", googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI",
googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json", googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json",
refererURL: "https://dar.kss.us.com", refererURL: "https://dar.kss.us.com",
defaultUser: "john@lyon-smith.org", //defaultUser: "john@lyon-smith.org",
//defaultUser: "", defaultUser: "",
minGPSAccuracy: 50, //minGPSAccuracy: 50,
//minGPSAccuracy: 20, minGPSAccuracy: 20,
minDistanceToItem: 10, minDistanceToItem: 10,
geocodeDelayMilliseconds: 500, geocodeDelayMilliseconds: 500,
// This region is downtown Toronto // This region is downtown Toronto
// initialRegion: {
// latitude: 43.653908,
// longitude: -79.384293,
// latitudeDelta: 0.0922,
// longitudeDelta: 0.0421,
// },
// This region is Bainbridge Island
initialRegion: { initialRegion: {
latitude: 47.629536, latitude: 43.653908,
longitude: -122.524162, longitude: -79.384293,
latitudeDelta: 0.0922, latitudeDelta: 0.0922,
longitudeDelta: 0.0421, longitudeDelta: 0.0421,
}, },
alwaysShowWorkItemInAR: true, // This region is Bainbridge Island
// initialRegion: {
// latitude: 47.629536,
// longitude: -122.524162,
// latitudeDelta: 0.0922,
// longitudeDelta: 0.0421,
// },
// alwaysShowWorkItemInAR: true,
} }

View File

@@ -34,7 +34,7 @@ export class BoundInput extends React.Component {
@autobind @autobind
handleChangeText(newText) { handleChangeText(newText) {
if (this.props.binder) { if (this && this.props && this.props.binder) {
this.setState( this.setState(
this.props.binder.updateFieldValue(this.props.name, newText) this.props.binder.updateFieldValue(this.props.name, newText)
) )

View File

@@ -11,6 +11,7 @@ import {
} from "react-native" } from "react-native"
import { Icon } from "." import { Icon } from "."
import ImagePicker from "react-native-image-picker" import ImagePicker from "react-native-image-picker"
import ImageResizer from "react-native-image-resizer"
import autobind from "autobind-decorator" import autobind from "autobind-decorator"
import { api } from "../API" import { api } from "../API"
@@ -48,7 +49,7 @@ export class BoundPhotoPanel extends Component {
@autobind @autobind
handlePhotoPress(index) { handlePhotoPress(index) {
const { onUploadStarted, onUploadEnded } = this.props const { onUploadStarted, onUploadEnded, onUploadProgress } = this.props
ImagePicker.showImagePicker( ImagePicker.showImagePicker(
{ {
@@ -67,11 +68,10 @@ export class BoundPhotoPanel extends Component {
const uri = response.path || response.uri const uri = response.path || response.uri
createResizedImage(uri, 800, 600, "JPEG", 80) ImageResizer.createResizedImage(uri, 1024, 1024, "JPEG", 80)
.then((newUri) => { .then((result) =>
return api.upload(result.path || result.uri, onUploadProgress)
api.upload(newUri, this.props.onUploadProgress) )
})
.then((uploadData) => { .then((uploadData) => {
if (onUploadEnded) { if (onUploadEnded) {
onUploadEnded(true, uploadData) onUploadEnded(true, uploadData)