Skip to content

Commit

Permalink
Try formatting with prettier and pre-commit hook 2
Browse files Browse the repository at this point in the history
  • Loading branch information
AvdhutPailwan committed May 14, 2024
1 parent d2e1332 commit bc31433
Show file tree
Hide file tree
Showing 47 changed files with 4,179 additions and 2,808 deletions.
62 changes: 31 additions & 31 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@import url("https://fonts.googleapis.com/css2?family=Italiana&family=Lato:wght@100;300;400;700;900&family=Roboto:wght@100;300;400;500;700;900&display=swap");
@import url("https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css");
@import url("https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css");
@import url('https://fonts.googleapis.com/css2?family=Italiana&family=Lato:wght@100;300;400;700;900&family=Roboto:wght@100;300;400;500;700;900&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css');

* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: "Lato", sans-serif;
font-family: 'Lato', sans-serif;
font-size: 22px;
}
#root {
Expand Down Expand Up @@ -117,7 +117,7 @@ p {
opacity: 0;
}
[tooltip]::before {
content: "";
content: '';
border: 5px solid transparent; /* opinion 4 */
z-index: 1001; /* absurdity 1 */
}
Expand Down Expand Up @@ -152,68 +152,68 @@ p {
}

/* don't show empty tooltips */
[tooltip=""]::before,
[tooltip=""]::after {
[tooltip='']::before,
[tooltip='']::after {
display: none !important;
}

/* FLOW: UP */
[tooltip]:not([flow])::before,
[tooltip][flow^="up"]::before {
[tooltip][flow^='up']::before {
bottom: 100%;
border-bottom-width: 0;
border-top-color: #3bb77e;
}
[tooltip]:not([flow])::after,
[tooltip][flow^="up"]::after {
[tooltip][flow^='up']::after {
bottom: calc(100% + 5px);
}
[tooltip]:not([flow])::before,
[tooltip]:not([flow])::after,
[tooltip][flow^="up"]::before,
[tooltip][flow^="up"]::after {
[tooltip][flow^='up']::before,
[tooltip][flow^='up']::after {
left: 50%;
transform: translate(-50%, -0.5em);
}

/* FLOW: DOWN */
[tooltip][flow^="down"]::before {
[tooltip][flow^='down']::before {
top: 100%;
border-top-width: 0;
border-bottom-color: #333;
}
[tooltip][flow^="down"]::after {
[tooltip][flow^='down']::after {
top: calc(100% + 5px);
}
[tooltip][flow^="down"]::before,
[tooltip][flow^="down"]::after {
[tooltip][flow^='down']::before,
[tooltip][flow^='down']::after {
left: 50%;
transform: translate(-50%, 0.5em);
}

/* FLOW: LEFT */
[tooltip][flow^="left"]::before {
[tooltip][flow^='left']::before {
top: 50%;
border-right-width: 0;
border-left-color: #333;
left: calc(0em - 5px);
transform: translate(-0.5em, -50%);
}
[tooltip][flow^="left"]::after {
[tooltip][flow^='left']::after {
top: 50%;
right: calc(100% + 5px);
transform: translate(-0.5em, -50%);
}

/* FLOW: RIGHT */
[tooltip][flow^="right"]::before {
[tooltip][flow^='right']::before {
top: 50%;
border-left-width: 0;
border-right-color: #3bb77e;
right: calc(0em - 5px);
transform: translate(0.5em, -50%);
}
[tooltip][flow^="right"]::after {
[tooltip][flow^='right']::after {
top: 50%;
left: calc(100% + 5px);
transform: translate(0.5em, -50%);
Expand All @@ -237,17 +237,17 @@ p {
/* FX All The Things */
[tooltip]:not([flow]):hover::before,
[tooltip]:not([flow]):hover::after,
[tooltip][flow^="up"]:hover::before,
[tooltip][flow^="up"]:hover::after,
[tooltip][flow^="down"]:hover::before,
[tooltip][flow^="down"]:hover::after {
[tooltip][flow^='up']:hover::before,
[tooltip][flow^='up']:hover::after,
[tooltip][flow^='down']:hover::before,
[tooltip][flow^='down']:hover::after {
animation: tooltips-vert 300ms ease-out forwards;
}

[tooltip][flow^="left"]:hover::before,
[tooltip][flow^="left"]:hover::after,
[tooltip][flow^="right"]:hover::before,
[tooltip][flow^="right"]:hover::after {
[tooltip][flow^='left']:hover::before,
[tooltip][flow^='left']:hover::after,
[tooltip][flow^='right']:hover::before,
[tooltip][flow^='right']:hover::after {
animation: tooltips-horz 300ms ease-out forwards;
}

Expand Down Expand Up @@ -307,7 +307,7 @@ p {
margin-bottom: 30px;
}
.sidebarWrapper h3:after {
content: "";
content: '';
width: 100%;
height: 3px;
background: #f0f0f0;
Expand All @@ -317,7 +317,7 @@ p {
}

.sidebarWrapper h3:before {
content: "";
content: '';
width: 20%;
height: 3px;
background: #b0e5c2;
Expand Down Expand Up @@ -447,7 +447,7 @@ ul.breadcrumb li {
ul.breadcrumb li + li:before {
padding: 8px;
color: black;
content: "/\00a0";
content: '/\00a0';
}
ul.breadcrumb li a {
color: #3bb77e;
Expand Down Expand Up @@ -560,7 +560,7 @@ input::-webkit-inner-spin-button {
}

/* Firefox */
input[type="number"] {
input[type='number'] {
-moz-appearance: textfield;
}

Expand Down
95 changes: 45 additions & 50 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import "bootstrap/dist/css/bootstrap.min.css";
import {
getDatabase,
onValue,
ref
} from "firebase/database";
import React, { createContext, useEffect, useState } from "react";
import { HashRouter, Route, Routes } from "react-router-dom";
import "./App.css";
import Loader from "./assets/images/loading.gif";
import Footer from "./components/footer/footer";
import Header from "./components/header/header";
import About from "./pages/About";
import AddProductForm from "./pages/AddProd";
import DetailsPage from "./pages/Details";
import Home from "./pages/Home/index";
import Listing from "./pages/Listing";
import NotFound from "./pages/NotFound";
import SignIn from "./pages/SignIn";
import SignUp from "./pages/SignUp";
import Cart from "./pages/cart";
import Wishlist from "./pages/wishList";
import "./responsive.css";
import 'bootstrap/dist/css/bootstrap.min.css';
import { getDatabase, onValue, ref } from 'firebase/database';
import React, { createContext, useEffect, useState } from 'react';
import { HashRouter, Route, Routes } from 'react-router-dom';
import './App.css';
import Loader from './assets/images/loading.gif';
import Footer from './components/footer/footer';
import Header from './components/header/header';
import About from './pages/About';
import AddProductForm from './pages/AddProd';
import DetailsPage from './pages/Details';
import Home from './pages/Home/index';
import Listing from './pages/Listing';
import NotFound from './pages/NotFound';
import SignIn from './pages/SignIn';
import SignUp from './pages/SignUp';
import Cart from './pages/cart';
import Wishlist from './pages/wishList';
import './responsive.css';

// import data from './data';
import { collection, doc, getDocs } from "firebase/firestore";
import MapComponent from "./components/map/ITEMmap";
import { db } from "./firebase";
import SellerForm from "./pages/SellerRegistration";
import { collection, doc, getDocs } from 'firebase/firestore';
import MapComponent from './components/map/ITEMmap';
import { db } from './firebase';
import SellerForm from './pages/SellerRegistration';

const MyContext = createContext();

Expand Down Expand Up @@ -57,8 +53,8 @@ function App() {

const fetchCartProducts = async () => {
try {
const cartRef = doc(db, "carts", localStorage.getItem("uid"));
const productsCollectionRef = collection(cartRef, "products");
const cartRef = doc(db, 'carts', localStorage.getItem('uid'));
const productsCollectionRef = collection(cartRef, 'products');
const querySnapshot = await getDocs(productsCollectionRef);
const products = [];
querySnapshot.forEach((doc) => {
Expand All @@ -67,15 +63,15 @@ function App() {
setCartItems(products);
setCartCount(products.length); // Set the product count
} catch (error) {
console.error("Error fetching cart products:", error);
console.error('Error fetching cart products:', error);
}
};

const fetchWishlistProducts = async () => {
console.log("fetchWishlistProducts");
console.log('fetchWishlistProducts');
try {
const wishlistRef = doc(db, "wishlists", localStorage.getItem("uid"));
const productsCollectionRef = collection(wishlistRef, "products");
const wishlistRef = doc(db, 'wishlists', localStorage.getItem('uid'));
const productsCollectionRef = collection(wishlistRef, 'products');
const querySnapshot = await getDocs(productsCollectionRef);
console.log(querySnapshot);
const products = [];
Expand All @@ -86,24 +82,24 @@ function App() {
setWishlistItems(products);
setWishlistCount(products.length); // Set the product count
} catch (error) {
console.error("Error fetching wishlist products:", error);
console.error('Error fetching wishlist products:', error);
}
};

useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch(
"https://mavrick-1.github.io/DataApi/data.json"
'https://mavrick-1.github.io/DataApi/data.json'
);
if (!response.ok) {
throw new Error("Network response was not ok");
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);
console.error('Error fetching data:', error);
}
};

Expand All @@ -113,7 +109,7 @@ function App() {
useEffect(() => {
getData();

const is_Login = localStorage.getItem("isLogin");
const is_Login = localStorage.getItem('isLogin');
setIsLogin(is_Login);

setTimeout(() => {
Expand All @@ -128,7 +124,7 @@ function App() {
const db = getDatabase();

// Reference to the node or path you want to fetch data from
const dataRef = ref(db, localStorage.getItem("user"));
const dataRef = ref(db, localStorage.getItem('user'));

// Fetch data from the specified path
onValue(
Expand All @@ -139,11 +135,11 @@ function App() {
//console.log("Data fetched successfully:", data);
},
(error) => {
console.error("Error fetching data:", error);
console.error('Error fetching data:', error);
}
);
} catch (error) {
console.error("Error:", error);
console.error('Error:', error);
}
};

Expand All @@ -153,7 +149,7 @@ function App() {
const db = getDatabase();

// Reference to the node or path you want to fetch data from
const dataRef = ref(db, localStorage.getItem("user"));
const dataRef = ref(db, localStorage.getItem('user'));

// Fetch data from the specified path
onValue(
Expand All @@ -164,17 +160,17 @@ function App() {
//console.log("Data fetched successfully:", data);
},
(error) => {
console.error("Error fetching data:", error);
console.error('Error fetching data:', error);
}
);
} catch (error) {
console.error("Error:", error);
console.error('Error:', error);
}
};

const addToCart = async (item) => {
try {
const user = localStorage.getItem("user");
const user = localStorage.getItem('user');
// Initialize Firebase database with the provided database URL
const db = getDatabase();
const cartRef = ref(db, user);
Expand All @@ -184,7 +180,7 @@ function App() {
setCartItems([...cartItems, { ...item, quantity: 1 }]);
//console.log('Item added to cart successfully');
} catch (error) {
console.error("Error adding item to cart:", error);
console.error('Error adding item to cart:', error);
}
};

Expand All @@ -198,12 +194,12 @@ function App() {
};

const signIn = () => {
const is_Login = localStorage.getItem("isLogin");
const is_Login = localStorage.getItem('isLogin');
setIsLogin(is_Login);
};

const signOut = () => {
localStorage.removeItem("isLogin");
localStorage.removeItem('isLogin');
setIsLogin(false);
};

Expand All @@ -229,7 +225,7 @@ function App() {
wishlistCount,
setWishlistCount,
fetchCartProducts,
fetchWishlistProducts,
fetchWishlistProducts
};

return data && data.productData ? (
Expand Down Expand Up @@ -297,4 +293,3 @@ function App() {
export default App;

export { MyContext };

Loading

0 comments on commit bc31433

Please sign in to comment.