Skip to content

Commit

Permalink
add: toast + change bottom text color
Browse files Browse the repository at this point in the history
  • Loading branch information
Shobhit-Nagpal committed Aug 10, 2024
1 parent 2542c3e commit a96cc63
Show file tree
Hide file tree
Showing 8 changed files with 684 additions and 41 deletions.
234 changes: 234 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@hookform/resolvers": "^3.9.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"canvas": "^2.11.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down
11 changes: 6 additions & 5 deletions src/app/api/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ export async function POST(req: NextRequest) {
ctx.fillText(pullRequests.toString() + " PRs", certificateImg.width * 0.57, certificateImg.height * 0.30);
ctx.fillText(score.toString() + " pts", certificateImg.width * 0.64, certificateImg.height * 0.30);

ctx.font = 'bold 24px Arial';
ctx.fillText(rank.toString(), certificateImg.width * 0.235, certificateImg.height * 0.76);
ctx.fillText(score.toString(), certificateImg.width * 0.435, certificateImg.height * 0.76);
ctx.fillText(pullRequests.toString(), certificateImg.width * 0.670, certificateImg.height * 0.76);
ctx.fillText(badges.toString(), certificateImg.width * 0.875, certificateImg.height * 0.76);
ctx.font = 'bold 20px Arial';
ctx.fillStyle = 'white';
ctx.fillText(rank.toString(), certificateImg.width * 0.235, certificateImg.height * 0.758);
ctx.fillText(score.toString(), certificateImg.width * 0.435, certificateImg.height * 0.758);
ctx.fillText(pullRequests.toString(), certificateImg.width * 0.670, certificateImg.height * 0.758);
ctx.fillText(badges.toString(), certificateImg.width * 0.875, certificateImg.height * 0.758);

const buffer = canvas.toBuffer('image/png');

Expand Down
6 changes: 5 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Toaster } from "@/components/ui/toaster";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });
Expand All @@ -16,7 +17,10 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<body className={inter.className}>
{children}
<Toaster />
</body>
</html>
);
}
Loading

0 comments on commit a96cc63

Please sign in to comment.