Skip to content

Commit 918abf3

Browse files
feat: add Dashboard page with bought, sold items, and current bids sections
1 parent f8a43ce commit 918abf3

File tree

3 files changed

+107
-2
lines changed

3 files changed

+107
-2
lines changed

backend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Backend for UniLoot - college-exclusive e-commerce platform",
55
"main": "server.ts",
66
"scripts": {
7-
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
7+
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
88
"build": "tsc",
99
"start": "nodemon dist/server.js"
1010
},
@@ -29,4 +29,4 @@
2929
"ts-node-dev": "^2.0.0",
3030
"typescript": "^5.2.2"
3131
}
32-
}
32+
}

frontend/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Browse from "./pages/Browse";
99
import Sell from "./pages/Sell";
1010
import ProductDetailsPage from "./pages/ProductDetail";
1111
import Navbar from "./components/Navbar";
12+
import Dashboard from "./pages/Dashboard";
1213
const queryClient = new QueryClient();
1314

1415
const App = () => (
@@ -27,6 +28,7 @@ const App = () => (
2728
<Route path="/browse" element={<Browse />} />
2829
<Route path="/product/:id" element={<ProductDetailsPage />} />
2930
<Route path="/sell" element={<Sell />} />
31+
<Route path="/dashboard" element={<Dashboard />} />
3032
</Routes>
3133
</div>
3234
</BrowserRouter>

frontend/src/pages/Dashboard.tsx

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import React from 'react';
2+
import { Button } from "@/components/ui/button";
3+
import { ShoppingCart, Tag, Clock } from "lucide-react";
4+
import { useNavigate } from 'react-router-dom';
5+
6+
7+
const Dashboard: React.FC = () => {
8+
const navigate = useNavigate();
9+
10+
// Dummy static data
11+
const boughtItems = [
12+
{ id: 1, name: "Physics Textbook", price: "Rs 30" },
13+
{ id: 2, name: "Laptop Stand", price: "Rs 25" },
14+
{ id: 3, name: "Stationery Kit", price: "Rs 10" },
15+
];
16+
17+
const soldItems = [
18+
{ id: 1, name: "Old Notes Set", price: "Rs 15" },
19+
{ id: 2, name: "Used Calculator", price: "Rs 20" },
20+
];
21+
22+
const currentBids = [
23+
{ id: 1, name: "Vintage Laptop", bid: "Rs 50" },
24+
{ id: 2, name: "Art Supplies", bid: "Rs 12" },
25+
];
26+
27+
28+
const handleBuyClick = () => {
29+
console.log('Buy button clicked - Navigate to browse page');
30+
navigate('/browse');
31+
};
32+
33+
const handleSellClick = () => {
34+
console.log('Sell button clicked - Navigate to sell page');
35+
navigate('/sell');
36+
};
37+
38+
return (
39+
<section className="w-full min-h-[calc(100vh-80px)] bg-blue-50 py-12 px-6 text-black">
40+
<div className="container mx-auto space-y-12">
41+
<h1 className="text-4xl font-extrabold text-gray-800 mb-6">
42+
Welcome Back, Student!
43+
</h1>
44+
45+
<div className="bg-white rounded-2xl shadow-lg p-6">
46+
<div className="flex items-center gap-3 mb-4">
47+
<ShoppingCart className="w-6 h-6 text-blue-800" />
48+
<h2 className="text-2xl font-semibold text-gray-800">Bought Items</h2>
49+
</div>
50+
<ul className="space-y-2">
51+
{boughtItems.map(item => (
52+
<li key={item.id} className="flex justify-between p-3 rounded-lg bg-blue-50 hover:bg-blue-100 transition">
53+
<span>{item.name}</span>
54+
<span className="font-semibold">{item.price}</span>
55+
</li>
56+
))}
57+
</ul>
58+
</div>
59+
60+
<div className="bg-white rounded-2xl shadow-lg p-6">
61+
<div className="flex items-center gap-3 mb-4">
62+
<Tag className="w-6 h-6 text-blue-800" />
63+
<h2 className="text-2xl font-semibold text-gray-800">Sold Items</h2>
64+
</div>
65+
<ul className="space-y-2">
66+
{soldItems.map(item => (
67+
<li key={item.id} className="flex justify-between p-3 rounded-lg bg-blue-50 hover:bg-blue-100 transition">
68+
<span>{item.name}</span>
69+
<span className="font-semibold">{item.price}</span>
70+
</li>
71+
))}
72+
</ul>
73+
</div>
74+
75+
<div className="bg-white rounded-2xl shadow-lg p-6">
76+
<div className="flex items-center gap-3 mb-4">
77+
<Clock className="w-6 h-6 text-blue-800" />
78+
<h2 className="text-2xl font-semibold text-gray-800">Current Bids</h2>
79+
</div>
80+
<ul className="space-y-2">
81+
{currentBids.map(item => (
82+
<li key={item.id} className="flex justify-between p-3 rounded-lg bg-blue-50 hover:bg-blue-100 transition">
83+
<span>{item.name}</span>
84+
<span className="font-semibold">{item.bid}</span>
85+
</li>
86+
))}
87+
</ul>
88+
</div>
89+
90+
<div className="flex gap-4 justify-center lg:justify-start">
91+
<Button className="bg-blue-800 text-white hover:bg-blue-700 px-6 py-3 rounded-lg"
92+
onClick={handleBuyClick}
93+
>Browse Marketplace</Button>
94+
<Button className="border-4 border-blue-800 text-blue-800 hover:bg-blue-800 hover:text-white px-6 py-3 rounded-lg"
95+
onClick={handleSellClick}
96+
>Sell an Item</Button>
97+
</div>
98+
</div>
99+
</section>
100+
);
101+
};
102+
103+
export default Dashboard;

0 commit comments

Comments
 (0)