From 4b825048b85289a10137dccdeec7402039fc7529 Mon Sep 17 00:00:00 2001 From: Steven Zhou Date: Thu, 14 Sep 2023 23:03:10 -0700 Subject: [PATCH 1/2] added resolve + help to items --- src/components/CreateModal/CreateModal.jsx | 6 ++++++ src/components/Home/Home.jsx | 5 ++++- src/components/Map/Map.jsx | 12 ++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/CreateModal/CreateModal.jsx b/src/components/CreateModal/CreateModal.jsx index edab641..566d3c8 100644 --- a/src/components/CreateModal/CreateModal.jsx +++ b/src/components/CreateModal/CreateModal.jsx @@ -151,6 +151,8 @@ export default function CreateModal({ name: "", description: "", itemDate: "", + isResolved: false, + isHelped: null, }); setUploadImg(""); setActiveStep(0); @@ -172,6 +174,8 @@ export default function CreateModal({ name: "", description: "", itemDate: "", + isResolved: false, + isHelped: null, }); setUploadImg(""); setActiveStep(0); @@ -545,6 +549,8 @@ export default function CreateModal({ name: "", description: "", itemDate: "", + isResolved: false, + isHelped: null, }); setUploadImg(""); onClose(); diff --git a/src/components/Home/Home.jsx b/src/components/Home/Home.jsx index 81c6b45..85dba5f 100644 --- a/src/components/Home/Home.jsx +++ b/src/components/Home/Home.jsx @@ -85,6 +85,8 @@ export default function Home() { name: "", description: "", itemDate: "", + isResolved: false, + isHelped: null }); const [isEdit, setIsEdit] = useState(false); @@ -133,7 +135,8 @@ export default function Home() { }; getData(); }, []); - + console.log("data", data) + window.onresize = () => { setScreenWidth(window.screen.width); }; diff --git a/src/components/Map/Map.jsx b/src/components/Map/Map.jsx index 905616b..c1d9f67 100644 --- a/src/components/Map/Map.jsx +++ b/src/components/Map/Map.jsx @@ -133,6 +133,7 @@ export default function Map({ ); async function handleSubmit() { + console.log("submitted") const date = new Date(); axios @@ -146,8 +147,11 @@ export default function Map({ location: [position.lat, position.lng], itemDate: newAddedItem.itemDate, date: date.toISOString(), + isResolved: newAddedItem.isResolved, + isHelped: newAddedItem.isHelped, }) .then((item) => { + console.log("item", item) const newItem = { image: newAddedItem.image, type: newAddedItem.type, @@ -159,6 +163,8 @@ export default function Map({ date: date.toISOString(), itemDate: newAddedItem.itemDate, id: item.data.id, + isResolved: newAddedItem.isResolved, + isHelped: newAddedItem.isHelped, }; setData((prev) => [...prev, newItem]); setPosition(centerPosition); @@ -170,6 +176,8 @@ export default function Map({ name: "", description: "", itemDate: "", + isResolved: false, + isHelped: null, }); setIsCreate(!isCreate); setUploadImg(""); @@ -221,8 +229,8 @@ export default function Map({ }, }); - return (position.lat !== centerPosition[0] && - position.lng !== centerPosition[1]) ? ( + return position.lat !== centerPosition[0] && + position.lng !== centerPosition[1] ? ( Date: Sun, 17 Sep 2023 02:02:29 -0700 Subject: [PATCH 2/2] resolved labels for images --- src/components/Home/Home.jsx | 1 - .../ImageContainer/ImageContainer.jsx | 27 ++++++++++++++++++ src/components/InfoModal/InfoModal.jsx | 28 +++++++++++++------ src/components/Map/Map.jsx | 1 - 4 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 src/components/ImageContainer/ImageContainer.jsx diff --git a/src/components/Home/Home.jsx b/src/components/Home/Home.jsx index 85dba5f..21319e2 100644 --- a/src/components/Home/Home.jsx +++ b/src/components/Home/Home.jsx @@ -135,7 +135,6 @@ export default function Home() { }; getData(); }, []); - console.log("data", data) window.onresize = () => { setScreenWidth(window.screen.width); diff --git a/src/components/ImageContainer/ImageContainer.jsx b/src/components/ImageContainer/ImageContainer.jsx new file mode 100644 index 0000000..8b0dd6c --- /dev/null +++ b/src/components/ImageContainer/ImageContainer.jsx @@ -0,0 +1,27 @@ +import { Image, Flex, Text } from "@chakra-ui/react"; + +export default function ImageContainer({ image, isresolved }) { + return ( + + {isresolved && + RETURNED + This item has been returned. + } + + + ); +} diff --git a/src/components/InfoModal/InfoModal.jsx b/src/components/InfoModal/InfoModal.jsx index f0bee46..ef26b3e 100644 --- a/src/components/InfoModal/InfoModal.jsx +++ b/src/components/InfoModal/InfoModal.jsx @@ -8,7 +8,6 @@ import { Text, Stack, useColorModeValue, - Image, Modal, ModalOverlay, ModalContent, @@ -20,6 +19,7 @@ import { formatDate } from "../../utils"; import { UserAuth } from "../../context/AuthContext"; import DataContext from "../../context/DataContext"; import axios from "axios"; +import ImageContainer from "../ImageContainer/ImageContainer"; export default function InfoModal({ setData, isOpen, onClose, props }) { const [showEmail, setShowEmail] = useState(false); @@ -52,7 +52,6 @@ export default function InfoModal({ setData, isOpen, onClose, props }) { } const formattedDate = formatDate(new Date(props.date)); - return ( - + + + {/* + + RESOLVED + + + */} { - console.log("item", item) const newItem = { image: newAddedItem.image, type: newAddedItem.type,