Bug fixing
@@ -390,14 +390,18 @@ class API extends EventEmitter {
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
mode: "no-cors",
|
mode: "no-cors",
|
||||||
}
|
}
|
||||||
|
let headers = new Headers()
|
||||||
|
|
||||||
fetch(
|
headers.set("Referer", config.refererURL)
|
||||||
|
fetchOptions.headers = headers
|
||||||
|
|
||||||
|
const path =
|
||||||
config.googleGeocodeURL +
|
config.googleGeocodeURL +
|
||||||
`?latlng=${coord.latitude},${coord.longitude}&key=${
|
`?latlng=${coord.latitude},${coord.longitude}&key=${
|
||||||
config.googleAPIKey
|
config.googleGeocodeAPIKey
|
||||||
}`,
|
}`
|
||||||
fetchOptions
|
|
||||||
)
|
fetch(path, fetchOptions)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return Promise.all([Promise.resolve(res), res.json()])
|
return Promise.all([Promise.resolve(res), res.json()])
|
||||||
})
|
})
|
||||||
@@ -407,7 +411,7 @@ class API extends EventEmitter {
|
|||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
let address = ""
|
let address = ""
|
||||||
|
|
||||||
if (responseBody.results && responseBody.result.length > 0) {
|
if (responseBody.results && responseBody.results.length > 0) {
|
||||||
address = responseBody.results[0].formatted_address
|
address = responseBody.results[0].formatted_address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
import autobind from "autobind-decorator"
|
import autobind from "autobind-decorator"
|
||||||
import backImage from "./images/back.png"
|
import backImage from "./images/back.png"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
|
import "url-search-params-polyfill"
|
||||||
|
|
||||||
const shapes = {
|
const shapes = {
|
||||||
order: {
|
order: {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import KeyboardSpacer from "react-native-keyboard-spacer"
|
|||||||
import { isIphoneX } from "react-native-iphone-x-helper"
|
import { isIphoneX } from "react-native-iphone-x-helper"
|
||||||
import { api } from "../API"
|
import { api } from "../API"
|
||||||
import { formatLatLng, parseLatLng } from "../util"
|
import { formatLatLng, parseLatLng } from "../util"
|
||||||
|
import "url-search-params-polyfill"
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
@@ -189,7 +190,7 @@ export class Activity extends React.Component {
|
|||||||
<BoundHeader
|
<BoundHeader
|
||||||
binder={binder}
|
binder={binder}
|
||||||
name="header"
|
name="header"
|
||||||
title="Work Item"
|
title="Activity"
|
||||||
leftButton={{ icon: "back", onPress: this.handleBackPress }}
|
leftButton={{ icon: "back", onPress: this.handleBackPress }}
|
||||||
rightButton={{ icon: "done", onPress: this.handleDonePress }}
|
rightButton={{ icon: "done", onPress: this.handleDonePress }}
|
||||||
/>
|
/>
|
||||||
@@ -220,31 +221,33 @@ export class Activity extends React.Component {
|
|||||||
label="Date & Time:"
|
label="Date & Time:"
|
||||||
/>
|
/>
|
||||||
<BoundInput binder={binder} name="location" label="Location:" />
|
<BoundInput binder={binder} name="location" label="Location:" />
|
||||||
<MapView
|
<View style={{ flexDirection: "column", justifyContent: "center" }}>
|
||||||
style={{
|
<MapView
|
||||||
flexDirection: "column",
|
style={{
|
||||||
justifyContent: "center",
|
flexDirection: "column",
|
||||||
width: "100%",
|
justifyContent: "center",
|
||||||
height: 400,
|
width: "100%",
|
||||||
marginTop: 10,
|
height: 400,
|
||||||
}}
|
marginTop: 10,
|
||||||
zoomControlEnabled={false}
|
}}
|
||||||
zoomEnabled={false}
|
zoomControlEnabled={false}
|
||||||
scrollEnabled={false}
|
zoomEnabled={false}
|
||||||
rotateEnabled={false}
|
scrollEnabled={false}
|
||||||
pitchEnabled={false}
|
rotateEnabled={false}
|
||||||
showsIndoors={false}
|
pitchEnabled={false}
|
||||||
showsTraffic={false}
|
showsIndoors={false}
|
||||||
showsCompass={false}
|
showsTraffic={false}
|
||||||
showsScale={false}
|
showsCompass={false}
|
||||||
showsUserLocation
|
showsScale={false}
|
||||||
cacheEnabled
|
showsUserLocation
|
||||||
initialRegion={{
|
cacheEnabled
|
||||||
latitude: 43.653908,
|
initialRegion={{
|
||||||
longitude: -79.384293,
|
latitude: 43.653908,
|
||||||
latitudeDelta: 0.0922,
|
longitude: -79.384293,
|
||||||
longitudeDelta: 0.0421,
|
latitudeDelta: 0.0922,
|
||||||
}}>
|
longitudeDelta: 0.0421,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
name="target"
|
name="target"
|
||||||
size={24}
|
size={24}
|
||||||
@@ -254,7 +257,7 @@ export class Activity extends React.Component {
|
|||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</MapView>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.panel}>
|
<View style={styles.panel}>
|
||||||
<PhotoPanel />
|
<PhotoPanel />
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import { Route, Redirect } from "react-router-native"
|
|||||||
|
|
||||||
export const DefaultRoute = () => {
|
export const DefaultRoute = () => {
|
||||||
// NOTE: When working on the app, change this to the page you are working on
|
// NOTE: When working on the app, change this to the page you are working on
|
||||||
return <Route render={() => <Redirect to={"/activity"} />} />
|
return <Route render={() => <Redirect to={"/workItem"} />} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class Login extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { messageModal, apiModal } = this.state
|
const { messageModal, apiModal, waitModal } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={Login.styles.page} behavior="padding">
|
<View style={Login.styles.page} behavior="padding">
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ import { ensurePermissions } from "../App"
|
|||||||
import { versionInfo } from "../version"
|
import { versionInfo } from "../version"
|
||||||
import { config } from "../config"
|
import { config } from "../config"
|
||||||
import KeyboardSpacer from "react-native-keyboard-spacer"
|
import KeyboardSpacer from "react-native-keyboard-spacer"
|
||||||
import hardhatPinImage from "./images/hardhat.png"
|
import hardhatPinImage from "./images/hardhat-pin.png"
|
||||||
import clipboardPinImage from "./images/clipboard.png"
|
import clipboardPinImage from "./images/clipboard-pin.png"
|
||||||
import questionPinImage from "./images/question.png"
|
import questionPinImage from "./images/question-pin.png"
|
||||||
|
|
||||||
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
||||||
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
|
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
|
||||||
@@ -141,7 +141,7 @@ export class Home extends React.Component {
|
|||||||
|
|
||||||
if (this.state.positionInfo) {
|
if (this.state.positionInfo) {
|
||||||
const coords = this.state.positionInfo.coords
|
const coords = this.state.positionInfo.coords
|
||||||
const workItem = sections[sectionIndex]
|
const workItem = this.sections[sectionIndex]
|
||||||
const [lng, lat] = workItem.location.coordinates
|
const [lng, lat] = workItem.location.coordinates
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -159,16 +159,16 @@ export class Home extends React.Component {
|
|||||||
@autobind
|
@autobind
|
||||||
handleWorkItemsListPress() {
|
handleWorkItemsListPress() {
|
||||||
const { positionInfo } = this.state
|
const { positionInfo } = this.state
|
||||||
this.props.history.push(
|
|
||||||
`/workItemList${
|
if (positionInfo) {
|
||||||
positionInfo
|
const { coords } = positionInfo
|
||||||
? "?latLng=" +
|
|
||||||
coords.latitude.toString() +
|
this.props.history.push(
|
||||||
"," +
|
`/workItemList?latLng=${coords.latitude},${coords.longitude}`
|
||||||
coords.longitude.toString()
|
)
|
||||||
: ""
|
} else {
|
||||||
}`
|
this.props.history.push("/workItemList")
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
@@ -184,8 +184,8 @@ export class Home extends React.Component {
|
|||||||
@autobind
|
@autobind
|
||||||
handleGlassesPress() {
|
handleGlassesPress() {
|
||||||
const { lat: lat1, lng: lng1 } = this.state.positionInfo.coords
|
const { lat: lat1, lng: lng1 } = this.state.positionInfo.coords
|
||||||
const closestWorkItem = null
|
let closestWorkItem = null
|
||||||
const shortestDistance = config.minDistanceToItem
|
let shortestDistance = config.minDistanceToItem
|
||||||
|
|
||||||
this.state.sections.forEach((workItem) => {
|
this.state.sections.forEach((workItem) => {
|
||||||
const [lng2, lat2] = workItem.location.coordinates
|
const [lng2, lat2] = workItem.location.coordinates
|
||||||
@@ -270,7 +270,7 @@ export class Home extends React.Component {
|
|||||||
showsBuildings={false}
|
showsBuildings={false}
|
||||||
showsTraffic={false}
|
showsTraffic={false}
|
||||||
showsIndoors={false}
|
showsIndoors={false}
|
||||||
zoomControlEnabled
|
zoomControlEnabled={false}
|
||||||
region={region}>
|
region={region}>
|
||||||
{sections.map((workItem, index) => (
|
{sections.map((workItem, index) => (
|
||||||
<Marker
|
<Marker
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/src/Home/images/clipboard-pin@1x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/src/Home/images/hardhat-pin@1x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/src/Home/images/question-pin@1x.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.1 KiB |
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from "react"
|
import React, { Component } from "react"
|
||||||
import Modal from "react-native-modal"
|
import Modal from "react-native-modal"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import { View, ActivityIndicator } from "react-native"
|
import { View, Text, ActivityIndicator } from "react-native"
|
||||||
|
|
||||||
export class WaitModal extends Component {
|
export class WaitModal extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@@ -18,10 +18,18 @@ export class WaitModal extends Component {
|
|||||||
style={{
|
style={{
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
backgroundColor: "#FFFFFF",
|
backgroundColor: "transparent",
|
||||||
}}>
|
}}>
|
||||||
<ActivityIndicator size="large" color="#0000FF" />
|
<ActivityIndicator size="large" color="#0000FF" />
|
||||||
<Text style={{ marginTop: 5, fontSize: 18 }}>{message}</Text>
|
<Text
|
||||||
|
style={{
|
||||||
|
marginTop: 15,
|
||||||
|
fontSize: 18,
|
||||||
|
alignSelf: "center",
|
||||||
|
color: "#FFFFFF",
|
||||||
|
}}>
|
||||||
|
{message}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { ifIphoneX, isIphoneX } from "react-native-iphone-x-helper"
|
|||||||
import KeyboardSpacer from "react-native-keyboard-spacer"
|
import KeyboardSpacer from "react-native-keyboard-spacer"
|
||||||
import { api } from "../API"
|
import { api } from "../API"
|
||||||
import "url-search-params-polyfill"
|
import "url-search-params-polyfill"
|
||||||
|
import { config } from "../config"
|
||||||
import { workItemTypeEnum, formatLatLng, parseLatLng } from "../util"
|
import { workItemTypeEnum, formatLatLng, parseLatLng } from "../util"
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
@@ -58,6 +59,7 @@ export class WorkItem extends React.Component {
|
|||||||
location: {
|
location: {
|
||||||
isValid: (r, v) => v !== "",
|
isValid: (r, v) => v !== "",
|
||||||
isReadOnly: true,
|
isReadOnly: true,
|
||||||
|
alwaysGet: true,
|
||||||
},
|
},
|
||||||
address: {
|
address: {
|
||||||
isValid: true,
|
isValid: true,
|
||||||
@@ -74,15 +76,18 @@ export class WorkItem extends React.Component {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
|
region = {
|
||||||
|
latitude: 43.653908,
|
||||||
|
longitude: -79.384293,
|
||||||
|
latitudeDelta: 0.0922,
|
||||||
|
longitudeDelta: 0.0421,
|
||||||
|
}
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
binder: new FormBinder({}, WorkItem.bindings),
|
binder: new FormBinder({}, WorkItem.bindings),
|
||||||
messageModal: null,
|
messageModal: null,
|
||||||
region: {
|
region,
|
||||||
latitude: 43.653908,
|
|
||||||
longitude: -79.384293,
|
|
||||||
latitudeDelta: 0.0922,
|
|
||||||
longitudeDelta: 0.0421,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { search } = this.props.location
|
const { search } = this.props.location
|
||||||
@@ -96,15 +101,17 @@ export class WorkItem extends React.Component {
|
|||||||
.then((workItem) => {
|
.then((workItem) => {
|
||||||
if (workItem) {
|
if (workItem) {
|
||||||
const [lng, lat] = workItem.location.coordinates
|
const [lng, lat] = workItem.location.coordinates
|
||||||
|
const region = {
|
||||||
|
latitude: lat,
|
||||||
|
longitude: lng,
|
||||||
|
latitudeDelta: 0.01,
|
||||||
|
longitudeDelta: 0.01,
|
||||||
|
}
|
||||||
|
|
||||||
workItem.location = formatLatLng(lat, lng)
|
workItem.location = formatLatLng(lat, lng)
|
||||||
this.setState({
|
this.setState({
|
||||||
binder: new FormBinder(workItem, WorkItem.bindings),
|
binder: new FormBinder(workItem, WorkItem.bindings),
|
||||||
region: {
|
region,
|
||||||
latitude: lat,
|
|
||||||
longitude: lng,
|
|
||||||
latitudeDelta: 0.01,
|
|
||||||
longitudeDelta: 0.01,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -198,6 +205,7 @@ export class WorkItem extends React.Component {
|
|||||||
|
|
||||||
if (this.geoCodeTimer) {
|
if (this.geoCodeTimer) {
|
||||||
clearTimeout(this.geoCodeTimer)
|
clearTimeout(this.geoCodeTimer)
|
||||||
|
this.geoCodeTimer = null
|
||||||
}
|
}
|
||||||
|
|
||||||
this.geoCodeTimer = setTimeout(
|
this.geoCodeTimer = setTimeout(
|
||||||
@@ -209,12 +217,16 @@ export class WorkItem extends React.Component {
|
|||||||
@autobind
|
@autobind
|
||||||
handleStartAddressLookup(latLng) {
|
handleStartAddressLookup(latLng) {
|
||||||
api
|
api
|
||||||
.addressLookup(latLng)
|
.getAddress(latLng)
|
||||||
.then((address) => {
|
.then((address) => {
|
||||||
this.setState({ address })
|
if (this.addressInput) {
|
||||||
|
this.addressInput.handleChangeText(address)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.setState({ address: "" })
|
if (this.addressInput) {
|
||||||
|
this.addressInput.handleChangeText("")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +264,7 @@ export class WorkItem extends React.Component {
|
|||||||
<View style={styles.panel}>
|
<View style={styles.panel}>
|
||||||
<View style={{ flexDirection: "column", justifyContent: "center" }}>
|
<View style={{ flexDirection: "column", justifyContent: "center" }}>
|
||||||
<MapView
|
<MapView
|
||||||
|
ref={(ref) => (this.mapView = ref)}
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
@@ -262,7 +275,7 @@ export class WorkItem extends React.Component {
|
|||||||
showsBuildings={false}
|
showsBuildings={false}
|
||||||
showsTraffic={false}
|
showsTraffic={false}
|
||||||
showsIndoors={false}
|
showsIndoors={false}
|
||||||
zoomControlEnabled
|
zoomControlEnabled={false}
|
||||||
rotateEnabled={false}
|
rotateEnabled={false}
|
||||||
region={region}
|
region={region}
|
||||||
onRegionChange={this.handleRegionChange}
|
onRegionChange={this.handleRegionChange}
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import {
|
|||||||
parseLatLng,
|
parseLatLng,
|
||||||
pad,
|
pad,
|
||||||
geoDistance,
|
geoDistance,
|
||||||
|
dotify,
|
||||||
} from "../util"
|
} from "../util"
|
||||||
|
import "url-search-params-polyfill"
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
@@ -179,7 +181,7 @@ export class WorkItemList extends React.Component {
|
|||||||
{workItemTypeText[item.workItemType]}
|
{workItemTypeText[item.workItemType]}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={{ fontSize: 14, color: "gray" }}>
|
<Text style={{ fontSize: 14, color: "gray" }}>
|
||||||
{`${item.address || "..."} | ${
|
{`${dotify(item.address) || "..."} | ${
|
||||||
this.position
|
this.position
|
||||||
? geoDistance(
|
? geoDistance(
|
||||||
this.position.latitude,
|
this.position.latitude,
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import { Platform } from "react-native"
|
|||||||
export const config = {
|
export const config = {
|
||||||
localIPAddr: "192.168.1.175",
|
localIPAddr: "192.168.1.175",
|
||||||
viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46",
|
viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46",
|
||||||
googleAPIKey:
|
googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI",
|
||||||
Platform.os === "ios"
|
|
||||||
? "AIzaSyDN4E_vzO4cKjKHkMg_49hX1GBnU34kx4U"
|
|
||||||
: "AIzaSyAC7r1GjMFL1atZdbEcFSdCaXDrPnISqTc",
|
|
||||||
googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json",
|
googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json",
|
||||||
|
refererURL: "https://dar.kss.us.com",
|
||||||
defaultUser: "john@lyon-smith.org",
|
defaultUser: "john@lyon-smith.org",
|
||||||
//defaultUser: "",
|
//defaultUser: "",
|
||||||
//minGPSAccuracy: 20,
|
//minGPSAccuracy: 20,
|
||||||
|
|||||||
@@ -54,7 +54,12 @@ export class BoundInput extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ width: "100%" }}>
|
<View style={{ width: "100%" }}>
|
||||||
<Text style={{ color: "black", fontSize: 14, marginBottom: 5 }}>
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "black",
|
||||||
|
fontSize: 14,
|
||||||
|
marginBottom: 5,
|
||||||
|
}}>
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -68,6 +73,7 @@ export class BoundInput extends React.Component {
|
|||||||
paddingTop: 7,
|
paddingTop: 7,
|
||||||
paddingBottom: Platform.OS === "ios" ? 7 : 0,
|
paddingBottom: Platform.OS === "ios" ? 7 : 0,
|
||||||
textAlignVertical: "top",
|
textAlignVertical: "top",
|
||||||
|
marginBottom: 5,
|
||||||
}}
|
}}
|
||||||
multiline={lines > 1}
|
multiline={lines > 1}
|
||||||
numberOfLines={lines}
|
numberOfLines={lines}
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ export const pad = (num, size) => {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const dotify = (s) => {
|
||||||
|
if (s.length < 30) {
|
||||||
|
return s
|
||||||
|
} else {
|
||||||
|
return s.substring(0, 26) + "..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const regionContainingPoints = (points, inset) => {
|
export const regionContainingPoints = (points, inset) => {
|
||||||
let minX,
|
let minX,
|
||||||
maxX,
|
maxX,
|
||||||
|
|||||||
@@ -143,75 +143,6 @@ export class Teams extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleResendEmail() {
|
|
||||||
this.setState({
|
|
||||||
waitModal: { message: "Resending Email..." },
|
|
||||||
})
|
|
||||||
api
|
|
||||||
.sendConfirmEmail({ existingEmail: this.state.selectedTeam.email })
|
|
||||||
.then(() => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "thumb",
|
|
||||||
message: `An email has been sent to '${
|
|
||||||
this.state.selectedTeam.email
|
|
||||||
}' with further instructions.`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.setState({
|
|
||||||
error: true,
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "hand",
|
|
||||||
message: "Unable to request email change.",
|
|
||||||
detail: error.message,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
|
||||||
handleChangeEmailDismiss(newEmail) {
|
|
||||||
this.setState({ changeEmailModal: null })
|
|
||||||
if (!newEmail) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
waitModal: { message: "Requesting Email Change..." },
|
|
||||||
})
|
|
||||||
if (this.state.selectedTeam) {
|
|
||||||
api
|
|
||||||
.sendConfirmEmail({
|
|
||||||
existingEmail: this.state.selectedTeam.email,
|
|
||||||
newEmail,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
this.setState({
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "hand",
|
|
||||||
message: `An email has been sent to '${newEmail}' to confirm this email.`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
this.setState({
|
|
||||||
error: true,
|
|
||||||
waitModal: null,
|
|
||||||
messageModal: {
|
|
||||||
icon: "hand",
|
|
||||||
message: "Unable to request email change.",
|
|
||||||
detail: error.message,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handleRemove() {
|
handleRemove() {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||