import { useAssignmentSubmission } from '@components/Contexts/Assignments/AssignmentSubmissionContext' import { BookPlus, BookUser, EllipsisVertical, FileUp, Forward, InfoIcon, ListTodo, Save } from 'lucide-react' import React, { useEffect } from 'react' type AssignmentBoxProps = { type: 'quiz' | 'file' view?: 'teacher' | 'student' | 'grading' | 'custom-grading' maxPoints?: number currentPoints?: number saveFC?: () => void submitFC?: () => void gradeFC?: () => void gradeCustomFC?: (grade: number) => void showSavingDisclaimer?: boolean children: React.ReactNode } function AssignmentBoxUI({ type, view, currentPoints, maxPoints, saveFC, submitFC, gradeFC, gradeCustomFC, showSavingDisclaimer, children }: AssignmentBoxProps) { const [customGrade, setCustomGrade] = React.useState(0) const submission = useAssignmentSubmission() as any useEffect(() => { } , [submission]) return (
{type === 'quiz' &&

Quiz

} {type === 'file' &&

File Submission

}
{view === 'teacher' &&

Teacher view

} {maxPoints &&

{maxPoints} points

}
{showSavingDisclaimer &&

Don't forget to save your progress

} {/* Teacher button */} {view === 'teacher' &&
saveFC && saveFC()} className='flex px-2 py-1 cursor-pointer rounded-md space-x-2 items-center bg-gradient-to-bl text-emerald-700 bg-emerald-300/20 hover:bg-emerald-300/10 hover:outline-offset-4 active:outline-offset-1 linear transition-all outline-offset-2 outline-dashed outline-emerald-500/60'>

Save

} {/* Student button */} {view === 'student' && submission && submission.length <= 0 &&
submitFC && submitFC()} className='flex px-2 py-1 cursor-pointer rounded-md space-x-2 items-center bg-gradient-to-bl text-emerald-700 bg-emerald-300/20 hover:bg-emerald-300/10 hover:outline-offset-4 active:outline-offset-1 linear transition-all outline-offset-2 outline-dashed outline-emerald-500/60'>

Save your progress

} {/* Grading button */} {view === 'grading' &&
gradeFC && gradeFC()} className='flex px-0.5 py-0.5 cursor-pointer rounded-md space-x-2 items-center bg-gradient-to-bl hover:outline-offset-4 active:outline-offset-1 linear transition-all outline-offset-2 outline-dashed outline-orange-500/60'>

Current points : {currentPoints}

Grade

} {/* CustomGrading button */} {view === 'custom-grading' && maxPoints &&
gradeCustomFC && gradeCustomFC(customGrade)} className='flex px-0.5 py-0.5 cursor-pointer rounded-md space-x-2 items-center bg-gradient-to-bl hover:outline-offset-4 active:outline-offset-1 linear transition-all outline-offset-2 outline-dashed outline-orange-500/60'>

Current points : {currentPoints}

setCustomGrade(parseInt(e.target.value))} placeholder={maxPoints.toString()} className='w-[100px] light-shadow text-sm py-0.5 outline outline-gray-200 rounded-lg px-2' type="number" />

Grade

}
{children}
) } export default AssignmentBoxUI