Skip to content

Navbar My order page in mobile view #11

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

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e70320e
copy data.json from main branch
murtazatankiwala456 Jun 11, 2024
598bfa5
completed till fetching products from dummy api (from folder-static)
murtazatankiwala456 Jun 12, 2024
9e60977
fetching products through json-server using redux toolkit
murtazatankiwala456 Jun 12, 2024
37a15cb
adding brands and categories section extracting from json (using map)
murtazatankiwala456 Jun 12, 2024
a92b677
filter feature added using redux and json server api
murtazatankiwala456 Jun 13, 2024
138d9f2
adding sorting functionality(desc according to new ruleJSON Server's …
murtazatankiwala456 Jun 14, 2024
049dc8d
fixing filter in mobile layout (add onClick func in mobile input)
murtazatankiwala456 Jun 14, 2024
be55c81
dividing product list into components (Pagination,Mobile/DesktopFilte…
murtazatankiwala456 Jun 14, 2024
c297593
checked functionality/common dispatch(AllProducts,filter)
murtazatankiwala456 Jun 15, 2024
82c96b3
makine array of objects for filter/ making sort as another function a…
murtazatankiwala456 Jun 15, 2024
d507391
pagination code done but not reflecting products on UI(have to fix it)
murtazatankiwala456 Jun 17, 2024
ac3fa71
fixed pagination issues:key instead of pagination:pagination[key]/ext…
murtazatankiwala456 Jun 17, 2024
3316e43
unable to render totalItems in UI pagination (have to fix)
murtazatankiwala456 Jun 17, 2024
40a7fce
fixed totalItems by extracting direct from json obj (data.items)/ imp…
murtazatankiwala456 Jun 17, 2024
a06e910
calling categories and brand through API
murtazatankiwala456 Jun 18, 2024
a591305
previous/next button is now working
murtazatankiwala456 Jun 19, 2024
0f7b724
product detail page added (dynamically)
murtazatankiwala456 Jun 20, 2024
0fb1030
form validation completed
murtazatankiwala456 Jun 21, 2024
b50cc6e
signup/login functionality add
murtazatankiwala456 Jun 21, 2024
5a68db0
fix path issue (Protected)
murtazatankiwala456 Jun 21, 2024
4e8afb6
add to cart API created
murtazatankiwala456 Jun 22, 2024
2291936
add to cart/fetch items in UI (Cart)
murtazatankiwala456 Jun 22, 2024
71b78c3
add to cart/update quantity
murtazatankiwala456 Jun 22, 2024
6300124
add to cart/delete item
murtazatankiwala456 Jun 22, 2024
6f0e5a1
checkout page functionality (grabing form values) done
murtazatankiwala456 Jun 24, 2024
9071af6
order API added
murtazatankiwala456 Jun 24, 2024
9b18c85
checkout validation/404page/OrderSuccessPage
murtazatankiwala456 Jun 25, 2024
266b7d7
successfully navigate to orderSuccessPage after clicking on order now
murtazatankiwala456 Jun 25, 2024
d89caed
empty card and currentOrder from the UI and API
murtazatankiwala456 Jun 25, 2024
51072c9
UserOrder created successfully/ (Math.ceil removed for exact calc)
murtazatankiwala456 Jun 25, 2024
f6bcaec
fix navbar menu issue in mobile layout
murtazatankiwala456 Jun 26, 2024
9a7f78d
My profile page added/fettchLoogedInUser API created for full details…
murtazatankiwala456 Jun 26, 2024
beab140
edit/remove address functionality in my profile page
murtazatankiwala456 Jun 26, 2024
834bc67
Add new Address functionality added
murtazatankiwala456 Jun 26, 2024
67348b7
signout functionality/forgot password page
murtazatankiwala456 Jun 27, 2024
22b1dab
admin route created
murtazatankiwala456 Jun 28, 2024
1a5a4b2
new product functionality added in admin route
murtazatankiwala456 Jun 28, 2024
418d60e
edit product functionality added in admin route
murtazatankiwala456 Jun 28, 2024
e1960cd
clean up the code (discard counter app actions)
murtazatankiwala456 Jun 29, 2024
7be4998
invoke reset button in checkout page
murtazatankiwala456 Jun 29, 2024
a589aa7
setValue fix in ProductForm.js
murtazatankiwala456 Jun 29, 2024
86bacfa
AdminOrderPage created (static)
murtazatankiwala456 Jul 1, 2024
290a6f9
make constant of discountedPrice()/ cancle buttons works in product form
murtazatankiwala456 Jul 1, 2024
88cd7bc
edit functionality in adminOrderPage/fix route of AdminDetailPage
murtazatankiwala456 Jul 2, 2024
303bc93
pagination added it AdminOrder Page (by making pagination a common co…
murtazatankiwala456 Jul 2, 2024
92a66e4
fix pagination logic in AdminOrder
murtazatankiwala456 Jul 2, 2024
acf0ed0
UI Changes + toggle show hide password button in login page
murtazatankiwala456 Jul 2, 2024
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
3,818 changes: 3,818 additions & 0 deletions data.json

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@testing-library/user-event": "^14.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.52.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.10.0",
"react-scripts": "5.0.1",
Expand Down
154 changes: 131 additions & 23 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,155 @@
import { Counter } from './features/counter/Counter';
import './App.css';
import Home from './pages/Home';
import LoginPage from './pages/LoginPage';
import SignupPage from './pages/SignupPage';
import { Counter } from "./features/counter/Counter";
import "./App.css";
import Home from "./pages/Home";
import LoginPage from "./pages/LoginPage";
import SignupPage from "./pages/SignupPage";

import {
createBrowserRouter,
RouterProvider,
Route,
Link,
} from 'react-router-dom';
import Cart from './features/cart/Cart';
import CartPage from './pages/CartPage';
import Checkout from './pages/Checkout';
import ProductDetailPage from './pages/ProductDetailPage';
} from "react-router-dom";

import CartPage from "./pages/CartPage";
import Checkout from "./pages/Checkout";
import ProductDetailPage from "./pages/ProductDetailPage";
import Protected from "./features/auth/components/Protected";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { selectLoggedInUser } from "./features/auth/authSlice";
import { fetchItemsByUserIdAsync } from "./features/cart/cartSlice";
import PageNotFound from "./pages/404";
import OrderSuccessPage from "./pages/OrderSuccessPage";
import UserOrderPage from "./pages/UserOrderPage";
import UserProfilePage from "./pages/UserProfilePage";
import { fetchLoggedInUserAsync } from "./features/user/userSlice";
import LogOut from "./features/auth/components/LogOut";
import ForgotPasswordPage from "./pages/ForgotPasswordPage";
import ProtectedAdmin from "./features/auth/components/ProtectedAdmin";
import AdminHome from "./pages/AdminHome";
import AdminProductDetail from "./features/admin/components/AdminProductDetail";
import ProductFormPage from "./pages/ProductFormPage";
import AdminOrderPage from "./pages/AdminOrderPage";
const router = createBrowserRouter([
{
path: '/',
element: <Home></Home>,
path: "/",

element: (
<Protected>
<Home></Home>
</Protected>
),
},
{
path: "/admin",

element: (
<ProtectedAdmin>
<AdminHome></AdminHome>
</ProtectedAdmin>
),
},
{
path: '/login',
path: "/login",
element: <LoginPage></LoginPage>,
},
{
path: '/signup',
path: "/signup",
element: <SignupPage></SignupPage>,
},
{
path: '/cart',
element: <CartPage></CartPage>,
{
path: "/cart",
element: (
<Protected>
<CartPage></CartPage>
</Protected>
),
},
{
path: '/checkout',
element: <Checkout></Checkout>,
{
path: "/checkout",
element: (
<Protected>
<Checkout></Checkout>
</Protected>
),
},
{
path: '/product-detail',
element: <ProductDetailPage></ProductDetailPage>,
{
path: "/product-detail/:id", // :id provided by react-router
element: (
<Protected>
<ProductDetailPage></ProductDetailPage>
</Protected>
),
},
{
path: "/admin/product-detail/:id", // :id provided by react-router
element: (
<ProtectedAdmin>
<AdminProductDetail></AdminProductDetail>
</ProtectedAdmin>
),
},
{
path: "/admin/product-form",
element: (
<ProtectedAdmin>
<ProductFormPage></ProductFormPage>
</ProtectedAdmin>
),
},
{
path: "/admin/orders",
element: (
<ProtectedAdmin>
<AdminOrderPage></AdminOrderPage>
</ProtectedAdmin>
),
},
{
path: "/admin/product-form/edit/:id",
element: (
<ProtectedAdmin>
<ProductFormPage></ProductFormPage>
</ProtectedAdmin>
),
},
{
path: "/order-success/:id",
element: <OrderSuccessPage></OrderSuccessPage>,
},
{
path: "/orders",
element: <UserOrderPage></UserOrderPage>,
},
{
path: "/profile",
element: <UserProfilePage></UserProfilePage>,
},
{
path: "/logout",
element: <LogOut></LogOut>,
},
{
path: "/forgot-paasword",
element: <ForgotPasswordPage></ForgotPasswordPage>,
},
{
path: "*",
element: <PageNotFound></PageNotFound>,
},
]);

function App() {
const dispatch = useDispatch();
const user = useSelector(selectLoggedInUser);

useEffect(() => {
if (user) {
dispatch(fetchItemsByUserIdAsync(user.id));
dispatch(fetchLoggedInUserAsync(user.id));
}
}, [dispatch, user]);
return (
<div className="App">
<RouterProvider router={router} />
Expand Down
5 changes: 5 additions & 0 deletions src/app/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const ITEMS_PER_PAGE = 6;
export function discountedPrice(item) {
const discountPercentage = item.discountPercentage || 0; // Ensure discountPercentage is defined or default to 0
return Math.round(item.price * (1 - item.discountPercentage / 100));
}
14 changes: 11 additions & 3 deletions src/app/store.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { configureStore } from '@reduxjs/toolkit';
import counterReducer from '../features/counter/counterSlice';
import { configureStore } from "@reduxjs/toolkit";
import productReducer from "../features/product/productSlice";
import authReducer from "../features/auth/authSlice";
import cartReducer from "../features/cart/cartSlice";
import orderReducer from "../features/order/orderSlice";
import userReducer from "../features/user/userSlice";

export const store = configureStore({
reducer: {
counter: counterReducer,
product: productReducer,
auth: authReducer,
cart: cartReducer,
order: orderReducer,
user: userReducer,
},
});
Loading