From 6716a736affdeb54fa00604621e35752b9503546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?=
<80620802+burakboduroglu@users.noreply.github.com>
Date: Sat, 19 Sep 2026 15:22:53 +0300
Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=93=9D=20teachers=20see=20which?=
=?UTF-8?q?=20homework=20is=20waiting=20on=20them=20-=20HomeworkQueuePanel?=
=?UTF-8?q?=20sits=20beside=20today's=20lessons=20on=20the=20teacher=20boa?=
=?UTF-8?q?rd:=20=20=20for=20the=20teacher's=20own=20homework=20due=20in?=
=?UTF-8?q?=20the=20last=2014=20days=20or=20the=20next=202=20=20=20(at=20m?=
=?UTF-8?q?ost=20six,=20closest=20first)=20it=20reads=20each=20roster=20an?=
=?UTF-8?q?d=20says=20how=20many=20=20=20students=20have=20not=20handed=20?=
=?UTF-8?q?in=20and=20how=20many=20hand-ins=20wait=20for=20a=20grade=20-?=
=?UTF-8?q?=20rows=20link=20to=20the=20homework;=20the=20header=20totals?=
=?UTF-8?q?=20what=20is=20left=20to=20grade;=20=20=20unenrolled=20leftover?=
=?UTF-8?q?s=20are=20not=20counted=20as=20owed=20-=20gated=20on=20the=20ho?=
=?UTF-8?q?mework=20module;=20a=20failed=20roster=20read=20drops=20its=20r?=
=?UTF-8?q?ow=20-=20homework-queue=20helpers=20with=20tests;=20dashboard?=
=?UTF-8?q?=20test=20for=20the=20panel;=20=20=20dashboard=20rule=20records?=
=?UTF-8?q?=20the=20capped=20roster=20reads?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.claude/skills/dashboard-design/SKILL.md | 5 ++
.../dashboard/homework-queue-panel.tsx | 80 +++++++++++++++++++
src/i18n/messages.ts | 15 ++++
src/lib/homework-queue.test.ts | 45 +++++++++++
src/lib/homework-queue.ts | 35 ++++++++
src/pages/dashboard-page.test.tsx | 15 ++++
src/pages/dashboard-page.tsx | 12 ++-
7 files changed, 204 insertions(+), 3 deletions(-)
create mode 100644 src/components/dashboard/homework-queue-panel.tsx
create mode 100644 src/lib/homework-queue.test.ts
create mode 100644 src/lib/homework-queue.ts
diff --git a/.claude/skills/dashboard-design/SKILL.md b/.claude/skills/dashboard-design/SKILL.md
index c3c8ed0..c028518 100644
--- a/.claude/skills/dashboard-design/SKILL.md
+++ b/.claude/skills/dashboard-design/SKILL.md
@@ -56,6 +56,11 @@ Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status
itself. The teacher panel reads roll-call counts only for lessons that have
started; the student panel never reads roll call. Gate it on the `sessions`
module.
+- **Teacher homework queue:** `HomeworkQueuePanel` reads the roster
+ (`/homework/{id}/submissions`) of at most `QUEUE_CAP` of the teacher's own
+ homework due in the last 14 days or next 2, and says how many have not handed
+ in and how many wait for a grade; rows link to the homework. No bulk endpoint,
+ so the cap stays; a failed read drops its row.
- **Parent homework:** `ChildHomeworkPanel` reads the selected child's
`/homework/report/{user}` (overdue / due this week) with no links — a parent
cannot open the course-scoped homework page.
diff --git a/src/components/dashboard/homework-queue-panel.tsx b/src/components/dashboard/homework-queue-panel.tsx
new file mode 100644
index 0000000..cd1da1d
--- /dev/null
+++ b/src/components/dashboard/homework-queue-panel.tsx
@@ -0,0 +1,80 @@
+import { For, Show, createMemo } from "solid-js";
+import { Link } from "@tanstack/solid-router";
+import { createResource } from "@/lib/create-resource";
+import type { Homework } from "@/api/client";
+import { getHomeworkSubmissions } from "@/api/homework";
+import { EmptyInline } from "@/components/ui/empty-inline";
+import { IconChevronRight } from "@/components/ui/icons";
+import { formatDateTime } from "@/lib/format";
+import { queueCandidates, queueRow, type QueueRow } from "@/lib/homework-queue";
+import { usePreferences, useT } from "@/stores/preferences-context";
+
+/**
+ * TCH "what is waiting on me": for the teacher's own homework due around
+ * now, how many students have not handed in and how many hand-ins still need
+ * a grade — as sentences, each linking to that homework. Counts come from
+ * each homework's roster (`/homework/{id}/submissions`), read for a capped
+ * handful since there is no bulk endpoint; a failed read drops its row.
+ */
+export function HomeworkQueuePanel(props: { homework: Homework[]; teacherId: string; now: number }) {
+ const t = useT();
+ const { locale } = usePreferences();
+ const candidates = createMemo(() => queueCandidates(props.homework, props.teacherId, props.now));
+ const [rows] = createResource(
+ () => candidates().map((item) => item.id).join(",") || null,
+ async () => {
+ const settled = await Promise.all(
+ candidates().map(async (item) => {
+ try {
+ return queueRow(item, (await getHomeworkSubmissions(item.id)).items);
+ } catch {
+ return null;
+ }
+ }),
+ );
+ return settled.filter((row): row is QueueRow => row != null && row.missing + row.toGrade > 0);
+ },
+ );
+ const toGrade = () => (rows() ?? []).reduce((sum, row) => sum + row.toGrade, 0);
+
+ return (
+
+