diff --git a/src/pages/account/index.jsx b/src/pages/account/index.jsx index ac6be0a..f943a58 100644 --- a/src/pages/account/index.jsx +++ b/src/pages/account/index.jsx @@ -1,35 +1,61 @@ +import { useEffect, useState } from "react"; +import { AiOutlineDelete, AiOutlineEdit } from "react-icons/ai"; + +import { getItemsByUser } from "@/lib/firebase/firestoreFunctions"; + +import DeleteWarning from "@/components/delete-warning"; +import ItemCard from "@/components/itemcard/ItemCard"; import Profile from "@/components/profile/Profile"; -import Layout from "@/layout/Layout"; +import { useAuth } from "@/context/AuthContext"; export default function MyAccount() { - return ; -} + const { currentUser } = useAuth(); + const [items, setItems] = useState([]); + const [deleteWarningItem, setDeleteWarningItem] = useState(); -export async function getStaticProps() { - try { - const info = { - surname: "ismail", - location: "istanbul", - phone: "123456789", - email: "ismail@ismail", - }; + useEffect(() => { + getItemsByUser(currentUser.uid).then((data) => { + setItems(data); + }); + }, [currentUser]); + return ( + <> + {deleteWarningItem && ( + + )} - // if (!info) { - // // Handle the case where 'info' is missing or undefined - // console.error("Info not found."); - // return { - // notFound: true, - // }; - // } + +
+

+ My Items: +

- return { - props: { info }, - }; - } catch (error) { - console.error("Error fetching info:", error); - return { - notFound: true, - }; - } +
+ {items.map((item) => ( +
+
+ + setDeleteWarningItem(item.id) + } + className='text-red text-3xl cursor-pointer' + /> + +
+ +
+ ))} +
+
+ + ); }