|
| 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