feat: complete pragativeer v2 frontend and backend, docker setup, and cbt engine
This commit is contained in:
67
src/app/api/og/progress/route.tsx
Normal file
67
src/app/api/og/progress/route.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { NextRequest } from 'next/server';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(req.url);
|
||||
|
||||
// Extract dynamic data from the URL query parameters
|
||||
const streak = searchParams.get('streak') || '0';
|
||||
const accuracy = searchParams.get('accuracy') || '0';
|
||||
const name = searchParams.get('name') || 'Student';
|
||||
|
||||
// Renders a high-end, minimalist graphic using pure Tailwind and React
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
style={{
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: '#0a0a0a', // Deep premium dark mode
|
||||
color: '#ffffff',
|
||||
fontFamily: 'sans-serif',
|
||||
padding: '40px',
|
||||
border: '8px solid #333',
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', fontSize: 60, fontWeight: 800, marginBottom: 20, letterSpacing: '-0.05em' }}>
|
||||
PragatiVeer
|
||||
</div>
|
||||
<div style={{ display: 'flex', fontSize: 32, color: '#a3a3a3', marginBottom: 60 }}>
|
||||
{name}'s JEE Preparation Progress
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', width: '100%', justifyContent: 'space-around' }}>
|
||||
{/* Streak Metric */}
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 80, fontWeight: 900, color: '#f59e0b' }}>{streak}🔥</span>
|
||||
<span style={{ fontSize: 24, color: '#d4d4d4', marginTop: 10 }}>Day Streak</span>
|
||||
</div>
|
||||
|
||||
{/* Accuracy Metric */}
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 80, fontWeight: 900, color: '#10b981' }}>{accuracy}%</span>
|
||||
<span style={{ fontSize: 24, color: '#d4d4d4', marginTop: 10 }}>Top Accuracy</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', position: 'absolute', bottom: 40, fontSize: 20, color: '#525252' }}>
|
||||
Join me on pragativeer.com/invite
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
{
|
||||
width: 1200,
|
||||
height: 630,
|
||||
}
|
||||
);
|
||||
} catch (e: any) {
|
||||
return new Response(`Failed to generate image`, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user