Skip to content

Commit

Permalink
Merge pull request #22 from pesto-students/feat/signup
Browse files Browse the repository at this point in the history
feat : shop page changes
  • Loading branch information
p-r1sm authored Feb 16, 2024
2 parents 262a8d0 + 76602ba commit 59f4d68
Show file tree
Hide file tree
Showing 53 changed files with 1,199 additions and 590 deletions.
Binary file added dist/assets/cauliflower-DbjgP0LG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/chinese_cabbage-hcVsq7jK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/corn-ERlktb6r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/cucumber-_A1alB3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/eggplant-Im4IoV8j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/green_capsicum-oFNtP4E_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/green_chilly-QnvCFJgP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion dist/assets/index-LvweM-oh.css

This file was deleted.

1 change: 1 addition & 0 deletions dist/assets/index-iVQZbP4t.css

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions dist/assets/index-kRs4n30u.js

Large diffs are not rendered by default.

88 changes: 0 additions & 88 deletions dist/assets/index-lnPv7wdp.js

This file was deleted.

Binary file added dist/assets/lettuce-jv9UU6lm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/mango-rLHV99aw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/okra-9qoK7b2G.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/potato-pLRUL5Bh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/red_capsicum-K9YI5jxE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/red_chilly-HBiLOt0C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/assets/tomato-zRv9G8g_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
href="./src/assets/logo-no-background.svg"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<title>Harvestly</title>
<script type="module" crossorigin src="./assets/index-lnPv7wdp.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-LvweM-oh.css">
<script type="module" crossorigin src="./assets/index-kRs4n30u.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-iVQZbP4t.css">
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
href="./src/assets/logo-no-background.svg"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<title>Harvestly</title>
</head>
<body>
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@material-tailwind/react": "^2.1.8",
"@react-oauth/google": "^0.12.1",
"@reduxjs/toolkit": "^2.0.1",
"axios": "^1.6.2",
"axios": "^1.6.7",
"js-cookie": "^3.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
24 changes: 15 additions & 9 deletions src/app/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { Routes, Route, Link } from "react-router-dom";
import Login from "../pages/Login.jsx";
import Register from "../pages/Register.jsx";
import Home from "../pages/Home.jsx";
import NotFound from "../pages/NotFound.jsx";
import Navbar from "../components/Navbar.jsx";
import PageFooter from "../components/Footer.jsx";
Expand All @@ -14,21 +13,28 @@ import Checkout from "../pages/Checkout.jsx";
import ProductDetail from "../pages/ProductDetail.jsx";

export default function App() {
// const [isLoggedIn, setIsLoggedIn] = useState(false)
const isLoggedIn = sessionStorage.getItem("token");

useEffect(() => {}, [isLoggedIn]);
return (
<>
<div className="overflow-y-scroll border-5 border-gray-800 rounded-lg bg-white flex flex-col m-auto overflow-x-hidden">
<Navbar />
<main>
<Routes>
<Route path="/" element={<Landing/>}></Route>
<Route path="home" element={<Home />} />
<Route path="/" element={<Landing />}></Route>
<Route path="login" element={<Login />} />
<Route path="register" element={<Register />} />
<Route path="shop" element={<Shop />} />
<Route path="products/:id" element={<ProductDetail />} />
<Route path="cart" element={<Cart />} />
<Route path="wishlist" element={<Wishlist />} />
<Route path="checkout" element={<Checkout/>}/>
{isLoggedIn ? (
<>
<Route path="shop" element={<Shop />} />
<Route path="products/:id" element={<ProductDetail />} />
<Route path="cart" element={<Cart />} />
<Route path="wishlist" element={<Wishlist />} />
<Route path="checkout" element={<Checkout />} />
</>
) : null}
<Route path="*" element={<NotFound />} />
</Routes>
</main>
Expand Down
5 changes: 0 additions & 5 deletions src/app/reducers/cartSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const cartSlice = createSlice({
initialState,
reducers: {
addProduct: (state, action) => {
console.log("State", state);
console.log("Action", action);
const existingProduct = state.cart.find(
(product) => product.id === action.payload.id
);
Expand All @@ -29,10 +27,7 @@ const cartSlice = createSlice({
if (existingProduct.quantity > 1) {
existingProduct.quantity--;
} else if (existingProduct.quantity === 1) {
// console.log("State",state);
console.log("existing product ", existingProduct.quantity);
const index = state.cart.findIndex((item) => item === existingProduct);
console.log(index);
state.cart.splice(index, 1);
}
},
Expand Down
36 changes: 36 additions & 0 deletions src/app/reducers/wishlistSlice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { createSlice } from "@reduxjs/toolkit";

const initialState = {
wishlist: [],
};

const wishlistSlice = createSlice({
name: "wishlist",
initialState,
reducers: {
addProductWishlist: (state, action) => {
const existingProduct = state.wishlist.find(
(product) => product.id === action.payload.id
);
if (existingProduct) {
// immer makes this immutable
// existingProduct.quantity++;
return;
} else {
// immer makes this immutable
state.wishlist.push({ ...action.payload, isWishlist: true });
}
},
removeProductWishlist: (state, action) => {
const index = state.wishlist.findIndex(
(product) => product.id === action.payload.id
);
state.wishlist.splice(index, 1);
},
},
});

export const { addProductWishlist, removeProductWishlist } =
wishlistSlice.actions;

export default wishlistSlice.reducer;
3 changes: 2 additions & 1 deletion src/app/store.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { configureStore } from "@reduxjs/toolkit";
import cartReducer from "./reducers/cartSlice";
import authReducer from "./reducers/authSlice";

import wishlistReducer from "./reducers/wishlistSlice";
const store = configureStore({
reducer: {
auth: authReducer,
cart: cartReducer,
wishlist: wishlistReducer,
},
});

Expand Down
Binary file added src/assets/products/cauliflower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/chinese_cabbage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/corn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/cucumber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/eggplant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/green_capsicum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/green_chilly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/lettuce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/mango.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/okra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/potato.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/products/red_capsicum.png
Binary file added src/assets/products/red_chilly.png
Binary file added src/assets/products/tomato.png
Loading

0 comments on commit 59f4d68

Please sign in to comment.