diff --git a/src/assets/logos/resolved.png b/src/assets/logos/resolved.png new file mode 100644 index 0000000..f6a2825 Binary files /dev/null and b/src/assets/logos/resolved.png differ diff --git a/src/components/CreateModal/CreateModal.jsx b/src/components/CreateModal/CreateModal.jsx index 566d3c8..d5cc066 100644 --- a/src/components/CreateModal/CreateModal.jsx +++ b/src/components/CreateModal/CreateModal.jsx @@ -112,15 +112,17 @@ export default function CreateModal({ <> {isCreate ? ( diff --git a/src/components/Map/Map.jsx b/src/components/Map/Map.jsx index c95fa8a..9267710 100644 --- a/src/components/Map/Map.jsx +++ b/src/components/Map/Map.jsx @@ -76,6 +76,7 @@ export default function Map({ } }, [focusLocation, setFocusLocation]); + console.log(findFilter); const allMarkers = data .filter((item) => { return ( @@ -85,7 +86,7 @@ export default function Map({ findFilter.isFound === !item.islost) && (findFilter.type === "everything" || findFilter.type === item.type) && (findFilter.uploadDate === "" || - item.itemDate.includes(findFilter.uploadDate)) && + (item.itemdate && item.itemdate.includes(findFilter.uploadDate))) && (!findFilter.isYourPosts || (findFilter.isYourPosts && item.email === user.email)) ); @@ -102,7 +103,11 @@ export default function Map({ setFocusLocation(item.location); }, }} - icon={(iconsMap[item.type] || iconsMap["others"])[item.islost]} + icon={ + item.isresolved + ? iconsMap["resolved"][item.islost] + : (iconsMap[item.type] || iconsMap["others"])[item.islost] + } > ); }); @@ -133,7 +138,7 @@ export default function Map({ ); async function handleSubmit() { - console.log("submitted") + console.log("submitted"); const date = new Date(); axios @@ -145,10 +150,10 @@ export default function Map({ description: newAddedItem.description, email: user.email, location: [position.lat, position.lng], - itemDate: newAddedItem.itemDate, + itemdate: newAddedItem.itemdate, date: date.toISOString(), - isResolved: newAddedItem.isResolved, - isHelped: newAddedItem.isHelped, + isresolved: newAddedItem.isresolved, + ishelped: newAddedItem.ishelped, }) .then((item) => { const newItem = { @@ -160,10 +165,10 @@ export default function Map({ email: user.email, location: [position.lat, position.lng], date: date.toISOString(), - itemDate: newAddedItem.itemDate, + itemdate: newAddedItem.itemdate, id: item.data.id, - isResolved: newAddedItem.isResolved, - isHelped: newAddedItem.isHelped, + isresolved: newAddedItem.isresolved, + ishelped: newAddedItem.ishelped, }; setData((prev) => [...prev, newItem]); setPosition(centerPosition); @@ -174,9 +179,9 @@ export default function Map({ islost: true, name: "", description: "", - itemDate: "", - isResolved: false, - isHelped: null, + itemdate: "", + isresolved: false, + ishelped: null, }); setIsCreate(!isCreate); setUploadImg(""); diff --git a/src/components/Map/MapIcons.js b/src/components/Map/MapIcons.js index d5d886d..582980a 100644 --- a/src/components/Map/MapIcons.js +++ b/src/components/Map/MapIcons.js @@ -10,6 +10,7 @@ import wallet_lost from "../../assets/logos/Wallet_lost.png"; import key_found from "../../assets/logos/Key_found.png"; import key_lost from "../../assets/logos/Key_lost.png"; +import resolved from "../../assets/logos/resolved.png"; import others_lost from "../../assets/logos/Others_lost.png"; import others_found from "../../assets/logos/Others_found.png"; @@ -17,6 +18,12 @@ import others_black from "../../assets/logos/others_black.svg"; import fly_img from "../../assets/images/fly_img.png"; +const resolvedIcon = L.icon({ + iconUrl: resolved, + iconSize: [50, 50], + iconAnchor: [25, 40], +}); + const headphoneLost = L.icon({ iconUrl: headphone_lost, iconSize: [60, 60], @@ -109,4 +116,8 @@ export const iconsMap = { true: othersLost, false: othersFound, }, + resolved: { + true: resolvedIcon, + false: resolvedIcon, + }, }; diff --git a/src/components/ResultCard/ResultCard.jsx b/src/components/ResultCard/ResultCard.jsx index be775c0..e17e84c 100644 --- a/src/components/ResultCard/ResultCard.jsx +++ b/src/components/ResultCard/ResultCard.jsx @@ -19,14 +19,34 @@ import locate from "../../assets/logos/locate.svg"; export default function ResultCard({ props, setData, onResultsBarClose }) { const infoModalDisclosure = useDisclosure(); - const {id} = useParams(); + const { id } = useParams(); const formattedDate = formatDate(new Date(props.date)); return ( <> - Car key + + {props.isresolved && ( + + + RETURNED + + + This item has been returned. + + + )} + + @@ -83,7 +103,9 @@ export default function ResultCard({ props, setData, onResultsBarClose }) { )} diff --git a/src/components/ResultsBar/ResultsBar.jsx b/src/components/ResultsBar/ResultsBar.jsx index b066abc..60d15cf 100644 --- a/src/components/ResultsBar/ResultsBar.jsx +++ b/src/components/ResultsBar/ResultsBar.jsx @@ -23,7 +23,8 @@ export default function ResultsBar({ findFilter.isFound === !item.islost) && (findFilter.type === "everything" || findFilter.type === item.type) && (findFilter.uploadDate === "" || - item.itemDate.includes(findFilter.uploadDate)) && + !item.itemdate || + (item.itemdate && item.itemdate.includes(findFilter.uploadDate))) && (!findFilter.isYourPosts || (findFilter.isYourPosts && item.email === user.email)) );