|
@@ -11,12 +11,9 @@ import { useState } from "react"
|
|
|
import { Alert, Text, StyleSheet, Pressable, TextInput, TouchableOpacity, View, Keyboard } from "react-native"
|
|
|
import Modal from "react-native-modal"
|
|
|
import Select from "react-native-multiple-select"
|
|
|
-import { useAuth } from "../../../../data/Auth/AuthContext"
|
|
|
import { LMComment } from "../../../../data/comments"
|
|
|
import { Landmark } from "../../../../data/landmarks"
|
|
|
|
|
|
-import { lmTypes as allLmTypes, lmTypesIndoor, catTypes } from "../../../../utils/GlobalUtils";
|
|
|
-
|
|
|
|
|
|
interface ReportProps {
|
|
|
landmark?: Landmark,
|
|
@@ -25,7 +22,6 @@ interface ReportProps {
|
|
|
}
|
|
|
|
|
|
export const Report: React.FC<ReportProps> = (props) => {
|
|
|
- let lmTypes = lmTypesIndoor
|
|
|
|
|
|
const [keyboardIsVisible, setKeyboardIsVisible] = useState(false)
|
|
|
useEffect(() => {
|
|
@@ -46,7 +42,6 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
|
setModalVisible(!modalVisible)
|
|
|
}
|
|
|
|
|
|
- const { landmarkOwnedByUser, anonUserId, setAlert } = useAuth()
|
|
|
const sendReport = () => {
|
|
|
var report = props.isLandmark ?
|
|
|
"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
|
|
|
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)
|
|
|
// console.log((landmarkOwnedByUser(props.landmark)))
|
|
|
}
|
|
@@ -97,7 +92,6 @@ export const Report: React.FC<ReportProps> = (props) => {
|
|
|
setSelectedReasons(selectedReasons)
|
|
|
for (let i = 0; i < selectedReasons.length; 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
|
|
|
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>
|
|
|
</Pressable>
|
|
|
</View>}
|