Skip to content

Commit

Permalink
Merge pull request #24 from NwinNwin/steven-connect+updated+backend
Browse files Browse the repository at this point in the history
added resolve + help to items
  • Loading branch information
NwinNwin authored Sep 17, 2023
2 parents fc65b4a + 21981e3 commit 7efe289
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/components/CreateModal/CreateModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export default function CreateModal({
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null,
});
setUploadImg("");
setActiveStep(0);
Expand All @@ -172,6 +174,8 @@ export default function CreateModal({
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null,
});
setUploadImg("");
setActiveStep(0);
Expand Down Expand Up @@ -545,6 +549,8 @@ export default function CreateModal({
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null,
});
setUploadImg("");
onClose();
Expand Down
4 changes: 3 additions & 1 deletion src/components/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export default function Home() {
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null
});

const [isEdit, setIsEdit] = useState(false);
Expand Down Expand Up @@ -133,7 +135,7 @@ export default function Home() {
};
getData();
}, []);

window.onresize = () => {
setScreenWidth(window.screen.width);
};
Expand Down
27 changes: 27 additions & 0 deletions src/components/ImageContainer/ImageContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Image, Flex, Text } from "@chakra-ui/react";

export default function ImageContainer({ image, isresolved }) {
return (
<Flex>
{isresolved && <Flex
backgroundColor={"rgba(255, 123, 0, 0.9)"}
position={"absolute"}
w={282}
justifyContent={"center"}
alignItems={"center"}
marginTop={90}
flexDir={"column"}
>
<Text fontSize={18} as="b" color={"white"} >RETURNED</Text>
<Text fontSize={15} color={"white"} >This item has been returned.</Text>
</Flex>}
<Image
rounded={"lg"}
height={230}
width={282}
objectFit={"cover"}
src={image}
/>
</Flex>
);
}
28 changes: 19 additions & 9 deletions src/components/InfoModal/InfoModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Text,
Stack,
useColorModeValue,
Image,
Modal,
ModalOverlay,
ModalContent,
Expand All @@ -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);
Expand Down Expand Up @@ -52,7 +52,6 @@ export default function InfoModal({ setData, isOpen, onClose, props }) {
}

const formattedDate = formatDate(new Date(props.date));

return (
<Modal
isOpen={isOpen}
Expand Down Expand Up @@ -109,13 +108,24 @@ export default function InfoModal({ setData, isOpen, onClose, props }) {
{props.name}
</Heading>

<Image
rounded={"lg"}
height={230}
width={282}
objectFit={"cover"}
src={props.image}
/>

<ImageContainer image={props.image} isresolved={props.isresolved}/>
{/* <Flex>
<Flex
backgroundColor={"rgba(245, 44, 44, 0.5)"}
float={"left"}
position={"absolute"}
>
<Text>RESOLVED</Text>
</Flex>
<Image
rounded={"lg"}
height={230}
width={282}
objectFit={"cover"}
src={props.image}
/>
</Flex> */}

<Text
textAlign="center"
Expand Down
11 changes: 9 additions & 2 deletions src/components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default function Map({
);

async function handleSubmit() {
console.log("submitted")
const date = new Date();

axios
Expand All @@ -146,6 +147,8 @@ export default function Map({
location: [position.lat, position.lng],
itemDate: newAddedItem.itemDate,
date: date.toISOString(),
isResolved: newAddedItem.isResolved,
isHelped: newAddedItem.isHelped,
})
.then((item) => {
const newItem = {
Expand All @@ -159,6 +162,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);
Expand All @@ -170,6 +175,8 @@ export default function Map({
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null,
});
setIsCreate(!isCreate);
setUploadImg("");
Expand Down Expand Up @@ -221,8 +228,8 @@ export default function Map({
},
});

return (position.lat !== centerPosition[0] &&
position.lng !== centerPosition[1]) ? (
return position.lat !== centerPosition[0] &&
position.lng !== centerPosition[1] ? (
<Marker
className="marker"
draggable={true}
Expand Down

0 comments on commit 7efe289

Please sign in to comment.