Add 'approve without feedback' button for homework review
Curators/admins can mark a submission APPROVED (and complete the lesson) without writing feedback. The student sees 'ДЗ принято ✓' and can no longer resubmit. No email is sent on silent approval. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ interface Submission {
|
||||
files: HWFile[];
|
||||
audioUrl?: string | null;
|
||||
submittedAt: Date;
|
||||
status: string;
|
||||
feedbacks: Feedback[];
|
||||
}
|
||||
|
||||
@@ -47,6 +48,9 @@ export function HomeworkSection({ homework, submission, slug, lessonId, allowAud
|
||||
const [editing, setEditing] = useState(!submission);
|
||||
|
||||
const isReviewed = submission && submission.feedbacks.length > 0;
|
||||
const isApproved = submission?.status === "APPROVED";
|
||||
// Финализировано: есть фидбек ИЛИ ДЗ принято кнопкой без ответа. Нельзя пересдавать.
|
||||
const isLocked = Boolean(isReviewed || isApproved);
|
||||
|
||||
const inputStyle = {
|
||||
border: "2px solid var(--border)",
|
||||
@@ -138,8 +142,45 @@ export function HomeworkSection({ homework, submission, slug, lessonId, allowAud
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Принято без письменного ответа */}
|
||||
{isApproved && !isReviewed && submission && (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-xs px-2 py-0.5 font-bold uppercase tracking-widest" style={{ border: "2px solid var(--foreground)", background: "var(--accent)" }}>
|
||||
ДЗ принято ✓
|
||||
</span>
|
||||
<span className="text-xs" style={{ color: "var(--muted-foreground)" }}>
|
||||
Сдано {new Date(submission.submittedAt).toLocaleDateString("ru-RU")}
|
||||
</span>
|
||||
</div>
|
||||
{submission.text && (
|
||||
<div className="px-4 py-3 text-sm whitespace-pre-wrap opacity-70" style={{ border: "2px solid var(--border)" }}>
|
||||
{submission.text}
|
||||
</div>
|
||||
)}
|
||||
{submission.audioUrl && (
|
||||
<div className="px-4 py-2" style={{ border: "1px solid var(--border)" }}>
|
||||
<p className="text-xs mb-1" style={{ color: "var(--muted-foreground)" }}>Аудио-ответ:</p>
|
||||
<audio controls src={submission.audioUrl} style={{ height: 32, width: "100%" }} />
|
||||
</div>
|
||||
)}
|
||||
{submission.files.length > 0 && (
|
||||
<div className="space-y-1">
|
||||
{submission.files.map((f) => (
|
||||
<a key={f.url} href={f.url} target="_blank" rel="noopener noreferrer"
|
||||
className="flex items-center gap-2 px-3 py-2 text-xs" style={{ border: "2px solid var(--border)" }}>
|
||||
<span>📎</span>
|
||||
<span className="flex-1 underline">{f.name}</span>
|
||||
<span style={{ color: "var(--muted-foreground)" }}>{formatSize(f.size)}</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Submitted, pending review */}
|
||||
{submission && !isReviewed && !editing && (
|
||||
{submission && !isLocked && !editing && (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -182,7 +223,7 @@ export function HomeworkSection({ homework, submission, slug, lessonId, allowAud
|
||||
)}
|
||||
|
||||
{/* Form */}
|
||||
{editing && !isReviewed && (
|
||||
{editing && !isLocked && (
|
||||
<div className="space-y-3">
|
||||
<textarea
|
||||
value={text}
|
||||
|
||||
Reference in New Issue
Block a user