diff --git a/src/components/Filter/Filter.jsx b/src/components/Filter/Filter.jsx index 9001308..dc22fa0 100644 --- a/src/components/Filter/Filter.jsx +++ b/src/components/Filter/Filter.jsx @@ -18,9 +18,11 @@ import { Button, } from "@chakra-ui/react"; import "./Filter.css"; +import { UserAuth } from "../../context/AuthContext"; export default function Filter({ findFilter, setFindFilter, onClose, isOpen }) { const [value, setValue] = useState("everything"); + const { user } = UserAuth(); useEffect(() => { /* eslint-disable react-hooks/exhaustive-deps */ @@ -70,12 +72,29 @@ export default function Filter({ findFilter, setFindFilter, onClose, isOpen }) { Found + + { + setFindFilter((prev) => ({ + ...prev, + isShowReturned: !prev.isShowReturned, + })); + }} + defaultChecked={findFilter.isShowReturned} + /> + + Returned + + { setFindFilter((prev) => ({ ...prev, @@ -83,7 +102,12 @@ export default function Filter({ findFilter, setFindFilter, onClose, isOpen }) { })); }} /> - + Your Posts @@ -124,6 +148,9 @@ export default function Filter({ findFilter, setFindFilter, onClose, isOpen }) { + + Found/Lost Date: + { setFindFilter((prev) => ({ @@ -149,6 +176,8 @@ export default function Filter({ findFilter, setFindFilter, onClose, isOpen }) { isFound: true, islost: true, uploadDate: "", + isYourPosts: false, + isShowReturned: true, }); onClose(); }} diff --git a/src/components/Home/Home.jsx b/src/components/Home/Home.jsx index e36de77..65f571e 100644 --- a/src/components/Home/Home.jsx +++ b/src/components/Home/Home.jsx @@ -75,6 +75,7 @@ export default function Home() { islost: true, uploadDate: "", isYourPosts: false, + isShowReturned: true, }); function isFilterOff() { @@ -84,7 +85,8 @@ export default function Home() { findFilter.islost === true && findFilter.uploadDate === "" && search === "" && - !findFilter.isYourPosts + !findFilter.isYourPosts && + findFilter.isShowReturned === true ); } diff --git a/src/components/InfoModal/InfoModal.jsx b/src/components/InfoModal/InfoModal.jsx index e77d1ee..fa9a0f2 100644 --- a/src/components/InfoModal/InfoModal.jsx +++ b/src/components/InfoModal/InfoModal.jsx @@ -57,7 +57,11 @@ export default function InfoModal({ > - + {props.islost ? ( - Lost on {props.itemDate} + Lost on {props.itemdate} ) : ( - Found on {props.itemDate} + Found on {props.itemdate} )} { diff --git a/src/components/ResultsBar/ResultsBar.jsx b/src/components/ResultsBar/ResultsBar.jsx index b2eee54..6507e22 100644 --- a/src/components/ResultsBar/ResultsBar.jsx +++ b/src/components/ResultsBar/ResultsBar.jsx @@ -24,10 +24,10 @@ export default function ResultsBar({ findFilter.isFound === !item.islost) && (findFilter.type === "everything" || findFilter.type === item.type) && (findFilter.uploadDate === "" || - !item.itemdate || (item.itemdate && item.itemdate.includes(findFilter.uploadDate))) && (!findFilter.isYourPosts || - (findFilter.isYourPosts && item.email === user.email)) + (findFilter.isYourPosts && item.email === user.email)) && + (findFilter.isShowReturned || !item.isresolved) ); }) .map((item) => { diff --git a/src/components/Type/TypeCard.jsx b/src/components/Type/TypeCard.jsx index 977a017..ec08fd6 100644 --- a/src/components/Type/TypeCard.jsx +++ b/src/components/Type/TypeCard.jsx @@ -19,15 +19,20 @@ export default function TypeCard({ backgroundColor={newAddedItem.type === type ? "#787092" : "white"} variant="outline" border="5px rgb(166, 152, 216) solid" - w={{ md: "7vw", base: "13vh" }} - h={{ md: "7vw", base: "13vh" }} + minW={{ md: "7vw", base: "13vh" }} + minH={{ md: "7vw", base: "13vh" }} borderRadius="20px" alignItems={"center"} justifyContent={"center"} flexDir={"column"} onClick={handleOnClick} > - + {type.toUpperCase()}