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
56 changes: 0 additions & 56 deletions app/api/progress/quiz/[userId]/[quizId]/attempts/route.ts

This file was deleted.

51 changes: 0 additions & 51 deletions app/api/progress/quiz/[userId]/[quizId]/route.ts

This file was deleted.

97 changes: 0 additions & 97 deletions app/api/progress/quiz/route.ts

This file was deleted.

10 changes: 8 additions & 2 deletions app/classrooms/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client'
import { LoadingSpinner } from '@/components/LoadingSpinner'
import { Loader2 } from 'lucide-react'
import { useAuth } from '@/contexts/AuthContext'
import { SessionManagement } from '@/components/session-views/session-management'

Expand All @@ -14,7 +14,13 @@ const ClassroomLessonPage: React.FC<PageProps> = ({ params }) => {

const classroomId = params.id

if (loading) return <LoadingSpinner />
if (loading) {
return (
<div className='flex items-center justify-center min-h-screen'>
<Loader2 className='h-8 w-8 animate-spin' />
</div>
)
}

if (!user) {
return (
Expand Down
11 changes: 9 additions & 2 deletions app/classrooms/[id]/session/[sid]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'
// import { useState } from 'react'
import { useRouter } from 'next/navigation'
import { LoadingSpinner } from '@/components/LoadingSpinner'
import { Loader2 } from 'lucide-react'
import { useAuth } from '@/contexts/AuthContext'
import { StudentSessionView } from '@/components/session-views/student-session-view'
import { TeacherSessionView } from '@/components/session-views/teacher-session-view'
Expand All @@ -21,7 +21,14 @@ const SessionPage: React.FC<PageProps> = ({ params }) => {
const classroomId = params.id
const sessionId = params.sid

if (loading) return <LoadingSpinner />
// Show loading state while fetching data
if (loading) {
return (
<div className='flex items-center justify-center min-h-screen'>
<Loader2 className='h-8 w-8 animate-spin' />
</div>
)
}

if (!user) {
return (
Expand Down
10 changes: 8 additions & 2 deletions app/classrooms/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
import { useAuth } from '@/contexts/AuthContext'
import { TeacherClassroomsView } from '@/components/classrooms/TeacherClassroomsView'
import { StudentClassroomsView } from '@/components/classrooms/StudentClassroomsView'
import { LoadingSpinner } from '@/components/LoadingSpinner'
import { Loader2 } from 'lucide-react'

const ClassroomPage = () => {
const { user, loading } = useAuth()

// to do: go home
// const router = useRouter()

if (loading) return <LoadingSpinner />
if (loading) {
return (
<div className='flex items-center justify-center min-h-screen'>
<Loader2 className='h-8 w-8 animate-spin' />
</div>
)
}

return (
<>
Expand Down
13 changes: 11 additions & 2 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
import { TeacherDashboard } from '@/components//dashboard/TeacherDashboard'
import { StudentDashboard } from '@/components/dashboard/StudentDashboard'
import { useAuth } from '@/contexts/AuthContext'
import { LoadingSpinner } from '@/components/LoadingSpinner'
import { Loader2 } from 'lucide-react'
import ProtectedRoute from '@/components/ProtectedRoute'

export default function DashboardPage() {
const { user, loading, signOut } = useAuth()

if (loading) return <LoadingSpinner />
if (loading) {
return (
<div className='min-h-screen flex items-center justify-center'>
<div className='text-center space-y-4'>
<Loader2 className='h-8 w-8 animate-spin mx-auto text-primary' />
<p className='text-lg text-muted-foreground'>Loading...</p>
</div>
</div>
)
}

return (
<ProtectedRoute>
Expand Down
11 changes: 8 additions & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { useRouter } from 'next/navigation'
import { useAuth } from '@/contexts/AuthContext'
import {
Loader2,
PlayCircle,
BookOpen,
Users2,
Expand All @@ -37,8 +38,6 @@ import { FeatureItem } from '@/components/feature-item'
import { HighlightedText } from '@/components/ui/highlighted-text'
import { StatsCard } from '@/components/stats-card'
import { Section } from '@/components/ui/section'
import { LoadingSpinner } from '@/components/LoadingSpinner'



export default function HomePage() {
Expand All @@ -49,7 +48,13 @@ export default function HomePage() {
const theme = useTheme()
const shadowColor = theme.resolvedTheme === 'dark' ? 'white' : 'black'

if (loading) return <LoadingSpinner />
if (loading) {
return (
<div className='min-h-screen flex items-center justify-center'>
<Loader2 className='h-8 w-8 animate-spin' />
</div>
)
}

return (
<div className='xl:px-24 lg:px-16 md:px-8 sm:px-8 px-8'>
Expand Down
11 changes: 9 additions & 2 deletions app/quizzes/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useQuiz } from '@/hooks/quiz/useQuizzes'
import QuizComponent from '@/components/quiz/quiz-component'
import { notFound } from 'next/navigation'
import { useEffect } from 'react'
import { LoadingSpinner } from '@/components/LoadingSpinner'
import { Loader2 } from 'lucide-react'

export default function QuizPage({ params }: { params: { id: string } }) {
const { quiz, isLoading, error } = useQuiz(params.id)
Expand All @@ -16,7 +16,14 @@ export default function QuizPage({ params }: { params: { id: string } }) {
}, [error])

if (isLoading) {
return <LoadingSpinner />
return (
<main className='container mx-auto py-8 px-4'>
<div className='max-w-4xl mx-auto text-center py-12'>
<Loader2 className='h-8 w-8 animate-spin' />
<p className='mt-4'>Loading quiz...</p>
</div>
</main>
)
}

if (!quiz) {
Expand Down
14 changes: 11 additions & 3 deletions app/quizzes/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
'use client'
import QuizCard from '@/components/quiz/quiz-card'
import { useQuizzes } from '@/hooks/quiz/useQuizzes'
import { LoadingSpinner } from '@/components/LoadingSpinner'

import { Loader2 } from 'lucide-react'

export default function QuizzesPage() {
const { quizzes, isLoading, error } = useQuizzes()

if (isLoading) return <LoadingSpinner />
if (isLoading) {
return (
<main className='container py-8 px-4'>
<div className='max-w-5xl mx-auto text-center py-12'>
<Loader2 className='h-8 w-8 animate-spin' />
<p className='mt-4'>Loading quizzes...</p>
</div>
</main>
)
}

if (error) {
return (
Expand Down
1 change: 0 additions & 1 deletion components/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export function LoadingSpinner() {
return (
<div className='flex items-center justify-center min-h-screen'>
<Loader2 className='h-8 w-8 animate-spin' />
<p className='mt-4'>Loading...</p>
</div>
)
}
Loading