Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main page groceries, electronics, fashion buttons Not Working Fixed #137

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,14 @@ function App() {
};

const fetchWishlistProducts = async () => {
console.log("fetchWishlistProducts");
try {
const wishlistRef = doc(db, "wishlists", localStorage.getItem("uid"));
const productsCollectionRef = collection(wishlistRef, "products");
const querySnapshot = await getDocs(productsCollectionRef);
console.log(querySnapshot);
const products = [];
querySnapshot.forEach((doc) => {
products.push({ id: doc.id, ...doc.data() });
});
console.log(products);
setWishlistItems(products);
setWishlistCount(products.length); // Set the product count
} catch (error) {
Expand All @@ -100,7 +97,6 @@ function App() {
throw new Error("Network response was not ok");
}
const data = await response.json();
// //console.log("fetced data", data)
setData(data);
} catch (error) {
console.error("Error fetching data:", error);
Expand Down Expand Up @@ -136,7 +132,6 @@ function App() {
(snapshot) => {
const data = snapshot.val();
setCartItems(data);
//console.log("Data fetched successfully:", data);
},
(error) => {
console.error("Error fetching data:", error);
Expand All @@ -161,7 +156,6 @@ function App() {
(snapshot) => {
const data = snapshot.val();
setCartItems(data);
//console.log("Data fetched successfully:", data);
},
(error) => {
console.error("Error fetching data:", error);
Expand All @@ -182,7 +176,6 @@ function App() {
const uniqueKey = user + item.id; // Modify as per your requirement
// Add item to the cart in Firebase
setCartItems([...cartItems, { ...item, quantity: 1 }]);
//console.log('Item added to cart successfully');
} catch (error) {
console.error("Error adding item to cart:", error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const Header = (props) => {
}
});
} catch (error) {
//console.log(error.message);
console.log(error);
}
};

Expand Down
7 changes: 3 additions & 4 deletions src/components/header/nav/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const Nav = (props) => {
const [openDropdownMenuIndex, setDropdownMenuIndex] = useState(null);

const [openMegaMenu, setOpenMegaMenu] = useState(false);

const context = useContext(MyContext);

useEffect(() => {
Expand Down Expand Up @@ -67,7 +66,7 @@ const Nav = (props) => {
navData.map((item, index) => {
return (
<li className='list-inline-item' key={index}>
<Button onClick={()=>openDropdownFun(index)}><a href={`${windowWidth>992 ? `/cat/${item.cat_name.toLowerCase()}` : '#'}`}
<Button onClick={()=>openDropdownFun(index)}><a href={`${windowWidth>992 ? `#/cat/${item.cat_name.toLowerCase()}` : '#'}`}
onClick={() => sessionStorage.setItem('cat', item.cat_name.toLowerCase())}
>{item.cat_name} <KeyboardArrowDownIcon className={`${openDropdownMenu===true && openDropdownMenuIndex===index && 'rotateIcon'}`}/></a></Button>
{
Expand All @@ -79,8 +78,8 @@ const Nav = (props) => {
item.items.map((item_, index_) => {
return (
<li key={index_}>
<Button onClick={props.closeNav}>
<a href={`/cat/${item.cat_name.toLowerCase()}/${item_.cat_name.replace(/\s/g, '-').toLowerCase()}`}
<Button onClick={()=>{props.closeNav();setDropdownMenu(!openDropdownMenu);setDropdownMenuIndex(null)}}>
<a href={`#/cat/${item.cat_name.toLowerCase()}/${item_.cat_name.replace(/\s/g, '-').toLowerCase()}`}
onClick={() => sessionStorage.setItem('cat', item.cat_name.toLowerCase())}>
{
item_.cat_name
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const DetailsPage = (props) => {
}));
});
} catch (error) {
//console.log(error.message);
console.log(error);
}

showReviews();
Expand All @@ -245,7 +245,7 @@ const DetailsPage = (props) => {
}
});
} catch (error) {
//console.log(error.message);
console.log(error);
}

if (reviews_Arr2.length !== 0) {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/wishList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const WishList = () => {
const navigate = useNavigate();
const [uid, setUid] = useState(localStorage.getItem("uid"));

console.log(wishlistItems);

useEffect(() => {
try {
if (context.isLogin === "true") {
Expand Down Expand Up @@ -64,7 +64,6 @@ const WishList = () => {
price += parseInt(doc.data()?.price) * doc.data()?.quantity;
});
context.setWishlistCount(products.length);
console.log(products);
setWishlistItems(products);
setTotalPrice(price);
} catch (error) {
Expand Down