diff --git a/general/projects/index.mdx b/general/projects/index.mdx index 5490d838d..8f774fe5e 100644 --- a/general/projects/index.mdx +++ b/general/projects/index.mdx @@ -1,9 +1,1123 @@ ---- -title: Moodle Projects -tags: - - Project ---- +// App.jsx - Main LMS Application +import React, { useState, useEffect, createContext, useContext } from 'react'; +import { BrowserRouter as Router, Routes, Route, Navigate, Link, useLocation } from 'react-router-dom'; +import { motion, AnimatePresence } from 'framer-motion'; +import { + BookOpen, Dashboard, Video, FileText, MessageCircle, Award, + Settings, LogOut, Menu, X, ChevronRight, PlayCircle, + CheckCircle, Clock, Users, TrendingUp, Search, Bell, + MoreVertical, Download, Upload, Calendar, Star +} from 'lucide-react'; -At any time Moodle has a number of projects in progress. This set of pages will detail all projects, whether they are in the planning stage, in-progress, abandoned, or complete. +// ==================== AUTH CONTEXT ==================== +const AuthContext = createContext(null); -Please note that this is a work-in-progress as we migrate the [legacy projects](https://docs.moodle.org/dev/Category:Project) into place. +const AuthProvider = ({ children }) => { + const [user, setUser] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + // Check for existing session + const storedUser = localStorage.getItem('lms_user'); + if (storedUser) { + setUser(JSON.parse(storedUser)); + } + setLoading(false); + }, []); + + const login = (email, password) => { + // Mock authentication - Replace with API call + return new Promise((resolve, reject) => { + setTimeout(() => { + const mockUser = { + id: 'USR-001', + name: 'John Doe', + email: email, + role: 'student', // 'student' | 'instructor' | 'admin' + avatar: 'https://i.pravatar.cc/150?u=john', + enrollmentDate: '2024-01-15' + }; + setUser(mockUser); + localStorage.setItem('lms_user', JSON.stringify(mockUser)); + resolve(mockUser); + }, 800); + }); + }; + + const logout = () => { + setUser(null); + localStorage.removeItem('lms_user'); + }; + + return ( + + {children} + + ); +}; + +const useAuth = () => useContext(AuthContext); + +// ==================== MOCK DATA ==================== +const MOCK_COURSES = [ + { + id: 'SYS-THEO-501', + code: 'SYS-THEO-501', + title: 'Systematic Theology I', + description: 'Comprehensive study of core Christian doctrines including God, creation, humanity, and Christology.', + instructor: 'Dr. Emmanuel Adesanya', + instructorId: 'INS-001', + thumbnail: 'https://images.unsplash.com/photo-1507842217343-583bb7270b66?w=800', + category: 'Theology', + level: 'Graduate', + credits: 3, + duration: '14 weeks', + totalLessons: 24, + totalAssignments: 5, + enrolledStudents: 45, + rating: 4.8, + price: 0, + syllabus: [ + { week: 1, topic: 'Introduction to Systematic Theology', lessons: 2 }, + { week: 2, topic: 'Doctrine of Revelation', lessons: 3 }, + { week: 3, topic: 'Doctrine of God', lessons: 4 }, + ] + }, + { + id: 'PAST-MIN-302', + code: 'PAST-MIN-302', + title: 'Pastoral Counseling', + description: 'Practical training in biblical counseling methods, crisis intervention, and soul care.', + instructor: 'Dr. Grace Obi', + instructorId: 'INS-002', + thumbnail: 'https://images.unsplash.com/photo-1573497019940-1c28c88b4f3e?w=800', + category: 'Ministry', + level: 'Advanced Diploma', + credits: 3, + duration: '12 weeks', + totalLessons: 18, + totalAssignments: 4, + enrolledStudents: 32, + rating: 4.9, + price: 0 + }, + { + id: 'BIB-GRP-401', + code: 'BIB-GRP-401', + title: 'Biblical Greek Exegesis', + description: 'Intermediate Greek grammar and exegesis of New Testament texts.', + instructor: 'Dr. Michael Torres', + instructorId: 'INS-003', + thumbnail: 'https://images.unsplash.com/photo-1456513080510-7bf3a84b82f8?w=800', + category: 'Biblical Languages', + level: 'Graduate', + credits: 4, + duration: '16 weeks', + totalLessons: 32, + totalAssignments: 8, + enrolledStudents: 28, + rating: 4.7, + price: 0 + } +]; + +const MOCK_LESSONS = [ + { + id: 'LSN-001', + courseId: 'SYS-THEO-501', + module: 'Module 1: Introduction', + title: 'What is Systematic Theology?', + duration: '45:00', + type: 'video', + completed: true, + order: 1 + }, + { + id: 'LSN-002', + courseId: 'SYS-THEO-501', + module: 'Module 1: Introduction', + title: 'Theological Method & Sources', + duration: '52:00', + type: 'video', + completed: true, + order: 2 + }, + { + id: 'LSN-003', + courseId: 'SYS-THEO-501', + module: 'Module 2: Doctrine of God', + title: 'Attributes of God - Part 1', + duration: '48:00', + type: 'video', + completed: false, + order: 3, + current: true + }, + { + id: 'LSN-004', + courseId: 'SYS-THEO-501', + module: 'Module 2: Doctrine of God', + title: 'Attributes of God - Part 2', + duration: '50:00', + type: 'video', + completed: false, + order: 4 + }, + { + id: 'LSN-005', + courseId: 'SYS-THEO-501', + module: 'Module 2: Doctrine of God', + title: 'Reading: The Knowledge of God', + duration: '30 min read', + type: 'reading', + completed: false, + order: 5 + } +]; + +const MOCK_ASSIGNMENTS = [ + { + id: 'ASG-001', + courseId: 'SYS-THEO-501', + title: 'Essay: The Doctrine of Trinity', + description: 'Write a 1500-word essay exploring the biblical basis for the doctrine of the Trinity.', + dueDate: '2024-03-15', + maxScore: 100, + submitted: true, + score: 92, + status: 'graded' + }, + { + id: 'ASG-002', + courseId: 'SYS-THEO-501', + title: 'Quiz: Attributes of God', + description: 'Multiple choice quiz covering communicable and incommunicable attributes.', + dueDate: '2024-03-22', + maxScore: 50, + submitted: false, + score: null, + status: 'pending' + }, + { + id: 'ASG-003', + courseId: 'PAST-MIN-302', + title: 'Case Study: Crisis Counseling', + description: 'Analyze a counseling case study and provide biblical recommendations.', + dueDate: '2024-03-25', + maxScore: 100, + submitted: false, + score: null, + status: 'pending' + } +]; + +const MOCK_PROGRESS = { + 'SYS-THEO-501': { + completedLessons: 12, + totalLessons: 24, + completedAssignments: 2, + totalAssignments: 5, + overallProgress: 65, + lastAccessed: '2024-03-10T14:30:00', + timeSpent: '18h 45m', + grade: 'A-' + }, + 'PAST-MIN-302': { + completedLessons: 16, + totalLessons: 18, + completedAssignments: 3, + totalAssignments: 4, + overallProgress: 89, + lastAccessed: '2024-03-09T10:15:00', + timeSpent: '24h 20m', + grade: 'A' + }, + 'BIB-GRP-401': { + completedLessons: 13, + totalLessons: 32, + completedAssignments: 3, + totalAssignments: 8, + overallProgress: 42, + lastAccessed: '2024-03-08T16:45:00', + timeSpent: '32h 10m', + grade: 'B+' + } +}; + +// ==================== COMPONENTS ==================== + +// Login Component +const Login = () => { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [error, setError] = useState(''); + const [loading, setLoading] = useState(false); + const { login } = useAuth(); + + const handleSubmit = async (e) => { + e.preventDefault(); + setError(''); + setLoading(true); + + try { + await login(email, password); + } catch (err) { + setError('Invalid credentials'); + } finally { + setLoading(false); + } + }; + + return ( +
+ +
+
+ +
+

El Shaddai LMS

+

Sign in to your student portal

+
+ +
+
+ + setEmail(e.target.value)} + className="w-full px-4 py-3 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent" + placeholder="student@elshaddai.edu" + required + /> +
+ +
+ + setPassword(e.target.value)} + className="w-full px-4 py-3 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent" + placeholder="••••••••" + required + /> +
+ + {error && ( +
+ {error} +
+ )} + + +
+ +
+ Demo: Use any email/password to login +
+
+
+ ); +}; + +// Sidebar Navigation +const Sidebar = ({ isOpen, setIsOpen }) => { + const location = useLocation(); + const { user, logout } = useAuth(); + + const menuItems = [ + { icon: Dashboard, label: 'Dashboard', path: '/dashboard' }, + { icon: BookOpen, label: 'My Courses', path: '/courses' }, + { icon: FileText, label: 'Assignments', path: '/assignments' }, + { icon: Award, label: 'Grades', path: '/grades' }, + { icon: MessageCircle, label: 'Discussions', path: '/discussions' }, + { icon: Calendar, label: 'Schedule', path: '/schedule' }, + ]; + + if (user?.role === 'instructor' || user?.role === 'admin') { + menuItems.push( + { icon: Users, label: 'Students', path: '/students' }, + { icon: TrendingUp, label: 'Analytics', path: '/analytics' } + ); + } + + return ( + <> + {/* Mobile Overlay */} + {isOpen && ( +
setIsOpen(false)} + /> + )} + + {/* Sidebar */} + + + ); +}; + +// Dashboard Component +const Dashboard = () => { + const { user } = useAuth(); + const enrolledCourses = MOCK_COURSES.slice(0, 3); + const pendingAssignments = MOCK_ASSIGNMENTS.filter(a => a.status === 'pending'); + + const stats = [ + { label: 'Active Courses', value: '3', icon: BookOpen, color: 'text-blue-600', bg: 'bg-blue-50' }, + { label: 'Completed', value: '12', icon: CheckCircle, color: 'text-green-600', bg: 'bg-green-50' }, + { label: 'Assignments', value: pendingAssignments.length, icon: FileText, color: 'text-purple-600', bg: 'bg-purple-50' }, + { label: 'Avg. Grade', value: 'A-', icon: Award, color: 'text-orange-600', bg: 'bg-orange-50' }, + ]; + + return ( +
+ {/* Welcome Header */} +
+
+

+ Welcome back, {user?.name.split(' ')[0]}! 👋 +

+

Here's what's happening with your courses today.

+
+ +
+ + {/* Stats Grid */} +
+ {stats.map((stat, i) => ( + +
+ +
+

{stat.value}

+

{stat.label}

+
+ ))} +
+ +
+ {/* Continue Learning */} +
+
+

Continue Learning

+ + View All + +
+ +
+ {enrolledCourses.map((course, i) => { + const progress = MOCK_PROGRESS[course.id]; + return ( + +
+ {course.title} +
+
+
+

{course.title}

+

{course.instructor}

+
+ + {progress?.overallProgress || 0}% + +
+ +
+
+ {progress?.completedLessons || 0}/{course.totalLessons} lessons + {progress?.timeSpent || '0h'} spent +
+
+
+
+
+ + + Continue + +
+
+ + ); + })} +
+
+ + {/* Upcoming Assignments */} +
+

Upcoming Assignments

+
+ {pendingAssignments.length > 0 ? ( + pendingAssignments.map((assignment, i) => ( + +
+
+ +
+
+

{assignment.title}

+

+ Due {new Date(assignment.dueDate).toLocaleDateString()} +

+
+
+
+ )) + ) : ( +
+ +

No pending assignments

+
+ )} +
+
+
+
+ ); +}; + +// Courses List Component +const CoursesList = () => { + const [searchQuery, setSearchQuery] = useState(''); + const [filter, setFilter] = useState('all'); + + const filteredCourses = MOCK_COURSES.filter(course => { + const matchesSearch = course.title.toLowerCase().includes(searchQuery.toLowerCase()) || + course.instructor.toLowerCase().includes(searchQuery.toLowerCase()); + return matchesSearch; + }); + + return ( +
+
+
+

My Courses

+

Manage and access your enrolled courses

+
+
+
+ + setSearchQuery(e.target.value)} + className="pl-10 pr-4 py-2 border border-border rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent" + /> +
+
+
+ +
+ {filteredCourses.map((course, i) => { + const progress = MOCK_PROGRESS[course.id]; + return ( + +
+ {course.title} +
+ {course.level} +
+
+ +
+
+ {course.code} + + {course.credits} credits +
+ +

+ {course.title} +

+

+ {course.description} +

+ +
+
+ + {course.instructor.charAt(0)} + +
+ {course.instructor} +
+ +
+
+ Progress + {progress?.overallProgress || 0}% +
+
+
+
+
+ + + {progress?.overallProgress > 0 ? 'Continue' : 'Start'} Learning + +
+ + ); + })} +
+
+ ); +}; + +// Course Player Component +const CoursePlayer = ({ courseId }) => { + const course = MOCK_COURSES.find(c => c.id === courseId); + const lessons = MOCK_LESSONS.filter(l => l.courseId === courseId); + const [activeLesson, setActiveLesson] = useState(lessons[0]); + const [sidebarOpen, setSidebarOpen] = useState(true); + + if (!course) return
Course not found
; + + const groupedLessons = lessons.reduce((acc, lesson) => { + if (!acc[lesson.module]) acc[lesson.module] = []; + acc[lesson.module].push(lesson); + return acc; + }, {}); + + return ( +
+ {/* Main Content */} +
+ {/* Video Player */} +
+
+ +
+
+

{activeLesson?.title}

+
+ {activeLesson?.duration} + {activeLesson?.module} +
+
+
+ + {/* Lesson Info */} +
+

{activeLesson?.title}

+

+ This lesson covers fundamental concepts and principles that will help you understand the core material. +

+ +
+ + +
+
+
+ + {/* Lessons Sidebar */} +
+
+

Course Content

+ +
+ +
+ {Object.entries(groupedLessons).map(([module, moduleLessons], i) => ( +
+

+ {module} +

+
+ {moduleLessons.map((lesson) => ( + + ))} +
+
+ ))} +
+
+
+ ); +}; + +// Assignments Component +const Assignments = () => { + const [filter, setFilter] = useState('all'); + + const filteredAssignments = MOCK_ASSIGNMENTS.filter(a => { + if (filter === 'all') return true; + return a.status === filter; + }); + + return ( +
+
+
+

Assignments

+

Track and submit your coursework

+
+
+ {['all', 'pending', 'graded'].map((f) => ( + + ))} +
+
+ +
+ {filteredAssignments.map((assignment, i) => { + const course = MOCK_COURSES.find(c => c.id === assignment.courseId); + return ( + +
+
+
+ + {course?.code} + + + {assignment.status === 'graded' ? 'Graded' : 'Pending'} + +
+ +

+ {assignment.title} +

+

{assignment.description}

+ +
+
+ + Due: {new Date(assignment.dueDate).toLocaleDateString()} +
+
+ + Max Score: {assignment.maxScore} +
+ {assignment.score && ( +
+ + Score: {assignment.score}/{assignment.maxScore} +
+ )} +
+
+ +
+ {assignment.status === 'pending' && ( + <> + + + + )} + {assignment.status === 'graded' && ( + + )} +
+
+
+ ); + })} +
+
+ ); +}; + +// Grades Component +const Grades = () => { + return ( +
+
+

Grades & Transcripts

+

View your academic performance

+
+ +
+
+

Overall GPA

+

3.8

+

↑ 0.2 from last term

+
+
+

Credits Earned

+

42

+

of 120 required

+
+
+

Courses Completed

+

14

+

3 in progress

+
+
+ +
+
+

Course Grades

+
+
+ + + + + + + + + + + + {MOCK_COURSES.map((course) => { + const progress = MOCK_PROGRESS[course.id]; + return ( + + + + + + + + ); + })} + +
CourseCreditsGradePointsStatus
+

{course.title}

+

{course.code}

+
{course.credits} + + {progress?.grade || 'N/A'} + + {progress?.overallProgress || 0}% + + {progress?.overallProgress === 100 ? 'Completed' : 'In Progress'} + +
+
+
+
+ ); +}; + +// Main Layout +const MainLayout = ({ children }) => { + const [sidebarOpen, setSidebarOpen] = useState(false); + + return ( +
+ + +
+ {/* Top Header */} +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+
+ + {/* Page Content */} +
+ {children} +
+
+
+ ); +}; + +// Protected Route +const ProtectedRoute = ({ children }) => { + const { user, loading } = useAuth(); + + if (loading) { + return ( +
+
+
+ ); + } + + return user ? children : ; +}; + +// Main App Component +export default function App() { + return ( + + + + } /> + + + + + + + } /> + + + + + + + } /> + + + + + + + } /> + + + + + + + } /> + + + + + + + } /> + + + + + + + } /> + + } /> + + + + ); +}