Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ NEXTAUTH_URL="http://localhost:3000"
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""

# OpenAI / AI question generation
OPENAI_API_KEY=""
OPENAI_MODEL="gpt-4o-mini"

# Cloudinary is optional for now. Add these only when working on upload/media features.
# CLOUDINARY_CLOUD_NAME=""
# CLOUDINARY_API_KEY=""
Expand Down
14 changes: 10 additions & 4 deletions src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ export default function LoginPage() {
</p>
</div>
<div className="flex-1 h-screen pr-10 pt-2">
<p className="flex justify-end text-[14px]">
Need help? <span className="pl-2 text-button"> Contact Support</span>
</p>
<div className="flex justify-between items-center px-4">
<a href="/" className="text-button text-[14px] hover:underline flex items-center gap-1">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
Back to Home
</a>
<p className="text-[14px]">
Need help? <span className="pl-2 text-button"> Contact Support</span>
</p>
</div>

<div className="w-full h-full flex justify-center flex-col items-center">
<div className="w-[80%] h-[60%] flex flex-col gap-8 ">
Expand Down Expand Up @@ -237,7 +243,7 @@ export default function LoginPage() {
<div className="gap-2 flex flex-col">
<div className="flex justify-between items-center">
<label htmlFor="password"> Password</label>
<p className="text-button text-[14px]">Forgot password?</p>
<p className="text-button text-[14px] cursor-pointer select-none">Forgot password?</p>
</div>

<Input
Expand Down
12 changes: 9 additions & 3 deletions src/app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,15 @@ export default function LoginPage() {

{/* Right Side - Login Form */}
<div className="flex-1 h-screen flex flex-col pr-10 pt-4">
<p className="flex justify-end text-[14px]">
Need help? <span className="pl-2 text-button"> Contact Support</span>
</p>
<div className="flex justify-between items-center px-4">
<a href="/" className="text-button text-[14px] hover:underline flex items-center gap-1">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
Back to Home
</a>
<p className="text-[14px]">
Need help? <span className="pl-2 text-button"> Contact Support</span>
</p>
</div>

<div className="flex flex-1 justify-center items-center">
<div className="w-[80%] flex flex-col gap-8">
Expand Down
7 changes: 3 additions & 4 deletions src/app/api/ai/generate-questions/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextResponse } from 'next/server';
import { AIController } from '@/modules/ai/ai.controller';

export async function POST() {
// TODO: Implement AI question generation
return NextResponse.json({ message: 'Not implemented' }, { status: 501 });
export async function POST(req: Request) {
return AIController.generateQuestions(req);
}
7 changes: 3 additions & 4 deletions src/app/api/quiz/create/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextResponse } from 'next/server';
import { QuizController } from '@/modules/quiz/quiz.controller';

export async function POST() {
// TODO: Implement quiz creation
return NextResponse.json({ message: 'Not implemented' }, { status: 501 });
export async function POST(req: Request) {
return QuizController.create(req);
}
7 changes: 3 additions & 4 deletions src/app/api/quiz/session/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextResponse } from 'next/server';
import { QuizController } from '@/modules/quiz/quiz.controller';

export async function GET() {
// TODO: Implement quiz session retrieval
return NextResponse.json({ message: 'Not implemented' }, { status: 501 });
export async function GET(req: Request) {
return QuizController.getSession(req);
}
7 changes: 3 additions & 4 deletions src/app/api/quiz/start/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextResponse } from 'next/server';
import { QuizController } from '@/modules/quiz/quiz.controller';

export async function POST() {
// TODO: Implement quiz start
return NextResponse.json({ message: 'Not implemented' }, { status: 501 });
export async function POST(req: Request) {
return QuizController.start(req);
}
7 changes: 3 additions & 4 deletions src/app/api/quiz/submit/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextResponse } from 'next/server';
import { QuizController } from '@/modules/quiz/quiz.controller';

export async function POST() {
// TODO: Implement quiz submission
return NextResponse.json({ message: 'Not implemented' }, { status: 501 });
export async function POST(req: Request) {
return QuizController.submit(req);
}
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata } from 'next';
import { Geist, Geist_Mono, Lexend, Manrope } from 'next/font/google';
import './globals.css';
import MainLayout from './mainLayout';
import ThemeToggle from '@/components/ThemeToggle';

const manrope = Manrope({
variable: '--font-manrope-sans',
Expand All @@ -22,6 +23,7 @@ export default async function RootLayout({
<html lang="en">
<body className={`${manrope.variable} antialiased `}>
<MainLayout>{children}</MainLayout>
<ThemeToggle />
</body>
</html>
);
Expand Down
15 changes: 15 additions & 0 deletions src/app/ncert/[class]/[subject]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ interface ChapterType {
pdf: string;
subjectId: string;
title: string;
content?: string;
}

function getReadTime(content: string | undefined | null): number | null {
if (!content) return null;
const words = content.trim().split(/\s+/).length;
return Math.ceil(words / 200);
}

export default function NcertSubjectPage() {
Expand Down Expand Up @@ -69,6 +76,14 @@ export default function NcertSubjectPage() {
{val.order < 10 ? `0${val.order}` : `${val.order}`}
</p>
<p className="text-xl font-semibold">{val.title}</p>
{(() => {
const readTime = getReadTime(val.content);
return readTime ? (
<span className="ml-auto text-xs font-medium px-3 py-1 rounded-full bg-primary/10 text-primary/70 border border-primary/20">
📖 ~{readTime} min read
</span>
) : null;
})()}
</a>
);
})}
Expand Down
Loading