|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { useState } from "react"; |
| 4 | +import { cn } from "@/lib/utils"; |
| 5 | +import { Card, CardContent } from "@/components/ui/card"; |
| 6 | +import { Button } from "@/components/ui/button"; |
| 7 | +import { ChefHat, ChevronRight, Users, Copy } from "lucide-react"; |
| 8 | +import Image from "next/image"; |
| 9 | + |
| 10 | +interface Prediction { |
| 11 | + id: string; |
| 12 | + title: string; |
| 13 | + date: string; |
| 14 | + potentialPayout: string; |
| 15 | + stake: string; |
| 16 | + odd: string; |
| 17 | + idNo: string; |
| 18 | + creator: string; |
| 19 | + participants: number; |
| 20 | + status: "Pending" | "Completed"; |
| 21 | +} |
| 22 | + |
| 23 | +const activePredictions: Prediction[] = [ |
| 24 | + { |
| 25 | + id: "1", |
| 26 | + title: "125,000 or above", |
| 27 | + date: "18-04-2025 21:43", |
| 28 | + potentialPayout: "179.52 strk", |
| 29 | + stake: "100 strk", |
| 30 | + odd: "2.54", |
| 31 | + idNo: "19133DK", |
| 32 | + creator: "Best Al this mon...", |
| 33 | + participants: 185, |
| 34 | + status: "Pending" |
| 35 | + } |
| 36 | +]; |
| 37 | + |
| 38 | +export function PredictionList() { |
| 39 | + const [activeTab, setActiveTab] = useState<"active" | "past">("active"); |
| 40 | + |
| 41 | + return ( |
| 42 | + <div className="space-y-6"> |
| 43 | + <div className="flex items-center gap-8 border-b border-zinc-800 pb-1"> |
| 44 | + <button |
| 45 | + onClick={() => setActiveTab("active")} |
| 46 | + className={cn( |
| 47 | + "pb-3 text-sm font-medium transition-colors relative", |
| 48 | + activeTab === "active" ? "text-primary" : "text-muted-foreground hover:text-white" |
| 49 | + )} |
| 50 | + > |
| 51 | + Active Prediction |
| 52 | + {activeTab === "active" && ( |
| 53 | + <span className="absolute bottom-0 left-0 w-full h-0.5 bg-primary" /> |
| 54 | + )} |
| 55 | + <span className="ml-2 bg-[#37B7C3] text-[#121212] text-[10px] font-bold px-1.5 py-0.5 rounded-full relative -top-0.5"> |
| 56 | + 6 |
| 57 | + </span> |
| 58 | + </button> |
| 59 | + <button |
| 60 | + onClick={() => setActiveTab("past")} |
| 61 | + className={cn( |
| 62 | + "pb-3 text-sm font-medium transition-colors relative", |
| 63 | + activeTab === "past" ? "text-primary" : "text-muted-foreground hover:text-white" |
| 64 | + )} |
| 65 | + > |
| 66 | + Past Predictions |
| 67 | + {activeTab === "past" && ( |
| 68 | + <span className="absolute bottom-0 left-0 w-full h-0.5 bg-primary" /> |
| 69 | + )} |
| 70 | + </button> |
| 71 | + </div> |
| 72 | + |
| 73 | + <div className="space-y-4"> |
| 74 | + {activeTab === "active" ? ( |
| 75 | + activePredictions.map((prediction) => ( |
| 76 | + <Card key={prediction.id} className="bg-[#1E1E1E] border-none text-white overflow-hidden"> |
| 77 | + <CardContent className="p-0"> |
| 78 | + {/* Header */} |
| 79 | + <div className="p-4 flex items-center justify-between border-b border-white/5"> |
| 80 | + <div> |
| 81 | + <h4 className="font-bold text-base">{prediction.title}</h4> |
| 82 | + <p className="text-zinc-500 text-xs mt-1">{prediction.date}</p> |
| 83 | + </div> |
| 84 | + <div className="flex items-center gap-2"> |
| 85 | + <span className="text-emerald-400 text-xs font-bold">{prediction.status}</span> |
| 86 | + <ChevronRight className="w-4 h-4 text-zinc-500" /> |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + |
| 90 | + {/* Stats */} |
| 91 | + <div className="p-4 space-y-3"> |
| 92 | + <div className="flex justify-between items-center text-sm"> |
| 93 | + <span className="text-zinc-400">Potential Payout:</span> |
| 94 | + <span className="font-bold font-mono text-lg">{prediction.potentialPayout}</span> |
| 95 | + </div> |
| 96 | + <div className="flex justify-between items-center text-sm"> |
| 97 | + <span className="text-zinc-400">Stake</span> |
| 98 | + <span className="text-white">{prediction.stake}</span> |
| 99 | + </div> |
| 100 | + <div className="flex justify-between items-center text-sm"> |
| 101 | + <span className="text-zinc-400">Odd</span> |
| 102 | + <span className="text-white">{prediction.odd}</span> |
| 103 | + </div> |
| 104 | + <div className="flex justify-between items-center text-sm"> |
| 105 | + <span className="text-zinc-400">ID No.</span> |
| 106 | + <div className="flex items-center gap-2 text-white"> |
| 107 | + {prediction.idNo} |
| 108 | + <Copy className="w-3 h-3 text-zinc-500 cursor-pointer hover:text-white" /> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + |
| 113 | + {/* Footer */} |
| 114 | + <div className="p-4 bg-zinc-900/50 flex items-center justify-between"> |
| 115 | + <div className="flex items-center gap-2"> |
| 116 | + <div className="w-8 h-8 rounded-lg bg-indigo-500/20 flex items-center justify-center text-indigo-400"> |
| 117 | + <ChefHat className="w-5 h-5" /> |
| 118 | + </div> |
| 119 | + <span className="text-sm font-medium text-zinc-300">{prediction.creator}</span> |
| 120 | + </div> |
| 121 | + <div className="flex items-center gap-1 text-zinc-400 text-sm"> |
| 122 | + <Users className="w-4 h-4" /> |
| 123 | + <span>{prediction.participants}</span> |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + </CardContent> |
| 127 | + </Card> |
| 128 | + )) |
| 129 | + ) : ( |
| 130 | + <div className="text-center py-10 text-zinc-500"> |
| 131 | + No past predictions found |
| 132 | + </div> |
| 133 | + )} |
| 134 | + </div> |
| 135 | + </div> |
| 136 | + ); |
| 137 | +} |
0 commit comments