Skip to content

Commit 2a2072d

Browse files
committed
Payment Method Added
1 parent a8d29ff commit 2a2072d

File tree

23 files changed

+869
-241
lines changed

23 files changed

+869
-241
lines changed

.firebase/hosting.YnVpbGQ.cache

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
favicon.ico,1669263837489,c1c6f064aaa55300fd03d27a24a5a9ee0d33399cdc34fd2b65e20882082c41e6
2+
logo192.png,1669186773986,3ee59515172ee198f3be375979df15ac5345183e656720a381b8872b2a39dc8b
3+
logo512.png,1669186775565,ee7e2f3fdb8209c4b6fd7bef6ba50d1b9dba30a25bb5c3126df057e1cb6f5331
4+
manifest.json,1669186766076,aff3449bdc238776f5d6d967f19ec491b36aed5fb7f23ccff6500736fd58494a
5+
robots.txt,1669186777799,bfe106a3fb878dc83461c86818bf74fc1bdc7f28538ba613cd3e775516ce8b49
6+
asset-manifest.json,1669698374360,39af39c13c372922d45d6ea4e902923fcecb34fc933d5fc0d9a409d770aca25a
7+
index.html,1669698374308,f12cbd0dea303b8a80e385d15111bde59317bf857bfb6b7e30c4dd7443665c41
8+
static/js/787.c4e7f8f9.chunk.js,1669698374354,91c272bf68adff064c800f366f30728320d116b78ce6c85e37780678453e9a15
9+
static/js/787.c4e7f8f9.chunk.js.map,1669698374357,033fe9275438718e0730acfbe04a0b09fd74cccd39b244c78f4a513c4ddd3a29
10+
static/js/main.b9c2dff4.js.LICENSE.txt,1669698374354,4bc7b9ff46fdf1ee16d1001023f9d7cb038627bcd988dc83776a4348146c4274
11+
static/css/main.6209d208.css.map,1669698374354,36cc8d8e482b174d68d0bd26fb90d57ba9ccbfa712755373a7d63733ac2a770b
12+
static/media/index.cd351d7c31d0d3fccf96.cjs,1669698374354,e93658ec997ed4c029ee70c288a9a53c257e6ac3e71cdf8a54924a8b99df1145
13+
static/media/slick.2630a3e3eab21c607e21.svg,1669698374356,d00477d40ed40fa1dd3bdee27d9286804121b15fea83bae7d5415d902b055de0
14+
static/media/slick.295183786cd8a1389865.woff,1669698374356,029a727c9e1081d2f9e1015f02f18da88f268512ea4f58589a6f17f532928530
15+
static/media/slick.a4e97f5a2a64f0ab1323.eot,1669698374354,52b9a169969e053d43df6bd21c4dc789c2518d99afd8590a17ef50cd24c77cf6
16+
static/media/slick.c94f7671dcc99dce43e2.ttf,1669698374352,6aad751007cf9a89350af287f824ab64f096c472c7c9c679fb3d55b6174fc004
17+
static/css/main.6209d208.css,1669698374355,843ff78e055148a6b939807b4bf45d123ad52476732a08e9e913cb9558785969
18+
static/media/lgoinImage.9c032dd9568f031ad772.png,1669698374356,8c791111174c6dbab833f3c2856acb5e9cc05b2a8ce492558c156836b9af256b
19+
static/media/Sign-up-amico.41f9736f605feac1dd44.png,1669698374354,0750799bf53c9ef3dd702363d4aa44c60202fb7081b385e0f260ded9ae5a1c3c
20+
static/js/main.b9c2dff4.js,1669698374356,b87212cc8f26bf21d1a802f33018921a5037bf0fad750a3aaff6a3ccdbda77d0
21+
static/js/main.b9c2dff4.js.map,1669698374359,4b7b4a07907d91728e37027313beaf4aebfadb06d90c6586b39ed36eb36878aa

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "indirect-fb2af"
4+
}
5+
}

firebase-debug.log

Lines changed: 0 additions & 31 deletions
This file was deleted.

firebase.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hosting": {
3+
"public": "build",
4+
"ignore": [
5+
"firebase.json",
6+
"**/.*",
7+
"**/node_modules/**"
8+
],
9+
"rewrites": [
10+
{
11+
"source": "**",
12+
"destination": "/index.html"
13+
}
14+
]
15+
}
16+
}

package-lock.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"private": true,
55
"dependencies": {
66
"@heroicons/react": "^2.0.13",
7+
"@stripe/react-stripe-js": "^1.15.0",
8+
"@stripe/stripe-js": "^1.44.1",
79
"@tanstack/react-query": "^4.16.1",
810
"@testing-library/jest-dom": "^5.16.5",
911
"@testing-library/react": "^13.4.0",

src/Contexts/AuthProvider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const AuthProvider = ({children}) => {
4848

4949

5050
const userEmailQueryData = (email) => {
51-
setLoading(true)
51+
5252
// axios
5353
// .post(`http://localhost:5000/users?email=${event?.email}`)
5454
fetch(`http://localhost:5000/users?email=${email}`, {
@@ -67,7 +67,7 @@ const AuthProvider = ({children}) => {
6767

6868
const ImageHosting = (photoFilePath) => {
6969

70-
setLoading(true)
70+
7171
const formData = new FormData();
7272
formData.append("image", photoFilePath);
7373
const url = `https://api.imgbb.com/1/upload?key=${process.env.REACT_APP_image_host_API}`;

src/Layout/DashboardLayout.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const DashboardLayout = () => {
4646
(emailData?.accountType === 'Seller' || emailData?.isAdmin) &&
4747
<>
4848
<li>
49-
<Link to="/dashboard">My Products</Link>
49+
<Link to="/dashboard">{emailData?.isAdmin ? 'Admin' : 'My'} Products</Link>
5050
</li>
5151

5252
<li>
@@ -56,28 +56,38 @@ const DashboardLayout = () => {
5656
}
5757

5858

59-
{
60-
(emailData?.accountType === 'Buyer' || emailData?.isAdmin ) &&
61-
<li>
62-
<Link to="/dashboard/myOrders">My Orders</Link>
63-
</li>
64-
65-
}
59+
6660

6761
{
6862

6963
emailData?.isAdmin &&
7064
<>
65+
<li>
66+
<Link to="/dashboard/allProducts">All Products</Link>
67+
</li>
7168
<li>
7269
<Link to="/dashboard/allSellers">All Sellers</Link>
7370
</li>
7471
<li>
7572
<Link to="/dashboard/allBuyers">All Buyers</Link>
7673
</li>
74+
<li>
75+
<Link to="/dashboard/allReports">Reported Items</Link>
76+
</li>
7777

7878
</>
7979
}
8080

81+
82+
83+
{
84+
(emailData?.accountType === 'Buyer' || emailData?.isAdmin ) &&
85+
<li>
86+
<Link to="/dashboard/myOrders">My Orders</Link>
87+
</li>
88+
89+
}
90+
8191
</ul>
8292
</div>
8393
</div>

src/Pages/Buyer/MyOrders.js

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
1-
import { useQuery } from '@tanstack/react-query';
2-
import React, { useContext } from 'react';
3-
import { Link } from 'react-router-dom';
4-
import { AuthContext } from '../../Contexts/AuthProvider';
1+
import { useQuery } from "@tanstack/react-query";
2+
import React, { useContext } from "react";
3+
import { Link } from "react-router-dom";
4+
import { AuthContext } from "../../Contexts/AuthProvider";
55

66
const MyOrders = () => {
7-
const {user} = useContext(AuthContext)
8-
const {
9-
data: bookings = [],
10-
isLoading,
11-
refetch,
12-
} = useQuery({
13-
queryKey: ["bookings", user?.email],
14-
queryFn: async () => {
15-
const res = await fetch(
16-
`http://localhost:5000/bookings?buyerEmail=${user?.email}`
17-
);
18-
const data = await res.json();
19-
return data;
20-
},
21-
});
7+
const { user } = useContext(AuthContext);
8+
const {
9+
data: bookings = [],
10+
isLoading,
11+
refetch,
12+
} = useQuery({
13+
queryKey: ["bookings", user?.email],
14+
queryFn: async () => {
15+
const res = await fetch(
16+
`http://localhost:5000/bookings?buyerEmail=${user?.email}`
17+
);
18+
const data = await res.json();
19+
return data;
20+
},
21+
});
2222

23-
// const dateTime = new Date(Timestamp);
24-
// const dividingTime = dateTime?.toLocaleString()?.split(":");
25-
// const showingTime =
26-
// dividingTime[0] + ":" + dividingTime[1] + " " + dividingTime[2].slice(-2);
23+
// const dateTime = new Date(Timestamp);
24+
// const dividingTime = dateTime?.toLocaleString()?.split(":");
25+
// const showingTime =
26+
// dividingTime[0] + ":" + dividingTime[1] + " " + dividingTime[2].slice(-2);
2727

28-
29-
return (
30-
<div>
31-
<div className="overflow-x-auto w-full">
28+
return (
29+
<div>
30+
{bookings?.length === 0 &&
31+
<div className="min-h-screen flex flex-col justify-center items-center ">
32+
<p className="text-red-900 text-3xl lg:text-5xl font-bold">You Have No Order</p>
33+
<p className="text-2xl lg:text-3xl font-bold text-neutral">Please Order / Booking Something</p>
34+
<Link to='/category/63819333db36b3423f40dba1' className="btn btn-neutral text-white font-bold mt-4">Have a Look</Link>
35+
</div> }
36+
<div className="overflow-x-auto w-full">
3237
<table className="table w-full">
3338
{/* <!-- head --> */}
3439
<thead className="bg-neutral">
@@ -44,7 +49,6 @@ const MyOrders = () => {
4449
{/* <!-- row 1 --> */}
4550

4651
{bookings.map((booking) => (
47-
4852
<tr key={booking?._id}>
4953
<td>
5054
<div className="flex items-center space-x-3">
@@ -68,16 +72,15 @@ const MyOrders = () => {
6872
<p className="text-neutral text-sm font-semibold">
6973
{booking?.sellerName}
7074
</p>
71-
<p className='text-sm'>{booking.Phone_Number}</p>
75+
<p className="text-sm">{booking.Phone_Number}</p>
7276
</td>
7377
{/* <td className="text-neutral text-sm font-semibold">
7478
{booking?.Timestamp}
7579
</td> */}
76-
<td className="flex items-center">
77-
${booking?.productPrice}
78-
</td>
80+
<td className="flex items-center">${booking?.productPrice}</td>
7981
<td>
80-
<Link to={`/payment/${booking._id}`}
82+
<Link
83+
to={`/dashboard/payment/${booking._id}`}
8184
// onClick={() => payNowHandler(booking)}
8285
className="btn btn-neutral hover:btn-primary text-white font-semibold"
8386
>
@@ -90,8 +93,8 @@ const MyOrders = () => {
9093
{/* <!-- foot --> */}
9194
</table>
9295
</div>
93-
</div>
94-
);
96+
</div>
97+
);
9598
};
9699

97-
export default MyOrders;
100+
export default MyOrders;

src/Pages/Catagories/CatagoriesShowcase/CatagoriesShowcase.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
import { useQuery } from '@tanstack/react-query';
22
import { data } from 'autoprefixer';
3+
import axios from 'axios';
34
import React from 'react';
45
import CatagoriesCard from '../CatagoriesCard/CatagoriesCard';
56

67
const CatagoriesShowcase = () => {
78

8-
const { data: catagories = [], isLoading } = useQuery({
9-
queryKey: ["catagories"],
10-
queryFn: async () => {
11-
const res = await fetch(`http://localhost:5000/catagories`);
12-
const data = await res.json();
13-
return data;
14-
},
15-
});
9+
10+
const {data:catagories = [] , isLoading} = useQuery({
11+
queryKey:['catagories'],
12+
queryFn: ()=>{
13+
const data = axios.get(`http://localhost:5000/catagories/`)
14+
return data
15+
}
16+
})
17+
18+
console.log(catagories?.data);
1619

1720

1821
return (
1922
<div className='my-20'>
2023
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10'>
2124
{
22-
catagories.map(category => <CatagoriesCard key={category._id} category={category} ></CatagoriesCard>)
25+
catagories?.data?.map(category => <CatagoriesCard key={category._id} category={category} ></CatagoriesCard>)
2326
}
2427
</div>
2528
</div>

0 commit comments

Comments
 (0)