|
@@ -11,6 +11,7 @@ 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"
|
|
|
|
|
@@ -45,26 +46,27 @@ 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
|
|
|
- // + "\n\tLandmark author: " + props.landmark?.user
|
|
|
- // + "\n\tCoordinates: " + props.landmark?.longitude + " " + props.landmark?.latitude
|
|
|
- // + "\n\tLandmark type: " + props.landmark?.landmark_type
|
|
|
- // :
|
|
|
- // "Report submitted for a comment on landmark " + props.comment?.landmark
|
|
|
- // + '\n\tComment: "' + props.comment?.content + '"'
|
|
|
- // report += "\nReason(s) for report: \n\t"
|
|
|
- // for (let i = 0; i < selectedReasons.length; i++) {
|
|
|
- // var tempItem = reasons.find(item => item.value === selectedReasons[i]).label
|
|
|
- // console.log(tempItem)
|
|
|
- // report += tempItem + ((i == selectedReasons.length - 1) ? "\n" : "\n\t")
|
|
|
- // }
|
|
|
- // text ? report += "Extra comments: " + text : null
|
|
|
- // console.log(report)
|
|
|
- // Alert.alert('Report submitted', 'Thank you for making the Atlas a safer place!')
|
|
|
- // setModalVisible(!modalVisible)
|
|
|
- console.log(lmTypes[6].label)
|
|
|
+ var report = props.isLandmark ?
|
|
|
+ "Report submitted for landmark '" + props.landmark?.title + "':\n\tID: " + props.landmark?.id
|
|
|
+ + "\n\tLandmark author: " + props.landmark?.user
|
|
|
+ + "\n\tCoordinates: " + props.landmark?.longitude + " " + props.landmark?.latitude
|
|
|
+ + "\n\tLandmark type: " + props.landmark?.landmark_type
|
|
|
+ :
|
|
|
+ "Report submitted for a comment on landmark " + props.comment?.landmark
|
|
|
+ + '\n\tComment: "' + props.comment?.content + '"'
|
|
|
+ report += "\nReason(s) for report: \n\t"
|
|
|
+ for (let i = 0; i < selectedReasons.length; i++) {
|
|
|
+ var tempItem = reasons.find(item => item.value === selectedReasons[i]).label
|
|
|
+ console.log(tempItem)
|
|
|
+ report += tempItem + ((i == selectedReasons.length - 1) ? "\n" : "\n\t")
|
|
|
+ }
|
|
|
+ text ? report += "Extra comments: " + text : null
|
|
|
+ console.log(report)
|
|
|
+ Alert.alert('Report submitted', 'Thank you for making the Atlas a safer place!')
|
|
|
+ setModalVisible(!modalVisible)
|
|
|
+ // console.log((landmarkOwnedByUser(props.landmark)))
|
|
|
}
|
|
|
|
|
|
const [modalVisible, setModalVisible] = useState(false)
|