diff --git a/package-lock.json b/package-lock.json
index f97b346..ffbe500 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -32,7 +32,7 @@
"react-resizable-panels": "^0.0.53",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
- "swiper": "^10.0.4",
+ "swiper": "^10.2.0",
"web-vitals": "^2.1.4"
}
},
@@ -18107,9 +18107,9 @@
}
},
"node_modules/swiper": {
- "version": "10.0.4",
- "resolved": "https://registry.npmjs.org/swiper/-/swiper-10.0.4.tgz",
- "integrity": "sha512-DlNR3KiaVkPep6RraZ2tNr7lvyuzELuR+4NZr4wO42t0UworIO3DxDlz8b5Q3uUioh7cJad99EdRJLkPF+r8Ag==",
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/swiper/-/swiper-10.2.0.tgz",
+ "integrity": "sha512-nktQsOtBInJjr3f5DicxC8eHYGcLXDVIGPSon0QoXRaO6NjKnATCbQ8SZsD3dN1Ph1RH4EhVPwSYCcuDRFWHGQ==",
"funding": [
{
"type": "patreon",
diff --git a/package.json b/package.json
index caf2bc2..c95238f 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
"react-resizable-panels": "^0.0.53",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
- "swiper": "^10.0.4",
+ "swiper": "^10.2.0",
"web-vitals": "^2.1.4"
},
"scripts": {
diff --git a/src/components/FeedbackModal/FeedbackModal.jsx b/src/components/FeedbackModal/FeedbackModal.jsx
new file mode 100644
index 0000000..45feba0
--- /dev/null
+++ b/src/components/FeedbackModal/FeedbackModal.jsx
@@ -0,0 +1,134 @@
+import {
+ Text,
+ Flex,
+ Modal,
+ ModalOverlay,
+ ModalContent,
+ ModalCloseButton,
+ ModalHeader,
+ ModalFooter,
+ Button,
+} from "@chakra-ui/react";
+import axios from "axios";
+import DataContext from "../../context/DataContext";
+import { useState, useContext } from "react";
+
+export default function FeedbackModal({
+ setData,
+ infoOnClose,
+ isOpen,
+ onClose,
+ props,
+}) {
+ const [feedbackHelped, setFeedbackHelped] = useState(null);
+ const { setLoading } = useContext(DataContext);
+
+ async function handleFeedback() {
+ setLoading(false);
+ axios
+ .put(`${process.env.REACT_APP_AWS_BACKEND_URL}/items/${props.id}`, {
+ isHelped: feedbackHelped,
+ })
+ .then(() => console.log("Success"))
+ .catch((err) => console.log(err));
+
+ setData((prevItems) => {
+ if (prevItems && prevItems.length > 0) {
+ return prevItems.map((item) => {
+ if (item.id === props.id) {
+ item.isresolved = true;
+ item.isHelped = feedbackHelped;
+ }
+ return item;
+ });
+ }
+ return prevItems;
+ });
+ setLoading(true);
+ }
+
+ return (
+ {
+ if (feedbackHelped === null) {
+ onClose();
+ } else {
+ onClose();
+ infoOnClose();
+ }
+ }}
+ >
+
+ {feedbackHelped === null ? (
+
+
+ ⚠️ Feedback ⚠️
+
+
+
+ Did ZotnFound help with resolving your item?
+
+
+
+
+
+
+ ) : (
+
+
+ ❤️ Thank You For Your Feedback ❤️
+
+
+
+ Your feedback has been recorded.
+
+
+
+
+
+ )}
+
+ );
+}
diff --git a/src/components/Home/Home.jsx b/src/components/Home/Home.jsx
index 21319e2..9e39de7 100644
--- a/src/components/Home/Home.jsx
+++ b/src/components/Home/Home.jsx
@@ -97,6 +97,8 @@ export default function Home() {
const [screenWidth, setScreenWidth] = useState(window.screen.width);
const [uploadImg, setUploadImg] = useState("");
+ console.log(data)
+
// LOGIN MODAL
const {
isOpen: isLoginModalOpen,
diff --git a/src/components/ImageContainer/ImageContainer.jsx b/src/components/ImageContainer/ImageContainer.jsx
index d05708c..39b03fe 100644
--- a/src/components/ImageContainer/ImageContainer.jsx
+++ b/src/components/ImageContainer/ImageContainer.jsx
@@ -16,7 +16,7 @@ export default function ImageContainer({ image, isresolved }) {
alignItems={"center"}
marginTop={30}
flexDir={"column"}
- w={400}
+ w={450}
>
RETURNED
diff --git a/src/components/InfoModal/InfoModal.jsx b/src/components/InfoModal/InfoModal.jsx
index a0dba7d..82f9f40 100644
--- a/src/components/InfoModal/InfoModal.jsx
+++ b/src/components/InfoModal/InfoModal.jsx
@@ -10,22 +10,23 @@ import {
ModalCloseButton,
Flex,
Tag,
+ useDisclosure,
} from "@chakra-ui/react";
import { formatDate } from "../../utils";
import { UserAuth } from "../../context/AuthContext";
import DataContext from "../../context/DataContext";
-import axios from "axios";
import ImageContainer from "../ImageContainer/ImageContainer";
-import { LinkIcon, EmailIcon, CloseIcon } from "@chakra-ui/icons";
+import FeedbackModal from "../FeedbackModal/FeedbackModal";
+import { LinkIcon, CheckIcon, EmailIcon, PhoneIcon } from "@chakra-ui/icons";
-export default function InfoModal({ setData, isOpen, onClose, props }) {
+export default function InfoModal({ setData, isOpen, onClose, onOpen, props }) {
const [showEmail, setShowEmail] = useState(false);
const { onLoginModalOpen } = useContext(DataContext);
- const { setLoading } = useContext(DataContext);
const { user } = UserAuth();
const navigate = useNavigate();
+ const feedbackModalDisclosure = useDisclosure();
const currentEmail = user?.email;
-
+
// function viewEmail() {
// if (user) {
// setShowEmail(true);
@@ -33,147 +34,150 @@ export default function InfoModal({ setData, isOpen, onClose, props }) {
// }
async function handleDelete() {
- onClose();
- setLoading(false);
- axios
- .delete(`${process.env.REACT_APP_AWS_BACKEND_URL}/items/${props.id}`)
- .then(() => console.log("Success"))
- .catch((err) => console.log(err));
- setData((prevItems) => {
- if (prevItems && prevItems.length > 0) {
- return prevItems.filter((item) => item.id !== props.id);
- }
- return prevItems;
- });
- setLoading(true);
+ feedbackModalDisclosure.onOpen();
}
const formattedDate = formatDate(new Date(props.date));
return (
- {
- onClose();
- navigate("/");
- }}
- size={{ base: "full", md: "5xl" }}
- >
-
-
-
+ <>
+ {
+ onClose();
+ navigate("/");
+ }}
+ size={{ base: "full", md: "5xl" }}
+ >
+
+
+
-
-
- {/* HEADING */}
-
-
- {props.name}
-
+
+
+ {/* HEADING */}
+
+
+ {props.name}
+
-
- {currentEmail === props.email ? (
-
-
- Owner
-
-
- ) : props.islost ? (
-
-
- Lost
-
-
- ) : (
-
-
- Found
-
-
- )}
- Posted: {formattedDate}
+
+ {currentEmail === props.email ? (
+
+
+ Owner
+
+
+ ) : props.islost ? (
+
+
+ Lost
+
+
+ ) : (
+
+
+ Found
+
+
+ )}
+ Posted: {formattedDate}
+
-
-
+
- {/* DESCRIPTION */}
-
-
- Description:
-
- {props.islost ? (
- Lost on {props.itemDate}
- ) : (
- Found on {props.itemDate}
- )}
-
- {props.description}
-
-
-
-
- {currentEmail !== props.email &&
- (!showEmail ? (
+ {/* DESCRIPTION */}
+
+
+ Description:
+
+ {props.islost ? (
+ Lost on {props.itemDate}
+ ) : (
+ Found on {props.itemDate}
+ )}
+
+ {props.description}
+
+
+
+
+ {currentEmail !== props.email &&
+ (!showEmail ? (
+
+ ) : (
+
+ ))}
+ {currentEmail === props.email && (
- ) : (
-
- ))}
- {currentEmail === props.email && (
+ )}
- )}
-
+
-
-
-
+
+
+
+ >
);
}
diff --git a/src/components/ResultCard/ResultCard.jsx b/src/components/ResultCard/ResultCard.jsx
index c80de24..fe4e408 100644
--- a/src/components/ResultCard/ResultCard.jsx
+++ b/src/components/ResultCard/ResultCard.jsx
@@ -18,7 +18,7 @@ import { formatDate } from "../../utils.js";
import locate from "../../assets/logos/locate.svg";
export default function ResultCard({ props, setData, onResultsBarClose }) {
- const { isOpen, onOpen, onClose } = useDisclosure();
+ const infoModalDisclosure = useDisclosure();
const {id} = useParams();
const formattedDate = formatDate(new Date(props.date));
@@ -47,7 +47,7 @@ export default function ResultCard({ props, setData, onResultsBarClose }) {
leftIcon={}
size="md"
w="20"
- onClick={onOpen}
+ onClick={infoModalDisclosure.onOpen}
>
View
@@ -79,12 +79,12 @@ export default function ResultCard({ props, setData, onResultsBarClose }) {
- {(isOpen || id) && (
+ {(infoModalDisclosure.isOpen || id) && (
)}
diff --git a/src/context/AuthContext.js b/src/context/AuthContext.js
index 53e4b26..cf7b1bf 100644
--- a/src/context/AuthContext.js
+++ b/src/context/AuthContext.js
@@ -1,5 +1,10 @@
import { useContext, createContext } from "react";
-import { GoogleAuthProvider, signOut, onAuthStateChanged, signInWithPopup } from "firebase/auth";
+import {
+ GoogleAuthProvider,
+ signOut,
+ onAuthStateChanged,
+ signInWithPopup,
+} from "firebase/auth";
import { auth } from "../firebase";
import { useEffect, useState } from "react";
@@ -19,7 +24,6 @@ export const AuthContextProvider = ({ children }) => {
});
};
-
const logOut = () => {
signOut(auth);
};
@@ -37,7 +41,11 @@ export const AuthContextProvider = ({ children }) => {
};
}, []);
- return {children};
+ return (
+
+ {children}
+
+ );
};
export const UserAuth = () => {