Skip to content

Commit

Permalink
added resolve + help to items
Browse files Browse the repository at this point in the history
  • Loading branch information
stevem-zhou committed Sep 15, 2023
1 parent fc65b4a commit 4b82504
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 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
5 changes: 4 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,8 @@ export default function Home() {
};
getData();
}, []);

console.log("data", data)

window.onresize = () => {
setScreenWidth(window.screen.width);
};
Expand Down
12 changes: 10 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,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,
Expand All @@ -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);
Expand All @@ -170,6 +176,8 @@ export default function Map({
name: "",
description: "",
itemDate: "",
isResolved: false,
isHelped: null,
});
setIsCreate(!isCreate);
setUploadImg("");
Expand Down Expand Up @@ -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] ? (
<Marker
className="marker"
draggable={true}
Expand Down

0 comments on commit 4b82504

Please sign in to comment.