forge
Explore
Log in

Don't you dare go Hollow

✨ student numbers, Mistral-shaped study and studio, evidence redesign

Browse files at this commit

dcf123a8823bd55f0a656ce94de6b865f41dc08aBurak BoduroğluParent: 7d6f928
  • feat
    • ✨ student numbers, Mistral-shaped study and studio, evidence redesign
Show full message
feat: ✨ student numbers, Mistral-shaped study and studio, evidence redesign
- student_number lands on PersonRef, User, CreateUser, ProfileUpdate and
  limits.user.max_student_number_len, matching the live contract
- the field is settable where it belongs: the admin create-user panel offers
  it only for a student role, and the profile form only on the admin surface
  (it is the office's field, not the account holder's); blank clears it
- Öğrenci Takibi tables share one column set — Öğrenci No, Adı, Sınıfı —
  extracted to student-directory-columns; search matches the number too
- tracking nav reads Yoklamalar / Sınav Notları / Pomodorolar, and the
  attendance entry uses its own key so a student's own /attendance stays
  "Yoklama"
- podcast history marks each episode with the narration the service settled
  on; an unsettled job stays unmarked and an unknown format prints verbatim
- podcast progress surfaces stage and the receipt's eta_secs, both already
  on the wire and discarded; polling moves to createLivePoll so a hidden tab
  stops asking and tab-back is fresh; the player opens in the clicked row
- /ai/study follows Le Chat: no card frame and no header strip, landing
  screen centres the mark and composer, wider composer, copy and "ask again"
  on a settled answer, rotating thinking phases, pin/unread scroll pill, and
  recency grouping in the thread list
- no thread search box and no stop button: /rag/threads takes no query
  parameter and RAG messages have no cancel route, so either would lie
- /ai/studio follows Mistral Studio: plain title and subtitle instead of the
  banner, flat hairline producer cards, and the output library as a dense
  divided list whose active row carries an accent edge; the library is the
  landing view and steps aside once a note is open
- the insights "what supports this" disclosure loses its gradient card and
  nested box; a new ChartComparatorBar reads a value against its cohort
  baseline with both numbers printed, and the service's own sentence now
  leads the numbers it explains
- drop three keys that no longer have a caller
--full-pageadded+0 -0

Binary file changed

src/api/__tests__/users/users.test.tsmodified+24 -0
@@ -228,4 +228,28 @@ describe("users API", () => {
228228 expect(init?.method).toBe("POST");
229229 expect(JSON.parse(init?.body as string)).toEqual(body);
230230 });
231+
232+ it("postUser carries the school-issued student number", async () => {
233+ mockFetchSuccess({ id: "u9", username: "ayse", role: "student", student_number: "1234" });
234+
235+ const body = { username: "ayse", password: "secret123", role: "student" as const, student_number: "1234" };
236+ await postUser(body);
237+
238+ const [url, init] = lastFetchCall();
239+ expect(url).toBe("/api/users");
240+ expect(init?.method).toBe("POST");
241+ expect(JSON.parse(init?.body as string)).toEqual(body);
242+ });
243+
244+ it("patchUserProfile sends an empty student number to clear it", async () => {
245+ mockFetchSuccess({ id: "u1", student_number: null });
246+
247+ const updates = { student_number: "" };
248+ await patchUserProfile("u1", updates);
249+
250+ const [url, init] = lastFetchCall();
251+ expect(url).toBe("/api/users/u1/profile");
252+ expect(init?.method).toBe("PATCH");
253+ expect(JSON.parse(init?.body as string)).toEqual(updates);
254+ });
231255 });
src/api/client/types.tsmodified+19 -0
@@ -26,6 +26,9 @@ export type User = {
2626 theme: UserTheme | null;
2727 language: UserLanguage | null;
2828 palette_color: string | null;
29+ // The school-issued student number, unique inside the school. Only ever a
30+ // value on a `student` row — a role change away from `student` clears it.
31+ student_number?: string | null;
2932 };
3033
3134 // PATCH /users/me and PATCH /users/{id}/profile take the same body: an omitted
@@ -40,6 +43,11 @@ export type ProfileUpdate = {
4043 bio?: string | null;
4144 // The teacher's branş, by name from settings.branches.
4245 branch?: string | null;
46+ // The school-issued student number, unique inside the school and only ever
47+ // held by a `student` account. Omit to keep it; send "" (or whitespace) to
48+ // clear it. Naming one for another role, or one another student holds, is
49+ // refused.
50+ student_number?: string | null;
4351 };
4452
4553 // POST /users (admin): the school office opens an account directly. `role`
@@ -49,12 +57,20 @@ export type CreateUserInput = {
4957 username: string;
5058 password: string;
5159 role?: Role;
60+ // Only a `student` account may hold one: naming it for any other role is a
61+ // 400, and a number another student already holds is a 409. Omit (or leave
62+ // blank) to open the account unnumbered.
63+ student_number?: string | null;
5264 };
5365
5466 export type PersonRef = {
5567 id: string;
5668 username: string;
5769 display_name: string | null;
70+ // The school-issued student number; `null` for every account that holds none,
71+ // every staff account included. It rides this ref the way a username does, so
72+ // a roster that names a student can name their number without a second read.
73+ student_number?: string | null;
5874 };
5975
6076 // The lifetime counter a badge reads. Badges sharing a stat form a ladder.
@@ -824,6 +840,9 @@ export type Limits = {
824840 max_name_len: number;
825841 max_display_name_len: number;
826842 max_bio_len: number;
843+ // A student number's length bound; the value is free text, unique inside the
844+ // school and only ever held by a `student` account.
845+ max_student_number_len: number;
827846 // Caps on what a profile read embeds, not on membership: the full lists
828847 // stay at /courses/me and /classes/me.
829848 max_profile_courses: number;
src/components/ai/note-studio-panel.tsxmodified+38 -35
@@ -9,7 +9,6 @@ import { RagOutputsPanel } from "@/components/notes/rag-outputs-panel";
99 import { StudioOutputLibrary } from "@/components/ai/studio-output-library";
1010 import { EmptyState } from "@/components/ui/empty-state";
1111 import { ErrorAlert } from "@/components/ui/error-alert";
12-import { IconSparkles } from "@/components/ui/icons";
1312 import { Label } from "@/components/ui/label";
1413 import { PageSpinner } from "@/components/ui/page-spinner";
1514 import { SearchableSelect } from "@/components/ui/searchable-select";
@@ -70,42 +69,42 @@ export function NoteStudioPanel() {
7069 when={(notes()?.length ?? 0) > 0}
7170 fallback={<EmptyState kind="notes" title={t("podcast.noNotes")} description={t("podcast.noNotesHint")} />}
7271 >
73- <div class="w-full space-y-5">
74- <section class="overflow-hidden rounded-2xl border border-border-line bg-surface-base shadow-xs">
75- <div class="flex items-start gap-3 border-b border-border-line bg-primary/[0.035] px-4 py-4 sm:px-5">
76- <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary-text">
77- <IconSparkles class="h-5 w-5" />
78- </div>
79- <div class="min-w-0">
80- <p class="text-xs font-medium uppercase tracking-[0.12em] text-primary-text">{t("aiHub.tab.studio")}</p>
81- <h1 class="mt-1 text-lg font-semibold tracking-tight text-text-strong">{t("aiHub.tab.studio")}</h1>
82- <p class="mt-1 max-w-2xl text-sm text-muted-foreground">{t("aiHub.description")}</p>
72+ {/* Laid out the way a studio home reads: a plain title and one line
73+ saying what it makes, the source picker, the producers, then
74+ everything produced so far. Flat hairline cards, no banner and no
75+ shadow stack — the work is the content, not the chrome. */}
76+ <div class="w-full space-y-8">
77+ <header class="space-y-1.5">
78+ <h1 class="text-2xl font-semibold tracking-tight text-text-strong">{t("aiHub.tab.studio")}</h1>
79+ <p class="text-sm text-muted-foreground">{t("aiStudio.heading")}</p>
80+ </header>
81+
82+ <div class="max-w-xl space-y-2">
83+ <Label for="sound-studio-note">{t("podcast.source")}</Label>
84+ <SearchableSelect
85+ id="sound-studio-note"
86+ class="w-full"
87+ value={selectedId()}
88+ onChange={setSelectedId}
89+ options={options()}
90+ placeholder={t("podcast.selectNote")}
91+ />
92+ </div>
93+
94+ <Show
95+ when={selected()}
96+ fallback={
97+ <div class="rounded-xl border border-dashed border-border-line px-6 py-12 text-center">
98+ <p class="text-sm font-medium text-text-strong">{t("aiStudio.pickPrompt")}</p>
99+ <p class="mx-auto mt-1 max-w-md text-sm text-muted-foreground">{t("aiStudio.pickPromptHint")}</p>
83100 </div>
84- </div>
85- <div class="space-y-2 px-4 py-4 sm:px-5">
86- <Label for="sound-studio-note">{t("podcast.source")}</Label>
87- <SearchableSelect
88- id="sound-studio-note"
89- class="w-full"
90- value={selectedId()}
91- onChange={setSelectedId}
92- options={options()}
93- placeholder={t("podcast.selectNote")}
94- />
95- </div>
96- </section>
97- <Show when={selected()}>
101+ }
102+ >
98103 {(note) => (
99- <section ref={outputsSection} class="scroll-mt-20 space-y-3 rounded-2xl border border-border-line bg-surface-base p-3 shadow-xs sm:p-4">
100- <div class="flex flex-wrap items-center justify-between gap-2 px-1">
101- <div class="min-w-0">
102- <p class="text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground">{t("aiStudio.outputs.title")}</p>
103- <h2 class="mt-1 truncate text-base font-semibold text-text-strong">{note().title}</h2>
104- <p class="mt-1 text-xs text-muted-foreground">{t("aiStudio.outputs.description")}</p>
105- </div>
106- <span class="rounded-full border border-border-line bg-background px-2.5 py-1 text-xs text-muted-foreground">
107- {note().courseTitle}
108- </span>
104+ <section ref={outputsSection} class="scroll-mt-20 space-y-4">
105+ <div class="flex flex-wrap items-baseline justify-between gap-2">
106+ <h2 class="min-w-0 truncate text-base font-semibold text-text-strong">{note().title}</h2>
107+ <span class="shrink-0 text-xs text-muted-foreground">{note().courseTitle}</span>
109108 </div>
110109 <div class="grid gap-4 xl:grid-cols-2">
111110 <RagOutputsPanel
@@ -120,6 +119,10 @@ export function NoteStudioPanel() {
120119 </section>
121120 )}
122121 </Show>
122+
123+ {/* The library is the landing view. Once a note is open the page is
124+ about producing for that note, so the list of everything else
125+ steps out of the way. */}
123126 <Show when={!selected()}>
124127 <StudioOutputLibrary
125128 notes={(notes() ?? []).map((note) => ({ id: note.id, title: note.title, courseTitle: note.courseTitle }))}
src/components/ai/studio-output-library.tsxmodified+31 -31
@@ -4,10 +4,11 @@ import { getCourseNoteRag } from "@/api/course-notes";
44 import { listPodcastJobs } from "@/api/podcast";
55 import { Badge } from "@/components/ui/badge";
66 import { EmptyInline } from "@/components/ui/empty-inline";
7-import { IconChevronRight, IconNote, IconSparkles, IconWaveform } from "@/components/ui/icons";
7+import { IconNote, IconSparkles, IconWaveform } from "@/components/ui/icons";
88 import { PageSpinner } from "@/components/ui/page-spinner";
99 import { cn } from "@/lib/cn";
10-import { useT } from "@/stores/preferences-context";
10+import { formatDate } from "@/lib/format";
11+import { usePreferences, useT } from "@/stores/preferences-context";
1112
1213 export type StudioLibraryNote = {
1314 id: string;
@@ -29,6 +30,7 @@ export function StudioOutputLibrary(props: {
2930 onSelect: (noteId: string) => void;
3031 }) {
3132 const t = useT();
33+ const { locale } = usePreferences();
3234 const source = createMemo(() => props.notes.map((note) => note.id).join(","));
3335 const [items] = createResource(source, async (): Promise<StudioLibraryItem[]> => {
3436 const [podcastResult, ...summaryResults] = await Promise.allSettled([
@@ -66,17 +68,15 @@ export function StudioOutputLibrary(props: {
6668
6769 return (
6870 <section class="overflow-hidden rounded-xl border border-border-line bg-surface-base">
69- <header class="flex flex-wrap items-start justify-between gap-3 border-b border-border-hairline px-4 py-4 sm:px-5">
70- <div class="flex min-w-0 items-start gap-3">
71- <div class="min-w-0">
72- <h2 class="text-sm font-semibold text-text-strong">{t("aiStudio.library.title")}</h2>
73- <p class="mt-0.5 text-xs text-muted-foreground">{t("aiStudio.library.description")}</p>
74- </div>
71+ <header class="flex flex-wrap items-baseline justify-between gap-3 border-b border-border-hairline px-4 py-3">
72+ <div class="min-w-0">
73+ <h2 class="text-sm font-semibold text-text-strong">{t("aiStudio.library.title")}</h2>
74+ <p class="mt-0.5 text-xs text-muted-foreground">{t("aiStudio.library.description")}</p>
7575 </div>
7676 <Show when={(items()?.length ?? 0) > 0}>
77- <Badge variant="secondary" class="rounded-md">
77+ <span class="shrink-0 text-xs tabular-nums text-muted-foreground">
7878 {t("aiStudio.library.count", { count: items()?.length ?? 0 })}
79- </Badge>
79+ </span>
8080 </Show>
8181 </header>
8282
@@ -89,7 +89,10 @@ export function StudioOutputLibrary(props: {
8989 </div>
9090 }
9191 >
92- <ul class="grid gap-3 p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-3">
92+ {/* Studio's own working screens are flat, dense lists rather than
93+ card grids: hairline dividers, one row per thing, and the active
94+ row marked by an accent edge instead of a box of its own. */}
95+ <ul class="divide-y divide-border-hairline">
9396 <For each={items()}>
9497 {(item) => (
9598 <li>
@@ -97,24 +100,23 @@ export function StudioOutputLibrary(props: {
97100 type="button"
98101 aria-current={props.selectedId === item.id ? "true" : undefined}
99102 class={cn(
100- "group flex h-full w-full flex-col rounded-xl border bg-background p-4 text-left outline-hidden transition-colors hover:border-primary/35 hover:bg-surface-tint focus-visible:ring-2 focus-visible:ring-ring",
101- props.selectedId === item.id ? "border-primary/40 bg-primary/[0.035]" : "border-border-hairline",
103+ "flex w-full items-center gap-3 border-l-2 px-4 py-2.5 text-left outline-hidden transition-colors hover:bg-surface-tint focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
104+ props.selectedId === item.id
105+ ? "border-l-primary bg-primary/[0.04]"
106+ : "border-l-transparent",
102107 )}
103108 onClick={() => props.onSelect(item.id)}
104109 >
105- <div class="flex w-full items-start gap-3">
106- <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text">
107- <Show when={item.podcastCount > 0} fallback={<IconNote class="h-4 w-4" />}>
108- <IconWaveform class="h-4 w-4" />
109- </Show>
110- </span>
111- <div class="min-w-0 flex-1">
112- <p class="truncate text-sm font-semibold text-text-strong">{item.title}</p>
113- <p class="mt-0.5 truncate text-xs text-muted-foreground">{item.courseTitle}</p>
114- </div>
115- </div>
116-
117- <div class="mt-4 flex flex-wrap gap-1.5">
110+ <span class="shrink-0 text-muted-foreground">
111+ <Show when={item.podcastCount > 0} fallback={<IconNote class="h-4 w-4" />}>
112+ <IconWaveform class="h-4 w-4" />
113+ </Show>
114+ </span>
115+ <span class="min-w-0 flex-1">
116+ <span class="block truncate text-sm font-medium text-text-strong">{item.title}</span>
117+ <span class="mt-0.5 block truncate text-xs text-muted-foreground">{item.courseTitle}</span>
118+ </span>
119+ <span class="hidden shrink-0 items-center gap-1.5 sm:flex">
118120 <Show when={item.hasSummary}>
119121 <Badge variant="outline" class="gap-1 rounded-md font-normal">
120122 <IconSparkles class="h-3 w-3" />
@@ -127,11 +129,9 @@ export function StudioOutputLibrary(props: {
127129 {t("aiStudio.library.podcastCount", { count: item.podcastCount })}
128130 </Badge>
129131 </Show>
130- </div>
131-
132- <span class="mt-4 inline-flex items-center gap-1 text-xs font-medium text-primary-text">
133- {t("aiStudio.library.open")}
134- <IconChevronRight class="h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5" />
132+ </span>
133+ <span class="shrink-0 text-xs tabular-nums text-muted-foreground">
134+ {formatDate(item.latestAt, locale())}
135135 </span>
136136 </button>
137137 </li>
src/components/insights/insight-module-views.tsxmodified+33 -18
@@ -1,5 +1,6 @@
11 import { For, Show, createSignal, type JSX } from "solid-js";
22 import { Badge } from "@/components/ui/badge";
3+import { ChartComparatorBar } from "@/components/ui/chart-comparator-bar";
34 import { detailText, dimensionLabel, type InsightDetailKey } from "@/i18n/insights-detail";
45 import type { Locale } from "@/i18n/messages";
56 import { cn } from "@/lib/cn";
@@ -168,11 +169,24 @@ function AttendanceView(props: { value: Rec; courseTitle: CourseTitle }) {
168169 <p class="text-xs font-semibold text-text-strong">
169170 {courseLabel(id, props.courseTitle, index())}
170171 </p>
172+ {/* The rate, its cohort baseline and the gap between them are
173+ one claim, so they read as one device instead of three rows
174+ the reader has to hold in their head at once. */}
175+ <Show
176+ when={num(stat().rate) !== null}
177+ fallback={<NoteLine>{detailText("attendance.rateSuppressed")}</NoteLine>}
178+ >
179+ <ChartComparatorBar
180+ label={detailText("attendance.rate")}
181+ fraction={num(stat().rate)!}
182+ valueText={pct(stat().rate)!}
183+ comparatorFraction={num(stat().cohort_median)}
184+ comparatorLabel={detailText("attendance.cohortMedian")}
185+ comparatorText={pct(stat().cohort_median)}
186+ gapText={ratePoints(stat().relative_gap)}
187+ />
188+ </Show>
171189 <dl class="space-y-1">
172- <LabeledRow label={detailText("attendance.rate")} value={pct(stat().rate)} mono />
173- <Show when={num(stat().rate) === null}>
174- <NoteLine>{detailText("attendance.rateSuppressed")}</NoteLine>
175- </Show>
176190 <LabeledRow
177191 label={detailText("attendance.present")}
178192 value={String(num(stat().present) ?? 0)}
@@ -189,21 +203,11 @@ function AttendanceView(props: { value: Rec; courseTitle: CourseTitle }) {
189203 mono
190204 />
191205 <LabeledRow label={detailText("attendance.excused")} value={String(num(stat().excused) ?? 0)} mono />
192- <LabeledRow
193- label={detailText("attendance.cohortMedian")}
194- value={pct(stat().cohort_median)}
195- mono
196- />
197206 <LabeledRow
198207 label={detailText("attendance.cohortN")}
199208 value={String(num(stat().cohort_n) ?? 0)}
200209 mono
201210 />
202- <LabeledRow
203- label={detailText("attendance.relativeGap")}
204- value={ratePoints(stat().relative_gap)}
205- mono
206- />
207211 </dl>
208212 </div>
209213 );
@@ -296,13 +300,24 @@ function MarksCourseDetail(props: { id: string; statRaw: unknown; courseTitle: C
296300 </div>
297301 </Show>
298302 <Show when={placed()}>
299- <LabeledRow label={detailText("marks.classAverage")} value={nText(placement().class_average)} mono />
300- <LabeledRow label={detailText("marks.classSd")} value={nText(placement().class_sd)} mono />
301- <LabeledRow label={detailText("marks.cohortN")} value={String(num(placement().cohort_n) ?? 0)} mono />
302- <LabeledRow label={detailText("marks.z")} value={zText(placement().z)} mono />
303+ {/* The service's own sentence is the claim; the numbers below are what
304+ backs it, so the sentence leads rather than trailing the dump. */}
303305 <Show when={str(placement().reason)}>
304306 {(reason) => <NoteLine>{reason()}</NoteLine>}
305307 </Show>
308+ <Show when={num(stat().average) !== null}>
309+ <ChartComparatorBar
310+ label={detailText("marks.average")}
311+ fraction={num(stat().average)! / 100}
312+ valueText={nText(stat().average)!}
313+ comparatorFraction={num(placement().class_average) == null ? null : num(placement().class_average)! / 100}
314+ comparatorLabel={detailText("marks.classAverage")}
315+ comparatorText={nText(placement().class_average)}
316+ />
317+ </Show>
318+ <LabeledRow label={detailText("marks.classSd")} value={nText(placement().class_sd)} mono />
319+ <LabeledRow label={detailText("marks.cohortN")} value={String(num(placement().cohort_n) ?? 0)} mono />
320+ <LabeledRow label={detailText("marks.z")} value={zText(placement().z)} mono />
306321 </Show>
307322 </dl>
308323
src/components/insights/insight-student-analysis-tabs.tsxmodified+13 -19
@@ -5,7 +5,7 @@ import { InsightModuleView } from "@/components/insights/insight-module-views";
55 import { ChartBar, type ChartBarItem } from "@/components/ui/chart-bar";
66 import { ChartProgressRing, type ProgressRingSegment } from "@/components/ui/chart-progress-ring";
77 import { EmptyInline } from "@/components/ui/empty-inline";
8-import { IconAlert, IconChart, IconChevronDown } from "@/components/ui/icons";
8+import { IconAlert, IconChevronDown } from "@/components/ui/icons";
99 import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
1010 import { isRecord, type UnknownRecord } from "@/lib/is-record";
1111 import { usePreferences } from "@/stores/preferences-context";
@@ -153,26 +153,20 @@ function ModuleTab(props: {
153153 <Show when={props.value != null} fallback={<EmptyInline title={props.t("insights.sectionNotComputed")} illustration="charts" />}>
154154 <div class="space-y-3">
155155 {chart()}
156- <details class="group overflow-hidden rounded-xl border border-primary/20 bg-gradient-to-br from-primary/10 via-surface-base to-info/5 shadow-xs">
157- <summary class="flex cursor-pointer list-none items-center justify-between gap-4 p-4 sm:p-5 [&::-webkit-details-marker]:hidden">
158- <span class="flex min-w-0 items-center gap-3">
159- <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-primary/20 bg-primary/10 text-primary-text shadow-xs">
160- <IconChart class="h-5 w-5" />
161- </span>
162- <span class="min-w-0">
163- <span class="block text-sm font-semibold text-text-strong">{props.t("insights.analysis.details")}</span>
164- <span class="mt-0.5 block text-xs leading-5 text-muted-foreground">{props.t("insights.analysis.detailsHint")}</span>
165- </span>
166- </span>
167- <span class="flex shrink-0 items-center gap-2 rounded-lg border border-border-line bg-surface-base px-3 py-2 text-xs font-medium text-text-strong shadow-xs transition-colors group-hover:border-primary/30 group-hover:text-primary-text">
168- <span class="hidden sm:inline">{props.t("insights.analysis.detailsAction")}</span>
169- <IconChevronDown class="h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180" />
156+ {/* The evidence behind the chart above. A native disclosure — keyboard
157+ operable and state-exposing for free — kept deliberately quiet: the
158+ numbers inside are the subject, so the frame does not compete with
159+ them. The chevron leads, which is where a reader looks for one. */}
160+ <details class="group rounded-xl border border-border-line bg-surface-base">
161+ <summary class="flex cursor-pointer list-none items-center gap-3 rounded-xl px-4 py-3 transition-colors hover:bg-surface-overlay/50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden">
162+ <IconChevronDown class="h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180" />
163+ <span class="min-w-0 flex-1">
164+ <span class="block text-sm font-medium text-text-strong">{props.t("insights.analysis.details")}</span>
165+ <span class="mt-0.5 block text-xs leading-5 text-muted-foreground">{props.t("insights.analysis.detailsHint")}</span>
170166 </span>
171167 </summary>
172- <div class="border-t border-primary/15 bg-surface-base/90 p-4 sm:p-5">
173- <div class="rounded-xl border border-border-hairline bg-surface-overlay/40 p-3 sm:p-4">
174- <InsightModuleView module={props.module} value={props.value} courseTitle={props.courseTitle} />
175- </div>
168+ <div class="border-t border-border-hairline px-4 py-4">
169+ <InsightModuleView module={props.module} value={props.value} courseTitle={props.courseTitle} />
176170 </div>
177171 </details>
178172 </div>
src/components/layout/nav-items.tsmodified+2 -2
@@ -182,7 +182,7 @@ const ADMIN_GROUPS: NavGroup[] = [
182182 labelKey: "nav.group.tracking",
183183 Icon: IconClipboardCheck,
184184 items: [
185- { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, minRole: "teacher", module: "attendance" },
185+ { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconClipboardCheck, minRole: "teacher", module: "attendance" },
186186 { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher", module: "marks" },
187187 { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconTimer, minRole: "teacher", module: "pomodoro" },
188188 ],
@@ -235,7 +235,7 @@ const TEACHER_GROUPS: NavGroup[] = [
235235 labelKey: "nav.group.tracking",
236236 Icon: IconClipboardCheck,
237237 items: [
238- { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, module: "attendance" },
238+ { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconClipboardCheck, module: "attendance" },
239239 { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, module: "marks" },
240240 { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconTimer, module: "pomodoro" },
241241 { id: "student-analysis", to: "/ai/insights", labelKey: "nav.studentAnalysis", Icon: IconChart },
src/components/notes/podcast-history.test.tsxmodified+25 -0
@@ -181,4 +181,29 @@ describe("PodcastHistory", () => {
181181 expect(podcastApi.listPodcastJobs).toHaveBeenLastCalledWith({ limit: 10, offset: 10, sourceId: "note-1" });
182182 expect(screen.getByText("2 / 2")).toBeTruthy();
183183 });
184+
185+ it("marks each episode with the narration the service settled on", async () => {
186+ podcastApi.listPodcastJobs.mockResolvedValue(
187+ page([
188+ job({ job_id: "job-1", source_title: "Düz", format: "duz_okuma" }),
189+ job({ job_id: "job-2", source_title: "İkili", format: "ogrenci_hoca" }),
190+ ]),
191+ );
192+
193+ renderHistory("note-1");
194+
195+ await waitFor(() => expect(screen.getByText("Düz okuma")).toBeTruthy());
196+ expect(screen.getByText("Öğrenci ve öğretmen")).toBeTruthy();
197+ });
198+
199+ it("leaves a job the service has not settled a format for unmarked", async () => {
200+ podcastApi.listPodcastJobs.mockResolvedValue(
201+ page([job({ state: "queued", format: null, duration_secs: null, finished_at: null })]),
202+ );
203+
204+ renderHistory("note-1");
205+
206+ await waitFor(() => expect(screen.getByText("Hücre")).toBeTruthy());
207+ expect(screen.queryByText("Düz okuma")).toBeNull();
208+ });
184209 });
src/components/notes/podcast-history.tsxmodified+29 -6
@@ -1,6 +1,7 @@
11 import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
22 import { createResource } from "@/lib/create-resource";
33 import { formatApiError } from "@/api/client";
4+import type { MessageKey } from "@/i18n/messages";
45 import { listPodcastJobs, podcastAudioUrl } from "@/api/podcast";
56 import { Alert } from "@/components/ui/alert";
67 import { Badge } from "@/components/ui/badge";
@@ -16,6 +17,15 @@ import { usePreferences, useT } from "@/stores/preferences-context";
1617
1718 const HISTORY_PAGE_SIZE = 10;
1819
20+// The three narrations the service produces. It settles the format on its first
21+// report, so a live job often carries none yet, and a format this build has no
22+// label for is shown verbatim rather than dropped.
23+const FORMAT_KEYS: Record<string, MessageKey> = {
24+ duz_okuma: "podcast.format.duz_okuma",
25+ tek_ogretici: "podcast.format.tek_ogretici",
26+ ogrenci_hoca: "podcast.format.ogrenci_hoca",
27+};
28+
1929 /**
2030 * The caller's own episodes, under the Ses Atölyesi panel. One-directional:
2131 * the studio produces, this only reads. A finished episode plays through the
@@ -66,6 +76,11 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
6676 if (state === "cancelled") return "secondary" as const;
6777 return "warning" as const;
6878 };
79+ const formatLabel = (format: string | null) => {
80+ if (!format) return "";
81+ const key = FORMAT_KEYS[format];
82+ return key ? t(key) : format;
83+ };
6984 const stateLabel = (state: string) => {
7085 if (state === "done") return t("podcast.history.state.done");
7186 if (state === "failed") return t("podcast.history.state.failed");
@@ -101,11 +116,15 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
101116 <ul class="space-y-2">
102117 <For each={jobs()}>
103118 {(row) => (
104- <li class="flex items-center gap-3 rounded-lg border border-border/60 p-3">
119+ <li class="rounded-lg border border-border/60 p-3">
120+ <div class="flex items-center gap-3">
105121 <div class="min-w-0 flex-1">
106122 <p class="truncate text-sm font-medium">{row.source_title ?? row.source_id}</p>
107123 <div class="mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
108124 <Badge variant={stateVariant(row.state)}>{stateLabel(row.state)}</Badge>
125+ <Show when={formatLabel(row.format)}>
126+ {(label) => <Badge variant="outline">{label()}</Badge>}
127+ </Show>
109128 <Show when={row.state === "failed" && row.error_code}>
110129 <span class="mono">{row.error_code}</span>
111130 </Show>
@@ -141,6 +160,15 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
141160 </a>
142161 </div>
143162 </Show>
163+ </div>
164+ {/* The player opens in the row the reader clicked. A single
165+ one under the whole list put it a screen away from the
166+ episode it belonged to. */}
167+ <Show when={playing() === row.job_id}>
168+ <audio class="mt-3 w-full" controls autoplay preload="metadata" src={podcastAudioUrl(row.job_id)}>
169+ {t("podcast.audioUnsupported")}
170+ </audio>
171+ </Show>
144172 </li>
145173 )}
146174 </For>
@@ -152,11 +180,6 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
152180 </Suspense>
153181 </Show>
154182
155- <Show when={playing()}>
156- <audio class="w-full" controls autoplay preload="metadata" src={podcastAudioUrl(playing())}>
157- {t("podcast.audioUnsupported")}
158- </audio>
159- </Show>
160183 </div>
161184 );
162185 }
src/components/notes/podcast-panel.tsxmodified+34 -13
@@ -17,6 +17,7 @@ import { Select } from "@/components/ui/select";
1717 import { PodcastHistory } from "@/components/notes/podcast-history";
1818 import { podcastDownloadFilename, usePodcastDownloadT } from "@/components/notes/podcast-download";
1919 import { cn } from "@/lib/cn";
20+import { createLivePoll } from "@/lib/create-live-poll";
2021 import { useT } from "@/stores/preferences-context";
2122
2223 const POLL_MS = 2_000;
@@ -31,7 +32,10 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
3132 const [error, setError] = createSignal("");
3233 const [submitting, setSubmitting] = createSignal(false);
3334 const [cancelling, setCancelling] = createSignal(false);
34- let timer: ReturnType<typeof setTimeout> | undefined;
35+ // The service's own estimate, taken from the submit receipt. It is never
36+ // restated by the status door, so it is shown as the one estimate it is and
37+ // never recomputed into a countdown the backend did not promise.
38+ const [etaSecs, setEtaSecs] = createSignal<number | null>(null);
3539 let generation = 0;
3640
3741 // Declared before the resource below: its source runs during setup, so a
@@ -39,9 +43,10 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
3943 const active = () => props.active !== false;
4044 const [capabilities] = createResource(() => (active() ? getAiCapabilities() : null));
4145 const storageKey = () => `hezarfen.podcast.${props.noteId}`;
46+ // A cancelled or finished job is simply not polled again; the ticker below
47+ // asks whether there is live work rather than being torn down.
4248 const stopPolling = () => {
43- if (timer) clearTimeout(timer);
44- timer = undefined;
49+ generation += 1;
4550 };
4651
4752 const poll = async (id: string, token: number) => {
@@ -56,10 +61,7 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
5661 }
5762 if (next.state === "failed") {
5863 setError(t("podcast.failed"));
59- return;
6064 }
61- if (next.state === "cancelled") return;
62- timer = setTimeout(() => void poll(id, token), POLL_MS);
6365 } catch (err) {
6466 if (token === generation) setError(formatApiError(err));
6567 }
@@ -70,10 +72,10 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
7072 const enabled = active();
7173 generation += 1;
7274 const token = generation;
73- stopPolling();
7475 setJobId("");
7576 setStatus(null);
7677 setArtifacts(null);
78+ setEtaSecs(null);
7779 setError("");
7880 if (!enabled || !noteId || typeof sessionStorage === "undefined") return;
7981 const stored = sessionStorage.getItem(storageKey());
@@ -85,14 +87,12 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
8587
8688 onCleanup(() => {
8789 generation += 1;
88- stopPolling();
8990 });
9091
9192 const submit = async () => {
9293 if (submitting()) return;
9394 generation += 1;
9495 const token = generation;
95- stopPolling();
9696 setSubmitting(true);
9797 setError("");
9898 setArtifacts(null);
@@ -101,8 +101,8 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
101101 if (token !== generation) return;
102102 setJobId(receipt.job_id);
103103 setStatus({ job_id: receipt.job_id, state: receipt.state, stage: "queued", progress: 0 });
104+ setEtaSecs(receipt.eta_secs);
104105 if (typeof sessionStorage !== "undefined") sessionStorage.setItem(storageKey(), receipt.job_id);
105- timer = setTimeout(() => void poll(receipt.job_id, token), POLL_MS);
106106 } catch (err) {
107107 setError(formatApiError(err));
108108 } finally {
@@ -117,7 +117,6 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
117117 setError("");
118118 try {
119119 await postPodcastJobCancel(id);
120- generation += 1;
121120 stopPolling();
122121 setStatus((current) => current ? { ...current, state: "cancelled" } : current);
123122 if (typeof sessionStorage !== "undefined") sessionStorage.removeItem(storageKey());
@@ -130,6 +129,13 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
130129
131130 const progress = () => Math.round(Math.min(1, Math.max(0, status()?.progress ?? 0)) * 100);
132131 const working = () => ["queued", "running"].includes(status()?.state ?? "");
132+
133+ // Poll through the shared primitive so a parked tab stops asking and a
134+ // tab-back is fresh at once — the hand-rolled timeout chain did neither.
135+ createLivePoll(() => {
136+ const id = jobId();
137+ if (id && working() && active()) void poll(id, generation);
138+ }, POLL_MS);
133139 const available = () => {
134140 const current = capabilities();
135141 if (!current || capabilities.error) return true;
@@ -152,12 +158,12 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
152158 return (
153159 <Suspense
154160 fallback={
155- <section class="flex min-h-44 items-center justify-center rounded-xl border border-border-line bg-surface-base p-4 shadow-xs">
161+ <section class="flex min-h-44 items-center justify-center rounded-xl border border-border-line bg-surface-base p-4">
156162 <p class="text-sm text-muted-foreground">{t("common.loading")}</p>
157163 </section>
158164 }
159165 >
160- <section class="space-y-4 rounded-xl border border-border-line bg-surface-base p-4 shadow-xs">
166+ <section class="space-y-4 rounded-xl border border-border-line bg-surface-base p-4">
161167 <div class="flex items-start gap-3">
162168 <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text">
163169 <IconWaveform class="h-5 w-5" />
@@ -204,6 +210,21 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
204210 <div class="h-2 overflow-hidden rounded-full bg-muted" role="progressbar" aria-valuenow={progress()} aria-valuemin="0" aria-valuemax="100">
205211 <div class="h-full rounded-full bg-primary transition-[width]" style={{ width: `${progress()}%` }} />
206212 </div>
213+ {/* The stage names itself in the service's own vocabulary and is not
214+ an enumerated set, so only the prefix is translated — the value
215+ is shown as it came rather than guessed at. */}
216+ <div class="flex flex-wrap items-baseline gap-x-3 gap-y-1 text-xs text-muted-foreground">
217+ <Show when={current().stage}>
218+ {(stage) => (
219+ <span>
220+ {t("podcast.stageLabel")} <span class="font-medium text-foreground">{stage()}</span>
221+ </span>
222+ )}
223+ </Show>
224+ <Show when={working() && etaSecs() != null}>
225+ <span class="tabular-nums">{t("podcast.etaHint", { secs: etaSecs()! })}</span>
226+ </Show>
227+ </div>
207228 <Show when={working()}>
208229 <Button type="button" size="sm" variant="outline" class="rounded-lg" disabled={cancelling()} onClick={() => void cancel()}>
209230 <IconX class="h-4 w-4" />{t("podcast.cancel")}
src/components/notes/rag-outputs-panel.tsxmodified+1 -1
@@ -199,7 +199,7 @@ export function RagOutputsPanel(props: {
199199 };
200200
201201 return (
202- <section class="space-y-3 rounded-lg border border-border/80 bg-card p-4 shadow-xs dark:border-white/8">
202+ <section class="space-y-3 rounded-xl border border-border-line bg-surface-base p-4">
203203 <div class="flex flex-wrap items-start justify-between gap-3">
204204 <div>
205205 <h3 class="text-sm font-semibold">{t("courseNotes.ragTitle")}</h3>
src/components/rag/rag-composer.tsxmodified+15 -6
@@ -1,7 +1,8 @@
1-import { createEffect } from "solid-js";
1+import { createEffect, onMount } from "solid-js";
22 import { Button } from "@/components/ui/button";
33 import { IconSend } from "@/components/ui/icons";
44 import { Textarea } from "@/components/ui/textarea";
5+import { cn } from "@/lib/cn";
56
67 const MAX_HEIGHT_PX = 176;
78
@@ -11,6 +12,10 @@ export function RagComposer(props: {
1112 sendLabel: string;
1213 hint: string;
1314 disabled: boolean;
15+ /** Take the caret on mount — the landing screen is the composer, so it should
16+ * be ready to type into, and a send that re-places it returns focus. */
17+ autofocus?: boolean;
18+ class?: string;
1419 onInput: (value: string) => void;
1520 onSubmit: () => void;
1621 }) {
@@ -27,15 +32,19 @@ export function RagComposer(props: {
2732 resize();
2833 });
2934
35+ onMount(() => {
36+ if (props.autofocus) field?.focus();
37+ });
38+
3039 return (
3140 <form
32- class="border-t border-border/70 bg-surface-base px-4 py-3 sm:px-6"
41+ class={cn("px-4 sm:px-6", props.class)}
3342 onSubmit={(event) => {
3443 event.preventDefault();
3544 if (!props.disabled) props.onSubmit();
3645 }}
3746 >
38- <div class="mx-auto flex w-full max-w-3xl items-end gap-2 rounded-xl border border-border bg-background px-3 py-2 transition-colors focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring">
47+ <div class="mx-auto flex w-full max-w-3xl items-end gap-2 rounded-2xl border border-border bg-surface-overlay px-3.5 py-2.5 transition-colors focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring">
3948 <Textarea
4049 ref={field}
4150 rows={1}
@@ -43,7 +52,7 @@ export function RagComposer(props: {
4352 value={props.value}
4453 disabled={props.disabled}
4554 placeholder={props.placeholder}
46- class="max-h-44 min-h-0 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-0 py-1.5 shadow-none hover:border-0 hover:bg-transparent focus:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0"
55+ class="max-h-44 min-h-0 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-0 py-1.5 text-base shadow-none hover:border-0 hover:bg-transparent focus:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0"
4756 onInput={(event) => props.onInput(event.currentTarget.value)}
4857 onKeyDown={(event) => {
4958 if (event.key === "Enter" && !event.shiftKey) {
@@ -55,7 +64,7 @@ export function RagComposer(props: {
5564 <Button
5665 type="submit"
5766 size="sm"
58- class="h-8 w-8 shrink-0 rounded-full p-0"
67+ class="h-9 w-9 shrink-0 rounded-full p-0"
5968 aria-label={props.sendLabel}
6069 title={props.sendLabel}
6170 disabled={props.disabled || !props.value.trim()}
@@ -63,7 +72,7 @@ export function RagComposer(props: {
6372 <IconSend class="h-4 w-4" />
6473 </Button>
6574 </div>
66- <p class="mx-auto mt-1.5 w-full max-w-3xl px-1 text-[11px] leading-4 text-muted-foreground">{props.hint}</p>
75+ <p class="mx-auto mt-2 w-full max-w-3xl px-1 text-center text-[11px] leading-4 text-muted-foreground">{props.hint}</p>
6776 </form>
6877 );
6978 }
src/components/rag/rag-copy.tsmodified+22 -2
@@ -17,7 +17,6 @@ function reasonText(locale: Locale, reason: string): string {
1717 const copy = {
1818 en: {
1919 title: "Ask your notes",
20- description: "Ask questions across the course material available to you and review the sources behind each answer.",
2120 newThread: "New chat",
2221 history: "Chat history",
2322 untitled: "Untitled chat",
@@ -29,6 +28,17 @@ const copy = {
2928 send: "Send",
3029 composerHint: "Enter to send · Shift+Enter for a new line",
3130 thinking: "Searching your course material…",
31+ thinking2: "Reading the sources…",
32+ thinking3: "Preparing the answer…",
33+ copy: "Copy",
34+ copied: "Copied",
35+ retry: "Ask again",
36+ scrollToLatest: "Latest",
37+ newMessages: "New message",
38+ groupToday: "Today",
39+ groupYesterday: "Yesterday",
40+ groupThisWeek: "This week",
41+ groupEarlier: "Earlier",
3242 sources: "Sources",
3343 source: "Source",
3444 subject: "Subject",
@@ -66,7 +76,6 @@ const copy = {
6676 },
6777 tr: {
6878 title: "Notlarına sor",
69- description: "Erişebildiğin ders içeriklerinde soru sor ve her yanıtın dayandığı kaynakları incele.",
7079 newThread: "Yeni sohbet",
7180 history: "Sohbet geçmişi",
7281 untitled: "Başlıksız sohbet",
@@ -78,6 +87,17 @@ const copy = {
7887 send: "Gönder",
7988 composerHint: "Göndermek için Enter · Yeni satır için Shift+Enter",
8089 thinking: "Ders içeriklerinde aranıyor…",
90+ thinking2: "Kaynaklar taranıyor…",
91+ thinking3: "Yanıt hazırlanıyor…",
92+ copy: "Kopyala",
93+ copied: "Kopyalandı",
94+ retry: "Tekrar sor",
95+ scrollToLatest: "En son",
96+ newMessages: "Yeni mesaj",
97+ groupToday: "Bugün",
98+ groupYesterday: "Dün",
99+ groupThisWeek: "Bu hafta",
100+ groupEarlier: "Daha önce",
81101 sources: "Kaynaklar",
82102 source: "Kaynak",
83103 subject: "Ders",
src/components/rag/rag-message-row.test.tsxadded+63 -0
@@ -0,0 +1,63 @@
1+import { cleanup, fireEvent, render, screen, waitFor } from "@solidjs/testing-library";
2+import { afterEach, describe, expect, it, vi } from "vitest";
3+import type { RagMessage } from "@/api/client";
4+import { RagMessageRow } from "@/components/rag/rag-message-row";
5+import { ragCopy } from "@/components/rag/rag-copy";
6+
7+const labels = ragCopy("tr");
8+
9+function message(over: Partial<RagMessage>): RagMessage {
10+ return {
11+ id: "m1",
12+ thread_id: "t1",
13+ role: "assistant",
14+ status: "complete",
15+ content: "Hücre zarı seçici geçirgendir.",
16+ abstained: false,
17+ reason: "",
18+ citations: [],
19+ created_at: Date.UTC(2026, 0, 2),
20+ ...over,
21+ };
22+}
23+
24+describe("RagMessageRow", () => {
25+ afterEach(() => {
26+ cleanup();
27+ vi.restoreAllMocks();
28+ });
29+
30+ it("copies a finished answer and says so", async () => {
31+ const writeText = vi.fn().mockResolvedValue(undefined);
32+ Object.assign(navigator, { clipboard: { writeText } });
33+
34+ render(() => <RagMessageRow message={message({})} labels={labels} />);
35+
36+ fireEvent.click(screen.getByRole("button", { name: labels.copy }));
37+
38+ await waitFor(() => expect(writeText).toHaveBeenCalledWith("Hücre zarı seçici geçirgendir."));
39+ await waitFor(() => expect(screen.getByText(labels.copied)).toBeTruthy());
40+ });
41+
42+ it("offers no copy on the user's own turn", () => {
43+ render(() => <RagMessageRow message={message({ role: "user" })} labels={labels} />);
44+
45+ expect(screen.queryByRole("button", { name: labels.copy })).toBeNull();
46+ });
47+
48+ it("re-asks through the handler the panel supplies", () => {
49+ const onRetry = vi.fn();
50+ render(() => <RagMessageRow message={message({ status: "failed" })} labels={labels} onRetry={onRetry} />);
51+
52+ fireEvent.click(screen.getByRole("button", { name: labels.retry }));
53+
54+ expect(onRetry).toHaveBeenCalledTimes(1);
55+ });
56+
57+ it("shows no action row while the answer is still pending", () => {
58+ render(() => <RagMessageRow message={message({ status: "pending", content: "" })} labels={labels} onRetry={vi.fn()} />);
59+
60+ expect(screen.queryByRole("button", { name: labels.retry })).toBeNull();
61+ expect(screen.queryByRole("button", { name: labels.copy })).toBeNull();
62+ });
63+});
src/components/rag/rag-message-row.tsxmodified+60 -11
@@ -1,16 +1,28 @@
1-import { Match, Show, Switch, type JSX } from "solid-js";
1+import { Match, Show, Switch, createSignal, type JSX } from "solid-js";
22 import type { RagMessage } from "@/api/client";
33 import { CelebiMarkdown } from "@/components/layout/celebi-markdown";
4-import { IconAlert, IconBotSquare } from "@/components/ui/icons";
4+import { IconAlert, IconCopy, IconRefresh } from "@/components/ui/icons";
55 import { RagCitations } from "@/components/rag/rag-citations";
6+import { RagThinkingLabel } from "@/components/rag/rag-thinking-label";
67 import { cn } from "@/lib/cn";
78
89 export function RagMessageRow(props: {
910 message: RagMessage;
1011 /** Rendered under the citations of an answer (e.g. study actions). */
1112 footer?: JSX.Element;
13+ /**
14+ * Re-asks the question this answer replies to. Passed only for the newest
15+ * answer — re-asking an older one would append it at the end of the
16+ * transcript, far from the turn the reader was looking at.
17+ */
18+ onRetry?: () => void;
1219 labels: {
1320 thinking: string;
21+ thinking2: string;
22+ thinking3: string;
23+ copy: string;
24+ copied: string;
25+ retry: string;
1426 sources: string;
1527 source: string;
1628 subject: string;
@@ -22,27 +34,38 @@ export function RagMessageRow(props: {
2234 abstainedReason: (reason: string) => string;
2335 };
2436 }) {
37+ const [copied, setCopied] = createSignal(false);
2538 const assistant = () => props.message.role === "assistant";
2639 const failure = () => props.message.error_code
2740 ? props.labels.failedWithCode(props.message.error_code)
2841 : props.labels.failed;
42+ const settled = () => props.message.status === "complete" || props.message.status === "failed";
43+ const copyable = () => assistant() && props.message.status === "complete" && !!props.message.content;
44+
45+ const copy = async () => {
46+ await navigator.clipboard.writeText(props.message.content);
47+ setCopied(true);
48+ window.setTimeout(() => setCopied(false), 1_500);
49+ };
2950
3051 return (
31- <article class={cn("flex gap-3", assistant() ? "justify-start" : "justify-end")}>
32- <Show when={assistant()}>
33- <span class="mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary-text">
34- <IconBotSquare class="h-4 w-4" />
35- </span>
36- </Show>
52+ // The user's turn is a bubble; the answer is not. An answer is the page's
53+ // content, not a message in a thread, so it runs the full reading column
54+ // with no frame and no avatar competing with the first line of text.
55+ <article class={cn("flex", assistant() ? "justify-start" : "justify-end")}>
3756 <div
3857 class={cn(
39- "max-w-[min(46rem,88%)] rounded-xl px-4 py-3 text-sm",
40- assistant() ? "border border-border-line bg-surface-base text-foreground" : "bg-primary text-primary-foreground",
58+ "text-sm",
59+ assistant()
60+ ? "w-full min-w-0 text-foreground"
61+ : "max-w-[min(46rem,88%)] rounded-xl bg-primary px-4 py-3 text-primary-foreground",
4162 )}
4263 >
4364 <Switch>
4465 <Match when={props.message.status === "pending" && !props.message.content}>
45- <p class="animate-pulse text-muted-foreground" role="status">{props.labels.thinking}</p>
66+ <p class="animate-pulse text-muted-foreground" role="status">
67+ <RagThinkingLabel phases={[props.labels.thinking, props.labels.thinking2, props.labels.thinking3]} />
68+ </p>
4669 </Match>
4770 <Match when={props.message.status === "failed"}>
4871 <div class="flex items-start gap-2 text-destructive-text">
@@ -65,6 +88,32 @@ export function RagMessageRow(props: {
6588 <Show when={assistant()}>
6689 <RagCitations citations={props.message.citations} labels={props.labels} />
6790 {props.footer}
91+ <Show when={settled() && (copyable() || props.onRetry)}>
92+ <div class="mt-2 flex flex-wrap items-center gap-3">
93+ <Show when={copyable()}>
94+ <button
95+ type="button"
96+ class="flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground"
97+ onClick={() => void copy()}
98+ >
99+ <IconCopy class="h-3 w-3" />
100+ {copied() ? props.labels.copied : props.labels.copy}
101+ </button>
102+ </Show>
103+ <Show when={props.onRetry}>
104+ {(retry) => (
105+ <button
106+ type="button"
107+ class="flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground"
108+ onClick={() => retry()()}
109+ >
110+ <IconRefresh class="h-3 w-3" />
111+ {props.labels.retry}
112+ </button>
113+ )}
114+ </Show>
115+ </div>
116+ </Show>
68117 </Show>
69118 </div>
70119 </article>
src/components/rag/rag-study-panel.tsxmodified+103 -40
@@ -19,7 +19,8 @@ import { RagThreadList } from "@/components/rag/rag-thread-list";
1919 import { Alert } from "@/components/ui/alert";
2020 import { Button } from "@/components/ui/button";
2121 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
22-import { IconBook, IconEdit, IconPlus } from "@/components/ui/icons";
22+import { IconChevronDown, IconPlus } from "@/components/ui/icons";
23+import { cn } from "@/lib/cn";
2324 import { scopeFromCitations } from "@/lib/rag-study-scope";
2425 import { usePreferences } from "@/stores/preferences-context";
2526
@@ -162,9 +163,33 @@ export function RagStudyPanel() {
162163 }
163164 };
164165
165- // Follow the conversation: a new turn (or a streamed chunk) keeps the view
166- // on the latest message, unless the reader has scrolled up to reread.
166+ // The transcript follows the newest turn only while the reader is pinned to
167+ // the bottom. Any upward scroll unpins at once — a distance threshold alone
168+ // lost to a streamed answer that grows every frame and kept dragging the
169+ // reader back down. Content that lands while unpinned raises the pill below
170+ // instead of yanking the view.
167171 let scroller: HTMLDivElement | undefined;
172+ const NEAR_BOTTOM_PX = 64;
173+ const [pinned, setPinned] = createSignal(true);
174+ const [unread, setUnread] = createSignal(false);
175+ let lastScrollTop = 0;
176+ const scrollToLatest = () => {
177+ if (!scroller) return;
178+ setPinned(true);
179+ setUnread(false);
180+ scroller.scrollTo({ top: scroller.scrollHeight, behavior: "smooth" });
181+ };
182+ const handleTranscriptScroll = () => {
183+ if (!scroller) return;
184+ const top = scroller.scrollTop;
185+ const distance = scroller.scrollHeight - top - scroller.clientHeight;
186+ if (top < lastScrollTop - 1 && distance > 1) setPinned(false);
187+ else if (distance <= NEAR_BOTTOM_PX) {
188+ setPinned(true);
189+ setUnread(false);
190+ }
191+ lastScrollTop = top;
192+ };
168193 createEffect(
169194 on(
170195 () => {
@@ -174,13 +199,23 @@ export function RagStudyPanel() {
174199 () => {
175200 const el = scroller;
176201 if (!el) return;
177- const nearBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 160;
178- if (nearBottom || sending()) queueMicrotask(() => el.scrollTo({ top: el.scrollHeight }));
202+ if (!pinned()) { setUnread(true); return; }
203+ queueMicrotask(() => {
204+ el.scrollTop = el.scrollHeight;
205+ lastScrollTop = el.scrollTop;
206+ });
179207 },
180208 { defer: true },
181209 ),
182210 );
183211
212+ /** Re-ask the question an answer replies to, through the same send pipeline. */
213+ const retry = (question: string) => {
214+ if (sending()) return;
215+ setDraft(question);
216+ void send();
217+ };
218+
184219 /** The user turn an answer replies to, used as the study range's label. */
185220 const questionBefore = (index: number) => {
186221 for (let i = index - 1; i >= 0; i -= 1) if (messages()[i]?.role === "user") return messages()[i]!.content;
@@ -208,36 +243,37 @@ export function RagStudyPanel() {
208243 />
209244 </aside>
210245
211- <section class="flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-border-line bg-surface-base shadow-xs" aria-label={copy().title}>
212- <header class="flex shrink-0 items-center justify-between gap-3 border-b border-border-line px-4 py-3 sm:px-5">
213- <div class="flex min-w-0 items-center gap-3">
214- <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary-text">
215- <IconBook class="h-4 w-4" />
216- </span>
217- <div class="min-w-0">
218- <p class="truncate text-sm font-semibold text-text-strong">{threadId() ? activeThread()?.title || copy().untitled : copy().title}</p>
219- <p class="truncate text-xs text-muted-foreground">{copy().description}</p>
220- </div>
221- </div>
222- <div class="flex shrink-0 items-center gap-2">
223- <Show when={activeThread()}>
224- {(thread) => (
225- <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg" aria-label={copy().rename} title={copy().rename} onClick={() => setRenaming(thread())}>
226- <IconEdit class="h-3.5 w-3.5" />
227- </Button>
228- )}
229- </Show>
230- </div>
231- </header>
232- <div ref={scroller} class="min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-6" aria-live="polite">
233- <div class="mx-auto w-full max-w-3xl space-y-5">
234- <Show when={error()}>
246+ {/* No card, no header strip: the transcript sits on the page the way a
247+ chat does. The conversation's own actions live on its row in the
248+ sidebar, which is where they were already duplicated. */}
249+ <section class="flex h-full min-h-0 flex-col" aria-label={copy().title}>
250+ <Show when={error()}>
251+ <div class="mx-auto w-full max-w-3xl px-4 pt-1 sm:px-6">
235252 <Alert variant="destructive">{error()}</Alert>
236- </Show>
253+ </div>
254+ </Show>
255+ <div class="relative min-h-0 flex-1">
256+ <div ref={scroller} onScroll={handleTranscriptScroll} class="h-full overflow-y-auto px-4 py-5 sm:px-6" aria-live="polite">
257+ <div class="mx-auto w-full max-w-3xl space-y-6">
237258 <Show
238259 when={messages().length > 0}
239260 fallback={
240- <RagStudyWelcome title={copy().emptyChat} hint={copy().emptyChatHint} />
261+ // The landing screen centres the mark and the composer instead of
262+ // stranding the composer at the bottom of an empty page.
263+ <div class="flex min-h-[60vh] flex-col justify-center">
264+ <RagStudyWelcome title={copy().emptyChat} hint={copy().emptyChatHint} />
265+ <RagComposer
266+ value={draft()}
267+ placeholder={copy().placeholder}
268+ sendLabel={copy().send}
269+ hint={copy().composerHint}
270+ disabled={sending()}
271+ autofocus
272+ class="px-0 sm:px-0"
273+ onInput={setDraft}
274+ onSubmit={() => void send()}
275+ />
276+ </div>
241277 }
242278 >
243279 <For each={messages()}>
@@ -246,10 +282,17 @@ export function RagStudyPanel() {
246282 message.role === "assistant" && message.status === "complete" && !message.abstained
247283 ? scopeFromCitations(message.citations, questionBefore(index()))
248284 : null;
285+ const question = () => questionBefore(index());
286+ const retryable = () =>
287+ message.role === "assistant" &&
288+ index() === messages().length - 1 &&
289+ (message.status === "complete" || message.status === "failed") &&
290+ question() != null;
249291 return (
250292 <RagMessageRow
251293 message={message}
252294 labels={copy()}
295+ onRetry={retryable() ? () => retry(question()!) : undefined}
253296 footer={
254297 <Show when={scope()}>
255298 {(current) => (
@@ -269,15 +312,35 @@ export function RagStudyPanel() {
269312 </Show>
270313 </div>
271314 </div>
272- <RagComposer
273- value={draft()}
274- placeholder={copy().placeholder}
275- sendLabel={copy().send}
276- hint={copy().composerHint}
277- disabled={sending()}
278- onInput={setDraft}
279- onSubmit={() => void send()}
280- />
315+ <Show when={!pinned()}>
316+ <button
317+ type="button"
318+ class={cn(
319+ "absolute bottom-3 left-1/2 inline-flex h-8 -translate-x-1/2 items-center gap-1.5 rounded-full border px-3 text-xs font-medium shadow-md backdrop-blur transition-colors",
320+ unread()
321+ ? "border-primary bg-primary text-primary-foreground hover:bg-primary/90"
322+ : "border-border bg-surface-base/95 text-foreground hover:bg-surface-overlay",
323+ )}
324+ onClick={scrollToLatest}
325+ >
326+ <IconChevronDown class="h-3.5 w-3.5" />
327+ {unread() ? copy().newMessages : copy().scrollToLatest}
328+ </button>
329+ </Show>
330+ </div>
331+ <Show when={messages().length > 0}>
332+ <RagComposer
333+ value={draft()}
334+ placeholder={copy().placeholder}
335+ sendLabel={copy().send}
336+ hint={copy().composerHint}
337+ disabled={sending()}
338+ autofocus
339+ class="pb-4"
340+ onInput={setDraft}
341+ onSubmit={() => void send()}
342+ />
343+ </Show>
281344 </section>
282345
283346 <ConfirmDialog
src/components/rag/rag-study-welcome.tsxmodified+10 -5
@@ -1,13 +1,18 @@
11 import { IconSparkles } from "@/components/ui/icons";
22
3-/** The Study tab before the first question: what it answers from, nothing more. */
3+/**
4+ * The landing screen, which is really just the brand mark above the composer.
5+ * The old version was a bordered illustration block that pushed the composer to
6+ * the bottom edge; here the mark introduces the composer and nothing else
7+ * competes with it — the page's whole job is "start typing".
8+ */
49 export function RagStudyWelcome(props: { title: string; hint: string }) {
510 return (
6- <div class="flex min-h-[40vh] flex-col items-center justify-center gap-3 py-10 text-center">
7- <span class="flex h-12 w-12 items-center justify-center rounded-2xl border border-primary/20 bg-primary/10 text-primary-text">
8- <IconSparkles class="h-6 w-6" />
11+ <div class="flex flex-col items-center gap-3 pb-6 text-center">
12+ <span class="flex h-11 w-11 items-center justify-center rounded-2xl bg-primary/10 text-primary-text">
13+ <IconSparkles class="h-5 w-5" />
914 </span>
10- <h2 class="text-xl font-semibold tracking-tight text-text-strong">{props.title}</h2>
15+ <h2 class="text-2xl font-semibold tracking-tight text-text-strong">{props.title}</h2>
1116 <p class="max-w-md text-sm leading-6 text-muted-foreground">{props.hint}</p>
1217 </div>
1318 );
src/components/rag/rag-thinking-label.tsxadded+20 -0
@@ -0,0 +1,20 @@
1+import { createSignal, onCleanup } from "solid-js";
2+
3+const ROTATE_MS = 1_800;
4+
5+/**
6+ * The "working on it" line while an answer is still pending.
7+ *
8+ * Retrieval here runs over the whole course corpus and takes longer than the
9+ * assistant popover's turn, and a single frozen sentence starts to read as a
10+ * stall. Rotating through the phases says the wait is expected — same device as
11+ * `CelebiThinkingLabel`, but the phrases come from this tree's own copy object
12+ * rather than the global message union.
13+ */
14+export function RagThinkingLabel(props: { phases: string[] }) {
15+ const [index, setIndex] = createSignal(0);
16+ const count = () => Math.max(1, props.phases.length);
17+ const timer = window.setInterval(() => setIndex((i) => i + 1), ROTATE_MS);
18+ onCleanup(() => window.clearInterval(timer));
19+ return <>{props.phases[index() % count()]}</>;
20+}
src/components/rag/rag-thread-list.tsxmodified+79 -31
@@ -12,12 +12,37 @@ import { formatDateTime } from "@/lib/format";
1212 import type { Locale } from "@/i18n/messages";
1313
1414 const THREAD_PAGE_SIZE = 12;
15+const DAY_MS = 86_400_000;
16+
17+type Bucket = "today" | "yesterday" | "week" | "earlier";
18+const BUCKET_ORDER: Bucket[] = ["today", "yesterday", "week", "earlier"];
19+
20+/** Which recency bucket a thread falls in, by local calendar day rather than a
21+ * rolling 24 hours — "dün" has to mean yesterday's date, not 25 hours ago. */
22+function bucketOf(updatedAt: number, now: Date): Bucket {
23+ const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
24+ if (updatedAt >= startOfToday) return "today";
25+ if (updatedAt >= startOfToday - DAY_MS) return "yesterday";
26+ if (updatedAt >= startOfToday - 6 * DAY_MS) return "week";
27+ return "earlier";
28+}
1529
1630 export function RagThreadList(props: {
1731 activeId?: string;
1832 version: number;
1933 locale: Locale;
20- labels: { untitled: string; emptyThreads: string; emptyThreadsHint: string; rename: string; actions: string; delete: string };
34+ labels: {
35+ untitled: string;
36+ emptyThreads: string;
37+ emptyThreadsHint: string;
38+ rename: string;
39+ actions: string;
40+ delete: string;
41+ groupToday: string;
42+ groupYesterday: string;
43+ groupThisWeek: string;
44+ groupEarlier: string;
45+ };
2146 onOpen: (thread: RagThread) => void;
2247 onRename: (thread: RagThread) => void;
2348 onRemove: (thread: RagThread) => void;
@@ -28,6 +53,20 @@ export function RagThreadList(props: {
2853 ({ page }) => getRagThreads({ limit: THREAD_PAGE_SIZE, offset: page * THREAD_PAGE_SIZE }),
2954 );
3055 const totalPages = () => Math.max(1, Math.ceil((threads.latest?.total ?? 0) / THREAD_PAGE_SIZE));
56+ const bucketLabel = (bucket: Bucket) =>
57+ bucket === "today" ? props.labels.groupToday
58+ : bucket === "yesterday" ? props.labels.groupYesterday
59+ : bucket === "week" ? props.labels.groupThisWeek
60+ : props.labels.groupEarlier;
61+ // Grouping is presentational only — the page still comes from the server in
62+ // its own order, so an empty bucket simply does not get a heading.
63+ const groups = (items: RagThread[]) => {
64+ const now = new Date();
65+ return BUCKET_ORDER.flatMap((bucket) => {
66+ const rows = items.filter((thread) => bucketOf(thread.updated_at, now) === bucket);
67+ return rows.length > 0 ? [{ bucket, rows }] : [];
68+ });
69+ };
3170
3271 createEffect(on(() => threads.latest, (result) => {
3372 if (result && result.items.length === 0 && page() > 0) setPage(Math.min(page() - 1, totalPages() - 1));
@@ -42,36 +81,45 @@ export function RagThreadList(props: {
4281 when={result().items.length > 0}
4382 fallback={<EmptyInline class="h-full py-10" size="md" illustration="messages" title={props.labels.emptyThreads} hint={props.labels.emptyThreadsHint} />}
4483 >
45- <ul class="space-y-1.5">
46- <For each={result().items}>
47- {(thread) => (
48- <li
49- class={cn(
50- "flex overflow-hidden rounded-lg border transition-colors",
51- thread.id === props.activeId ? "border-primary/40 bg-primary/5" : "border-border-hairline bg-card hover:border-border-line",
52- )}
53- aria-current={thread.id === props.activeId ? "true" : undefined}
54- >
55- <button
56- type="button"
57- class="flex min-w-0 flex-1 flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-muted/60"
58- onClick={() => props.onOpen(thread)}
59- >
60- <span class="w-full truncate text-sm font-medium">{thread.title || props.labels.untitled}</span>
61- <span class="text-[11px] tabular-nums text-muted-foreground">{formatDateTime(thread.updated_at, props.locale)}</span>
62- </button>
63- <TableRowActions
64- compact
65- label={props.labels.actions}
66- actions={[
67- { label: props.labels.rename, icon: <IconEdit class="h-4 w-4" />, onSelect: () => props.onRename(thread) },
68- { label: props.labels.delete, icon: <IconTrash class="h-4 w-4" />, destructive: true, onSelect: () => props.onRemove(thread) },
69- ]}
70- />
71- </li>
72- )}
73- </For>
74- </ul>
84+ <For each={groups(result().items)}>
85+ {(group) => (
86+ <section class="mb-3 last:mb-0">
87+ <h3 class="px-1 pb-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground">
88+ {bucketLabel(group.bucket)}
89+ </h3>
90+ <ul class="space-y-1.5">
91+ <For each={group.rows}>
92+ {(thread) => (
93+ <li
94+ class={cn(
95+ "flex overflow-hidden rounded-lg border transition-colors",
96+ thread.id === props.activeId ? "border-primary/40 bg-primary/5" : "border-border-hairline bg-card hover:border-border-line",
97+ )}
98+ aria-current={thread.id === props.activeId ? "true" : undefined}
99+ >
100+ <button
101+ type="button"
102+ class="flex min-w-0 flex-1 flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-muted/60"
103+ onClick={() => props.onOpen(thread)}
104+ >
105+ <span class="w-full truncate text-sm font-medium">{thread.title || props.labels.untitled}</span>
106+ <span class="text-[11px] tabular-nums text-muted-foreground">{formatDateTime(thread.updated_at, props.locale)}</span>
107+ </button>
108+ <TableRowActions
109+ compact
110+ label={props.labels.actions}
111+ actions={[
112+ { label: props.labels.rename, icon: <IconEdit class="h-4 w-4" />, onSelect: () => props.onRename(thread) },
113+ { label: props.labels.delete, icon: <IconTrash class="h-4 w-4" />, destructive: true, onSelect: () => props.onRemove(thread) },
114+ ]}
115+ />
116+ </li>
117+ )}
118+ </For>
119+ </ul>
120+ </section>
121+ )}
122+ </For>
75123 </Show>
76124 )}
77125 </Show>
src/components/ui/chart-comparator-bar.tsxadded+82 -0
@@ -0,0 +1,82 @@
1+import { Show, type Component } from "solid-js";
2+import { cn } from "@/lib/cn";
3+
4+export type ChartComparatorBarProps = {
5+ label: string;
6+ /** Where the fill ends, as a 0..1 fraction of the track. */
7+ fraction: number;
8+ /** The value as the caller already formatted it — a percent, a mark, a count. */
9+ valueText: string;
10+ /**
11+ * The baseline this value is read against (a cohort median, a class average)
12+ * as a fraction of the same track. Null when the service withheld it, and
13+ * then the bar is drawn without a tick rather than against a guessed one.
14+ */
15+ comparatorFraction?: number | null;
16+ /** What the baseline is, e.g. "sınıf ortalaması". */
17+ comparatorLabel?: string;
18+ comparatorText?: string | null;
19+ /** The signed distance between value and baseline, formatted by the caller. */
20+ gapText?: string | null;
21+ class?: string;
22+};
23+
24+const clamp = (value: number) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0));
25+
26+/**
27+ * One value read against one baseline, in the width of a table row: the fill is
28+ * the value, the tick across it is the baseline.
29+ *
30+ * Both numbers stay printed next to the bar rather than being encoded in it —
31+ * the bar is the quick read, the text is the actual claim, so the comparison
32+ * survives for a reader who cannot separate the two colours (WCAG 1.4.1).
33+ */
34+export const ChartComparatorBar: Component<ChartComparatorBarProps> = (props) => {
35+ const fill = () => clamp(props.fraction);
36+ const tick = () => (props.comparatorFraction == null ? null : clamp(props.comparatorFraction));
37+ const ariaLabel = () =>
38+ [
39+ `${props.label}: ${props.valueText}`,
40+ props.comparatorText ? `${props.comparatorLabel ?? ""} ${props.comparatorText}`.trim() : null,
41+ props.gapText,
42+ ]
43+ .filter(Boolean)
44+ .join(", ");
45+
46+ return (
47+ <div class={cn("space-y-1", props.class)} role="img" aria-label={ariaLabel()}>
48+ <div class="flex items-baseline justify-between gap-3">
49+ <span class="min-w-0 truncate text-xs text-muted-foreground">{props.label}</span>
50+ <span class="shrink-0 text-sm font-semibold tabular-nums text-text-strong">{props.valueText}</span>
51+ </div>
52+ <div class="relative h-2 overflow-hidden rounded-full bg-surface-overlay">
53+ <div class="h-full rounded-full bg-primary" style={{ width: `${fill() * 100}%` }} />
54+ <Show when={tick() != null}>
55+ {/* Pulled half its own width back so the tick sits on the baseline,
56+ not just past it; the last pixel stays inside the track. */}
57+ <span
58+ class="absolute inset-y-0 w-0.5 -translate-x-1/2 rounded-full bg-text-strong"
59+ style={{ left: `${tick()! * 100}%` }}
60+ />
61+ </Show>
62+ </div>
63+ <Show when={props.comparatorText || props.gapText}>
64+ <p class="flex flex-wrap items-baseline gap-x-2 text-[11px] leading-5 text-muted-foreground">
65+ <Show when={props.comparatorText}>
66+ {(text) => (
67+ <span>
68+ <Show when={props.comparatorLabel}>
69+ <span>{props.comparatorLabel}: </span>
70+ </Show>
71+ <span class="font-medium tabular-nums">{text()}</span>
72+ </span>
73+ )}
74+ </Show>
75+ <Show when={props.gapText}>
76+ {(gap) => <span class="font-medium tabular-nums text-text-strong">{gap()}</span>}
77+ </Show>
78+ </p>
79+ </Show>
80+ </div>
81+ );
82+};
src/components/users/create-user-panel.tsxmodified+27 -1
@@ -32,15 +32,20 @@ export function CreateUserPanel(props: {
3232 const [username, setUsername] = createSignal("");
3333 const [password, setPassword] = createSignal("");
3434 const [role, setRole] = createSignal<Role>(props.fixedRole ?? "student");
35+ const [studentNumber, setStudentNumber] = createSignal("");
3536 const [error, setError] = createSignal("");
3637 const [pending, setPending] = createSignal(false);
3738
3839 const userLimits = () => limits.latest?.user;
40+ // Only a student account may hold a number; the server 400s on any other
41+ // role, so the field is asked for — and sent — only when the role is student.
42+ const effectiveRole = () => props.fixedRole ?? role();
3943
4044 const reset = () => {
4145 setUsername("");
4246 setPassword("");
4347 setRole(props.fixedRole ?? "student");
48+ setStudentNumber("");
4449 setError("");
4550 };
4651
@@ -63,7 +68,14 @@ export function CreateUserPanel(props: {
6368 if (msg) { setError(msg); return; }
6469 setPending(true);
6570 try {
66- const created = await postUser({ username: username().trim(), password: password(), role: props.fixedRole ?? role() });
71+ const number = studentNumber().trim();
72+ const created = await postUser({
73+ username: username().trim(),
74+ password: password(),
75+ role: effectiveRole(),
76+ // Blank is the same as omitted, so an unnumbered student stays unnumbered.
77+ ...(effectiveRole() === "student" && number ? { student_number: number } : {}),
78+ });
6779 reset();
6880 props.onCreated(created);
6981 } catch (err) {
@@ -120,6 +132,20 @@ export function CreateUserPanel(props: {
120132 </Select>
121133 </div>
122134 </Show>
135+ <Show when={effectiveRole() === "student"}>
136+ <div class="space-y-1.5">
137+ <Label for="create-user-student-number">{t("roster.studentNumber")}</Label>
138+ <Input
139+ id="create-user-student-number"
140+ class="h-10 rounded-lg"
141+ maxlength={userLimits()?.max_student_number_len}
142+ autocomplete="off"
143+ value={studentNumber()}
144+ onInput={(e) => setStudentNumber(e.currentTarget.value)}
145+ />
146+ <p class="text-xs text-muted-foreground">{t("admin.studentNumberHint")}</p>
147+ </div>
148+ </Show>
123149 <div class="flex flex-wrap items-center justify-end gap-2">
124150 <Button type="button" variant="outline" class="h-10 rounded-lg" onClick={close}>
125151 {t("common.cancel")}
src/components/users/profile-form.tsxmodified+27 -0
@@ -54,6 +54,14 @@ export function ProfileForm(props: {
5454 branches?: string[];
5555 maxDisplayNameLen?: number;
5656 maxBioLen?: number;
57+ /**
58+ * Offer the school-issued student number. It is the office's field, not the
59+ * account holder's, so only the admin surface passes this; it stays hidden
60+ * for anyone editing their own profile. Ignored for a non-student role,
61+ * which the server refuses a number for anyway.
62+ */
63+ editStudentNumber?: boolean;
64+ maxStudentNumberLen?: number;
5765 onSaved: () => void;
5866 onSave?: (body: ProfileUpdate) => Promise<User>;
5967 }) {
@@ -66,6 +74,8 @@ export function ProfileForm(props: {
6674 const [displayName, setDisplayName] = createSignal(props.profile?.display_name ?? "");
6775 const [bio, setBio] = createSignal(props.profile?.bio ?? "");
6876 const [branch, setBranch] = createSignal(props.profile?.branch ?? "");
77+ const [studentNumber, setStudentNumber] = createSignal(props.user.student_number ?? "");
78+ const showStudentNumber = () => !!props.editStudentNumber && props.user.role === "student";
6979 // Branş is a teacher's field; a stored value outside the list still shows so
7080 // saving the form never silently drops it.
7181 const branchOptions = () => {
@@ -100,6 +110,10 @@ export function ProfileForm(props: {
100110 if (e !== (props.user.email ?? "")) b.email = e;
101111 if (p !== (props.user.phone ?? "")) b.phone = p;
102112 if (d !== (props.user.birth_date ?? "")) b.birth_date = d;
113+ // Blank clears it server-side, which is how the office un-numbers a student.
114+ if (showStudentNumber() && studentNumber().trim() !== (props.user.student_number ?? "")) {
115+ b.student_number = studentNumber().trim();
116+ }
103117 if (props.profile) {
104118 // An empty string clears the field server-side; an omitted key keeps it.
105119 const dn = displayName().trim();
@@ -183,6 +197,19 @@ export function ProfileForm(props: {
183197 </Select>
184198 </div>
185199 </Show>
200+ <Show when={showStudentNumber()}>
201+ <div class="space-y-1.5">
202+ <Label for="pf-student-number">{t("roster.studentNumber")}</Label>
203+ <Input
204+ id="pf-student-number"
205+ class="h-10"
206+ maxlength={props.maxStudentNumberLen}
207+ value={studentNumber()}
208+ onInput={(e) => setStudentNumber(e.currentTarget.value)}
209+ />
210+ <p class="text-xs text-muted-foreground">{t("admin.studentNumberHint")}</p>
211+ </div>
212+ </Show>
186213 <div class="space-y-1.5">
187214 <Label for="pf-email">{t("profile.email")}</Label>
188215 <Input id="pf-email" class="h-10" type="email" value={email()} onInput={(e) => setEmail(e.currentTarget.value)} />
src/components/users/student-directory-columns.tsxadded+35 -0
@@ -0,0 +1,35 @@
1+import type { ColumnDef } from "@tanstack/solid-table";
2+import type { StudentDirectoryRow } from "@/lib/student-directory";
3+import type { useT } from "@/stores/preferences-context";
4+
5+/**
6+ * The three identifying columns every teacher-facing tracking table opens with —
7+ * student number, name, class — so Yoklamalar, Sınav Notları and Pomodorolar
8+ * read the same row the same way. Each page appends its own columns after these.
9+ */
10+export function studentDirectoryColumns(t: ReturnType<typeof useT>): ColumnDef<StudentDirectoryRow>[] {
11+ return [
12+ {
13+ id: "studentNumber",
14+ // Sorts as text: the backend stores a free-text number, not an integer.
15+ accessorFn: (row) => row.person.student_number ?? "",
16+ header: t("roster.studentNumber"),
17+ meta: { headerClass: "w-32 min-w-32 whitespace-nowrap" },
18+ cell: (cell) => (
19+ <span class="tabular-nums text-muted-foreground">{cell.row.original.person.student_number || "—"}</span>
20+ ),
21+ },
22+ {
23+ id: "student",
24+ accessorFn: (row) => row.person.display_name || row.person.username,
25+ header: t("roster.name"),
26+ cell: (cell) => <span class="font-medium">{cell.row.original.person.display_name || t("exams.nameless")}</span>,
27+ },
28+ {
29+ id: "class",
30+ accessorFn: (row) => row.classes.map((cls) => cls.name).join(", "),
31+ header: t("roster.studentClass"),
32+ cell: (cell) => <span>{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span>,
33+ },
34+ ];
35+}
src/i18n/locales/en.tsmodified+11 -5
@@ -37,8 +37,10 @@ export const en: Dict = {
3737 "ai.noChats": "No chats yet. Start one and it will appear here.",
3838 "ai.searchCount": "{current} / {total}",
3939 "ai.noSearchResults": "No messages match your search.",
40- "aiHub.description": "Every AI surface in one place: note outputs and podcasts, student analysis, and Çelebi.",
4140 "aiHub.tab.studio": "Note studio",
41+ "aiStudio.heading": "Turn one course note into a summary or a podcast",
42+ "aiStudio.pickPrompt": "Pick a course note",
43+ "aiStudio.pickPromptHint": "Pick a course note above; its summary and podcast producers open here.",
4244 "aiHub.tab.insights": "Analysis",
4345 // Çelebi's intent engine only understands Turkish: the same English wording
4446 // comes back as "please rephrase" from the live assistant, so the examples
@@ -385,9 +387,9 @@ export const en: Dict = {
385387 "nav.work": "Shift",
386388 "nav.staffWork": "Staff work logs",
387389 "nav.users": "Users & roles",
388- "nav.studentMarks": "Student marks",
390+ "nav.studentMarks": "Exam marks",
389391 "nav.studentAttendance": "Attendance",
390- "nav.studentPomodoro": "Student pomodoros",
392+ "nav.studentPomodoro": "Pomodoros",
391393 "nav.settings": "Settings",
392394 "nav.terms": "Terms",
393395 "nav.guide": "Guide",
@@ -474,7 +476,10 @@ export const en: Dict = {
474476 "comingSoon.emptyTitle": "Not available yet",
475477 "comingSoon.emptyDescription": "This part of Hezarfen is still being built. Check back soon.",
476478 "roster.student": "Student",
479+ "roster.studentNumber": "Student no",
477480 "roster.studentName": "Student name",
481+ "roster.name": "Name",
482+ "roster.studentClass": "Class",
478483 "roster.teacher": "Teacher",
479484 "roster.class": "Class",
480485 "roster.classAll": "Class: All",
@@ -703,7 +708,6 @@ export const en: Dict = {
703708 "aiStudio.library.emptyHint": "Create a summary or podcast for a lesson note to add it to this area.",
704709 "aiStudio.library.summary": "AI summary",
705710 "aiStudio.library.podcastCount": "{count} podcasts",
706- "aiStudio.library.open": "Open note",
707711 "today.titleStudent": "Today's lessons",
708712 "today.inProgress": "On now",
709713 "childHomework.title": "Homework",
@@ -1012,6 +1016,8 @@ export const en: Dict = {
10121016 "podcast.noNotes": "No lesson notes are available.",
10131017 "podcast.noNotesHint": "Add a note to one of your courses before creating audio.",
10141018 "podcast.format": "Narration style",
1019+ "podcast.stageLabel": "Stage:",
1020+ "podcast.etaHint": "Estimated time: about {secs}s",
10151021 "podcast.format.duz_okuma": "Straight reading",
10161022 "podcast.format.tek_ogretici": "Single instructor",
10171023 "podcast.format.ogrenci_hoca": "Student and teacher",
@@ -1106,7 +1112,6 @@ export const en: Dict = {
11061112 "insights.analysis.onTime": "On time",
11071113 "insights.analysis.details": "What supports this analysis?",
11081114 "insights.analysis.detailsHint": "Explore comparisons, trends and the limits of the available data.",
1109- "insights.analysis.detailsAction": "Explore",
11101115 "insights.runs": "Analysis runs",
11111116 "insights.runsSubtitle": "Nightly and manually queued school analyses.",
11121117 "insights.runDay": "Run day",
@@ -1547,6 +1552,7 @@ export const en: Dict = {
15471552 "admin.createUserHint": "Open an account directly — no invite or self-registration.",
15481553 "admin.createUserPassword": "Password",
15491554 "admin.createUserPasswordHint": "If this username already exists at another school, enter that account's current password to add it here.",
1555+ "admin.studentNumberHint": "The school-issued student number, unique inside the school. May be left blank.",
15501556 "admin.createUserReserved": "This username is reserved. Pick another one.",
15511557 "admin.createUserDone": "Account {username} created.",
15521558 "admin.username": "Username",
src/i18n/locales/tr.tsmodified+12 -6
@@ -37,8 +37,10 @@ export const tr: Dict = {
3737 "ai.noChats": "Henüz sohbet yok. Başlattığın sohbetler burada görünür.",
3838 "ai.searchCount": "{current} / {total}",
3939 "ai.noSearchResults": "Aramanla eşleşen mesaj yok.",
40- "aiHub.description": "Tüm yapay zekâ araçları tek yerde: not çıktıları ve podcast, öğrenci analizi ve Çelebi.",
4140 "aiHub.tab.studio": "Not Stüdyosu",
41+ "aiStudio.heading": "Bir ders notundan özet ve podcast üret",
42+ "aiStudio.pickPrompt": "Bir ders notu seç",
43+ "aiStudio.pickPromptHint": "Yukarıdaki listeden bir ders notu seç; özet ve podcast üretimi burada açılır.",
4244 "aiHub.tab.insights": "Analiz",
4345 "aiHub.celebiExample.student1": "Bu hafta hangi ödevlerin teslimi var?",
4446 "aiHub.celebiExample.student2": "Sınıfım kaç gün devamsızlık yaptı?",
@@ -381,9 +383,9 @@ export const tr: Dict = {
381383 "nav.work": "Mesai",
382384 "nav.staffWork": "Personel mesaisi",
383385 "nav.users": "Kullanıcılar ve roller",
384- "nav.studentMarks": "Öğrenci notları",
385- "nav.studentAttendance": "Yoklama",
386- "nav.studentPomodoro": "Öğrenci pomodoroları",
386+ "nav.studentMarks": "Sınav Notları",
387+ "nav.studentAttendance": "Yoklamalar",
388+ "nav.studentPomodoro": "Pomodorolar",
387389 "nav.settings": "Ayarlar",
388390 "nav.terms": "Dönemler",
389391 "nav.guide": "Rehber",
@@ -470,7 +472,10 @@ export const tr: Dict = {
470472 "comingSoon.emptyTitle": "Henüz kullanıma açık değil",
471473 "comingSoon.emptyDescription": "Hezarfen'in bu bölümü hâlâ hazırlanıyor. Yakında tekrar bakın.",
472474 "roster.student": "Öğrenci",
475+ "roster.studentNumber": "Öğrenci No",
473476 "roster.studentName": "Öğrenci Adı Soyadı",
477+ "roster.name": "Adı",
478+ "roster.studentClass": "Sınıfı",
474479 "roster.teacher": "Öğretmen",
475480 "roster.class": "Sınıf",
476481 "roster.classAll": "Sınıf: Tümü",
@@ -699,7 +704,6 @@ export const tr: Dict = {
699704 "aiStudio.library.emptyHint": "Bu alana eklemek için bir ders notundan özet veya podcast oluştur.",
700705 "aiStudio.library.summary": "Yapay zekâ özeti",
701706 "aiStudio.library.podcastCount": "{count} podcast",
702- "aiStudio.library.open": "Nota git",
703707 "today.titleStudent": "Bugünkü derslerin",
704708 "today.inProgress": "Şimdi",
705709 "childHomework.title": "Ödevler",
@@ -1008,6 +1012,8 @@ export const tr: Dict = {
10081012 "podcast.noNotes": "Kullanılabilir ders notu yok.",
10091013 "podcast.noNotesHint": "Ses oluşturmadan önce derslerinizden birine not ekleyin.",
10101014 "podcast.format": "Anlatım biçimi",
1015+ "podcast.stageLabel": "Aşama:",
1016+ "podcast.etaHint": "Tahmini süre: yaklaşık {secs} sn",
10111017 "podcast.format.duz_okuma": "Düz okuma",
10121018 "podcast.format.tek_ogretici": "Tek öğretici",
10131019 "podcast.format.ogrenci_hoca": "Öğrenci ve öğretmen",
@@ -1102,7 +1108,6 @@ export const tr: Dict = {
11021108 "insights.analysis.onTime": "Zamanında",
11031109 "insights.analysis.details": "Bu analizin dayanağı ne?",
11041110 "insights.analysis.detailsHint": "Karşılaştırmaları, eğilimleri ve mevcut verinin sınırlarını keşfet.",
1105- "insights.analysis.detailsAction": "İncele",
11061111 "insights.runs": "Analiz çalıştırmaları",
11071112 "insights.runsSubtitle": "Gece çalışan ve elle sıraya alınan okul analizleri.",
11081113 "insights.runDay": "Çalışma günü",
@@ -1543,6 +1548,7 @@ export const tr: Dict = {
15431548 "admin.createUserHint": "Davet veya kendi kaydı olmadan doğrudan hesap açın.",
15441549 "admin.createUserPassword": "Şifre",
15451550 "admin.createUserPasswordHint": "Bu kullanıcı adı başka bir okulda zaten varsa, o hesabın mevcut şifresini girin; hesap bu okula da eklenir.",
1551+ "admin.studentNumberHint": "Okulun verdiği öğrenci numarası; okul içinde benzersizdir. Boş bırakılabilir.",
15461552 "admin.createUserReserved": "Bu kullanıcı adı ayrılmış. Başka bir ad seçin.",
15471553 "admin.createUserDone": "{username} hesabı oluşturuldu.",
15481554 "admin.username": "Kullanıcı adı",
src/i18n/messages.tsmodified+9 -3
@@ -33,7 +33,6 @@ export type MessageKey =
3333 | "ai.noChats"
3434 | "ai.searchCount"
3535 | "ai.noSearchResults"
36- | "aiHub.description"
3736 | "aiHub.tab.studio"
3837 | "aiHub.tab.insights"
3938 | "aiHub.celebiExample.student1"
@@ -442,7 +441,10 @@ export type MessageKey =
442441 | "comingSoon.emptyTitle"
443442 | "comingSoon.emptyDescription"
444443 | "roster.student"
444+ | "roster.studentNumber"
445445 | "roster.studentName"
446+ | "roster.name"
447+ | "roster.studentClass"
446448 | "roster.teacher"
447449 | "roster.class"
448450 | "roster.classAll"
@@ -690,7 +692,9 @@ export type MessageKey =
690692 | "aiStudio.library.emptyHint"
691693 | "aiStudio.library.summary"
692694 | "aiStudio.library.podcastCount"
693- | "aiStudio.library.open"
695+ | "aiStudio.heading"
696+ | "aiStudio.pickPrompt"
697+ | "aiStudio.pickPromptHint"
694698 | "today.titleStudent"
695699 | "today.inProgress"
696700 | "childHomework.title"
@@ -999,6 +1003,8 @@ export type MessageKey =
9991003 | "podcast.noNotes"
10001004 | "podcast.noNotesHint"
10011005 | "podcast.format"
1006+ | "podcast.stageLabel"
1007+ | "podcast.etaHint"
10021008 | "podcast.format.duz_okuma"
10031009 | "podcast.format.tek_ogretici"
10041010 | "podcast.format.ogrenci_hoca"
@@ -1093,7 +1099,6 @@ export type MessageKey =
10931099 | "insights.analysis.onTime"
10941100 | "insights.analysis.details"
10951101 | "insights.analysis.detailsHint"
1096- | "insights.analysis.detailsAction"
10971102 | "insights.runs"
10981103 | "insights.runsSubtitle"
10991104 | "insights.runDay"
@@ -1445,6 +1450,7 @@ export type MessageKey =
14451450 | "admin.createUserHint"
14461451 | "admin.createUserPassword"
14471452 | "admin.createUserPasswordHint"
1453+ | "admin.studentNumberHint"
14481454 | "admin.createUserReserved"
14491455 | "admin.createUserDone"
14501456 | "admin.username"
src/pages/admin-user-detail-page.tsxmodified+7 -0
@@ -1,6 +1,7 @@
11 import { Link, useLocation, useParams } from "@tanstack/solid-router";
22 import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
33 import { createResource } from "@/lib/create-resource";
4+import { getLimits } from "@/api/limits";
45 import { getSettings } from "@/api/settings";
56 import { getUserById, getUserProfile, patchUserProfile, patchUserRole } from "@/api/users";
67 import { formatApiError, type Role } from "@/api/client";
@@ -43,6 +44,7 @@ function AdminUserDetailContent() {
4344 // Branş (and display name/bio) live only on the profile read, not on User.
4445 const [profile, { refetch: refetchProfile }] = createResource(id, (userId) => getUserProfile(userId).catch(() => null));
4546 const [settings] = createResource(() => getSettings().catch(() => null));
47+ const [limits] = createResource(() => getLimits().catch(() => null));
4648 const [editing, setEditing] = createSignal(false);
4749 const [studentsOpen, setStudentsOpen] = createSignal(false);
4850 const [pendingRole, setPendingRole] = createSignal<Role>("student");
@@ -107,6 +109,9 @@ function AdminUserDetailContent() {
107109 <DetailField label={t("profile.email")} value={current().email || "—"} />
108110 <DetailField label={t("profile.phone")} value={current().phone || "—"} />
109111 <DetailField label={t("profile.birthDate")} value={current().birth_date || "—"} />
112+ <Show when={current().role === "student"}>
113+ <DetailField label={t("roster.studentNumber")} value={current().student_number || "—"} />
114+ </Show>
110115 <Show when={hasMinRole(current().role, "teacher")}>
111116 <DetailField label={t("profile.branch")} value={profile.latest?.branch || "—"} />
112117 </Show>
@@ -143,6 +148,8 @@ function AdminUserDetailContent() {
143148 user={current()}
144149 profile={profile.latest ? { display_name: profile.latest.display_name, bio: profile.latest.bio, branch: profile.latest.branch } : undefined}
145150 branches={settings.latest?.branches}
151+ editStudentNumber
152+ maxStudentNumberLen={limits.latest?.user.max_student_number_len}
146153 onSave={(body) => patchUserProfile(current().id, body)}
147154 onSaved={async () => {
148155 setEditing(false);
src/pages/student-attendance-page.tsxmodified+4 -14
@@ -11,6 +11,7 @@ import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
1111 import { ErrorAlert } from "@/components/ui/error-alert";
1212 import { IconEye } from "@/components/ui/icons";
1313 import { SidePanel } from "@/components/ui/side-panel";
14+import { studentDirectoryColumns } from "@/components/users/student-directory-columns";
1415 import { TableRowActions } from "@/components/ui/table-row-actions";
1516 import { matchesSearch } from "@/lib/search-text";
1617 import { personLabel } from "@/lib/person";
@@ -62,20 +63,9 @@ function StudentAttendanceContent() {
6263 const rows = () => list();
6364 const listLoading = () => list.loading;
6465 const searchPerson = (row: StudentDirectoryRow, query: string) =>
65- matchesSearch(query, row.person.display_name, ...row.classes.map((cls) => cls.name));
66+ matchesSearch(query, row.person.display_name, row.person.student_number, ...row.classes.map((cls) => cls.name));
6667 const columns = createMemo<ColumnDef<StudentDirectoryRow>[]>(() => [
67- {
68- id: "student",
69- accessorFn: (row) => row.person.display_name || row.person.username,
70- header: t("roster.studentName"),
71- cell: (cell) => <span class="font-medium">{cell.row.original.person.display_name || t("exams.nameless")}</span>,
72- },
73- {
74- id: "class",
75- accessorFn: (row) => row.classes.map((cls) => cls.name).join(", "),
76- header: t("roster.class"),
77- cell: (cell) => <span>{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span>,
78- },
68+ ...studentDirectoryColumns(t),
7969 {
8070 id: "actions",
8171 header: t("common.actions"),
@@ -108,7 +98,7 @@ function StudentAttendanceContent() {
10898 <Alert variant="destructive">{error()}</Alert>
10999 </Show>
110100
111- <Show when={!listLoading()} fallback={<DataTableSkeleton columns={3} rows={6} />}>
101+ <Show when={!listLoading()} fallback={<DataTableSkeleton columns={4} rows={6} />}>
112102 <DataTable
113103 title={t("nav.studentAttendance")}
114104 description={t("attendance.lookup")}
src/pages/student-marks-page.tsxmodified+4 -14
@@ -13,6 +13,7 @@ import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
1313 import { ErrorAlert } from "@/components/ui/error-alert";
1414 import { IconEye } from "@/components/ui/icons";
1515 import { SidePanel } from "@/components/ui/side-panel";
16+import { studentDirectoryColumns } from "@/components/users/student-directory-columns";
1617 import { TableRowActions } from "@/components/ui/table-row-actions";
1718 import { matchesSearch } from "@/lib/search-text";
1819 import { personLabel } from "@/lib/person";
@@ -100,20 +101,9 @@ function StudentMarksContent() {
100101 };
101102 const listLoading = () => list.loading;
102103 const searchPerson = (row: StudentDirectoryRow, query: string) =>
103- matchesSearch(query, row.person.display_name, ...row.classes.map((cls) => cls.name));
104+ matchesSearch(query, row.person.display_name, row.person.student_number, ...row.classes.map((cls) => cls.name));
104105 const columns = createMemo<ColumnDef<StudentDirectoryRow>[]>(() => [
105- {
106- id: "student",
107- accessorFn: (row) => row.person.display_name || row.person.username,
108- header: t("roster.studentName"),
109- cell: (cell) => <span class="font-medium">{cell.row.original.person.display_name || t("exams.nameless")}</span>,
110- },
111- {
112- id: "class",
113- accessorFn: (row) => row.classes.map((cls) => cls.name).join(", "),
114- header: t("roster.class"),
115- cell: (cell) => <span>{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span>,
116- },
106+ ...studentDirectoryColumns(t),
117107 {
118108 id: "average",
119109 header: t("marks.overall"),
@@ -168,7 +158,7 @@ function StudentMarksContent() {
168158 <Alert role="status">{t("marks.averageCapped", { cap: MARKS_FETCH_CAP })}</Alert>
169159 </Show>
170160
171- <Show when={!listLoading()} fallback={<DataTableSkeleton columns={4} rows={6} />}>
161+ <Show when={!listLoading()} fallback={<DataTableSkeleton columns={5} rows={6} />}>
172162 <DataTable
173163 title={t("nav.studentMarks")}
174164 description={t("marks.lookup")}
src/pages/student-pomodoro-page.tsxmodified+4 -14
@@ -11,6 +11,7 @@ import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
1111 import { ErrorAlert } from "@/components/ui/error-alert";
1212 import { IconEye } from "@/components/ui/icons";
1313 import { SidePanel } from "@/components/ui/side-panel";
14+import { studentDirectoryColumns } from "@/components/users/student-directory-columns";
1415 import { TableRowActions } from "@/components/ui/table-row-actions";
1516 import { matchesSearch } from "@/lib/search-text";
1617 import { personLabel } from "@/lib/person";
@@ -62,20 +63,9 @@ function StudentPomodoroContent() {
6263 const rows = () => list();
6364 const listLoading = () => list.loading;
6465 const searchPerson = (row: StudentDirectoryRow, query: string) =>
65- matchesSearch(query, row.person.display_name, ...row.classes.map((cls) => cls.name));
66+ matchesSearch(query, row.person.display_name, row.person.student_number, ...row.classes.map((cls) => cls.name));
6667 const studentColumns = createMemo<ColumnDef<StudentDirectoryRow>[]>(() => [
67- {
68- id: "student",
69- accessorFn: (row) => row.person.display_name || row.person.username,
70- header: t("roster.studentName"),
71- cell: (cell) => <span class="font-medium">{cell.row.original.person.display_name || t("exams.nameless")}</span>,
72- },
73- {
74- id: "class",
75- accessorFn: (row) => row.classes.map((cls) => cls.name).join(", "),
76- header: t("roster.class"),
77- cell: (cell) => <span>{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span>,
78- },
68+ ...studentDirectoryColumns(t),
7969 {
8070 id: "actions",
8171 header: t("common.actions"),
@@ -105,7 +95,7 @@ function StudentPomodoroContent() {
10595 <Alert variant="destructive">{error()}</Alert>
10696 </Show>
10797
108- <Show when={!listLoading()} fallback={<DataTableSkeleton columns={3} rows={6} />}>
98+ <Show when={!listLoading()} fallback={<DataTableSkeleton columns={4} rows={6} />}>
10999 <DataTable
110100 title={t("nav.studentPomodoro")}
111101 description={t("pomodoro.lookup")}