|
@@ -11,12 +11,9 @@ import { useState } from "react"
|
|
import { Alert, Text, StyleSheet, Pressable, TextInput, TouchableOpacity, View, Keyboard } from "react-native"
|
|
import { Alert, Text, StyleSheet, Pressable, TextInput, TouchableOpacity, View, Keyboard } from "react-native"
|
|
import Modal from "react-native-modal"
|
|
import Modal from "react-native-modal"
|
|
import Select from "react-native-multiple-select"
|
|
import Select from "react-native-multiple-select"
|
|
-import { useAuth } from "../../../../data/Auth/AuthContext"
|
|
|
|
import { LMComment } from "../../../../data/comments"
|
|
import { LMComment } from "../../../../data/comments"
|
|
import { Landmark } from "../../../../data/landmarks"
|
|
import { Landmark } from "../../../../data/landmarks"
|
|
|
|
|
|
-import { lmTypes as allLmTypes, lmTypesIndoor, catTypes } from "../../../../utils/GlobalUtils";
|
|
|
|
-
|
|
|
|
|
|
|
|
interface ReportProps {
|
|
interface ReportProps {
|
|
landmark?: Landmark,
|
|
landmark?: Landmark,
|
|
@@ -25,7 +22,6 @@ interface ReportProps {
|
|
}
|
|
}
|
|
|
|
|
|
export const Report: React.FC<ReportProps> = (props) => {
|
|
export const Report: React.FC<ReportProps> = (props) => {
|
|
- let lmTypes = lmTypesIndoor
|
|
|
|
|
|
|
|
const [keyboardIsVisible, setKeyboardIsVisible] = useState(false)
|
|
const [keyboardIsVisible, setKeyboardIsVisible] = useState(false)
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -46,7 +42,6 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
setModalVisible(!modalVisible)
|
|
setModalVisible(!modalVisible)
|
|
}
|
|
}
|
|
|
|
|
|
- const { landmarkOwnedByUser, anonUserId, setAlert } = useAuth()
|
|
|
|
const sendReport = () => {
|
|
const sendReport = () => {
|
|
var report = props.isLandmark ?
|
|
var report = props.isLandmark ?
|
|
"Report submitted for landmark '" + props.landmark?.title + "':\n\tID: " + props.landmark?.id
|
|
"Report submitted for landmark '" + props.landmark?.title + "':\n\tID: " + props.landmark?.id
|
|
@@ -64,7 +59,7 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
}
|
|
}
|
|
text ? report += "Extra comments: " + text : null
|
|
text ? report += "Extra comments: " + text : null
|
|
console.log(report)
|
|
console.log(report)
|
|
- Alert.alert('Report submitted', 'Thank you for making the Atlas a safer place!')
|
|
|
|
|
|
+ Alert.alert('Report submitted', 'Thank you for making The Atlas a safer place!')
|
|
setModalVisible(!modalVisible)
|
|
setModalVisible(!modalVisible)
|
|
// console.log((landmarkOwnedByUser(props.landmark)))
|
|
// console.log((landmarkOwnedByUser(props.landmark)))
|
|
}
|
|
}
|
|
@@ -97,7 +92,6 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
setSelectedReasons(selectedReasons)
|
|
setSelectedReasons(selectedReasons)
|
|
for (let i = 0; i < selectedReasons.length; i++) {
|
|
for (let i = 0; i < selectedReasons.length; i++) {
|
|
var tempItem = reasons.find(item => item.value === selectedReasons[i])
|
|
var tempItem = reasons.find(item => item.value === selectedReasons[i])
|
|
- console.log(tempItem)
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -161,7 +155,16 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
</Pressable>
|
|
</Pressable>
|
|
<Pressable
|
|
<Pressable
|
|
style={styles.submit}
|
|
style={styles.submit}
|
|
- onPress={sendReport}>
|
|
|
|
|
|
+ onPress={() =>
|
|
|
|
+ Alert.alert(
|
|
|
|
+ 'Are you sure you want to submit this report?',
|
|
|
|
+ 'This action cannot be undone.',
|
|
|
|
+ [
|
|
|
|
+ { text: 'Cancel', onPress: () => console.log('Report cancelled'), style: 'cancel' },
|
|
|
|
+ { text: 'OK', onPress: sendReport },
|
|
|
|
+ ],
|
|
|
|
+ { cancelable: false }
|
|
|
|
+ )}>
|
|
<Text style={{ color: 'white', textAlign: 'center' }}>Submit</Text>
|
|
<Text style={{ color: 'white', textAlign: 'center' }}>Submit</Text>
|
|
</Pressable>
|
|
</Pressable>
|
|
</View>}
|
|
</View>}
|