|
1 | | -import React, { useEffect, useState } from "react"; |
2 | | -import Layout from "@theme/Layout"; |
3 | | -import Head from "@docusaurus/Head"; |
4 | | -import type confettiType from "canvas-confetti"; |
| 1 | +import React, { useEffect, useState } from 'react'; |
| 2 | +import Layout from '@theme/Layout'; |
| 3 | +import Head from '@docusaurus/Head'; |
| 4 | +import NavbarIcon from "../../../components/navbar/NavbarIcon"; |
| 5 | +import { useHistory } from "@docusaurus/router"; |
| 6 | +import type confettiType from 'canvas-confetti'; |
| 7 | +import "../dashboard.css"; |
5 | 8 |
|
6 | 9 | const GiveawayPage: React.FC = () => { |
| 10 | + const history = useHistory(); |
| 11 | + const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false); |
| 12 | + const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false); |
7 | 13 | const [timeLeft, setTimeLeft] = useState({ |
8 | 14 | days: "--", |
9 | 15 | hours: "--", |
10 | 16 | minutes: "--", |
11 | 17 | seconds: "--", |
12 | 18 | }); |
13 | 19 |
|
14 | | - const countdownTarget = new Date("2025-08-15T23:59:59").getTime(); // Update the deadline if needed |
| 20 | + const countdownTarget = new Date('2025-08-15T23:59:59').getTime(); |
15 | 21 |
|
16 | 22 | // Countdown Timer Effect |
17 | 23 | useEffect(() => { |
@@ -63,70 +69,155 @@ const GiveawayPage: React.FC = () => { |
63 | 69 | return () => clearTimeout(timer); |
64 | 70 | }, []); |
65 | 71 |
|
| 72 | + const handleTabChange = (tab: "home" | "discuss" | "leaderboard" | "giveaway") => { |
| 73 | + setIsMobileSidebarOpen(false); |
| 74 | + if (tab === "discuss") { |
| 75 | + history.push("/dashboard#discuss"); |
| 76 | + } else if (tab === "leaderboard") { |
| 77 | + history.push("/dashboard#leaderboard"); |
| 78 | + } else if (tab === "home") { |
| 79 | + history.push("/dashboard"); |
| 80 | + } |
| 81 | + }; |
| 82 | + |
66 | 83 | return ( |
67 | | - <Layout> |
| 84 | + <Layout title="Giveaway" description="RecodeHive Giveaway"> |
68 | 85 | <Head> |
69 | 86 | <title>🎁 RecodeHive Giveaway</title> |
70 | 87 | </Head> |
| 88 | + <div className={`dashboard-layout ${isMobileSidebarOpen ? 'sidebar-open' : ''}`}> |
| 89 | + {/* Mobile Menu Button */} |
| 90 | + <button |
| 91 | + className={`mobile-menu-btn ${isMobileSidebarOpen ? 'open' : ''}`} |
| 92 | + onClick={() => setIsMobileSidebarOpen(!isMobileSidebarOpen)} |
| 93 | + aria-label="Toggle mobile menu" |
| 94 | + /> |
| 95 | + |
| 96 | + {/* Sidebar Navigation */} |
| 97 | + <nav |
| 98 | + className={`dashboard-sidebar ${ |
| 99 | + isSidebarCollapsed ? "collapsed" : "" |
| 100 | + } ${isMobileSidebarOpen ? "show" : ""}`} |
| 101 | + > |
| 102 | + <div className="sidebar-header"> |
| 103 | + <div className="sidebar-logo"> |
| 104 | + <h2>RecodeHive</h2> |
| 105 | + </div> |
| 106 | + <button |
| 107 | + className="sidebar-toggle" |
| 108 | + onClick={() => setIsSidebarCollapsed(!isSidebarCollapsed)} |
| 109 | + aria-label={ |
| 110 | + isSidebarCollapsed ? "Expand sidebar" : "Collapse sidebar" |
| 111 | + } |
| 112 | + > |
| 113 | + {isSidebarCollapsed ? "→" : "←"} |
| 114 | + </button> |
| 115 | + </div> |
| 116 | + <ul className="sidebar-nav"> |
| 117 | + <li |
| 118 | + className="nav-item" |
| 119 | + onClick={() => handleTabChange("home")} |
| 120 | + > |
| 121 | + <span className="nav-icon"> |
| 122 | + <NavbarIcon name="Dashboard" /> |
| 123 | + </span> |
| 124 | + <span className="nav-text">Home</span> |
| 125 | + </li> |
| 126 | + <li |
| 127 | + className="nav-item" |
| 128 | + onClick={() => handleTabChange("discuss")} |
| 129 | + > |
| 130 | + <span className="nav-icon"> |
| 131 | + <NavbarIcon name="Broadcast" /> |
| 132 | + </span> |
| 133 | + <span className="nav-text">Discuss</span> |
| 134 | + </li> |
| 135 | + <li |
| 136 | + className="nav-item" |
| 137 | + onClick={() => handleTabChange("leaderboard")} |
| 138 | + > |
| 139 | + <span className="nav-icon"> |
| 140 | + <NavbarIcon name="Badges" /> |
| 141 | + </span> |
| 142 | + <span className="nav-text">Leaderboard</span> |
| 143 | + </li> |
| 144 | + <li |
| 145 | + className="nav-item active" |
| 146 | + > |
| 147 | + <span className="nav-icon"> |
| 148 | + <NavbarIcon name="Donate" /> |
| 149 | + </span> |
| 150 | + <span className="nav-text">Giveaway</span> |
| 151 | + </li> |
| 152 | + </ul> |
| 153 | + <div className="sidebar-footer"> |
| 154 | + <button |
| 155 | + className="sidebar-toggle bottom-toggle" |
| 156 | + onClick={() => setIsSidebarCollapsed(!isSidebarCollapsed)} |
| 157 | + aria-label={ |
| 158 | + isSidebarCollapsed ? "Expand sidebar" : "Collapse sidebar" |
| 159 | + } |
| 160 | + > |
| 161 | + {isSidebarCollapsed ? "→" : "←"} |
| 162 | + </button> |
| 163 | + </div> |
| 164 | + </nav> |
| 165 | + |
| 166 | + <main |
| 167 | + className={`dashboard-main ${ |
| 168 | + isSidebarCollapsed ? "sidebar-collapsed" : "" |
| 169 | + }`} |
| 170 | + > |
| 171 | + <div className="min-h-screen bg-gradient-to-br from-[#0f0c29] via-[#302b63] to-[#24243e] text-white py-10 px-6"> |
| 172 | + <div className="max-w-4xl mx-auto text-center"> |
| 173 | + <h1 className="text-4xl sm:text-5xl font-bold mb-6">🎉 RecodeHive Giveaway</h1> |
| 174 | + <p className="text-lg mb-8">Participate now and win exclusive swag, resources, and more!</p> |
| 175 | + |
| 176 | + <div className="flex justify-center gap-4 text-center mb-12"> |
| 177 | + {['days', 'hours', 'minutes', 'seconds'].map((unit) => ( |
| 178 | + <div key={unit} className="bg-white/10 px-6 py-4 rounded-xl shadow-md"> |
| 179 | + <div className="text-3xl font-bold">{timeLeft[unit as keyof typeof timeLeft]}</div> |
| 180 | + <div className="text-sm uppercase tracking-widest">{unit}</div> |
| 181 | + </div> |
| 182 | + ))} |
| 183 | + </div> |
71 | 184 |
|
72 | | - <div className="min-h-screen bg-gradient-to-br from-[#0f0c29] via-[#302b63] to-[#24243e] text-white py-10 px-6"> |
73 | | - <div className="max-w-4xl mx-auto text-center"> |
74 | | - <h1 className="text-4xl sm:text-5xl font-bold mb-6"> |
75 | | - 🎉 RecodeHive Giveaway |
76 | | - </h1> |
77 | | - <p className="text-lg mb-8"> |
78 | | - Participate now and win exclusive swag, resources, and more! |
79 | | - </p> |
80 | | - |
81 | | - <div className="flex justify-center gap-4 text-center mb-12"> |
82 | | - {["days", "hours", "minutes", "seconds"].map((unit) => ( |
83 | | - <div |
84 | | - key={unit} |
85 | | - className="bg-white/10 px-6 py-4 rounded-xl shadow-md" |
86 | | - > |
87 | | - <div className="text-3xl font-bold"> |
88 | | - {timeLeft[unit as keyof typeof timeLeft]} |
89 | | - </div> |
90 | | - <div className="text-sm uppercase tracking-widest">{unit}</div> |
| 185 | + <div className="bg-white/10 p-6 rounded-xl shadow-xl mb-10"> |
| 186 | + <h2 className="text-2xl font-semibold mb-4">🏆 Leaderboard</h2> |
| 187 | + <table className="w-full text-left border-collapse"> |
| 188 | + <thead> |
| 189 | + <tr className="border-b border-white/20"> |
| 190 | + <th className="pb-2">Rank</th> |
| 191 | + <th className="pb-2">Username</th> |
| 192 | + <th className="pb-2">Points</th> |
| 193 | + </tr> |
| 194 | + </thead> |
| 195 | + <tbody> |
| 196 | + <tr className="border-b border-white/10"> |
| 197 | + <td>1</td> |
| 198 | + <td>OpenSourcePro</td> |
| 199 | + <td>1200</td> |
| 200 | + </tr> |
| 201 | + <tr className="border-b border-white/10"> |
| 202 | + <td>2</td> |
| 203 | + <td>CodeWizard</td> |
| 204 | + <td>950</td> |
| 205 | + </tr> |
| 206 | + <tr> |
| 207 | + <td>3</td> |
| 208 | + <td>DevChampion</td> |
| 209 | + <td>875</td> |
| 210 | + </tr> |
| 211 | + </tbody> |
| 212 | + </table> |
91 | 213 | </div> |
92 | | - ))} |
93 | | - </div> |
94 | 214 |
|
95 | | - <div className="bg-white/10 p-6 rounded-xl shadow-xl mb-10"> |
96 | | - <h2 className="text-2xl font-semibold mb-4">🏆 Leaderboard</h2> |
97 | | - <table className="w-full border-collapse"> |
98 | | - <thead> |
99 | | - <tr className="border-b border-white/20"> |
100 | | - <th className="pb-2 text-center">Rank</th> |
101 | | - <th className="pb-2 text-center">Username</th> |
102 | | - <th className="pb-2 text-center">Points</th> |
103 | | - </tr> |
104 | | - </thead> |
105 | | - <tbody> |
106 | | - <tr className="border-b border-white/10"> |
107 | | - <td className="text-center">1</td> |
108 | | - <td className="text-center">OpenSourcePro</td> |
109 | | - <td className="text-center">1200</td> |
110 | | - </tr> |
111 | | - <tr className="border-b border-white/10"> |
112 | | - <td className="text-center">2</td> |
113 | | - <td className="text-center">CodeWizard</td> |
114 | | - <td className="text-center">950</td> |
115 | | - </tr> |
116 | | - <tr> |
117 | | - <td className="text-center">3</td> |
118 | | - <td className="text-center">DevChampion</td> |
119 | | - <td className="text-center">875</td> |
120 | | - </tr> |
121 | | - </tbody> |
122 | | - </table> |
| 215 | + <p className="text-sm text-white text-opacity-60 italic"> |
| 216 | + Winners will be announced after the countdown ends. Stay active on the dashboard to climb up the leaderboard! |
| 217 | + </p> |
| 218 | + </div> |
123 | 219 | </div> |
124 | | - |
125 | | - <p className="text-sm text-white text-opacity-60 italic"> |
126 | | - Winners will be announced after the countdown ends. Stay active on |
127 | | - the dashboard to climb up the leaderboard! |
128 | | - </p> |
129 | | - </div> |
| 220 | + </main> |
130 | 221 | </div> |
131 | 222 | </Layout> |
132 | 223 | ); |
|
0 commit comments