Skip to content

Commit 0a7f908

Browse files
feat: Integrate LeetCode calendar component into dashboard with customizable options
1 parent 4a78180 commit 0a7f908

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

app/dashboard/page.tsx

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ import {
2525
Twitter,
2626
Trophy,
2727
TrendingUp,
28-
CheckCircle,
29-
Clock,
3028
Zap,
31-
Calendar,
3229
Code,
33-
AlertCircle,
34-
LineChart,
3530
Target,
3631
Award,
3732
Hash
3833
} from "lucide-react";
3934

35+
import LeetCodeCalendar from "leetcode-calendar";
36+
import { exampleTheme } from "../../lib/leetcode-calendar-theme";
37+
4038
ChartJS.register(
4139
CategoryScale,
4240
LinearScale,
@@ -149,7 +147,13 @@ export default function Dashboard() {
149147
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
150148
{/* Leetcode calendar to show up here */}
151149
<div className="lg:col-span-2">
152-
150+
<LeetCodeCalendar username="yashksaini"
151+
blockSize={12} // Optional: Size of each block in pixels (default: 15)
152+
blockMargin={3} // Optional: Margin between blocks in pixels (default: 5)
153+
fontSize={11} // Optional: Font size of the text within blocks (default: 16)
154+
theme={exampleTheme} // Optional: A custom theme object to style the calendar
155+
style={{ maxWidth: '950px' }}
156+
/>
153157
</div>
154158

155159
{/* Recent Submissions */}
@@ -245,22 +249,21 @@ export default function Dashboard() {
245249
);
246250
}
247251

248-
interface QuickStatProps {
252+
function QuickStat({ icon, label, value }:
253+
{
249254
icon: React.ReactNode;
250255
label: string;
251256
value: string | number;
252-
}
253-
254-
function QuickStat({ icon, label, value }: QuickStatProps) {
255-
return (
256-
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg px-3 py-2 text-center">
257-
<div className="flex items-center gap-1 text-gray-600 dark:text-gray-400">
258-
{icon}
259-
<span className="text-xs">{label}</span>
257+
}) {
258+
return (
259+
<div className="flex items-center space-x-3 bg-secondary/50 rounded-lg p-4 hover:bg-secondary/70 transition-colors">
260+
<div className="p-2 bg-background rounded-full">{icon}</div>
261+
<div>
262+
<div className="text-2xl font-bold">{value.toLocaleString()}</div>
263+
<div className="text-sm font-medium">{label}</div>
264+
</div>
260265
</div>
261-
<div className="font-semibold">{value}</div>
262-
</div>
263-
);
266+
);
264267
}
265268

266269
interface DetailStats {
@@ -279,7 +282,7 @@ function DetailCard({ title, icon, stats }: { title: string; icon: React.ReactNo
279282
</CardHeader>
280283
<CardContent className="p-4">
281284
<div className="grid grid-cols-2 gap-4">
282-
{stats.map((stat: { label: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; value: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; }, idx: React.Key | null | undefined) => (
285+
{stats.map((stat, idx) => (
283286
<div key={idx} className="bg-gray-50 dark:bg-gray-800 p-3 rounded-lg">
284287
<div className="text-sm text-gray-600 dark:text-gray-400">{stat.label}</div>
285288
<div className="text-lg font-semibold">{stat.value}</div>

0 commit comments

Comments
 (0)