Skip to content
Merged
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
11 changes: 9 additions & 2 deletions src/app/api/courses/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export async function GET(request: Request): Promise<NextResponse<PaginatedRespo
}

const { searchParams } = new URL(request.url);
const limit = searchParams.get('limit') || '10';
const limit = parseInt(searchParams.get('limit') || '10', 10);
const cursor = searchParams.get('cursor');

const courses = [
{
Expand Down Expand Up @@ -53,10 +54,16 @@ export async function GET(request: Request): Promise<NextResponse<PaginatedRespo
},
];

const startIndex = cursor ? parseInt(cursor, 10) : 0;
const page = courses.slice(startIndex, startIndex + limit);
const nextIndex = startIndex + limit;
const nextCursor = nextIndex < courses.length ? String(nextIndex) : undefined;

return addHeaders(
NextResponse.json({
data: courses.slice(0, parseInt(limit)),
data: page,
total: courses.length,
nextCursor,
}),
);
}
20 changes: 20 additions & 0 deletions src/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Dashboard | TeachLink',
description: 'Track your learning progress, manage downloaded courses, and continue where you left off.',
openGraph: {
title: 'Dashboard | TeachLink',
description: 'Track your learning progress and continue your courses.',
type: 'website',
},
twitter: {
card: 'summary',
title: 'Dashboard | TeachLink',
description: 'Track your learning progress and continue your courses.',
},
};

export default function DashboardLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
16 changes: 16 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import type { Metadata } from 'next';
import CourseCard from './components/courses/CourseCard';
import Link from 'next/link';

export const metadata: Metadata = {
title: 'TeachLink - Offline Learning Platform',
description: 'Learn anywhere, anytime with offline capabilities. Access courses, track progress, and study without an internet connection.',
openGraph: {
title: 'TeachLink - Offline Learning Platform',
description: 'Learn anywhere, anytime with offline capabilities.',
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: 'TeachLink - Offline Learning Platform',
description: 'Learn anywhere, anytime with offline capabilities.',
},
};

export default function Home() {
return (
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 text-white">
Expand Down
20 changes: 20 additions & 0 deletions src/app/profile/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Profile | TeachLink',
description: 'Manage your TeachLink profile, preferences, and account settings.',
openGraph: {
title: 'Profile | TeachLink',
description: 'Manage your TeachLink profile and account settings.',
type: 'profile',
},
twitter: {
card: 'summary',
title: 'Profile | TeachLink',
description: 'Manage your TeachLink profile and account settings.',
},
};

export default function ProfileLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
Loading
Loading