forge
Explore
Log in

Don't you dare go Hollow

🎓 grade blueprints, public profiles, badges, and board group invites

Browse files at this commit

faaf9bcc70dd6d92ab08a5c864609f49cbc8d082Burak BoduroğluParent: a616723
  • feat
    • 🎓 grade blueprints, public profiles, badges, and board group invites
Show full message
feat: 🎓 grade blueprints, public profiles, badges, and board group invites
- cover the four surfaces the backend opened in b15ef98..6ddc914, one API
  file per endpoint with the domain's mandatory vitest cases
- grade blueprints: a manager-only tab on /management/classes plus an
  "apply blueprint" action on a class. The grade label is the record key
  and is free text, so it is percent-encoded everywhere
- a blueprint's skipped[] is an outcome report, not an error: the save
  still toasts and the shortfall opens a separate table. Backend English
  reasons are normalized and localized in lib/blueprint-skip, never
  rendered raw, and a 409 re-reads the blueprint and reseeds the form
  since there is no version token to retry with
- public profiles at /profile/me and /profile/$userId, with bio and
  display name on the existing PATCH /users/me. The parent restriction is
  left to the backend's 403 — a parent may read their linked students, so
  a client role gate would wrongly close that
- avatars ride a plain <img> against the same-origin /api path rather than
  fetch+objectURL; a shared revision counter busts the browser's image
  cache after an upload or delete and refreshes the sidebar chip
- badges render from the /limits catalogue: unearned tiles carry a padlock
  and a progress bar, and a tooltip repeats what the tile already shows,
  since a tooltip can never be opened by touch
- boards gain POST /boards/{id}/invite behind a source picker in the
  settings panel, creator-only, keyed per source kind so a non-creator
  never fires the list requests
- profile links added where people are listed: the user table and detail,
  class members, linked students, and a parent's own children. A router
  <Link> inside a modal panel never navigates, so those close the panel
  first and then navigate

49 changed files +3245 -213

src/api/__tests__/boards/boards.test.tsmodified+26 -0
@@ -10,6 +10,7 @@ import {
10 postBoard,10 postBoard,
11 postBoardClear,11 postBoardClear,
12 postBoardClose,12 postBoardClose,
13+ postBoardInvite,
13 } from "../../boards";14 } from "../../boards";
14 import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";15 import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";
15 16
@@ -121,4 +122,29 @@ describe("boards API", () => {
121 expect(url).toBe("/api/boards/b1");122 expect(url).toBe("/api/boards/b1");
122 expect(init?.method).toBe("DELETE");123 expect(init?.method).toBe("DELETE");
123 });124 });
125+
126+ it("postBoardInvite POSTs a class invite to /boards/:id/invite", async () => {
127+ mockFetchSuccess({ id: "b1", participants: ["u1", "u2"] });
128+ const body = { kind: "class", class: "cl1" } as const;
129+ await postBoardInvite("b1", body);
130+
131+ const [url, init] = lastFetchCall();
132+ expect(url).toBe("/api/boards/b1/invite");
133+ expect(init?.method).toBe("POST");
134+ expect(init?.body).toBe(JSON.stringify(body));
135+ });
136+
137+ it("postBoardInvite POSTs a course invite", async () => {
138+ mockFetchSuccess({ id: "b1", participants: [] });
139+ const body = { kind: "course", course: "co1" } as const;
140+ await postBoardInvite("b1", body);
141+ expect(lastFetchCall()[1]?.body).toBe(JSON.stringify(body));
142+ });
143+
144+ it("postBoardInvite POSTs an event invite", async () => {
145+ mockFetchSuccess({ id: "b1", participants: [] });
146+ const body = { kind: "event", event: "e1" } as const;
147+ await postBoardInvite("b1", body);
148+ expect(lastFetchCall()[1]?.body).toBe(JSON.stringify(body));
149+ });
124 });150 });
src/api/__tests__/classes/classes.test.tsmodified+57 -0
@@ -13,6 +13,12 @@ import {
13 postClassCourse,13 postClassCourse,
14 getClassCourses,14 getClassCourses,
15 deleteClassCourse,15 deleteClassCourse,
16+ postClassBlueprint,
17+ getClassBlueprints,
18+ getClassBlueprintByGrade,
19+ patchClassBlueprintByGrade,
20+ deleteClassBlueprintByGrade,
21+ postClassBlueprintApply,
16 } from "../../classes";22 } from "../../classes";
17 import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";23 import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";
18 24
@@ -128,4 +134,55 @@ describe("classes API", () => {
128 expect(url).toBe("/api/classes/c1/courses/co1");134 expect(url).toBe("/api/classes/c1/courses/co1");
129 expect(init?.method).toBe("DELETE");135 expect(init?.method).toBe("DELETE");
130 });136 });
137+
138+ it("postClassBlueprint POSTs /classes/blueprints with the body", async () => {
139+ mockFetchSuccess({ blueprint: { grade: "9", courses: [], creator: {} }, skipped: [] });
140+ const body = { grade: "9", course_ids: ["co1", "co2"] };
141+ await postClassBlueprint(body);
142+ const [url, init] = lastFetchCall();
143+ expect(url).toBe("/api/classes/blueprints");
144+ expect(init?.method).toBe("POST");
145+ expect(init?.body).toBe(JSON.stringify(body));
146+ });
147+
148+ it("getClassBlueprints GETs /classes/blueprints with pagination", async () => {
149+ mockFetchSuccess({ items: [], total: 0 });
150+ await getClassBlueprints({ limit: 20, offset: 40 });
151+ const [url] = lastFetchCall();
152+ expect(url).toBe("/api/classes/blueprints?limit=20&offset=40");
153+ });
154+
155+ it("getClassBlueprintByGrade encodes the grade, which is the record key", async () => {
156+ mockFetchSuccess({ grade: "9/A", courses: [], creator: {} });
157+ await getClassBlueprintByGrade("9/A");
158+ const [url] = lastFetchCall();
159+ expect(url).toBe("/api/classes/blueprints/9%2FA");
160+ });
161+
162+ it("patchClassBlueprintByGrade PATCHes the whole course set", async () => {
163+ mockFetchSuccess({ blueprint: { grade: "9", courses: [], creator: {} }, skipped: [] });
164+ const body = { course_ids: ["co1"] };
165+ await patchClassBlueprintByGrade("9", body);
166+ const [url, init] = lastFetchCall();
167+ expect(url).toBe("/api/classes/blueprints/9");
168+ expect(init?.method).toBe("PATCH");
169+ expect(init?.body).toBe(JSON.stringify(body));
170+ });
171+
172+ it("deleteClassBlueprintByGrade DELETEs /classes/blueprints/:grade", async () => {
173+ mockFetch204();
174+ await deleteClassBlueprintByGrade("9/A");
175+ const [url, init] = lastFetchCall();
176+ expect(url).toBe("/api/classes/blueprints/9%2FA");
177+ expect(init?.method).toBe("DELETE");
178+ });
179+
180+ it("postClassBlueprintApply POSTs /classes/:id/blueprint with no body", async () => {
181+ mockFetchSuccess({ skipped: [] });
182+ await postClassBlueprintApply("c1");
183+ const [url, init] = lastFetchCall();
184+ expect(url).toBe("/api/classes/c1/blueprint");
185+ expect(init?.method).toBe("POST");
186+ expect(init?.body).toBeUndefined();
187+ });
131 });188 });
src/api/__tests__/users/users.test.tsmodified+60 -1
@@ -8,7 +8,13 @@ import { patchUserProfile } from "../../users";
8 import { patchUserRole } from "../../users";8 import { patchUserRole } from "../../users";
9 import { patchMyPreferences } from "../../users";9 import { patchMyPreferences } from "../../users";
10 import { patchUserPreferences } from "../../users";10 import { patchUserPreferences } from "../../users";
11-import { lastFetchCall, mockFetchSuccess } from "../helpers/mock-fetch";11+import { getMyProfile } from "../../users";
12+import { getUserProfile } from "../../users";
13+import { postMyAvatar } from "../../users";
14+import { deleteMyAvatar } from "../../users";
15+import { deleteUserAvatar } from "../../users";
16+import { getUserAvatarUrl } from "../../users";
17+import { lastFetchCall, mockFetch204, mockFetchSuccess } from "../helpers/mock-fetch";
12 18
13 describe("users API", () => {19 describe("users API", () => {
14 afterEach(() => {20 afterEach(() => {
@@ -155,4 +161,57 @@ describe("users API", () => {
155 expect(init?.method).toBe("PATCH");161 expect(init?.method).toBe("PATCH");
156 expect(init?.body).toBe(JSON.stringify(updates));162 expect(init?.body).toBe(JSON.stringify(updates));
157 });163 });
164+
165+ it("getMyProfile calls /users/me/profile", async () => {
166+ const profile = { id: "u1", username: "test", badges: [] };
167+ mockFetchSuccess(profile);
168+
169+ const result = await getMyProfile();
170+ expect(result).toEqual(profile);
171+ const [url] = lastFetchCall();
172+ expect(url).toBe("/api/users/me/profile");
173+ });
174+
175+ it("getUserProfile calls /users/:id/profile", async () => {
176+ mockFetchSuccess({ id: "u2", username: "other", badges: [] });
177+ await getUserProfile("u2");
178+ const [url] = lastFetchCall();
179+ expect(url).toBe("/api/users/u2/profile");
180+ });
181+
182+ it("postMyAvatar POSTs the file as multipart under the `file` field", async () => {
183+ mockFetchSuccess({ content_type: "image/png", size: 1024 }, 201);
184+
185+ const file = new File(["x"], "me.png", { type: "image/png" });
186+ const result = await postMyAvatar(file);
187+ expect(result).toEqual({ content_type: "image/png", size: 1024 });
188+
189+ const [url, init] = lastFetchCall();
190+ expect(url).toBe("/api/users/me/avatar");
191+ expect(init?.method).toBe("POST");
192+ expect(init?.body).toBeInstanceOf(FormData);
193+ expect((init?.body as FormData).get("file")).toBe(file);
194+ });
195+
196+ it("deleteMyAvatar calls DELETE /users/me/avatar", async () => {
197+ mockFetch204();
198+ await deleteMyAvatar();
199+ const [url, init] = lastFetchCall();
200+ expect(url).toBe("/api/users/me/avatar");
201+ expect(init?.method).toBe("DELETE");
202+ });
203+
204+ it("deleteUserAvatar calls DELETE /users/:id/avatar", async () => {
205+ mockFetch204();
206+ await deleteUserAvatar("u2");
207+ const [url, init] = lastFetchCall();
208+ expect(url).toBe("/api/users/u2/avatar");
209+ expect(init?.method).toBe("DELETE");
210+ });
211+
212+ it("getUserAvatarUrl builds a same-origin URL, with the cache-buster only when versioned", () => {
213+ expect(getUserAvatarUrl("u1")).toBe("/api/users/u1/avatar");
214+ expect(getUserAvatarUrl("u1", 3)).toBe("/api/users/u1/avatar?v=3");
215+ expect(getUserAvatarUrl("u/1")).toBe("/api/users/u%2F1/avatar");
216+ });
158 });217 });
src/api/boards/index.tsmodified+1 -0
@@ -6,6 +6,7 @@ export * from "./getBoardStrokes";
6 export * from "./getBoardHistory";6 export * from "./getBoardHistory";
7 export * from "./getBoardEpochs";7 export * from "./getBoardEpochs";
8 export * from "./patchBoardById";8 export * from "./patchBoardById";
9+export * from "./postBoardInvite";
9 export * from "./postBoardClear";10 export * from "./postBoardClear";
10 export * from "./postBoardClose";11 export * from "./postBoardClose";
11 export * from "./deleteBoardById";12 export * from "./deleteBoardById";
src/api/boards/postBoardInvite.tsadded+12 -0
@@ -0,0 +1,12 @@
1+import { client } from "../client";
2+import type { Board, BoardInviteBody } from "./types";
3+
4+// Adds every member of a class, course/club or event to the roster in one
5+// pass. Creator only. Additive and idempotent — it never removes anyone, and
6+// members already on the board are skipped. Parents and ids that no longer
7+// resolve are dropped silently, but going over max_participants refuses the
8+// whole invite with a 409 and adds nobody. A named id that does not exist is a
9+// 400, not a 404 — a 404 here would mean the board itself.
10+export function postBoardInvite(id: string, body: BoardInviteBody): Promise<Board> {
11+ return client<Board>(`/boards/${encodeURIComponent(id)}/invite`, { method: "POST", body });
12+}
src/api/boards/types.tsmodified+7 -0
@@ -45,5 +45,12 @@ export type UpdateBoardBody = {
45 locked?: boolean;45 locked?: boolean;
46 };46 };
47 47
48+// POST /boards/{id}/invite, tagged by `kind` — send exactly one id key.
49+// A club is just a course whose kind is "club", so it rides the "course" arm.
50+export type BoardInviteBody =
51+ | { kind: "class"; class: string }
52+ | { kind: "course"; course: string }
53+ | { kind: "event"; event: string };
54+
48 // GET /boards/{id}/history: `epoch` narrows to one epoch; omit for whole life.55 // GET /boards/{id}/history: `epoch` narrows to one epoch; omit for whole life.
49 export type BoardHistoryParams = PageParams & { epoch?: number };56 export type BoardHistoryParams = PageParams & { epoch?: number };
src/api/classes/deleteClassBlueprintByGrade.tsadded+7 -0
@@ -0,0 +1,7 @@
1+import { client } from "../client";
2+
3+// Detaches every course this blueprint attached, across every class at the
4+// grade, then drops the template. Hand-attached courses stay.
5+export function deleteClassBlueprintByGrade(grade: string): Promise<void> {
6+ return client<void>(`/classes/blueprints/${encodeURIComponent(grade)}`, { method: "DELETE" });
7+}
src/api/classes/getClassBlueprintByGrade.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import type { ClassBlueprint } from "../client";
3+
4+// The grade label is the record key and is free text, so it must be encoded —
5+// a grade like "9/A" would otherwise read as a second path segment.
6+export function getClassBlueprintByGrade(grade: string, signal?: AbortSignal): Promise<ClassBlueprint> {
7+ return client<ClassBlueprint>(`/classes/blueprints/${encodeURIComponent(grade)}`, { signal });
8+}
src/api/classes/getClassBlueprints.tsadded+11 -0
@@ -0,0 +1,11 @@
1+import { client } from "../client";
2+import { normalizePage, pageQuery, type Page, type PageParams } from "../client";
3+import type { ClassBlueprint } from "../client";
4+
5+export async function getClassBlueprints(
6+ params?: PageParams,
7+ signal?: AbortSignal,
8+): Promise<Page<ClassBlueprint>> {
9+ const data = await client<unknown>(`/classes/blueprints${pageQuery(params)}`, { signal });
10+ return normalizePage<ClassBlueprint>(data);
11+}
src/api/classes/index.tsmodified+6 -0
@@ -11,3 +11,9 @@ export * from "./deleteClassMember";
11 export * from "./postClassCourse";11 export * from "./postClassCourse";
12 export * from "./getClassCourses";12 export * from "./getClassCourses";
13 export * from "./deleteClassCourse";13 export * from "./deleteClassCourse";
14+export * from "./postClassBlueprint";
15+export * from "./getClassBlueprints";
16+export * from "./getClassBlueprintByGrade";
17+export * from "./patchClassBlueprintByGrade";
18+export * from "./deleteClassBlueprintByGrade";
19+export * from "./postClassBlueprintApply";
src/api/classes/patchClassBlueprintByGrade.tsadded+19 -0
@@ -0,0 +1,19 @@
1+import { client } from "../client";
2+import type { BlueprintResult } from "../client";
3+
4+// `course_ids` is the whole set, not a delta: a course dropped from it is
5+// detached from every class at this grade that the blueprint attached it to.
6+// Hand-attached courses are never touched.
7+export type UpdateBlueprintBody = { course_ids: string[] };
8+
9+// A 409 means the blueprint changed since it was read — there is no version to
10+// echo back, so re-read it and let the user resubmit from the fresh list.
11+export function patchClassBlueprintByGrade(
12+ grade: string,
13+ body: UpdateBlueprintBody,
14+): Promise<BlueprintResult> {
15+ return client<BlueprintResult>(`/classes/blueprints/${encodeURIComponent(grade)}`, {
16+ method: "PATCH",
17+ body,
18+ });
19+}
src/api/classes/postClassBlueprint.tsadded+11 -0
@@ -0,0 +1,11 @@
1+import { client } from "../client";
2+import type { BlueprintResult } from "../client";
3+
4+export type CreateBlueprintBody = { grade: string; course_ids: string[] };
5+
6+// Manager+. Creates the blueprint and immediately applies it to every existing
7+// class at that grade; pairs that could not land come back in `skipped`.
8+// A grade that already holds a blueprint is a 409.
9+export function postClassBlueprint(body: CreateBlueprintBody): Promise<BlueprintResult> {
10+ return client<BlueprintResult>("/classes/blueprints", { method: "POST", body });
11+}
src/api/classes/postClassBlueprintApply.tsadded+10 -0
@@ -0,0 +1,10 @@
1+import { client } from "../client";
2+import type { BlueprintApplyResult } from "../client";
3+
4+// Applies this class's grade blueprint to this one class. A 404 means either
5+// the class is gone or no blueprint covers its grade.
6+export function postClassBlueprintApply(classId: string): Promise<BlueprintApplyResult> {
7+ return client<BlueprintApplyResult>(`/classes/${encodeURIComponent(classId)}/blueprint`, {
8+ method: "POST",
9+ });
10+}
src/api/client/types.tsmodified+102 -0
@@ -26,12 +26,16 @@ export type User = {
26 palette_color: string | null;26 palette_color: string | null;
27 };27 };
28 28
29+// PATCH /users/me and PATCH /users/{id}/profile take the same body: an omitted
30+// (or null) field is left alone, an empty string clears it.
29 export type ProfileUpdate = {31 export type ProfileUpdate = {
30 name?: string | null;32 name?: string | null;
31 surname?: string | null;33 surname?: string | null;
32 email?: string | null;34 email?: string | null;
33 phone?: string | null;35 phone?: string | null;
34 birth_date?: string | null;36 birth_date?: string | null;
37+ display_name?: string | null;
38+ bio?: string | null;
35 };39 };
36 40
37 export type PersonRef = {41 export type PersonRef = {
@@ -40,6 +44,61 @@ export type PersonRef = {
40 display_name: string | null;44 display_name: string | null;
41 };45 };
42 46
47+// The lifetime counter a badge reads. Badges sharing a stat form a ladder.
48+export type BadgeStat =
49+ | "homework_submitted"
50+ | "homework_on_time"
51+ | "exam_sat"
52+ | "pomodoro_finished"
53+ | "pomodoro_focus_ms";
54+
55+// One entry of the badge catalogue, served by GET /limits. The label and icon
56+// behind an id live in the client, exactly as they do for a role.
57+export type BadgeCatalogEntry = { id: string; stat: BadgeStat | string; threshold: number };
58+
59+// A badge a person has earned. Awards are permanent and `earned_at` is the
60+// moment of first crossing, unix ms.
61+export type EarnedBadge = { id: string; earned_at: number };
62+
63+export type AvatarMeta = { content_type: string; size: number };
64+
65+export type ProfileClassRef = { id: string; name: string; grade: string | null };
66+
67+export type ProfileCourseRef = { id: string; title: string; kind: CourseKind };
68+
69+// Lifetime counters behind the badge ladders, plus the two live totals the
70+// capped `classes`/`courses` lists would otherwise hide.
71+export type ProfileStats = {
72+ pomodoro_sessions: number;
73+ pomodoro_focus_ms: number;
74+ courses: number;
75+ classes: number;
76+ homework_submitted_total: number;
77+ homework_on_time_total: number;
78+ exam_sat_total: number;
79+ pomodoro_finished_total: number;
80+ pomodoro_focus_ms_total: number;
81+};
82+
83+// A person's public profile. Readable by any authenticated account except a
84+// parent, who only reaches their own and their linked students'. Never carries
85+// email, phone or birth date at any role — those stay on GET /users/{id}.
86+export type Profile = {
87+ id: string;
88+ username: string;
89+ display_name: string | null;
90+ role: Role;
91+ bio: string | null;
92+ avatar: AvatarMeta | null;
93+ // Capped at limits.user.max_profile_classes; stats.classes holds the true total.
94+ classes: ProfileClassRef[];
95+ // Capped at limits.user.max_profile_courses, and filtered to what the reader
96+ // may see; stats.courses holds the owner's true, unfiltered total.
97+ courses: ProfileCourseRef[];
98+ badges: EarnedBadge[];
99+ stats: ProfileStats;
100+};
101+
43 export type Note = {102 export type Note = {
44 id: string;103 id: string;
45 title: string;104 title: string;
@@ -195,6 +254,29 @@ export type ClassCourse = {
195 attached_by: PersonRef;254 attached_by: PersonRef;
196 };255 };
197 256
257+// A grade blueprint: the set of courses every class at one grade takes. The
258+// grade label is the record's key, so there is at most one per grade. Creating
259+// or editing one applies it to every existing class at that grade right away.
260+export type ClassBlueprint = {
261+ grade: string;
262+ courses: string[];
263+ creator: PersonRef;
264+};
265+
266+// One (class, course) pair a blueprint could not attach. Applying is
267+// best-effort: a pair that cannot land is reported here and the rest still go
268+// through. `reason` is backend English — localize it, never render it raw.
269+export type BlueprintSkip = {
270+ class: string;
271+ class_name: string;
272+ course: string;
273+ reason: string;
274+};
275+
276+export type BlueprintResult = { blueprint: ClassBlueprint; skipped: BlueprintSkip[] };
277+
278+export type BlueprintApplyResult = { skipped: BlueprintSkip[] };
279+
198 export type CourseSession = {280 export type CourseSession = {
199 id: string;281 id: string;
200 course: string;282 course: string;
@@ -499,6 +581,12 @@ export type Limits = {
499 min_password_len: number;581 min_password_len: number;
500 max_password_len: number;582 max_password_len: number;
501 max_name_len: number;583 max_name_len: number;
584+ max_display_name_len: number;
585+ max_bio_len: number;
586+ // Caps on what a profile read embeds, not on membership: the full lists
587+ // stay at /courses/me and /classes/me.
588+ max_profile_courses: number;
589+ max_profile_classes: number;
502 max_email_len: number;590 max_email_len: number;
503 min_phone_digits: number;591 min_phone_digits: number;
504 max_phone_digits: number;592 max_phone_digits: number;
@@ -507,6 +595,7 @@ export type Limits = {
507 languages: UserLanguage[];595 languages: UserLanguage[];
508 session_duration_days: number;596 session_duration_days: number;
509 };597 };
598+ badges: { catalog: BadgeCatalogEntry[] };
510 note: { max_title_len: number; max_content_len: number; max_files: number };599 note: { max_title_len: number; max_content_len: number; max_files: number };
511 file: {600 file: {
512 max_name_len: number;601 max_name_len: number;
@@ -601,6 +690,19 @@ export type Limits = {
601 max_max_threads: number;690 max_max_threads: number;
602 default_max_threads: number;691 default_max_threads: number;
603 };692 };
693+ board: {
694+ max_title_len: number;
695+ // People the creator may name onto one board. Every participant draws, so
696+ // this also bounds a room's writer count.
697+ max_participants: number;
698+ max_stroke_payload_len: number;
699+ max_epoch_strokes: number;
700+ max_board_strokes: number;
701+ max_boards_per_creator: number;
702+ stroke_kinds: string[];
703+ ws_tick_secs: number;
704+ ws_max_board_id_len: number;
705+ };
604 settings: {706 settings: {
605 max_list_len: number;707 max_list_len: number;
606 max_item_len: number;708 max_item_len: number;
src/api/users/deleteMyAvatar.tsadded+5 -0
@@ -0,0 +1,5 @@
1+import { client } from "../client";
2+
3+export function deleteMyAvatar(): Promise<void> {
4+ return client<void>("/users/me/avatar", { method: "DELETE" });
5+}
src/api/users/deleteUserAvatar.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+
3+// Admin-only moderation delete of someone else's avatar.
4+export function deleteUserAvatar(id: string): Promise<void> {
5+ return client<void>(`/users/${encodeURIComponent(id)}/avatar`, { method: "DELETE" });
6+}
src/api/users/getMyProfile.tsadded+6 -0
@@ -0,0 +1,6 @@
1+import { client } from "../client";
2+import type { Profile } from "../client";
3+
4+export function getMyProfile(signal?: AbortSignal): Promise<Profile> {
5+ return client<Profile>("/users/me/profile", { signal });
6+}
src/api/users/getUserAvatarUrl.tsadded+9 -0
@@ -0,0 +1,9 @@
1+// The avatar endpoint answers with raw image bytes, so it is read through a
2+// plain <img src>, not fetch: /api is same-origin, which carries the session
3+// cookie on its own. `version` is a cache-buster the caller bumps after an
4+// upload or delete — the URL is otherwise identical before and after, and the
5+// browser's in-memory image cache would keep serving the old bytes.
6+export function getUserAvatarUrl(userId: string, version?: number): string {
7+ const bust = version ? `?v=${version}` : "";
8+ return `/api/users/${encodeURIComponent(userId)}/avatar${bust}`;
9+}
src/api/users/getUserProfile.tsadded+8 -0
@@ -0,0 +1,8 @@
1+import { client } from "../client";
2+import type { Profile } from "../client";
3+
4+// Any authenticated account may read any profile, except a parent, who reaches
5+// only their own and their linked students' (403 otherwise).
6+export function getUserProfile(id: string, signal?: AbortSignal): Promise<Profile> {
7+ return client<Profile>(`/users/${encodeURIComponent(id)}/profile`, { signal });
8+}
src/api/users/index.tsmodified+6 -0
@@ -7,3 +7,9 @@ export * from "./patchUserProfile";
7 export * from "./patchUserRole";7 export * from "./patchUserRole";
8 export * from "./patchMyPreferences";8 export * from "./patchMyPreferences";
9 export * from "./patchUserPreferences";9 export * from "./patchUserPreferences";
10+export * from "./getMyProfile";
11+export * from "./getUserProfile";
12+export * from "./postMyAvatar";
13+export * from "./deleteMyAvatar";
14+export * from "./deleteUserAvatar";
15+export * from "./getUserAvatarUrl";
src/api/users/postMyAvatar.tsadded+10 -0
@@ -0,0 +1,10 @@
1+import { formClient } from "../client";
2+import type { AvatarMeta } from "../client";
3+
4+// PNG, JPEG, WebP or GIF only — no SVG — under the school's max_file_bytes.
5+// Uploading over an existing avatar replaces it.
6+export function postMyAvatar(file: File, signal?: AbortSignal): Promise<AvatarMeta> {
7+ const body = new FormData();
8+ body.append("file", file);
9+ return formClient<AvatarMeta>("/users/me/avatar", body, signal);
10+}
src/components/classes/blueprint-panel.tsxadded+179 -0
@@ -0,0 +1,179 @@
1+import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
2+import {
3+ getClassBlueprintByGrade,
4+ patchClassBlueprintByGrade,
5+ postClassBlueprint,
6+} from "@/api/classes";
7+import { ApiError, formatApiError, type BlueprintResult, type ClassBlueprint, type Course } from "@/api/client";
8+import { Alert } from "@/components/ui/alert";
9+import { Button } from "@/components/ui/button";
10+import { Input } from "@/components/ui/input";
11+import { Label } from "@/components/ui/label";
12+import { SidePanel } from "@/components/ui/side-panel";
13+import { courseKindLabel } from "@/lib/course-kind";
14+import { useT } from "@/stores/preferences-context";
15+
16+export function BlueprintPanel(props: {
17+ open: boolean;
18+ onOpenChange: (open: boolean) => void;
19+ /** null creates a new blueprint; set edits that grade's course set. */
20+ blueprint: ClassBlueprint | null;
21+ courses: Course[];
22+ maxCourses: number;
23+ maxGradeLen: number;
24+ onSaved: (result: BlueprintResult) => void;
25+}) {
26+ const t = useT();
27+ const [grade, setGrade] = createSignal("");
28+ const [selected, setSelected] = createSignal<string[]>([]);
29+ const [filter, setFilter] = createSignal("");
30+ const [error, setError] = createSignal("");
31+ const [warning, setWarning] = createSignal("");
32+ const [pending, setPending] = createSignal(false);
33+
34+ const editing = () => props.blueprint !== null;
35+
36+ // The panel instance is reused between "edit grade 9" and "edit grade 10",
37+ // and props are not read at construction time in Solid — seeding these at
38+ // the top of the component would freeze the first blueprint's course set.
39+ createEffect(() => {
40+ if (!props.open) return;
41+ const bp = props.blueprint;
42+ setGrade(bp?.grade ?? "");
43+ setSelected(bp?.courses ? [...bp.courses] : []);
44+ setFilter("");
45+ setError("");
46+ setWarning("");
47+ });
48+
49+ const visibleCourses = createMemo(() => {
50+ const q = filter().trim().toLocaleLowerCase("tr-TR");
51+ if (!q) return props.courses;
52+ return props.courses.filter((c) => c.title.toLocaleLowerCase("tr-TR").includes(q));
53+ });
54+
55+ const isSelected = (id: string) => selected().includes(id);
56+ const atCeiling = () => selected().length >= props.maxCourses;
57+
58+ const toggle = (id: string) => {
59+ setSelected((prev) => (prev.includes(id) ? prev.filter((c) => c !== id) : [...prev, id]));
60+ };
61+
62+ // A losing race has no version token to retry with, so re-read the blueprint,
63+ // reseed the checkboxes from the server's list, and let the user resubmit.
64+ const reseedFromServer = async (g: string) => {
65+ try {
66+ const fresh = await getClassBlueprintByGrade(g);
67+ setSelected([...fresh.courses]);
68+ setWarning(t("classBlueprints.staleReload"));
69+ setError("");
70+ } catch (err) {
71+ setError(formatApiError(err));
72+ }
73+ };
74+
75+ const submit = async (e: Event) => {
76+ e.preventDefault();
77+ const g = grade().trim();
78+ if (!g) return;
79+ setError("");
80+ setWarning("");
81+ setPending(true);
82+ try {
83+ const result = editing()
84+ ? await patchClassBlueprintByGrade(g, { course_ids: selected() })
85+ : await postClassBlueprint({ grade: g, course_ids: selected() });
86+ props.onSaved(result);
87+ } catch (err) {
88+ if (err instanceof ApiError && err.status === 409) {
89+ if (editing()) {
90+ await reseedFromServer(g);
91+ } else {
92+ setError(t("classBlueprints.conflictExists"));
93+ }
94+ } else {
95+ setError(formatApiError(err));
96+ }
97+ } finally {
98+ setPending(false);
99+ }
100+ };
101+
102+ return (
103+ <SidePanel
104+ open={props.open}
105+ onOpenChange={props.onOpenChange}
106+ title={editing() ? t("classBlueprints.edit") : t("classBlueprints.new")}
107+ description={t("classBlueprints.selectCourses")}
108+ size="wide"
109+ >
110+ <form onSubmit={submit} class="space-y-4">
111+ <Show when={warning()}>
112+ <Alert class="border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200">{warning()}</Alert>
113+ </Show>
114+
115+ <div class="space-y-1.5">
116+ <Label for="bp-grade">{t("classBlueprints.grade")}</Label>
117+ <Input
118+ id="bp-grade"
119+ class="h-10"
120+ maxlength={props.maxGradeLen}
121+ value={grade()}
122+ disabled={editing()}
123+ onInput={(e) => setGrade(e.currentTarget.value)}
124+ />
125+ <p class="text-xs text-muted-foreground">{t("classBlueprints.gradeHint")}</p>
126+ </div>
127+
128+ <div class="space-y-2">
129+ <div class="flex flex-wrap items-baseline justify-between gap-2">
130+ <Label for="bp-filter">{t("classBlueprints.courses")}</Label>
131+ <span class="text-xs tabular-nums text-muted-foreground">
132+ {t("classBlueprints.selected", { count: selected().length, max: props.maxCourses })}
133+ </span>
134+ </div>
135+ <p class="text-xs text-muted-foreground">{t("classBlueprints.wholeSetHint")}</p>
136+ <Input
137+ id="bp-filter"
138+ class="h-8 rounded-lg text-[13px]"
139+ placeholder={t("classBlueprints.filterCourses")}
140+ value={filter()}
141+ onInput={(e) => setFilter(e.currentTarget.value)}
142+ />
143+ <div class="max-h-72 space-y-1 overflow-y-auto rounded-lg border border-border/70 p-2">
144+ <Show
145+ when={visibleCourses().length > 0}
146+ fallback={<p class="p-2 text-sm text-muted-foreground">{t("classBlueprints.noCourseMatch")}</p>}
147+ >
148+ <For each={visibleCourses()}>
149+ {(course) => (
150+ <label class="flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/60">
151+ <input
152+ type="checkbox"
153+ class="h-4 w-4 shrink-0 accent-primary"
154+ checked={isSelected(course.id)}
155+ disabled={!isSelected(course.id) && atCeiling()}
156+ onChange={() => toggle(course.id)}
157+ />
158+ <span class="min-w-0 flex-1 truncate">{course.title}</span>
159+ <span class="shrink-0 text-xs text-muted-foreground">{courseKindLabel(course.kind, t)}</span>
160+ </label>
161+ )}
162+ </For>
163+ </Show>
164+ </div>
165+ </div>
166+
167+ <Show when={error()}>
168+ <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>
169+ </Show>
170+
171+ <div class="flex justify-end">
172+ <Button type="submit" class="w-full sm:w-auto" disabled={pending() || !grade().trim()}>
173+ {t("common.save")}
174+ </Button>
175+ </div>
176+ </form>
177+ </SidePanel>
178+ );
179+}
src/components/classes/blueprint-skipped-report.tsxadded+52 -0
@@ -0,0 +1,52 @@
1+import { createMemo } from "solid-js";
2+import type { ColumnDef } from "@tanstack/solid-table";
3+import type { BlueprintSkip } from "@/api/client";
4+import { DataTable } from "@/components/ui/data-table";
5+import { SidePanel } from "@/components/ui/side-panel";
6+import { skipReasonCopy } from "@/lib/blueprint-skip";
7+import { useT } from "@/stores/preferences-context";
8+
9+export function BlueprintSkippedReport(props: {
10+ open: boolean;
11+ onOpenChange: (open: boolean) => void;
12+ skipped: BlueprintSkip[];
13+ /** Resolves a course id to its title; falls back to the id when unknown. */
14+ courseTitle: (id: string) => string;
15+}) {
16+ const t = useT();
17+
18+ const columns = createMemo<ColumnDef<BlueprintSkip>[]>(() => [
19+ {
20+ id: "class",
21+ accessorFn: (row) => row.class_name || row.class,
22+ header: t("classBlueprints.skippedClass"),
23+ meta: { cellClass: "font-medium" },
24+ },
25+ {
26+ id: "course",
27+ accessorFn: (row) => props.courseTitle(row.course),
28+ header: t("classBlueprints.skippedCourse"),
29+ },
30+ {
31+ id: "reason",
32+ accessorFn: (row) => {
33+ const copy = skipReasonCopy(row.reason, props.courseTitle(row.course));
34+ return t(copy.key, copy.vars);
35+ },
36+ header: t("classBlueprints.skippedReason"),
37+ meta: { cellClass: "text-muted-foreground" },
38+ },
39+ ]);
40+
41+ return (
42+ <SidePanel
43+ open={props.open}
44+ onOpenChange={props.onOpenChange}
45+ title={t("classBlueprints.skippedTitle")}
46+ description={t("classBlueprints.skippedSubtitle")}
47+ size="wide"
48+ >
49+ <DataTable columns={columns()} data={props.skipped} />
50+ </SidePanel>
51+ );
52+}
src/components/classes/blueprints-tab.tsxadded+199 -0
@@ -0,0 +1,199 @@
1+import { Show, createMemo, createResource, createSignal } from "solid-js";
2+import type { ColumnDef } from "@tanstack/solid-table";
3+import { deleteClassBlueprintByGrade, getClassBlueprints } from "@/api/classes";
4+import { getCourses } from "@/api/courses";
5+import { getLimits } from "@/api/limits";
6+import { formatApiError, type BlueprintSkip, type ClassBlueprint } from "@/api/client";
7+import { BlueprintPanel } from "@/components/classes/blueprint-panel";
8+import { BlueprintSkippedReport } from "@/components/classes/blueprint-skipped-report";
9+import { Alert } from "@/components/ui/alert";
10+import { Button } from "@/components/ui/button";
11+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
12+import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
13+import { IconEdit, IconPlus, IconTrash } from "@/components/ui/icons";
14+import { TableRowActions } from "@/components/ui/table-row-actions";
15+import { createFlash } from "@/lib/flash";
16+import { personLabel } from "@/lib/person";
17+import { useT } from "@/stores/preferences-context";
18+
19+export function BlueprintsTab(props: {
20+ /** Every blueprint route is manager+; below that the tab is not rendered. */
21+ canManage: () => boolean;
22+ /** Tabs keep both panels mounted, so the list is only fetched once opened. */
23+ active: () => boolean;
24+}) {
25+ const t = useT();
26+ const [error, setError] = createSignal("");
27+ const [flash, setFlash] = createFlash();
28+ const [panelOpen, setPanelOpen] = createSignal(false);
29+ const [editing, setEditing] = createSignal<ClassBlueprint | null>(null);
30+ const [deleting, setDeleting] = createSignal<ClassBlueprint | null>(null);
31+ const [skipped, setSkipped] = createSignal<BlueprintSkip[]>([]);
32+ const [reportOpen, setReportOpen] = createSignal(false);
33+
34+ const enabled = () => (props.active() && props.canManage() ? true : null);
35+ const [list, { refetch }] = createResource(enabled, async () =>
36+ (await getClassBlueprints({ limit: 200 })).items,
37+ );
38+ const [courses] = createResource(enabled, async () => (await getCourses({ limit: 200 })).items);
39+ const [limits] = createResource(enabled, () => getLimits());
40+
41+ const courseTitle = (id: string) => courses.latest?.find((c) => c.id === id)?.title ?? id;
42+
43+ const columns = createMemo<ColumnDef<ClassBlueprint>[]>(() => [
44+ {
45+ id: "grade",
46+ accessorFn: (row) => row.grade,
47+ header: t("classBlueprints.grade"),
48+ meta: { cellClass: "font-medium" },
49+ },
50+ {
51+ id: "count",
52+ accessorFn: (row) => t("classBlueprints.courseCount", { count: row.courses.length }),
53+ header: t("classBlueprints.courseCountColumn"),
54+ },
55+ {
56+ id: "titles",
57+ accessorFn: (row) => {
58+ const names = row.courses.slice(0, 3).map(courseTitle);
59+ const rest = row.courses.length - names.length;
60+ return rest > 0 ? `${names.join(", ")} +${rest}` : names.join(", ") || "—";
61+ },
62+ header: t("classBlueprints.courses"),
63+ meta: { cellClass: "text-muted-foreground" },
64+ },
65+ {
66+ id: "creator",
67+ accessorFn: (row) => personLabel(row.creator),
68+ header: t("common.creator"),
69+ meta: { cellClass: "text-muted-foreground" },
70+ },
71+ {
72+ id: "actions",
73+ header: t("common.actions"),
74+ meta: { headerClass: "w-14 text-center", cellClass: "px-1 text-center" },
75+ cell: (cell) => (
76+ <TableRowActions
77+ label={t("common.actions")}
78+ actions={[
79+ {
80+ label: t("classBlueprints.edit"),
81+ icon: <IconEdit class="h-4 w-4" />,
82+ onSelect: () => {
83+ setEditing(cell.row.original);
84+ setPanelOpen(true);
85+ },
86+ },
87+ {
88+ label: t("classBlueprints.delete"),
89+ icon: <IconTrash class="h-4 w-4" />,
90+ destructive: true,
91+ onSelect: () => setDeleting(cell.row.original),
92+ },
93+ ]}
94+ />
95+ ),
96+ },
97+ ]);
98+
99+ // A saved blueprint is not an error even when some pairs did not attach: the
100+ // template was written either way, so the toast fires and the shortfall is a
101+ // separate, dismissible report.
102+ const handleSaved = async (rows: BlueprintSkip[]) => {
103+ setPanelOpen(false);
104+ setEditing(null);
105+ await refetch();
106+ setSkipped(rows);
107+ setFlash(t("classBlueprints.saved"));
108+ };
109+
110+ const remove = async () => {
111+ const bp = deleting();
112+ if (!bp) return;
113+ setError("");
114+ try {
115+ await deleteClassBlueprintByGrade(bp.grade);
116+ setDeleting(null);
117+ await refetch();
118+ setFlash(t("classBlueprints.deleted"));
119+ } catch (err) {
120+ setError(formatApiError(err));
121+ }
122+ };
123+
124+ return (
125+ <div class="space-y-4">
126+ <Show when={flash()}>
127+ <Alert variant="success">{flash()}</Alert>
128+ </Show>
129+ <Show when={error()}>
130+ <Alert variant="destructive">{error()}</Alert>
131+ </Show>
132+ <Show when={skipped().length > 0}>
133+ <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200">
134+ <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span>
135+ <Button type="button" size="sm" variant="outline" class="shrink-0 rounded-lg" onClick={() => setReportOpen(true)}>
136+ {t("classBlueprints.skippedDetails")}
137+ </Button>
138+ </Alert>
139+ </Show>
140+
141+ {/* The list is read through `.latest`, so a refetch after a save never
142+ re-suspends the tab; the skeleton only covers the first load. */}
143+ <Show when={!list.loading || list.latest} fallback={<DataTableSkeleton />}>
144+ <DataTable
145+ columns={columns()}
146+ data={list.latest ?? []}
147+ filterColumn="grade"
148+ enablePagination
149+ pageSize={10}
150+ title={t("classBlueprints.title")}
151+ description={t("classBlueprints.subtitle")}
152+ empty={t("classBlueprints.empty")}
153+ actions={
154+ <Button
155+ size="sm"
156+ class="min-w-30 rounded-lg"
157+ onClick={() => {
158+ setEditing(null);
159+ setPanelOpen(true);
160+ }}
161+ >
162+ <IconPlus class="h-4 w-4" />
163+ {t("classBlueprints.new")}
164+ </Button>
165+ }
166+ />
167+ </Show>
168+
169+ <BlueprintPanel
170+ open={panelOpen()}
171+ onOpenChange={(open) => {
172+ setPanelOpen(open);
173+ if (!open) setEditing(null);
174+ }}
175+ blueprint={editing()}
176+ courses={courses.latest ?? []}
177+ maxCourses={limits.latest?.course.max_class_courses ?? 50}
178+ maxGradeLen={limits.latest?.course.max_class_grade_len ?? 20}
179+ onSaved={(result) => void handleSaved(result.skipped)}
180+ />
181+
182+ <BlueprintSkippedReport
183+ open={reportOpen()}
184+ onOpenChange={setReportOpen}
185+ skipped={skipped()}
186+ courseTitle={courseTitle}
187+ />
188+
189+ <ConfirmDialog
190+ open={deleting() !== null}
191+ onOpenChange={(open) => !open && setDeleting(null)}
192+ title={t("classBlueprints.delete")}
193+ summary={t("classBlueprints.deleteConfirm", { grade: deleting()?.grade ?? "" })}
194+ variant="destructive"
195+ onConfirm={remove}
196+ />
197+ </div>
198+ );
199+}
src/components/ui/tooltip.tsxadded+31 -0
@@ -0,0 +1,31 @@
1+import { Tooltip as TooltipPrimitive } from "@kobalte/core/tooltip";
2+import type { ComponentProps, ValidComponent } from "solid-js";
3+import { splitProps } from "solid-js";
4+import { cn } from "@/lib/cn";
5+
6+// Kobalte's tooltip opens on hover and on keyboard focus, so a focusable
7+// trigger reaches keyboard users too. It is deliberately not a touch surface:
8+// anything a tooltip says must also be readable without it, since a tap can
9+// never open one.
10+export const Tooltip = TooltipPrimitive;
11+export const TooltipTrigger = TooltipPrimitive.Trigger;
12+
13+export function TooltipContent<T extends ValidComponent = "div">(
14+ props: ComponentProps<typeof TooltipPrimitive.Content<T>>,
15+) {
16+ const [local, rest] = splitProps(props as ComponentProps<typeof TooltipPrimitive.Content>, [
17+ "class",
18+ ]);
19+ return (
20+ <TooltipPrimitive.Portal>
21+ <TooltipPrimitive.Content
22+ class={cn(
23+ "z-50 max-w-64 rounded-md border border-border/80 bg-popover px-3 py-2 text-xs text-popover-foreground shadow-xl shadow-black/10",
24+ "origin-(--kb-tooltip-content-transform-origin) animate-in fade-in-0 zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
25+ local.class,
26+ )}
27+ {...rest}
28+ />
29+ </TooltipPrimitive.Portal>
30+ );
31+}
src/components/users/avatar-upload.tsxadded+130 -0
@@ -0,0 +1,130 @@
1+import { Show, createResource, createSignal } from "solid-js";
2+import { formatApiError } from "@/api/client";
3+import { getLimits } from "@/api/limits";
4+import { deleteMyAvatar, postMyAvatar } from "@/api/users";
5+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
6+import {
7+ DropdownMenu,
8+ DropdownMenuContent,
9+ DropdownMenuItem,
10+ DropdownMenuTrigger,
11+} from "@/components/ui/dropdown-menu";
12+import { IconEdit, IconTrash, IconUploadCloud } from "@/components/ui/icons";
13+import { UserAvatar } from "@/components/users/user-avatar";
14+import { AVATAR_ACCEPT, AVATAR_CONTENT_TYPES, bumpAvatarRevision, formatBytes } from "@/lib/avatar";
15+import { useT } from "@/stores/preferences-context";
16+
17+export function AvatarUpload(props: {
18+ userId: string;
19+ name: string;
20+ hasAvatar: boolean;
21+ /** Re-read the profile so `avatar` reflects what was just written. */
22+ onChanged: () => void | Promise<void>;
23+}) {
24+ const t = useT();
25+ const [limits] = createResource(() => getLimits());
26+ const [busy, setBusy] = createSignal(false);
27+ const [error, setError] = createSignal("");
28+ const [removeOpen, setRemoveOpen] = createSignal(false);
29+ let input: HTMLInputElement | undefined;
30+
31+ const maxBytes = () => limits.latest?.file.default_max_file_bytes ?? 5 * 1024 * 1024;
32+
33+ const pick = async (file: File) => {
34+ setError("");
35+ if (!AVATAR_CONTENT_TYPES.includes(file.type)) {
36+ setError(t("avatar.typeInvalid"));
37+ return;
38+ }
39+ if (file.size > maxBytes()) {
40+ setError(t("avatar.tooLarge", { size: formatBytes(maxBytes()) }));
41+ return;
42+ }
43+ setBusy(true);
44+ try {
45+ await postMyAvatar(file);
46+ bumpAvatarRevision();
47+ await props.onChanged();
48+ } catch (err) {
49+ setError(formatApiError(err));
50+ } finally {
51+ setBusy(false);
52+ }
53+ };
54+
55+ const remove = async () => {
56+ setError("");
57+ setBusy(true);
58+ try {
59+ await deleteMyAvatar();
60+ bumpAvatarRevision();
61+ await props.onChanged();
62+ } catch (err) {
63+ setError(formatApiError(err));
64+ } finally {
65+ setBusy(false);
66+ }
67+ };
68+
69+ return (
70+ <div class="space-y-1.5">
71+ {/* The photo controls hang off the avatar itself rather than sitting
72+ beside it as a row of buttons, so the header reads as a person, not
73+ as a form. */}
74+ <div class="relative w-fit">
75+ <UserAvatar userId={props.userId} name={props.name} hasAvatar={props.hasAvatar} size="xl" />
76+ <DropdownMenu placement="bottom-start" gutter={6}>
77+ <DropdownMenuTrigger
78+ class="absolute -right-1 -top-1 flex h-7 w-7 items-center justify-center rounded-full border border-card bg-primary text-primary-foreground shadow-sm outline-hidden transition-colors hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60"
79+ disabled={busy()}
80+ aria-label={t("avatar.title")}
81+ >
82+ <IconEdit class="h-3.5 w-3.5" />
83+ </DropdownMenuTrigger>
84+ <DropdownMenuContent class="w-56">
85+ <DropdownMenuItem class="gap-2.5 rounded-lg" onSelect={() => input?.click()}>
86+ <IconUploadCloud class="h-4 w-4 shrink-0 text-muted-foreground" />
87+ <span>{props.hasAvatar ? t("avatar.change") : t("avatar.upload")}</span>
88+ </DropdownMenuItem>
89+ <Show when={props.hasAvatar}>
90+ <DropdownMenuItem destructive class="gap-2.5 rounded-lg" onSelect={() => setRemoveOpen(true)}>
91+ <IconTrash class="h-4 w-4 shrink-0" />
92+ <span>{t("avatar.remove")}</span>
93+ </DropdownMenuItem>
94+ </Show>
95+ <p class="px-2 pb-1.5 pt-1 text-[11px] leading-snug text-muted-foreground">
96+ {t("avatar.hint", { size: formatBytes(maxBytes()) })}
97+ </p>
98+ </DropdownMenuContent>
99+ </DropdownMenu>
100+ </div>
101+
102+ <Show when={error()}>
103+ <p class="max-w-40 text-xs text-destructive">{error()}</p>
104+ </Show>
105+
106+ <input
107+ ref={input}
108+ type="file"
109+ accept={AVATAR_ACCEPT}
110+ class="hidden"
111+ onChange={(e) => {
112+ const file = e.currentTarget.files?.[0];
113+ // Clear it before awaiting, so picking the same file twice in a row
114+ // still fires a change event.
115+ e.currentTarget.value = "";
116+ if (file) void pick(file);
117+ }}
118+ />
119+
120+ <ConfirmDialog
121+ open={removeOpen()}
122+ onOpenChange={setRemoveOpen}
123+ title={t("avatar.remove")}
124+ summary={t("avatar.removeConfirm")}
125+ variant="destructive"
126+ onConfirm={remove}
127+ />
128+ </div>
129+ );
130+}
src/components/users/badge-grid.test.tsxadded+67 -0
@@ -0,0 +1,67 @@
1+import { render, screen } from "@solidjs/testing-library";
2+import type { BadgeCatalogEntry, ProfileStats } from "@/api/client";
3+import { BadgeGrid } from "@/components/users/badge-grid";
4+import { PreferencesProvider } from "@/stores/preferences-context";
5+
6+const catalog: BadgeCatalogEntry[] = [
7+ { id: "homework_submitted_1", stat: "homework_submitted", threshold: 1 },
8+ { id: "homework_submitted_10", stat: "homework_submitted", threshold: 10 },
9+ // An id this build has no copy for — it must render, not crash.
10+ { id: "streak_1000", stat: "streak_days", threshold: 1000 },
11+];
12+
13+const stats: ProfileStats = {
14+ pomodoro_sessions: 0,
15+ pomodoro_focus_ms: 0,
16+ courses: 0,
17+ classes: 0,
18+ homework_submitted_total: 7,
19+ homework_on_time_total: 0,
20+ exam_sat_total: 0,
21+ pomodoro_finished_total: 0,
22+ pomodoro_focus_ms_total: 0,
23+};
24+
25+function renderGrid(earned: { id: string; earned_at: number }[]) {
26+ return render(() => (
27+ <PreferencesProvider>
28+ <BadgeGrid catalog={catalog} earned={earned} stats={stats} />
29+ </PreferencesProvider>
30+ ));
31+}
32+
33+afterEach(() => vi.restoreAllMocks());
34+
35+test("shows the whole catalogue, earned and locked alike", () => {
36+ renderGrid([{ id: "homework_submitted_1", earned_at: 1_700_000_000_000 }]);
37+ expect(screen.getAllByRole("generic", { hidden: true }).length).toBeGreaterThan(0);
38+ // Both the earned and the unearned tier are present — the incomplete grid is
39+ // the point, so an unearned badge is never hidden.
40+ expect(screen.getByText("First Steps")).toBeTruthy();
41+ expect(screen.getByText("Steady Hand")).toBeTruthy();
42+});
43+
44+test("an unearned badge shows its progress inline, an earned one shows its date", () => {
45+ renderGrid([{ id: "homework_submitted_1", earned_at: 1_700_000_000_000 }]);
46+ // The tooltip is hover-only, so the tile itself must carry the numbers:
47+ // 7 of 10 done on the second tier.
48+ expect(screen.getAllByText("7 / 10").length).toBeGreaterThan(0);
49+ expect(screen.getAllByText(/Earned/).length).toBeGreaterThan(0);
50+ // The remaining count rides the accessible name, which is what the tooltip
51+ // repeats — a keyboard or screen-reader user gets it without hovering.
52+ expect(screen.getByLabelText(/Steady Hand — 3 to go/)).toBeTruthy();
53+});
54+
55+test("a badge whose stat this build does not know shows no progress bar", () => {
56+ renderGrid([]);
57+ // Falls back to the raw id for the label and to the generic locked line.
58+ expect(screen.getByText("streak_1000")).toBeTruthy();
59+ expect(screen.getAllByText("Not earned yet").length).toBe(1);
60+});
61+
62+test("every tile is focusable and labelled, so the tooltip is reachable by keyboard", () => {
63+ renderGrid([]);
64+ const tiles = screen.getAllByLabelText(/—/);
65+ expect(tiles.length).toBe(catalog.length);
66+ for (const tile of tiles) expect(tile.getAttribute("tabindex")).toBe("0");
67+});
src/components/users/badge-grid.tsxadded+220 -0
@@ -0,0 +1,220 @@
1+import { Collapsible } from "@kobalte/core/collapsible";
2+import { For, Match, Show, Switch, createMemo } from "solid-js";
3+import type { BadgeCatalogEntry, EarnedBadge, ProfileStats } from "@/api/client";
4+import {
5+ IconChevronDown,
6+ IconClipboardCheck,
7+ IconClock,
8+ IconExam,
9+ IconHomework,
10+ IconLock,
11+ IconSparkles,
12+} from "@/components/ui/icons";
13+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
14+import {
15+ badgeDescKey,
16+ badgeNameKey,
17+ badgeProgress,
18+ badgeProgressLabel,
19+ badgeProgressRatio,
20+ badgeRemaining,
21+ badgeThresholdLabel,
22+} from "@/lib/badges";
23+import { cn } from "@/lib/cn";
24+import { formatDate } from "@/lib/format";
25+import { usePreferences, useT } from "@/stores/preferences-context";
26+
27+function StatIcon(props: { stat: string; class?: string }) {
28+ return (
29+ <Switch fallback={<IconSparkles class={props.class} />}>
30+ <Match when={props.stat === "homework_submitted"}>
31+ <IconHomework class={props.class} />
32+ </Match>
33+ <Match when={props.stat === "homework_on_time"}>
34+ <IconClipboardCheck class={props.class} />
35+ </Match>
36+ <Match when={props.stat === "exam_sat"}>
37+ <IconExam class={props.class} />
38+ </Match>
39+ <Match when={props.stat.startsWith("pomodoro")}>
40+ <IconClock class={props.class} />
41+ </Match>
42+ </Switch>
43+ );
44+}
45+
46+export function BadgeGrid(props: {
47+ /** The whole catalogue, from limits.badges.catalog — unearned entries stay
48+ * visible and locked, so the goal is legible before it is reached. */
49+ catalog: BadgeCatalogEntry[];
50+ earned: EarnedBadge[];
51+ stats: ProfileStats;
52+}) {
53+ const t = useT();
54+ const prefs = usePreferences();
55+
56+ const earnedAt = createMemo(() => {
57+ const map = new Map<string, number>();
58+ for (const b of props.earned) map.set(b.id, b.earned_at);
59+ return map;
60+ });
61+
62+ // A badge the backend ships before this build has copy for it must still
63+ // render, so both lookups fall back rather than throwing.
64+ const label = (id: string) => {
65+ const key = badgeNameKey(id);
66+ return key ? t(key) : id;
67+ };
68+ const description = (id: string) => {
69+ const key = badgeDescKey(id);
70+ return key ? t(key) : "";
71+ };
72+
73+ const earnedCount = createMemo(
74+ () => props.catalog.filter((entry) => earnedAt().has(entry.id)).length,
75+ );
76+ const overallRatio = () =>
77+ props.catalog.length === 0 ? 0 : earnedCount() / props.catalog.length;
78+
79+ return (
80+ <Collapsible defaultOpen class="group/badges rounded-lg border bg-card shadow-xs">
81+ <Collapsible.Trigger class="flex w-full items-center gap-3 px-4 py-3 text-left outline-hidden transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring ui-expanded:border-b ui-expanded:border-border">
82+ <span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-muted text-muted-foreground">
83+ <IconSparkles class="h-3.5 w-3.5" />
84+ </span>
85+ <span class="min-w-0 flex-1">
86+ <span class="block text-sm font-semibold">{t("badges.title")}</span>
87+ <span class="block text-xs text-muted-foreground">{t("badges.subtitle")}</span>
88+ </span>
89+ <Show when={props.catalog.length > 0}>
90+ <span class="hidden items-center gap-2 sm:flex">
91+ <span class="h-1.5 w-24 overflow-hidden rounded-full bg-muted">
92+ <span
93+ class="block h-full rounded-full bg-primary transition-[width] duration-500"
94+ style={{ width: `${overallRatio() * 100}%` }}
95+ />
96+ </span>
97+ <span class="text-xs tabular-nums text-muted-foreground">
98+ {t("badges.earnedCount", { earned: earnedCount(), total: props.catalog.length })}
99+ </span>
100+ </span>
101+ </Show>
102+ <IconChevronDown class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-expanded/badges:rotate-180" />
103+ </Collapsible.Trigger>
104+
105+ <Collapsible.Content>
106+ <div class="p-4">
107+ <Show
108+ when={props.catalog.length > 0}
109+ fallback={<p class="text-sm text-muted-foreground">{t("badges.none")}</p>}
110+ >
111+ {/* A horizontal rail rather than a grid: thirteen tiles would otherwise
112+ push the rest of the profile off the first screen. Snap points keep
113+ a card from being cut in half mid-scroll, and the edge fade says
114+ there is more to the right without spending a control on it. */}
115+ <div class="relative">
116+ <div
117+ role="list"
118+ class="-mx-1 flex snap-x snap-mandatory gap-3 overflow-x-auto px-1 pb-2 [scrollbar-width:thin]"
119+ >
120+ <For each={props.catalog}>
121+ {(entry) => {
122+ const at = () => earnedAt().get(entry.id);
123+ const current = () => badgeProgress(entry.stat, props.stats) ?? 0;
124+ const tracked = () => badgeProgress(entry.stat, props.stats) !== null;
125+ const ratio = () => badgeProgressRatio(current(), entry.threshold);
126+ const left = () => badgeRemaining(entry.stat, current(), entry.threshold);
127+ const isHours = entry.stat === "pomodoro_focus_ms";
128+
129+ // The tooltip enriches; it never carries the only copy of
130+ // anything, since a touch device can never open one.
131+ const hint = () =>
132+ at()
133+ ? t("badges.earnedOn", { date: formatDate(at()!, prefs.locale()) })
134+ : tracked()
135+ ? t(isHours ? "badges.remainingHours" : "badges.remaining", { count: left() })
136+ : t("badges.locked");
137+
138+ return (
139+ <Tooltip openDelay={200} closeDelay={80}>
140+ <TooltipTrigger
141+ as="div"
142+ role="listitem"
143+ // Focusable so the tooltip is reachable without a pointer;
144+ // the label repeats what the tooltip would say, since a
145+ // tooltip can never be opened by touch.
146+ tabindex="0"
147+ aria-label={`${label(entry.id)} — ${hint()}`}
148+ class={cn(
149+ "flex w-60 shrink-0 snap-start gap-3 rounded-lg border bg-card p-3 text-left shadow-xs outline-hidden transition-colors",
150+ "focus-visible:ring-2 focus-visible:ring-ring",
151+ at() ? "border-primary/40" : "border-border/70",
152+ )}
153+ >
154+ <span
155+ class={cn(
156+ "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full",
157+ at() ? "bg-primary/15 text-primary" : "bg-muted text-muted-foreground grayscale",
158+ )}
159+ >
160+ <StatIcon stat={entry.stat} class="h-5 w-5" />
161+ {/* A locked badge reads as locked, not as disabled: the
162+ padlock says "not yet", dimming alone says "off". */}
163+ <Show when={!at()}>
164+ <span class="absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full border border-card bg-muted-foreground/80 text-card">
165+ <IconLock class="h-2.5 w-2.5" />
166+ </span>
167+ </Show>
168+ </span>
169+
170+ <div class="min-w-0 flex-1 space-y-1">
171+ <p class={cn("truncate text-sm font-semibold", !at() && "text-muted-foreground")}>
172+ {label(entry.id)}
173+ </p>
174+ <p class="line-clamp-2 text-xs text-muted-foreground">{description(entry.id)}</p>
175+
176+ <Show
177+ when={!at() && tracked()}
178+ fallback={
179+ <p class="text-[11px] tabular-nums text-muted-foreground">{hint()}</p>
180+ }
181+ >
182+ <div class="space-y-1">
183+ <span class="block h-1 overflow-hidden rounded-full bg-muted">
184+ <span
185+ class="block h-full rounded-full bg-muted-foreground/60 transition-[width] duration-500"
186+ style={{ width: `${ratio() * 100}%` }}
187+ />
188+ </span>
189+ <p class="text-[11px] tabular-nums text-muted-foreground">
190+ {badgeProgressLabel(entry.stat, current())} /{" "}
191+ {badgeThresholdLabel(entry.stat, entry.threshold)}
192+ </p>
193+ </div>
194+ </Show>
195+ </div>
196+ </TooltipTrigger>
197+
198+ <TooltipContent>
199+ <p class="font-semibold">{label(entry.id)}</p>
200+ <Show when={description(entry.id)}>
201+ <p class="mt-0.5 text-muted-foreground">{description(entry.id)}</p>
202+ </Show>
203+ <p class="mt-1 tabular-nums">{hint()}</p>
204+ </TooltipContent>
205+ </Tooltip>
206+ );
207+ }}
208+ </For>
209+ </div>
210+ <span
211+ aria-hidden="true"
212+ class="pointer-events-none absolute inset-y-0 right-0 w-10 bg-gradient-to-l from-card to-transparent"
213+ />
214+ </div>
215+ </Show>
216+ </div>
217+ </Collapsible.Content>
218+ </Collapsible>
219+ );
220+}
src/components/users/parent-students-panel.tsxmodified+67 -18
@@ -1,4 +1,5 @@
1 import { For, Show, Suspense, createResource, createSignal } from "solid-js";1 import { For, Show, Suspense, createResource, createSignal } from "solid-js";
2+import { useNavigate } from "@tanstack/solid-router";
2 import { getParentStudents } from "@/api/parents";3 import { getParentStudents } from "@/api/parents";
3 import { postParentStudent } from "@/api/parents";4 import { postParentStudent } from "@/api/parents";
4 import { deleteParentStudent } from "@/api/parents";5 import { deleteParentStudent } from "@/api/parents";
@@ -6,7 +7,8 @@ import { formatApiError } from "@/api/client";
6 import type { PersonRef } from "@/api/client";7 import type { PersonRef } from "@/api/client";
7 import { SidePanel } from "@/components/ui/side-panel";8 import { SidePanel } from "@/components/ui/side-panel";
8 import { Button } from "@/components/ui/button";9 import { Button } from "@/components/ui/button";
9-import { IconTrash, IconPlus } from "@/components/ui/icons";10+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
11+import { IconChevronRight, IconPlus, IconTrash } from "@/components/ui/icons";
10 import { personLabel } from "@/lib/person";12 import { personLabel } from "@/lib/person";
11 import { useT } from "@/stores/preferences-context";13 import { useT } from "@/stores/preferences-context";
12 import { UserSearchSelect } from "@/components/users/user-search-select";14 import { UserSearchSelect } from "@/components/users/user-search-select";
@@ -14,14 +16,19 @@ import { createFlash } from "@/lib/flash";
14 import { Alert } from "@/components/ui/alert";16 import { Alert } from "@/components/ui/alert";
15 import { PageSpinner } from "@/components/ui/page-spinner";17 import { PageSpinner } from "@/components/ui/page-spinner";
16 18
19+// Admin-facing: the students one parent is the guardian of. This is somebody
20+// else's list, never the viewer's own children — the parent's own view of the
21+// same relation lives at /students.
17 export function ParentStudentsPanel(props: {22 export function ParentStudentsPanel(props: {
18 open: boolean;23 open: boolean;
19 onOpenChange: (open: boolean) => void;24 onOpenChange: (open: boolean) => void;
20 parent: PersonRef | null;25 parent: PersonRef | null;
21 }) {26 }) {
22 const t = useT();27 const t = useT();
28+ const navigate = useNavigate();
23 const [error, setError] = createSignal("");29 const [error, setError] = createSignal("");
24 const [flash, setFlash] = createFlash();30 const [flash, setFlash] = createFlash();
31+ const [removing, setRemoving] = createSignal<PersonRef | null>(null);
25 32
26 const [students, { refetch }] = createResource(33 const [students, { refetch }] = createResource(
27 () => (props.open && props.parent ? props.parent.id : null),34 () => (props.open && props.parent ? props.parent.id : null),
@@ -30,6 +37,8 @@ export function ParentStudentsPanel(props: {
30 37
31 const [selectedStudentId, setSelectedStudentId] = createSignal("");38 const [selectedStudentId, setSelectedStudentId] = createSignal("");
32 39
40+ const linkedIds = () => (students.latest ?? []).map((student) => student.id);
41+
33 const handleAdd = async () => {42 const handleAdd = async () => {
34 if (!props.parent || !selectedStudentId()) return;43 if (!props.parent || !selectedStudentId()) return;
35 setError("");44 setError("");
@@ -37,19 +46,21 @@ export function ParentStudentsPanel(props: {
37 await postParentStudent(props.parent.id, selectedStudentId());46 await postParentStudent(props.parent.id, selectedStudentId());
38 await refetch();47 await refetch();
39 setSelectedStudentId("");48 setSelectedStudentId("");
40- setFlash(t("common.saved"));49+ setFlash(t("parentLink.linked"));
41 } catch (err) {50 } catch (err) {
42 setError(formatApiError(err));51 setError(formatApiError(err));
43 }52 }
44 };53 };
45 54
46- const handleRemove = async (studentId: string) => {55+ const handleRemove = async () => {
47- if (!props.parent) return;56+ const student = removing();
57+ if (!props.parent || !student) return;
48 setError("");58 setError("");
49 try {59 try {
50- await deleteParentStudent(props.parent.id, studentId);60+ await deleteParentStudent(props.parent.id, student.id);
61+ setRemoving(null);
51 await refetch();62 await refetch();
52- setFlash(t("common.deleted"));63+ setFlash(t("parentLink.removed"));
53 } catch (err) {64 } catch (err) {
54 setError(formatApiError(err));65 setError(formatApiError(err));
55 }66 }
@@ -65,10 +76,10 @@ export function ParentStudentsPanel(props: {
65 }76 }
66 props.onOpenChange(open);77 props.onOpenChange(open);
67 }}78 }}
68- title={t("nav.myStudents")}79+ title={t("parentLink.title")}
69- description={props.parent ? personLabel(props.parent) : ""}80+ description={props.parent ? t("parentLink.subtitle", { name: personLabel(props.parent) }) : ""}
70 >81 >
71- <div class="flex flex-col h-full space-y-6 p-4">82+ <div class="flex h-full flex-col space-y-6 p-4">
72 <Show when={flash()}>83 <Show when={flash()}>
73 <Alert variant="success">{flash()}</Alert>84 <Alert variant="success">{flash()}</Alert>
74 </Show>85 </Show>
@@ -76,33 +87,59 @@ export function ParentStudentsPanel(props: {
76 87
77 <div class="flex items-end gap-2">88 <div class="flex items-end gap-2">
78 <div class="flex-1">89 <div class="flex-1">
90+ {/* A guardian link only ever points at a student, so the picker
91+ must not offer teachers or other parents. */}
79 <UserSearchSelect92 <UserSearchSelect
80 id="parent-student-select"93 id="parent-student-select"
81- role={undefined}94+ role="student"
82 value={selectedStudentId()}95 value={selectedStudentId()}
83 onChange={setSelectedStudentId}96 onChange={setSelectedStudentId}
84- label={t("events.selectAttendee")}97+ label={t("parentLink.selectStudent")}
98+ excludeIds={linkedIds()}
85 />99 />
86 </div>100 </div>
87 <Button onClick={handleAdd} disabled={!selectedStudentId()}>101 <Button onClick={handleAdd} disabled={!selectedStudentId()}>
88 <IconPlus class="mr-2 h-4 w-4" />102 <IconPlus class="mr-2 h-4 w-4" />
89- {t("common.create")}103+ {t("parentLink.add")}
90 </Button>104 </Button>
91 </div>105 </div>
92 106
93 <div class="flex-1 overflow-auto rounded-md border">107 <div class="flex-1 overflow-auto rounded-md border">
94 <Suspense fallback={<div class="p-8"><PageSpinner /></div>}>108 <Suspense fallback={<div class="p-8"><PageSpinner /></div>}>
95 <Show when={students()}>109 <Show when={students()}>
96- <Show when={students()!.length > 0} fallback={<div class="p-8 text-center text-sm text-muted-foreground">{t("common.noResults")}</div>}>110+ <Show
111+ when={students()!.length > 0}
112+ fallback={<div class="p-8 text-center text-sm text-muted-foreground">{t("parentLink.empty")}</div>}
113+ >
97 <div class="divide-y">114 <div class="divide-y">
98 <For each={students()}>115 <For each={students()}>
99 {(student) => (116 {(student) => (
100- <div class="flex items-center justify-between p-3">117+ <div class="flex items-center gap-2 p-3">
101- <div class="min-w-0">118+ {/* A router <Link> inside this modal panel never
102- <div class="truncate text-sm font-medium">{personLabel(student)}</div>119+ navigates — the dialog's dismiss handling swallows
120+ the click — so close the panel first, then go. */}
121+ <button
122+ type="button"
123+ class="group min-w-0 flex-1 rounded-md text-left outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
124+ title={t("profile.viewProfile")}
125+ onClick={() => {
126+ props.onOpenChange(false);
127+ void navigate({ to: "/profile/$userId", params: { userId: student.id } });
128+ }}
129+ >
130+ <div class="flex items-center gap-1 truncate text-sm font-medium group-hover:underline">
131+ {personLabel(student)}
132+ <IconChevronRight class="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
133+ </div>
103 <div class="truncate text-xs text-muted-foreground">@{student.username}</div>134 <div class="truncate text-xs text-muted-foreground">@{student.username}</div>
104- </div>135+ </button>
105- <Button variant="ghost" size="icon" class="text-destructive hover:bg-destructive/10 hover:text-destructive" onClick={() => handleRemove(student.id)}>136+ <Button
137+ variant="ghost"
138+ size="icon"
139+ class="shrink-0 text-destructive hover:bg-destructive/10 hover:text-destructive"
140+ aria-label={t("parentLink.remove")}
141+ onClick={() => setRemoving(student)}
142+ >
106 <IconTrash class="h-4 w-4" />143 <IconTrash class="h-4 w-4" />
107 </Button>144 </Button>
108 </div>145 </div>
@@ -114,6 +151,18 @@ export function ParentStudentsPanel(props: {
114 </Suspense>151 </Suspense>
115 </div>152 </div>
116 </div>153 </div>
154+
155+ <ConfirmDialog
156+ open={removing() !== null}
157+ onOpenChange={(open) => !open && setRemoving(null)}
158+ title={t("parentLink.remove")}
159+ summary={t("parentLink.removeConfirm", {
160+ student: personLabel(removing()),
161+ parent: personLabel(props.parent),
162+ })}
163+ variant="destructive"
164+ onConfirm={handleRemove}
165+ />
117 </SidePanel>166 </SidePanel>
118 );167 );
119 }168 }
src/components/users/profile-form.tsxmodified+53 -1
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button";
7 import { DatePicker } from "@/components/ui/date-picker";7 import { DatePicker } from "@/components/ui/date-picker";
8 import { Input } from "@/components/ui/input";8 import { Input } from "@/components/ui/input";
9 import { Label } from "@/components/ui/label";9 import { Label } from "@/components/ui/label";
10+import { Textarea } from "@/components/ui/textarea";
10 import { createFlash } from "@/lib/flash";11 import { createFlash } from "@/lib/flash";
11 import { useT } from "@/stores/preferences-context";12 import { useT } from "@/stores/preferences-context";
12 13
@@ -38,13 +39,28 @@ function isoFromDateInput(value: string): string {
38 return `${year}-${month}-${day}`;39 return `${year}-${month}-${day}`;
39 }40 }
40 41
41-export function ProfileForm(props: { user: User; onSaved: () => void; onSave?: (body: ProfileUpdate) => Promise<User> }) {42+export function ProfileForm(props: {
43+ user: User;
44+ /**
45+ * `display_name` and `bio` ride the same PATCH but do not live on `User` —
46+ * GET /auth/me never returns them, only GET /users/{id}/profile does. Pass
47+ * them where a profile is in hand; omit them and the fields stay hidden
48+ * rather than silently offering to clear values they cannot see.
49+ */
50+ profile?: { display_name: string | null; bio: string | null };
51+ maxDisplayNameLen?: number;
52+ maxBioLen?: number;
53+ onSaved: () => void;
54+ onSave?: (body: ProfileUpdate) => Promise<User>;
55+}) {
42 const t = useT();56 const t = useT();
43 const [name, setName] = createSignal(props.user.name ?? "");57 const [name, setName] = createSignal(props.user.name ?? "");
44 const [surname, setSurname] = createSignal(props.user.surname ?? "");58 const [surname, setSurname] = createSignal(props.user.surname ?? "");
45 const [email, setEmail] = createSignal(props.user.email ?? "");59 const [email, setEmail] = createSignal(props.user.email ?? "");
46 const [phone, setPhone] = createSignal(props.user.phone ?? "");60 const [phone, setPhone] = createSignal(props.user.phone ?? "");
47 const [birthDate, setBirthDate] = createSignal(dateInputFromIso(props.user.birth_date));61 const [birthDate, setBirthDate] = createSignal(dateInputFromIso(props.user.birth_date));
62+ const [displayName, setDisplayName] = createSignal(props.profile?.display_name ?? "");
63+ const [bio, setBio] = createSignal(props.profile?.bio ?? "");
48 const [error, setError] = createSignal("");64 const [error, setError] = createSignal("");
49 const [flash, setFlash] = createFlash();65 const [flash, setFlash] = createFlash();
50 const [pending, setPending] = createSignal(false);66 const [pending, setPending] = createSignal(false);
@@ -71,6 +87,13 @@ export function ProfileForm(props: { user: User; onSaved: () => void; onSave?: (
71 if (e !== (props.user.email ?? "")) b.email = e;87 if (e !== (props.user.email ?? "")) b.email = e;
72 if (p !== (props.user.phone ?? "")) b.phone = p;88 if (p !== (props.user.phone ?? "")) b.phone = p;
73 if (d !== (props.user.birth_date ?? "")) b.birth_date = d;89 if (d !== (props.user.birth_date ?? "")) b.birth_date = d;
90+ if (props.profile) {
91+ // An empty string clears the field server-side; an omitted key keeps it.
92+ const dn = displayName().trim();
93+ const bi = bio().trim();
94+ if (dn !== (props.profile.display_name ?? "")) b.display_name = dn;
95+ if (bi !== (props.profile.bio ?? "")) b.bio = bi;
96+ }
74 return b;97 return b;
75 };98 };
76 99
@@ -108,6 +131,35 @@ export function ProfileForm(props: { user: User; onSaved: () => void; onSave?: (
108 <Input id="pf-surname" class="h-10" value={surname()} onInput={(e) => setSurname(e.currentTarget.value)} />131 <Input id="pf-surname" class="h-10" value={surname()} onInput={(e) => setSurname(e.currentTarget.value)} />
109 </div>132 </div>
110 </div>133 </div>
134+ <Show when={props.profile}>
135+ <div class="space-y-1.5">
136+ <Label for="pf-display-name">{t("profile.displayName")}</Label>
137+ <Input
138+ id="pf-display-name"
139+ class="h-10"
140+ maxlength={props.maxDisplayNameLen}
141+ value={displayName()}
142+ onInput={(e) => setDisplayName(e.currentTarget.value)}
143+ />
144+ <p class="text-xs text-muted-foreground">{t("profile.displayNameHint")}</p>
145+ </div>
146+ <div class="space-y-1.5">
147+ <Label for="pf-bio">{t("profile.bio")}</Label>
148+ <Textarea
149+ id="pf-bio"
150+ rows={3}
151+ maxlength={props.maxBioLen}
152+ value={bio()}
153+ onInput={(e) => setBio(e.currentTarget.value)}
154+ />
155+ <p class="text-xs text-muted-foreground">
156+ {t("profile.bioHint")}
157+ <Show when={props.maxBioLen}>
158+ {(max) => <span class="ml-1 tabular-nums">{bio().length} / {max()}</span>}
159+ </Show>
160+ </p>
161+ </div>
162+ </Show>
111 <div class="space-y-1.5">163 <div class="space-y-1.5">
112 <Label for="pf-email">{t("profile.email")}</Label>164 <Label for="pf-email">{t("profile.email")}</Label>
113 <Input id="pf-email" class="h-10" type="email" value={email()} onInput={(e) => setEmail(e.currentTarget.value)} />165 <Input id="pf-email" class="h-10" type="email" value={email()} onInput={(e) => setEmail(e.currentTarget.value)} />
src/components/users/profile-memberships.tsxadded+146 -0
@@ -0,0 +1,146 @@
1+import { For, Show, createMemo, createSignal } from "solid-js";
2+import { Link } from "@tanstack/solid-router";
3+import type { ClassGroup, ProfileClassRef, ProfileCourseRef } from "@/api/client";
4+import { courseKindLabel } from "@/lib/course-kind";
5+import { Badge } from "@/components/ui/badge";
6+import { IconBook, IconSchool } from "@/components/ui/icons";
7+import { PaginationControls } from "@/components/ui/pagination-controls";
8+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
9+import { cn } from "@/lib/cn";
10+import { personLabel } from "@/lib/person";
11+import { useT } from "@/stores/preferences-context";
12+
13+const PAGE_SIZE = 5;
14+
15+function pageOf<T>(rows: T[], page: number): T[] {
16+ return rows.slice(page * PAGE_SIZE, page * PAGE_SIZE + PAGE_SIZE);
17+}
18+
19+function pageCount(total: number): number {
20+ return Math.max(1, Math.ceil(total / PAGE_SIZE));
21+}
22+
23+export function ProfileMemberships(props: {
24+ classes: ProfileClassRef[];
25+ courses: ProfileCourseRef[];
26+ /**
27+ * The same classes read through /classes, which carry the homeroom teacher
28+ * the profile payload omits. Empty when the viewer may not make that read —
29+ * a student looking at a peer — and the rows simply omit the teacher then.
30+ */
31+ detailed: ClassGroup[];
32+ classTotal: number;
33+ courseTotal: number;
34+}) {
35+ const t = useT();
36+ const [tab, setTab] = createSignal("classes");
37+ const [classPage, setClassPage] = createSignal(0);
38+ const [coursePage, setCoursePage] = createSignal(0);
39+
40+ const teacherOf = (id: string) => {
41+ const match = props.detailed.find((c) => c.id === id);
42+ return match?.teacher ? personLabel(match.teacher) : null;
43+ };
44+
45+ const classRows = createMemo(() => pageOf(props.classes, classPage()));
46+ const courseRows = createMemo(() => pageOf(props.courses, coursePage()));
47+
48+ return (
49+ <Tabs value={tab()} onChange={setTab} class="rounded-lg border bg-card shadow-xs">
50+ <TabsList class="w-full justify-start rounded-none border-b bg-transparent px-2">
51+ <TabsTrigger value="classes">
52+ {t("profile.classes")}
53+ <span class="ml-1.5 tabular-nums text-muted-foreground">{props.classTotal}</span>
54+ </TabsTrigger>
55+ <TabsTrigger value="courses">
56+ {t("profile.courses")}
57+ <span class="ml-1.5 tabular-nums text-muted-foreground">{props.courseTotal}</span>
58+ </TabsTrigger>
59+ </TabsList>
60+
61+ <TabsContent value="classes" class="p-3">
62+ <Show
63+ when={props.classes.length > 0}
64+ fallback={<p class="px-1 py-6 text-center text-sm text-muted-foreground">{t("profile.noClasses")}</p>}
65+ >
66+ <ul class="space-y-1.5">
67+ <For each={classRows()}>
68+ {(c) => (
69+ <li class="flex items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5">
70+ <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary">
71+ <IconSchool class="h-4 w-4" />
72+ </span>
73+ <span class="min-w-0 flex-1">
74+ <span class="block truncate text-sm font-medium">{c.name}</span>
75+ <span class="block truncate text-xs text-muted-foreground">
76+ {teacherOf(c.id)
77+ ? `${t("classGroups.homeroomTeacher")}: ${teacherOf(c.id)}`
78+ : t("classGroups.noTeacher")}
79+ </span>
80+ </span>
81+ <Show when={c.grade}>
82+ {(g) => (
83+ <Badge variant="secondary" class="shrink-0 rounded-md">
84+ {g()}
85+ </Badge>
86+ )}
87+ </Show>
88+ </li>
89+ )}
90+ </For>
91+ </ul>
92+ <Show when={pageCount(props.classes.length) > 1}>
93+ <div class="mt-3">
94+ <PaginationControls
95+ page={classPage()}
96+ totalPages={pageCount(props.classes.length)}
97+ onPageChange={setClassPage}
98+ />
99+ </div>
100+ </Show>
101+ </Show>
102+ </TabsContent>
103+
104+ <TabsContent value="courses" class="p-3">
105+ <Show
106+ when={props.courses.length > 0}
107+ fallback={<p class="px-1 py-6 text-center text-sm text-muted-foreground">{t("profile.noCourses")}</p>}
108+ >
109+ <ul class="space-y-1.5">
110+ <For each={courseRows()}>
111+ {(c) => (
112+ <li>
113+ <Link
114+ to="/courses/$id"
115+ params={{ id: c.id }}
116+ class="flex items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5 transition-colors hover:border-primary/40 hover:bg-muted/40"
117+ >
118+ <span
119+ class={cn(
120+ "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",
121+ c.kind === "club" ? "bg-violet-500/10 text-violet-600 dark:text-violet-300" : "bg-primary/10 text-primary",
122+ )}
123+ >
124+ <IconBook class="h-4 w-4" />
125+ </span>
126+ <span class="min-w-0 flex-1 truncate text-sm font-medium">{c.title}</span>
127+ <Badge variant="outline" class="shrink-0 rounded-md">{courseKindLabel(c.kind, t)}</Badge>
128+ </Link>
129+ </li>
130+ )}
131+ </For>
132+ </ul>
133+ <Show when={pageCount(props.courses.length) > 1}>
134+ <div class="mt-3">
135+ <PaginationControls
136+ page={coursePage()}
137+ totalPages={pageCount(props.courses.length)}
138+ onPageChange={setCoursePage}
139+ />
140+ </div>
141+ </Show>
142+ </Show>
143+ </TabsContent>
144+ </Tabs>
145+ );
146+}
src/components/users/user-avatar.tsxadded+62 -0
@@ -0,0 +1,62 @@
1+import { Show, createEffect, createSignal } from "solid-js";
2+import { getUserAvatarUrl } from "@/api/users";
3+import { avatarRevision } from "@/lib/avatar";
4+import { cn } from "@/lib/cn";
5+import { personInitials } from "@/lib/person";
6+
7+const SIZES = {
8+ xs: "h-6 w-6 text-[9px]",
9+ sm: "h-8 w-8 text-[11px]",
10+ md: "h-10 w-10 text-sm",
11+ lg: "h-16 w-16 text-lg",
12+ xl: "h-24 w-24 text-2xl",
13+} as const;
14+
15+export type UserAvatarSize = keyof typeof SIZES;
16+
17+export function UserAvatar(props: {
18+ userId: string;
19+ /** Label the initials and the alt text are built from. */
20+ name: string;
21+ /**
22+ * Pass the profile's `avatar != null` when it is known: false skips the
23+ * request entirely, so a person without a photo costs no 404. Omit it where
24+ * the caller has no profile in hand (the sidebar) and the image is simply
25+ * attempted, falling back to initials if it is not there.
26+ */
27+ hasAvatar?: boolean;
28+ size?: UserAvatarSize;
29+ class?: string;
30+}) {
31+ const [broken, setBroken] = createSignal(false);
32+
33+ // A once-404'd avatar must not stay broken after the person uploads one, and
34+ // the same component instance is reused across /profile/$userId navigations.
35+ createEffect(() => {
36+ props.userId;
37+ avatarRevision();
38+ setBroken(false);
39+ });
40+
41+ const showImage = () => props.hasAvatar !== false && !broken();
42+
43+ return (
44+ <span
45+ class={cn(
46+ "relative flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary/15 font-bold text-primary shadow-xs ring-1 ring-border/70 dark:bg-emerald-100 dark:text-emerald-950 dark:ring-white/20",
47+ SIZES[props.size ?? "sm"],
48+ props.class,
49+ )}
50+ >
51+ {personInitials(props.name)}
52+ <Show when={showImage()}>
53+ <img
54+ src={getUserAvatarUrl(props.userId, avatarRevision())}
55+ alt={props.name}
56+ class="absolute inset-0 h-full w-full object-cover"
57+ onError={() => setBroken(true)}
58+ />
59+ </Show>
60+ </span>
61+ );
62+}
src/components/users/user-table.tsxmodified+9 -2
@@ -1,4 +1,5 @@
1 import { createMemo, createSignal, Show } from "solid-js";1 import { createMemo, createSignal, Show } from "solid-js";
2+import { useNavigate } from "@tanstack/solid-router";
2 import type { ColumnDef } from "@tanstack/solid-table";3 import type { ColumnDef } from "@tanstack/solid-table";
3 import type { Role, User } from "@/api/client";4 import type { Role, User } from "@/api/client";
4 import type { MessageKey } from "@/i18n/messages";5 import type { MessageKey } from "@/i18n/messages";
@@ -7,7 +8,7 @@ import { Button } from "@/components/ui/button";
7 import { ConfirmDialog } from "@/components/ui/confirm-dialog";8 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
8 import { DataTable } from "@/components/ui/data-table";9 import { DataTable } from "@/components/ui/data-table";
9 import { TableRowActions } from "@/components/ui/table-row-actions";10 import { TableRowActions } from "@/components/ui/table-row-actions";
10-import { IconCheck, IconEye, IconUsers } from "@/components/ui/icons";11+import { IconCheck, IconExternalLink, IconEye, IconUsers } from "@/components/ui/icons";
11 import { ROLES } from "@/lib/roles";12 import { ROLES } from "@/lib/roles";
12 import { useT } from "@/stores/preferences-context";13 import { useT } from "@/stores/preferences-context";
13 14
@@ -71,6 +72,7 @@ export function UserTable(props: {
71 onParentClick?: (user: User) => void;72 onParentClick?: (user: User) => void;
72 }) {73 }) {
73 const t = useT();74 const t = useT();
75+ const navigate = useNavigate();
74 const searchUser = (user: User, query: string) =>76 const searchUser = (user: User, query: string) =>
75 [user.username, displayName(user), user.email, user.id, t(`role.${user.role}` as MessageKey)]77 [user.username, displayName(user), user.email, user.id, t(`role.${user.role}` as MessageKey)]
76 .join(" ")78 .join(" ")
@@ -127,10 +129,15 @@ export function UserTable(props: {
127 icon: <IconEye class="h-4 w-4" />,129 icon: <IconEye class="h-4 w-4" />,
128 onSelect: () => props.onUserClick?.(cell.row.original),130 onSelect: () => props.onUserClick?.(cell.row.original),
129 },131 },
132+ {
133+ label: t("profile.viewProfile"),
134+ icon: <IconExternalLink class="h-4 w-4" />,
135+ onSelect: () => void navigate({ to: "/profile/$userId", params: { userId: cell.row.original.id } }),
136+ },
130 ...(cell.row.original.role === "parent"137 ...(cell.row.original.role === "parent"
131 ? [138 ? [
132 {139 {
133- label: t("nav.myStudents"),140+ label: t("parentLink.manage"),
134 icon: <IconUsers class="h-4 w-4" />,141 icon: <IconUsers class="h-4 w-4" />,
135 onSelect: () => props.onParentClick?.(cell.row.original),142 onSelect: () => props.onParentClick?.(cell.row.original),
136 },143 },
src/components/whiteboard/board-bulk-invite.tsxadded+157 -0
@@ -0,0 +1,157 @@
1+import { For, Show, createResource, createSignal } from "solid-js";
2+import { getClasses, getMyClasses } from "@/api/classes";
3+import { getCourses } from "@/api/courses";
4+import { getEvents } from "@/api/events";
5+import { postBoardInvite } from "@/api/boards";
6+import { getLimits } from "@/api/limits";
7+import { ApiError, formatApiError } from "@/api/client";
8+import type { Board, BoardInviteBody } from "@/api/boards";
9+import { Button } from "@/components/ui/button";
10+import { Label } from "@/components/ui/label";
11+import { SearchableSelect } from "@/components/ui/searchable-select";
12+import { cn } from "@/lib/cn";
13+import { useT } from "@/stores/preferences-context";
14+
15+type InviteKind = BoardInviteBody["kind"];
16+
17+const KINDS: InviteKind[] = ["class", "course", "event"];
18+
19+async function loadOptions(kind: InviteKind) {
20+ if (kind === "class") {
21+ // GET /classes is teacher+; a teacher who is not on the school-wide list
22+ // still has their own, so fall back rather than showing an empty picker.
23+ try {
24+ return (await getClasses({ limit: 200 })).items.map((c) => ({ value: c.id, label: c.name }));
25+ } catch {
26+ return (await getMyClasses({ limit: 200 })).items.map((c) => ({ value: c.id, label: c.name }));
27+ }
28+ }
29+ if (kind === "course") {
30+ // A club is a course whose kind is "club", so one list covers both arms.
31+ return (await getCourses({ limit: 200 })).items.map((c) => ({ value: c.id, label: c.title }));
32+ }
33+ return (await getEvents({ limit: 200 })).items.map((e) => ({ value: e.id, label: e.title }));
34+}
35+
36+export function BoardBulkInvite(props: {
37+ boardId: () => string;
38+ /** Creator-only, and only while the board is open — the backend 403s below that. */
39+ visible: () => boolean;
40+ participantCount: () => number;
41+ onInvited: (board: Board) => void;
42+}) {
43+ const t = useT();
44+ const [kind, setKind] = createSignal<InviteKind>("class");
45+ const [picked, setPicked] = createSignal("");
46+ const [error, setError] = createSignal("");
47+ const [notice, setNotice] = createSignal("");
48+ const [pending, setPending] = createSignal(false);
49+
50+ // The panel keeps its children mounted, so gate on `visible` too: a
51+ // non-creator must never fire these three list requests, and switching kind
52+ // must refetch rather than leave the previous kind's options on screen.
53+ const [options] = createResource(
54+ () => (props.visible() ? kind() : null),
55+ (k) => loadOptions(k),
56+ );
57+ const [limits] = createResource(() => (props.visible() ? true : null), () => getLimits());
58+
59+ const invite = async () => {
60+ const id = picked();
61+ if (!id) return;
62+ setError("");
63+ setNotice("");
64+ setPending(true);
65+ const before = props.participantCount();
66+ const k = kind();
67+ const body: BoardInviteBody =
68+ k === "class" ? { kind: "class", class: id } : k === "course" ? { kind: "course", course: id } : { kind: "event", event: id };
69+ try {
70+ const board = await postBoardInvite(props.boardId(), body);
71+ props.onInvited(board);
72+ const added = board.participants.length - before;
73+ setNotice(added > 0 ? t("whiteboard.inviteAdded", { count: added }) : t("whiteboard.inviteNoneAdded"));
74+ setPicked("");
75+ } catch (err) {
76+ if (err instanceof ApiError && err.status === 409) {
77+ setError(t("whiteboard.inviteTooMany", { max: limits.latest?.board?.max_participants ?? 200 }));
78+ } else if (err instanceof ApiError && err.status === 400) {
79+ // A named class/course/event that no longer exists is a 400 here; a 404
80+ // would have meant the board itself.
81+ setError(t("whiteboard.inviteNotFound"));
82+ } else {
83+ setError(formatApiError(err));
84+ }
85+ } finally {
86+ setPending(false);
87+ }
88+ };
89+
90+ return (
91+ <section class="space-y-3 rounded-xl border border-border/70 bg-card p-4 shadow-xs">
92+ <div>
93+ <h3 class="text-sm font-semibold">{t("whiteboard.bulkInvite")}</h3>
94+ <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.bulkInviteHint")}</p>
95+ </div>
96+
97+ <div class="flex flex-wrap gap-1.5">
98+ <For each={KINDS}>
99+ {(k) => (
100+ <button
101+ type="button"
102+ class={cn(
103+ "rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",
104+ kind() === k
105+ ? "border-primary bg-primary/10 text-primary"
106+ : "border-border/70 text-muted-foreground hover:bg-muted/60",
107+ )}
108+ aria-pressed={kind() === k}
109+ onClick={() => {
110+ setKind(k);
111+ setPicked("");
112+ setError("");
113+ setNotice("");
114+ }}
115+ >
116+ {t(
117+ k === "class"
118+ ? "whiteboard.inviteSourceClass"
119+ : k === "course"
120+ ? "whiteboard.inviteSourceCourse"
121+ : "whiteboard.inviteSourceEvent",
122+ )}
123+ </button>
124+ )}
125+ </For>
126+ </div>
127+
128+ <div class="space-y-1.5">
129+ <Label for="board-invite-source">{t("whiteboard.inviteSelect")}</Label>
130+ <div class="flex flex-wrap gap-2">
131+ <SearchableSelect
132+ id="board-invite-source"
133+ class="min-w-0 flex-1"
134+ value={picked()}
135+ onChange={setPicked}
136+ options={options.latest ?? []}
137+ placeholder={t("whiteboard.inviteSelect")}
138+ disabled={options.loading || (options.latest?.length ?? 0) === 0}
139+ />
140+ <Button type="button" size="sm" class="rounded-lg" disabled={pending() || !picked()} onClick={() => void invite()}>
141+ {t("whiteboard.inviteAction")}
142+ </Button>
143+ </div>
144+ <Show when={!options.loading && (options.latest?.length ?? 0) === 0}>
145+ <p class="text-xs text-muted-foreground">{t("whiteboard.inviteEmptySource")}</p>
146+ </Show>
147+ </div>
148+
149+ <Show when={notice()}>
150+ <p class="text-xs text-muted-foreground">{notice()}</p>
151+ </Show>
152+ <Show when={error()}>
153+ <p class="text-xs text-destructive">{error()}</p>
154+ </Show>
155+ </section>
156+ );
157+}
src/components/whiteboard/board-settings-panel.tsxmodified+43 -22
@@ -1,11 +1,14 @@
1 import { Show, createEffect, createMemo, createSignal } from "solid-js";1 import { Show, createEffect, createMemo, createSignal } from "solid-js";
2 import type { ColumnDef } from "@tanstack/solid-table";2 import type { ColumnDef } from "@tanstack/solid-table";
3+import type { Board } from "@/api/boards";
4+import { BoardBulkInvite } from "@/components/whiteboard/board-bulk-invite";
3 import { ErrorAlert } from "@/components/ui/error-alert";5 import { ErrorAlert } from "@/components/ui/error-alert";
4 import { Button } from "@/components/ui/button";6 import { Button } from "@/components/ui/button";
5 import { DataTable } from "@/components/ui/data-table";7 import { DataTable } from "@/components/ui/data-table";
6 import { Input } from "@/components/ui/input";8 import { Input } from "@/components/ui/input";
7 import { Label } from "@/components/ui/label";9 import { Label } from "@/components/ui/label";
8 import { SidePanel } from "@/components/ui/side-panel";10 import { SidePanel } from "@/components/ui/side-panel";
11+import { TableRowActions } from "@/components/ui/table-row-actions";
9 import { UserSearchSelect } from "@/components/users/user-search-select";12 import { UserSearchSelect } from "@/components/users/user-search-select";
10 import { useT } from "@/stores/preferences-context";13 import { useT } from "@/stores/preferences-context";
11 14
@@ -19,6 +22,7 @@ type ParticipantRow = {
19 export function BoardSettingsPanel(props: {22 export function BoardSettingsPanel(props: {
20 open: boolean;23 open: boolean;
21 onOpenChange: (open: boolean) => void;24 onOpenChange: (open: boolean) => void;
25+ boardId: () => string;
22 title: () => string;26 title: () => string;
23 participants: () => string[];27 participants: () => string[];
24 creatorId: () => string;28 creatorId: () => string;
@@ -28,6 +32,7 @@ export function BoardSettingsPanel(props: {
28 roleOf: (id: string) => string;32 roleOf: (id: string) => string;
29 onTitleSave: (title: string) => Promise<void>;33 onTitleSave: (title: string) => Promise<void>;
30 onParticipantsSave: (participants: string[]) => Promise<void>;34 onParticipantsSave: (participants: string[]) => Promise<void>;
35+ onInvited: (board: Board) => void;
31 }) {36 }) {
32 const t = useT();37 const t = useT();
33 const [title, setTitle] = createSignal("");38 const [title, setTitle] = createSignal("");
@@ -93,22 +98,23 @@ export function BoardSettingsPanel(props: {
93 {98 {
94 id: "actions",99 id: "actions",
95 header: t("common.actions"),100 header: t("common.actions"),
96- meta: { align: "center" },101+ meta: { align: "center", label: t("common.actions") },
97 cell: (cell) => (102 cell: (cell) => (
98 <Show103 <Show
99 when={props.canManageParticipants() && !cell.row.original.creator}104 when={props.canManageParticipants() && !cell.row.original.creator}
100 fallback={<span class="text-xs text-muted-foreground">{cell.row.original.creator ? t("whiteboard.creator") : "—"}</span>}105 fallback={<span class="text-xs text-muted-foreground">{cell.row.original.creator ? t("whiteboard.creator") : "—"}</span>}
101 >106 >
102- <Button107+ <TableRowActions
103- type="button"108+ compact
104- variant="outline"109+ label={t("common.actions")}
105- size="sm"110+ actions={[{
106- class="h-8 rounded-lg px-2 text-xs"111+ label: t("whiteboard.removeParticipant"),
107- disabled={pending()}112+ icon: <span class="text-base leading-none">×</span>,
108- onClick={() => void saveParticipants(props.participants().filter((id) => id !== cell.row.original.id))}113+ destructive: true,
109- >114+ disabled: pending(),
110- {t("whiteboard.removeParticipant")}115+ onSelect: () => void saveParticipants(props.participants().filter((id) => id !== cell.row.original.id)),
111- </Button>116+ }]}
117+ />
112 </Show>118 </Show>
113 ),119 ),
114 },120 },
@@ -118,21 +124,23 @@ export function BoardSettingsPanel(props: {
118 <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.edit")} size="wide">124 <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.edit")} size="wide">
119 <div class="space-y-6">125 <div class="space-y-6">
120 <Show when={error()}><ErrorAlert message={error()} /></Show>126 <Show when={error()}><ErrorAlert message={error()} /></Show>
121- <section class="space-y-3 rounded-xl border border-border/70 bg-card p-4 shadow-xs">127+ <section class="space-y-3 rounded-lg border border-border/70 bg-card p-4 shadow-sm">
122- <Label for="whiteboard-title">{t("whiteboard.titleLabel")}</Label>128+ <div>
123- <div class="flex flex-wrap gap-2">129+ <h3 class="text-sm font-semibold">{t("whiteboard.titleLabel")}</h3>
124- <Input id="whiteboard-title" class="min-w-0 flex-1" maxlength={200} value={title()} onInput={(event) => setTitle(event.currentTarget.value)} />130+ <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.edit")}</p>
131+ </div>
132+ <div class="grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end">
133+ <div class="space-y-1.5">
134+ <Label for="whiteboard-title" class="sr-only">{t("whiteboard.titleLabel")}</Label>
135+ <Input id="whiteboard-title" maxlength={200} value={title()} onInput={(event) => setTitle(event.currentTarget.value)} />
136+ </div>
125 <Button type="button" size="sm" class="rounded-lg" disabled={pending() || !title().trim() || title().trim() === props.title()} onClick={() => void saveTitle()}>137 <Button type="button" size="sm" class="rounded-lg" disabled={pending() || !title().trim() || title().trim() === props.title()} onClick={() => void saveTitle()}>
126 {t("common.save")}138 {t("common.save")}
127 </Button>139 </Button>
128 </div>140 </div>
129 </section>141 </section>
130 142
131- <section class="space-y-3 rounded-xl border border-border/70 bg-card p-4 shadow-xs">143+ <section class="space-y-3">
132- <div>
133- <h3 class="text-sm font-semibold">{t("whiteboard.participants")}</h3>
134- <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.participantsHint")}</p>
135- </div>
136 <Show when={props.canManageParticipants()} fallback={<p class="text-xs text-muted-foreground">{t("whiteboard.creator")}</p>}>144 <Show when={props.canManageParticipants()} fallback={<p class="text-xs text-muted-foreground">{t("whiteboard.creator")}</p>}>
137 <Show145 <Show
138 when={props.canSearchPeople()}146 when={props.canSearchPeople()}
@@ -154,14 +162,27 @@ export function BoardSettingsPanel(props: {
154 columns={columns()}162 columns={columns()}
155 data={rows()}163 data={rows()}
156 empty={t("whiteboard.empty")}164 empty={t("whiteboard.empty")}
157- class="overflow-hidden rounded-xl border border-border/70 bg-background/40"165+ title={t("whiteboard.participants")}
158- tableClass="min-w-[32rem]"166+ description={t("whiteboard.participantsHint")}
167+ class="rounded-lg border border-border/70 bg-card p-4 shadow-sm"
168+ tableClass="min-w-[26rem]"
159 enableColumnVisibility={false}169 enableColumnVisibility={false}
160 enableSorting={false}170 enableSorting={false}
161 enablePagination171 enablePagination
162 pageSize={8}172 pageSize={8}
163 />173 />
164 </section>174 </section>
175+
176+ {/* Inviting a whole group is the creator's alone, exactly like the
177+ roster edits above. */}
178+ <Show when={props.canManageParticipants()}>
179+ <BoardBulkInvite
180+ boardId={props.boardId}
181+ visible={props.canManageParticipants}
182+ participantCount={() => props.participants().length}
183+ onInvited={props.onInvited}
184+ />
185+ </Show>
165 </div>186 </div>
166 </SidePanel>187 </SidePanel>
167 );188 );
src/i18n/messages.tsmodified+760 -120
@@ -61,6 +61,151 @@ export type MessageKey =
61 | "classGroups.noTeacher"61 | "classGroups.noTeacher"
62 | "classGroups.selectTeacher"62 | "classGroups.selectTeacher"
63 | "classGroups.yourClass"63 | "classGroups.yourClass"
64+ | "classBlueprints.tab"
65+ | "classBlueprints.classesTab"
66+ | "classBlueprints.title"
67+ | "classBlueprints.subtitle"
68+ | "classBlueprints.new"
69+ | "classBlueprints.edit"
70+ | "classBlueprints.grade"
71+ | "classBlueprints.gradeHint"
72+ | "classBlueprints.courses"
73+ | "classBlueprints.courseCount"
74+ | "classBlueprints.courseCountColumn"
75+ | "classBlueprints.selected"
76+ | "classBlueprints.empty"
77+ | "classBlueprints.selectCourses"
78+ | "classBlueprints.wholeSetHint"
79+ | "classBlueprints.filterCourses"
80+ | "classBlueprints.noCourseMatch"
81+ | "classBlueprints.saved"
82+ | "classBlueprints.delete"
83+ | "classBlueprints.deleteConfirm"
84+ | "classBlueprints.deleted"
85+ | "classBlueprints.apply"
86+ | "classBlueprints.applyHint"
87+ | "classBlueprints.applyNoGrade"
88+ | "classBlueprints.applied"
89+ | "classBlueprints.noBlueprintForGrade"
90+ | "classBlueprints.conflictExists"
91+ | "classBlueprints.staleReload"
92+ | "classBlueprints.skippedSummary"
93+ | "classBlueprints.skippedDetails"
94+ | "classBlueprints.skippedTitle"
95+ | "classBlueprints.skippedSubtitle"
96+ | "classBlueprints.skippedClass"
97+ | "classBlueprints.skippedCourse"
98+ | "classBlueprints.skippedReason"
99+ | "classBlueprints.skipClassGone"
100+ | "classBlueprints.skipCoursePruned"
101+ | "classBlueprints.skipCeiling"
102+ | "classBlueprints.skipOverloaded"
103+ | "classBlueprints.skipNoSeat"
104+ | "classBlueprints.skipCourseGone"
105+ | "classBlueprints.skipOther"
106+ | "profile.myProfile"
107+ | "profile.viewProfile"
108+ | "profile.displayName"
109+ | "profile.displayNameHint"
110+ | "profile.bio"
111+ | "profile.bioHint"
112+ | "profile.bioEmpty"
113+ | "profile.classes"
114+ | "profile.noClasses"
115+ | "profile.courses"
116+ | "profile.noCourses"
117+ | "profile.stats"
118+ | "profile.statFocusHours"
119+ | "profile.statSessions"
120+ | "profile.statHomework"
121+ | "profile.statOnTime"
122+ | "profile.statExams"
123+ | "profile.statCourses"
124+ | "profile.statClasses"
125+ | "common.clearSearch"
126+ | "common.refresh"
127+ | "editor.bold"
128+ | "editor.italic"
129+ | "editor.underline"
130+ | "editor.strike"
131+ | "editor.bulletList"
132+ | "editor.numberedList"
133+ | "editor.clearFormatting"
134+ | "messages.refreshList"
135+ | "messages.deleteDraft"
136+ | "messages.restoreFromTrash"
137+ | "messages.labelsPlaceholder"
138+ | "messages.bodyPlaceholder"
139+ | "messages.replyPlaceholder"
140+ | "questions.deleteConfirm"
141+ | "profile.forbiddenParent"
142+ | "profile.notFound"
143+ | "parentLink.manage"
144+ | "parentLink.title"
145+ | "parentLink.subtitle"
146+ | "parentLink.selectStudent"
147+ | "parentLink.add"
148+ | "parentLink.empty"
149+ | "parentLink.linked"
150+ | "parentLink.remove"
151+ | "parentLink.removeConfirm"
152+ | "parentLink.removed"
153+ | "avatar.title"
154+ | "avatar.change"
155+ | "avatar.upload"
156+ | "avatar.remove"
157+ | "avatar.removeConfirm"
158+ | "avatar.removed"
159+ | "avatar.uploaded"
160+ | "avatar.hint"
161+ | "avatar.typeInvalid"
162+ | "avatar.tooLarge"
163+ | "badges.title"
164+ | "badges.subtitle"
165+ | "badges.earnedOn"
166+ | "badges.locked"
167+ | "badges.remaining"
168+ | "badges.remainingHours"
169+ | "badges.none"
170+ | "badges.earnedCount"
171+ | "badge.homework_submitted_1.name"
172+ | "badge.homework_submitted_1.desc"
173+ | "badge.homework_submitted_10.name"
174+ | "badge.homework_submitted_10.desc"
175+ | "badge.homework_submitted_50.name"
176+ | "badge.homework_submitted_50.desc"
177+ | "badge.homework_on_time_10.name"
178+ | "badge.homework_on_time_10.desc"
179+ | "badge.homework_on_time_25.name"
180+ | "badge.homework_on_time_25.desc"
181+ | "badge.exam_sat_1.name"
182+ | "badge.exam_sat_1.desc"
183+ | "badge.exam_sat_10.name"
184+ | "badge.exam_sat_10.desc"
185+ | "badge.exam_sat_25.name"
186+ | "badge.exam_sat_25.desc"
187+ | "badge.pomodoro_finished_10.name"
188+ | "badge.pomodoro_finished_10.desc"
189+ | "badge.pomodoro_finished_50.name"
190+ | "badge.pomodoro_finished_50.desc"
191+ | "badge.pomodoro_finished_200.name"
192+ | "badge.pomodoro_finished_200.desc"
193+ | "badge.pomodoro_focus_ms_36000000.name"
194+ | "badge.pomodoro_focus_ms_36000000.desc"
195+ | "badge.pomodoro_focus_ms_180000000.name"
196+ | "badge.pomodoro_focus_ms_180000000.desc"
197+ | "whiteboard.bulkInvite"
198+ | "whiteboard.bulkInviteHint"
199+ | "whiteboard.inviteSourceClass"
200+ | "whiteboard.inviteSourceCourse"
201+ | "whiteboard.inviteSourceEvent"
202+ | "whiteboard.inviteSelect"
203+ | "whiteboard.inviteAction"
204+ | "whiteboard.inviteAdded"
205+ | "whiteboard.inviteNoneAdded"
206+ | "whiteboard.inviteTooMany"
207+ | "whiteboard.inviteNotFound"
208+ | "whiteboard.inviteEmptySource"
64 | "nav.children"209 | "nav.children"
65 | "nav.school"210 | "nav.school"
66 | "nav.notes"211 | "nav.notes"
@@ -113,7 +258,6 @@ export type MessageKey =
113 | "notifications.clearAll"258 | "notifications.clearAll"
114 | "notifications.dismiss"259 | "notifications.dismiss"
115 | "notifications.empty"260 | "notifications.empty"
116- | "nav.myStudents"
117 | "parents.title"261 | "parents.title"
118 | "parents.subtitle"262 | "parents.subtitle"
119 | "common.loading"263 | "common.loading"
@@ -332,6 +476,11 @@ export type MessageKey =
332 | "dashboard.successTrendSchool"476 | "dashboard.successTrendSchool"
333 | "dashboard.courseAveragesSchool"477 | "dashboard.courseAveragesSchool"
334 | "dashboard.examGraded"478 | "dashboard.examGraded"
479+ | "dashboard.chartExamCount"
480+ | "dashboard.chartLatest"
481+ | "dashboard.chartAverage"
482+ | "dashboard.chartRange"
483+ | "dashboard.chartLatestExam"
335 | "dashboard.focusHeatmap"484 | "dashboard.focusHeatmap"
336 | "dashboard.focusHeatmapDesc"485 | "dashboard.focusHeatmapDesc"
337 | "dashboard.activityHeatmap"486 | "dashboard.activityHeatmap"
@@ -686,18 +835,83 @@ export type MessageKey =
686 | "admin.noUsers"835 | "admin.noUsers"
687 | "guide.title"836 | "guide.title"
688 | "guide.subtitle"837 | "guide.subtitle"
689- | "guide.step1.title"838+ | "guide.roles.title"
690- | "guide.step1.body"839+ | "guide.roles.subtitle"
691- | "guide.step2.title"840+ | "guide.roles.adminTab"
692- | "guide.step2.body"841+ | "guide.roles.student.heading"
693- | "guide.step3.title"842+ | "guide.roles.student.i1"
694- | "guide.step3.body"843+ | "guide.roles.student.i2"
695- | "guide.step4.title"844+ | "guide.roles.student.i3"
696- | "guide.step4.body"845+ | "guide.roles.student.i4"
697- | "guide.step5.title"846+ | "guide.roles.teacher.heading"
698- | "guide.step5.body"847+ | "guide.roles.teacher.i1"
699- | "guide.step6.title"848+ | "guide.roles.teacher.i2"
700- | "guide.step6.body"849+ | "guide.roles.teacher.i3"
850+ | "guide.roles.teacher.i4"
851+ | "guide.roles.parent.heading"
852+ | "guide.roles.parent.i1"
853+ | "guide.roles.parent.i2"
854+ | "guide.roles.parent.i3"
855+ | "guide.roles.parent.i4"
856+ | "guide.roles.admin.heading"
857+ | "guide.roles.admin.i1"
858+ | "guide.roles.admin.i2"
859+ | "guide.roles.admin.i3"
860+ | "guide.roles.admin.i4"
861+ | "guide.modules.title"
862+ | "guide.modules.subtitle"
863+ | "guide.step.ai.badge"
864+ | "guide.step.ai.title"
865+ | "guide.step.ai.description"
866+ | "guide.step.ai.cta"
867+ | "guide.step.ai.f1"
868+ | "guide.step.ai.f2"
869+ | "guide.step.ai.f3"
870+ | "guide.step.notes.badge"
871+ | "guide.step.notes.title"
872+ | "guide.step.notes.description"
873+ | "guide.step.notes.cta"
874+ | "guide.step.notes.f1"
875+ | "guide.step.notes.f2"
876+ | "guide.step.notes.f3"
877+ | "guide.step.questions.badge"
878+ | "guide.step.questions.title"
879+ | "guide.step.questions.description"
880+ | "guide.step.questions.cta"
881+ | "guide.step.questions.f1"
882+ | "guide.step.questions.f2"
883+ | "guide.step.questions.f3"
884+ | "guide.step.courses.badge"
885+ | "guide.step.courses.title"
886+ | "guide.step.courses.description"
887+ | "guide.step.courses.cta"
888+ | "guide.step.courses.f1"
889+ | "guide.step.courses.f2"
890+ | "guide.step.courses.f3"
891+ | "guide.step.exams.badge"
892+ | "guide.step.exams.title"
893+ | "guide.step.exams.description"
894+ | "guide.step.exams.cta"
895+ | "guide.step.exams.f1"
896+ | "guide.step.exams.f2"
897+ | "guide.step.exams.f3"
898+ | "guide.step.marks.badge"
899+ | "guide.step.marks.title"
900+ | "guide.step.marks.description"
901+ | "guide.step.marks.cta"
902+ | "guide.step.marks.f1"
903+ | "guide.step.marks.f2"
904+ | "guide.step.marks.f3"
905+ | "guide.tips.title"
906+ | "guide.tips.subtitle"
907+ | "guide.tips.locale.title"
908+ | "guide.tips.locale.body"
909+ | "guide.tips.sync.title"
910+ | "guide.tips.sync.body"
911+ | "guide.tips.import.title"
912+ | "guide.tips.import.body"
913+ | "guide.tips.weights.title"
914+ | "guide.tips.weights.body"
701 | "guide.rolesTitle"915 | "guide.rolesTitle"
702 | "courses.helpTitle"916 | "courses.helpTitle"
703 | "courses.helpBody"917 | "courses.helpBody"
@@ -1349,7 +1563,157 @@ const en: Dict = {
1349 "classGroups.noTeacher": "Not assigned",1563 "classGroups.noTeacher": "Not assigned",
1350 "classGroups.selectTeacher": "Select a teacher",1564 "classGroups.selectTeacher": "Select a teacher",
1351 "classGroups.yourClass": "Class",1565 "classGroups.yourClass": "Class",
1352- "nav.children": "Children",1566+ "classBlueprints.tab": "Grade blueprints",
1567+ "classBlueprints.classesTab": "Classes",
1568+ "classBlueprints.title": "Grade blueprints",
1569+ "classBlueprints.subtitle": "Every class at a grade takes this set of courses.",
1570+ "classBlueprints.new": "New blueprint",
1571+ "classBlueprints.edit": "Edit blueprint",
1572+ "classBlueprints.grade": "Grade",
1573+ "classBlueprints.gradeHint": "There is one blueprint per grade, so the grade cannot be changed later.",
1574+ "classBlueprints.courses": "Courses",
1575+ "classBlueprints.courseCount": "{count} courses",
1576+ "classBlueprints.courseCountColumn": "Course count",
1577+ "classBlueprints.selected": "{count} / {max} selected",
1578+ "classBlueprints.empty": "No blueprints yet.",
1579+ "classBlueprints.selectCourses": "Select the courses every class at this grade takes.",
1580+ "classBlueprints.wholeSetHint":
1581+ "This is the complete list — courses you uncheck are detached from every class at this grade. Hand-attached courses stay.",
1582+ "classBlueprints.filterCourses": "Filter courses",
1583+ "classBlueprints.noCourseMatch": "No course matches that filter.",
1584+ "classBlueprints.saved": "Blueprint saved and applied to every class at this grade.",
1585+ "classBlueprints.delete": "Delete blueprint",
1586+ "classBlueprints.deleteConfirm":
1587+ "Delete the blueprint for grade {grade}? The courses it attached are detached from every class at this grade. Hand-attached courses stay.",
1588+ "classBlueprints.deleted": "Blueprint deleted.",
1589+ "classBlueprints.apply": "Apply blueprint",
1590+ "classBlueprints.applyHint": "Attaches this grade's blueprint courses to this class.",
1591+ "classBlueprints.applyNoGrade": "Assign a grade to this class first.",
1592+ "classBlueprints.applied": "Blueprint applied.",
1593+ "classBlueprints.noBlueprintForGrade": "There is no blueprint for grade {grade} yet.",
1594+ "classBlueprints.conflictExists": "A blueprint already exists for this grade. Edit it from the list instead.",
1595+ "classBlueprints.staleReload":
1596+ "This blueprint changed while you were editing. The list has been refreshed — review it and save again.",
1597+ "classBlueprints.skippedSummary": "Saved. {count} class-course pairs could not be attached.",
1598+ "classBlueprints.skippedDetails": "See details",
1599+ "classBlueprints.skippedTitle": "Not attached",
1600+ "classBlueprints.skippedSubtitle": "Everything else went through. These pairs were left alone.",
1601+ "classBlueprints.skippedClass": "Class",
1602+ "classBlueprints.skippedCourse": "Course",
1603+ "classBlueprints.skippedReason": "Reason",
1604+ "classBlueprints.skipClassGone": "The class was deleted while the blueprint was being applied.",
1605+ "classBlueprints.skipCoursePruned": "This course no longer exists and has been dropped from the blueprint.",
1606+ "classBlueprints.skipCeiling": "The class already holds the maximum number of courses.",
1607+ "classBlueprints.skipOverloaded": "The class holds more students than one course attach may enroll at once.",
1608+ "classBlueprints.skipNoSeat": "{course} has no free seat for the whole class.",
1609+ "classBlueprints.skipCourseGone": "{course} no longer exists — detach it from this class first.",
1610+ "classBlueprints.skipOther": "This pair could not be attached.",
1611+ "profile.myProfile": "My profile",
1612+ "profile.viewProfile": "View profile",
1613+ "profile.displayName": "Display name",
1614+ "profile.displayNameHint": "Shown to other people instead of your username.",
1615+ "profile.bio": "About",
1616+ "profile.bioHint": "A short line about yourself.",
1617+ "profile.bioEmpty": "No bio yet.",
1618+ "profile.classes": "Classes",
1619+ "profile.noClasses": "Not in any class.",
1620+ "profile.courses": "Courses",
1621+ "profile.noCourses": "No courses to show.",
1622+ "profile.stats": "Stats",
1623+ "profile.statFocusHours": "Hours focused",
1624+ "profile.statSessions": "Focus sessions",
1625+ "profile.statHomework": "Homework submitted",
1626+ "profile.statOnTime": "Submitted on time",
1627+ "profile.statExams": "Exams sat",
1628+ "profile.statCourses": "Courses",
1629+ "profile.statClasses": "Classes",
1630+ "common.clearSearch": "Clear search",
1631+ "common.refresh": "Refresh",
1632+ "editor.bold": "Bold (Ctrl+B)",
1633+ "editor.italic": "Italic (Ctrl+I)",
1634+ "editor.underline": "Underline (Ctrl+U)",
1635+ "editor.strike": "Strikethrough",
1636+ "editor.bulletList": "Bulleted list",
1637+ "editor.numberedList": "Numbered list",
1638+ "editor.clearFormatting": "Clear formatting",
1639+ "messages.refreshList": "Refresh messages",
1640+ "messages.deleteDraft": "Delete draft",
1641+ "messages.restoreFromTrash": "Restore from trash",
1642+ "messages.labelsPlaceholder": "e.g. Study, Exam (optional)",
1643+ "messages.bodyPlaceholder": "Write your message here…",
1644+ "messages.replyPlaceholder": "Write your reply…",
1645+ "questions.deleteConfirm": "Delete this question?",
1646+ "profile.forbiddenParent": "You can only view your own profile and your children's.",
1647+ "profile.notFound": "There is no such person.",
1648+ "parentLink.manage": "Linked students",
1649+ "parentLink.title": "Linked students",
1650+ "parentLink.subtitle": "Students {name} is the guardian of.",
1651+ "parentLink.selectStudent": "Choose a student",
1652+ "parentLink.add": "Link",
1653+ "parentLink.empty": "No students are linked to this parent yet.",
1654+ "parentLink.linked": "Student linked.",
1655+ "parentLink.remove": "Remove link",
1656+ "parentLink.removeConfirm": "Unlink {student} from {parent}? The parent loses access to that student's records.",
1657+ "parentLink.removed": "Link removed.",
1658+ "avatar.title": "Photo",
1659+ "avatar.change": "Change photo",
1660+ "avatar.upload": "Upload photo",
1661+ "avatar.remove": "Remove photo",
1662+ "avatar.removeConfirm": "Remove your profile photo?",
1663+ "avatar.removed": "Photo removed.",
1664+ "avatar.uploaded": "Photo updated.",
1665+ "avatar.hint": "PNG, JPEG, WebP or GIF, up to {size}.",
1666+ "avatar.typeInvalid": "Use a PNG, JPEG, WebP or GIF image.",
1667+ "avatar.tooLarge": "This image is larger than {size}.",
1668+ "badges.title": "Badges",
1669+ "badges.subtitle": "Earned automatically as the work adds up.",
1670+ "badges.earnedOn": "Earned {date}",
1671+ "badges.locked": "Not earned yet",
1672+ "badges.remaining": "{count} to go",
1673+ "badges.remainingHours": "{count} hours to go",
1674+ "badges.none": "No badges yet.",
1675+ "badges.earnedCount": "{earned} / {total} earned",
1676+ "badge.homework_submitted_1.name": "First Steps",
1677+ "badge.homework_submitted_1.desc": "Submit your first homework.",
1678+ "badge.homework_submitted_10.name": "Steady Hand",
1679+ "badge.homework_submitted_10.desc": "Submit 10 homework assignments.",
1680+ "badge.homework_submitted_50.name": "Homework Master",
1681+ "badge.homework_submitted_50.desc": "Submit 50 homework assignments.",
1682+ "badge.homework_on_time_10.name": "On the Dot",
1683+ "badge.homework_on_time_10.desc": "Turn in 10 homework assignments on time.",
1684+ "badge.homework_on_time_25.name": "Clockwork",
1685+ "badge.homework_on_time_25.desc": "Turn in 25 homework assignments on time.",
1686+ "badge.exam_sat_1.name": "First Exam",
1687+ "badge.exam_sat_1.desc": "Sit your first exam.",
1688+ "badge.exam_sat_10.name": "Exam Regular",
1689+ "badge.exam_sat_10.desc": "Sit 10 exams.",
1690+ "badge.exam_sat_25.name": "Exam Veteran",
1691+ "badge.exam_sat_25.desc": "Sit 25 exams.",
1692+ "badge.pomodoro_finished_10.name": "Focus Starter",
1693+ "badge.pomodoro_finished_10.desc": "Finish 10 focus sessions.",
1694+ "badge.pomodoro_finished_50.name": "Focus Habit",
1695+ "badge.pomodoro_finished_50.desc": "Finish 50 focus sessions.",
1696+ "badge.pomodoro_finished_200.name": "Focus Champion",
1697+ "badge.pomodoro_finished_200.desc": "Finish 200 focus sessions.",
1698+ "badge.pomodoro_focus_ms_36000000.name": "Ten Hours Deep",
1699+ "badge.pomodoro_focus_ms_36000000.desc": "Spend 10 hours in focus sessions.",
1700+ "badge.pomodoro_focus_ms_180000000.name": "Fifty Hours Deep",
1701+ "badge.pomodoro_focus_ms_180000000.desc": "Spend 50 hours in focus sessions.",
1702+ "whiteboard.bulkInvite": "Invite a group",
1703+ "whiteboard.bulkInviteHint":
1704+ "Adds everyone in the group as a participant. Parents are skipped, and people already on the board keep their place.",
1705+ "whiteboard.inviteSourceClass": "Class",
1706+ "whiteboard.inviteSourceCourse": "Course or club",
1707+ "whiteboard.inviteSourceEvent": "Event",
1708+ "whiteboard.inviteSelect": "Choose a group",
1709+ "whiteboard.inviteAction": "Invite",
1710+ "whiteboard.inviteAdded": "{count} people added.",
1711+ "whiteboard.inviteNoneAdded": "Everyone in that group is already a participant.",
1712+ "whiteboard.inviteTooMany":
1713+ "That group would push the board past {max} participants, so nobody was added. Remove some participants or invite a smaller group.",
1714+ "whiteboard.inviteNotFound": "That group no longer exists. Refresh the list.",
1715+ "whiteboard.inviteEmptySource": "Nothing to pick here yet.",
1716+ "nav.children": "My children",
1353 "nav.school": "School",1717 "nav.school": "School",
1354 "nav.notes": "Notebook",1718 "nav.notes": "Notebook",
1355 "nav.events": "Events",1719 "nav.events": "Events",
@@ -1361,9 +1725,9 @@ const en: Dict = {
1361 "nav.marks": "Report card",1725 "nav.marks": "Report card",
1362 "nav.messages": "Messages",1726 "nav.messages": "Messages",
1363 "rightPanel.messagesTitle": "Messages",1727 "rightPanel.messagesTitle": "Messages",
1364- "rightPanel.calendarTitle": "Calendar & Events",1728+ "rightPanel.calendarTitle": "Calendar & events",
1365- "rightPanel.openFullMessages": "Open Full Messages",1729+ "rightPanel.openFullMessages": "Open all messages",
1366- "rightPanel.openFullCalendar": "Open Full Calendar",1730+ "rightPanel.openFullCalendar": "Open full calendar",
1367 "rightPanel.noUnread": "No unread messages",1731 "rightPanel.noUnread": "No unread messages",
1368 "rightPanel.noUpcoming": "No upcoming events or exams",1732 "rightPanel.noUpcoming": "No upcoming events or exams",
1369 "rightPanel.unreadBadge": "Unread",1733 "rightPanel.unreadBadge": "Unread",
@@ -1401,7 +1765,6 @@ const en: Dict = {
1401 "nav.group.community": "Community",1765 "nav.group.community": "Community",
1402 "nav.group.services": "School services",1766 "nav.group.services": "School services",
1403 "nav.darkMode": "Dark mode",1767 "nav.darkMode": "Dark mode",
1404- "nav.myStudents": "My students",
1405 "parents.title": "My Students",1768 "parents.title": "My Students",
1406 "parents.subtitle": "Review academic records for the students linked to your account.",1769 "parents.subtitle": "Review academic records for the students linked to your account.",
1407 "common.loading": "Loading…",1770 "common.loading": "Loading…",
@@ -1467,9 +1830,9 @@ const en: Dict = {
1467 "common.saved": "Saved successfully.",1830 "common.saved": "Saved successfully.",
1468 "common.createItem": "Create new {item}",1831 "common.createItem": "Create new {item}",
1469 "common.countItem": "{count} {item}",1832 "common.countItem": "{count} {item}",
1470- "pool.title": "Question Pool",1833+ "pool.title": "Question pool",
1471 "pool.subtitle": "Post questions and discuss solutions with teachers and classmates.",1834 "pool.subtitle": "Post questions and discuss solutions with teachers and classmates.",
1472- "pool.ask": "Ask Question",1835+ "pool.ask": "Ask a question",
1473 "pool.subject": "Subject",1836 "pool.subject": "Subject",
1474 "pool.body": "Question details",1837 "pool.body": "Question details",
1475 "pool.image": "Attachment (Image)",1838 "pool.image": "Attachment (Image)",
@@ -1618,6 +1981,11 @@ const en: Dict = {
1618 "dashboard.successTrendSchool": "Class averages of recent exams.",1981 "dashboard.successTrendSchool": "Class averages of recent exams.",
1619 "dashboard.courseAveragesSchool": "Average of recent exams, by course.",1982 "dashboard.courseAveragesSchool": "Average of recent exams, by course.",
1620 "dashboard.examGraded": "{count} graded",1983 "dashboard.examGraded": "{count} graded",
1984+ "dashboard.chartExamCount": "Exams",
1985+ "dashboard.chartLatest": "Latest score",
1986+ "dashboard.chartAverage": "Chart average",
1987+ "dashboard.chartRange": "Score range",
1988+ "dashboard.chartLatestExam": "Latest exam",
1621 "dashboard.focusHeatmap": "Focus activity",1989 "dashboard.focusHeatmap": "Focus activity",
1622 "dashboard.focusHeatmapDesc": "Your pomodoro sessions, day by day.",1990 "dashboard.focusHeatmapDesc": "Your pomodoro sessions, day by day.",
1623 "dashboard.activityHeatmap": "School activity",1991 "dashboard.activityHeatmap": "School activity",
@@ -1846,11 +2214,11 @@ const en: Dict = {
1846 "exams.gradeAfterExam": "Available after the exam ends",2214 "exams.gradeAfterExam": "Available after the exam ends",
1847 "exams.results": "Results table",2215 "exams.results": "Results table",
1848 "exams.noResults": "No results yet.",2216 "exams.noResults": "No results yet.",
1849- "exams.details": "Exam Details",2217+ "exams.details": "Exam details",
1850 "exams.schedule": "Schedule",2218 "exams.schedule": "Schedule",
1851- "exams.examStatistics": "Exam Statistics",2219+ "exams.examStatistics": "Exam statistics",
1852- "exams.examQuestions": "Exam Questions",2220+ "exams.examQuestions": "Exam questions",
1853- "exams.studentResults": "Student Grades",2221+ "exams.studentResults": "Student grades",
1854 "exams.window": "Window",2222 "exams.window": "Window",
1855 "exams.unscheduled": "Unscheduled",2223 "exams.unscheduled": "Unscheduled",
1856 "exams.mode": "Mode",2224 "exams.mode": "Mode",
@@ -1878,19 +2246,19 @@ const en: Dict = {
1878 "exams.startTime": "Start time",2246 "exams.startTime": "Start time",
1879 "exams.endTime": "End time",2247 "exams.endTime": "End time",
1880 "exams.scheduleRequired": "Sync/Async exams require a start and end time",2248 "exams.scheduleRequired": "Sync/Async exams require a start and end time",
1881- "exams.step1Details": "1. Exam Details",2249+ "exams.step1Details": "1. Exam details",
1882 "exams.step2Questions": "2. Questions",2250 "exams.step2Questions": "2. Questions",
1883- "exams.hasDuration": "Enable Time Limit",2251+ "exams.hasDuration": "Enable time limit",
1884 "exams.hasDurationHelp": "Sets how many minutes students get in the exam room.",2252 "exams.hasDurationHelp": "Sets how many minutes students get in the exam room.",
1885- "exams.accessAndAttempts": "Access & Attempts",2253+ "exams.accessAndAttempts": "Access & attempts",
1886- "exams.singleAttempt": "Single Attempt (1)",2254+ "exams.singleAttempt": "Single attempt (1)",
1887- "exams.multipleAttempts": "Multiple Attempts",2255+ "exams.multipleAttempts": "Multiple attempts",
1888- "exams.finishAndClose": "Finish & Close",2256+ "exams.finishAndClose": "Finish & close",
1889- "exams.nextQuestions": "Save & Add Questions",2257+ "exams.nextQuestions": "Save & add questions",
1890- "exams.sectionBasic": "Basic Information",2258+ "exams.sectionBasic": "Basic information",
1891- "exams.sectionSchedule": "Schedule & Mode",2259+ "exams.sectionSchedule": "Schedule & mode",
1892- "exams.sectionDuration": "Time Limit",2260+ "exams.sectionDuration": "Time limit",
1893- "exams.sectionAccess": "Participation & Attempts",2261+ "exams.sectionAccess": "Participation & attempts",
1894 "exams.times": "times",2262 "exams.times": "times",
1895 "questions.title": "Questions",2263 "questions.title": "Questions",
1896 "questions.add": "Add question",2264 "questions.add": "Add question",
@@ -2034,9 +2402,9 @@ const en: Dict = {
2034 "attempt.submitted": "Submitted",2402 "attempt.submitted": "Submitted",
2035 "attempt.submittedCanRetakeInfo": "You have submitted this attempt. You can take the exam again using your remaining attempts.",2403 "attempt.submittedCanRetakeInfo": "You have submitted this attempt. You can take the exam again using your remaining attempts.",
2036 "attempt.submittedFinalInfo": "You have submitted this exam. It cannot be reopened.",2404 "attempt.submittedFinalInfo": "You have submitted this exam. It cannot be reopened.",
2037- "attempt.submittedAt": "Submitted At",2405+ "attempt.submittedAt": "Submitted at",
2038- "exams.startsAt": "Start Date",2406+ "exams.startsAt": "Start date",
2039- "exams.endsAt": "End Date",2407+ "exams.endsAt": "End date",
2040 "attempt.expired": "Expired",2408 "attempt.expired": "Expired",
2041 "attempt.expiredInfo": "The time for this exam has expired. It cannot be reopened.",2409 "attempt.expiredInfo": "The time for this exam has expired. It cannot be reopened.",
2042 "attempt.noAttemptsLeft": "No rights left",2410 "attempt.noAttemptsLeft": "No rights left",
@@ -2058,24 +2426,83 @@ const en: Dict = {
2058 "admin.noUsers": "No users registered yet.",2426 "admin.noUsers": "No users registered yet.",
2059 "guide.title": "Product guide",2427 "guide.title": "Product guide",
2060 "guide.subtitle": "How the platform fits together, from classes and exams to report cards, notes, and events.",2428 "guide.subtitle": "How the platform fits together, from classes and exams to report cards, notes, and events.",
2061- "guide.step1.title": "1. Home overview",2429+ "guide.roles.title": "Role permission map",
2062- "guide.step1.body":2430+ "guide.roles.subtitle": "What each role on the platform can reach and manage.",
2063- "Live counts and shortcuts for notes, events, courses, exams, and your report card.",2431+ "guide.roles.adminTab": "Manager & admin",
2064- "guide.step2.title": "2. Notes",2432+ "guide.roles.student.heading": "Student study and participation tools",
2065- "guide.step2.body":2433+ "guide.roles.student.i1": "Keep notes in a private notebook, import PDFs and draw",
2066- "Private scratchpad. Create, edit, delete — delete/update ask for confirmation with a short summary.",2434+ "guide.roles.student.i2": "Ask in the question pool and write solutions for others",
2067- "guide.step3.title": "3. Events & attendance",2435+ "guide.roles.student.i3": "Enter the exam room for enrolled courses and sit timed exams",
2068- "guide.step3.body":2436+ "guide.roles.student.i4": "Follow their own report-card average and attendance",
2069- "Teachers and managers open an event, select a student, then save present/absent/late/excused attendance.",2437+ "guide.roles.teacher.heading": "Teacher management and teaching panel",
2070- "guide.step4.title": "4. Education",2438+ "guide.roles.teacher.i1": "Create courses, study sessions and clubs, and enrol students",
2071- "guide.step4.body":2439+ "guide.roles.teacher.i2": "Take roll call in lesson sessions (present, absent, late, excused)",
2072- "Teachers create a course, study session, or club, enroll students, then add exams by kind inside it.",2440+ "guide.roles.teacher.i3": "Create exams, add questions and run live exam monitoring",
2073- "guide.step5.title": "5. Exams",2441+ "guide.roles.teacher.i4": "Review answer sheets, award marks and confirm report cards",
2074- "guide.step5.body":2442+ "guide.roles.parent.heading": "Parent tracking and information portal",
2075- "List all exams here. New exams are created from an education detail page, not from this list.",2443+ "guide.roles.parent.i1": "Follow linked students' attendance records as they happen",
2076- "guide.step6.title": "6. Report card",2444+ "guide.roles.parent.i2": "See a student's per-course report-card averages",
2077- "guide.step6.body":2445+ "guide.roles.parent.i3": "Follow the upcoming exam and event calendar",
2078- "Your weighted course averages and overall average. Teachers can look up any student.",2446+ "guide.roles.parent.i4": "Message teachers and the school office directly",
2447+ "guide.roles.admin.heading": "Manager and system policy panel",
2448+ "guide.roles.admin.i1": "Create accounts and assign their roles (student, teacher, parent)",
2449+ "guide.roles.admin.i2": "Define academic terms, exam kinds and their weights",
2450+ "guide.roles.admin.i3": "Manage every course and event record at audit level",
2451+ "guide.roles.admin.i4": "Review staff work logs and system records",
2452+ "guide.modules.title": "Core flows and features",
2453+ "guide.modules.subtitle": "The platform's main modules and how each one is used.",
2454+ "guide.step.ai.badge": "AI",
2455+ "guide.step.ai.title": "Çelebi AI assistant",
2456+ "guide.step.ai.description": "The assistant reachable from every page through “Ask Çelebi” in the top bar. It answers about your campus data, your course topics and the system itself.",
2457+ "guide.step.ai.cta": "Try Çelebi",
2458+ "guide.step.ai.f1": "One click from every page",
2459+ "guide.step.ai.f2": "Campus and course-aware answers",
2460+ "guide.step.ai.f3": "Contextual study guidance",
2461+ "guide.step.notes.badge": "Notes and drawing",
2462+ "guide.step.notes.title": "Smart notebook and drawing canvas",
2463+ "guide.step.notes.description": "Turn PDF, TXT and Markdown material into clean Markdown notes. Add freehand sketches and diagrams with the built-in .hzdraw canvas.",
2464+ "guide.step.notes.cta": "Go to notes",
2465+ "guide.step.notes.f1": "Automatic PDF and TXT converter",
2466+ "guide.step.notes.f2": "Built-in .hzdraw freehand canvas",
2467+ "guide.step.notes.f3": "Markdown formatting and an OCR warning",
2468+ "guide.step.questions.badge": "Question pool",
2469+ "guide.step.questions.title": "Question pool and solutions",
2470+ "guide.step.questions.description": "Share your questions in the community pool and add written or multiple-choice solutions. Teacher-approved solutions mark the answer to trust.",
2471+ "guide.step.questions.cta": "Question pool",
2472+ "guide.step.questions.f1": "Written and multiple-choice solutions",
2473+ "guide.step.questions.f2": "Teacher-approved solution badge",
2474+ "guide.step.questions.f3": "Filterable topic and status categories",
2475+ "guide.step.courses.badge": "Courses and study",
2476+ "guide.step.courses.title": "Courses, study sessions and clubs",
2477+ "guide.step.courses.description": "The course, study-session and club programme. Teachers enrol students, take lesson roll call (present, absent, late, excused) and follow the syllabus.",
2478+ "guide.step.courses.cta": "My courses",
2479+ "guide.step.courses.f1": "Student enrolment management",
2480+ "guide.step.courses.f2": "Roll call as the session runs",
2481+ "guide.step.courses.f3": "Exam and study calendar alignment",
2482+ "guide.step.exams.badge": "Exam room",
2483+ "guide.step.exams.title": "Exam room and live monitoring",
2484+ "guide.step.exams.description": "A live exam room with a countdown and autosave. Teachers follow answer sheets and instant marking suggestions from the live monitor.",
2485+ "guide.step.exams.cta": "Exam room",
2486+ "guide.step.exams.f1": "Countdown synced to the server clock",
2487+ "guide.step.exams.f2": "WebSocket and REST autosave",
2488+ "guide.step.exams.f3": "Live teacher monitoring and marking",
2489+ "guide.step.marks.badge": "Report card",
2490+ "guide.step.marks.title": "Report card and progress",
2491+ "guide.step.marks.description": "Term course averages and an overall score computed from exam-kind weights, alongside attendance statistics.",
2492+ "guide.step.marks.cta": "My report card",
2493+ "guide.step.marks.f1": "Weighted exam average",
2494+ "guide.step.marks.f2": "Attendance and excuse summaries",
2495+ "guide.step.marks.f3": "Detailed charts and course reports",
2496+ "guide.tips.title": "Practical tips and shortcuts",
2497+ "guide.tips.subtitle": "Small things that make the platform quicker to work with.",
2498+ "guide.tips.locale.title": "Language and theme",
2499+ "guide.tips.locale.body": "Open the account menu at the bottom of the sidebar to switch between Turkish and English, and between the light and dark themes.",
2500+ "guide.tips.sync.title": "Automatic saving",
2501+ "guide.tips.sync.body": "Your exam-room answers and canvas drafts are saved in the background against the server clock.",
2502+ "guide.tips.import.title": "Quick note import",
2503+ "guide.tips.import.body": "Use the import button on the notes page to turn PDF and TXT course documents into clean Markdown.",
2504+ "guide.tips.weights.title": "Weighted marking",
2505+ "guide.tips.weights.body": "Exam results feed your report-card average using the exam-kind weights the school office defines.",
2079 "guide.rolesTitle": "Who can do what?",2506 "guide.rolesTitle": "Who can do what?",
2080 "guide.rolesBody":2507 "guide.rolesBody":
2081 "Student: notes, events attendance, view courses/exams, own results & report card. Teacher: create courses/events, enroll, add exams, grade. Manager: manage any course/event. Admin: user roles.",2508 "Student: notes, events attendance, view courses/exams, own results & report card. Teacher: create courses/events, enroll, add exams, grade. Manager: manage any course/event. Admin: user roles.",
@@ -2128,7 +2555,7 @@ const en: Dict = {
2128 "role.parent": "Parent",2555 "role.parent": "Parent",
2129 "role.teacher": "Teacher",2556 "role.teacher": "Teacher",
2130 "role.manager": "Manager",2557 "role.manager": "Manager",
2131- "role.admin": "ADMIN",2558+ "role.admin": "Admin",
2132 "courses.title": "Education",2559 "courses.title": "Education",
2133 "courses.listTitle": "{item} records",2560 "courses.listTitle": "{item} records",
2134 "courses.subtitle": "Manage {item}, enrollment, and exams in one place.",2561 "courses.subtitle": "Manage {item}, enrollment, and exams in one place.",
@@ -2224,11 +2651,11 @@ const en: Dict = {
2224 "exams.finished": "Finished",2651 "exams.finished": "Finished",
2225 "exams.active": "Active",2652 "exams.active": "Active",
2226 "exams.upcoming": "Upcoming",2653 "exams.upcoming": "Upcoming",
2227- "exams.liveMonitor": "Live Monitor",2654+ "exams.liveMonitor": "Live monitor",
2228 "exams.liveMonitorDesc": "Real-time exam roster, progress, and marks.",2655 "exams.liveMonitorDesc": "Real-time exam roster, progress, and marks.",
2229- "exams.finalState": "Final State",2656+ "exams.finalState": "Final state",
2230 "exams.finalStateDesc": "Final exam results, progress, and marks.",2657 "exams.finalStateDesc": "Final exam results, progress, and marks.",
2231- "exams.liveRoster": "Live Roster",2658+ "exams.liveRoster": "Live roster",
2232 "exams.notStarted": "Not started",2659 "exams.notStarted": "Not started",
2233 "exams.lastActivity": "Last activity",2660 "exams.lastActivity": "Last activity",
2234 "exams.answerSheet": "Answer Sheet",2661 "exams.answerSheet": "Answer Sheet",
@@ -2260,7 +2687,7 @@ const en: Dict = {
2260 "exams.emptyRoster": "No enrolled students yet.",2687 "exams.emptyRoster": "No enrolled students yet.",
2261 "exams.selectStudent": "Select a student from the roster",2688 "exams.selectStudent": "Select a student from the roster",
2262 "exams.viewSheet": "View answers",2689 "exams.viewSheet": "View answers",
2263- "profile.title": "My Profile",2690+ "profile.title": "Profile",
2264 "profile.subtitle": "Your personal information. All fields are optional.",2691 "profile.subtitle": "Your personal information. All fields are optional.",
2265 "profile.name": "Name",2692 "profile.name": "Name",
2266 "profile.surname": "Surname",2693 "profile.surname": "Surname",
@@ -2566,7 +2993,7 @@ const en: Dict = {
2566 "messages.sent": "Sent",2993 "messages.sent": "Sent",
2567 "messages.archive": "Archive",2994 "messages.archive": "Archive",
2568 "messages.trash": "Trash",2995 "messages.trash": "Trash",
2569- "messages.newMessage": "New Message",2996+ "messages.newMessage": "New message",
2570 "messages.recipient": "Recipient",2997 "messages.recipient": "Recipient",
2571 "messages.recipientPlaceholder": "Search for name or username...",2998 "messages.recipientPlaceholder": "Search for name or username...",
2572 "messages.search": "Search messages",2999 "messages.search": "Search messages",
@@ -2576,8 +3003,8 @@ const en: Dict = {
2576 "messages.send": "Send",3003 "messages.send": "Send",
2577 "messages.moveToArchive": "Archive",3004 "messages.moveToArchive": "Archive",
2578 "messages.moveOutOfArchive": "Move out of Archive",3005 "messages.moveOutOfArchive": "Move out of Archive",
2579- "messages.moveToTrash": "Move to Trash",3006+ "messages.moveToTrash": "Move to trash",
2580- "messages.deleteForever": "Delete Permanently",3007+ "messages.deleteForever": "Delete permanently",
2581 "messages.movedToast": "Message moved.",3008 "messages.movedToast": "Message moved.",
2582 "messages.deletedToast": "Message deleted.",3009 "messages.deletedToast": "Message deleted.",
2583 "messages.sentToast": "Message sent.",3010 "messages.sentToast": "Message sent.",
@@ -2649,7 +3076,157 @@ const tr: Dict = {
2649 "classGroups.noTeacher": "Atanmadı",3076 "classGroups.noTeacher": "Atanmadı",
2650 "classGroups.selectTeacher": "Bir öğretmen seç",3077 "classGroups.selectTeacher": "Bir öğretmen seç",
2651 "classGroups.yourClass": "Şube",3078 "classGroups.yourClass": "Şube",
2652- "nav.children": "Çocuklar",3079+ "classBlueprints.tab": "Seviye şablonları",
3080+ "classBlueprints.classesTab": "Şubeler",
3081+ "classBlueprints.title": "Seviye şablonları",
3082+ "classBlueprints.subtitle": "Bir seviyedeki her şube bu ders kümesini alır.",
3083+ "classBlueprints.new": "Yeni şablon",
3084+ "classBlueprints.edit": "Şablonu düzenle",
3085+ "classBlueprints.grade": "Seviye",
3086+ "classBlueprints.gradeHint": "Her seviyenin tek bir şablonu olur, bu yüzden seviye sonradan değiştirilemez.",
3087+ "classBlueprints.courses": "Dersler",
3088+ "classBlueprints.courseCount": "{count} ders",
3089+ "classBlueprints.courseCountColumn": "Ders sayısı",
3090+ "classBlueprints.selected": "{count} / {max} seçildi",
3091+ "classBlueprints.empty": "Henüz şablon yok.",
3092+ "classBlueprints.selectCourses": "Bu seviyedeki her şubenin aldığı dersleri seç.",
3093+ "classBlueprints.wholeSetHint":
3094+ "Bu liste tamamıdır — işaretini kaldırdığın dersler bu seviyedeki her şubeden çıkarılır. Elle eklenen dersler kalır.",
3095+ "classBlueprints.filterCourses": "Derslerde ara",
3096+ "classBlueprints.noCourseMatch": "Bu aramayla eşleşen ders yok.",
3097+ "classBlueprints.saved": "Şablon kaydedildi ve bu seviyedeki her şubeye uygulandı.",
3098+ "classBlueprints.delete": "Şablonu sil",
3099+ "classBlueprints.deleteConfirm":
3100+ "{grade} seviyesinin şablonu silinsin mi? Şablonun eklediği dersler bu seviyedeki her şubeden çıkarılır. Elle eklenen dersler kalır.",
3101+ "classBlueprints.deleted": "Şablon silindi.",
3102+ "classBlueprints.apply": "Şablonu uygula",
3103+ "classBlueprints.applyHint": "Bu seviyenin şablon derslerini bu şubeye ekler.",
3104+ "classBlueprints.applyNoGrade": "Önce bu şubeye bir seviye ata.",
3105+ "classBlueprints.applied": "Şablon uygulandı.",
3106+ "classBlueprints.noBlueprintForGrade": "{grade} seviyesi için henüz bir şablon yok.",
3107+ "classBlueprints.conflictExists": "Bu seviye için zaten bir şablon var. Bunun yerine listeden düzenle.",
3108+ "classBlueprints.staleReload":
3109+ "Sen düzenlerken bu şablon değişti. Liste yenilendi — gözden geçirip tekrar kaydet.",
3110+ "classBlueprints.skippedSummary": "Kaydedildi. {count} şube-ders eşleşmesi eklenemedi.",
3111+ "classBlueprints.skippedDetails": "Detayları gör",
3112+ "classBlueprints.skippedTitle": "Eklenemeyenler",
3113+ "classBlueprints.skippedSubtitle": "Geri kalan her şey uygulandı. Aşağıdaki eşleşmelere dokunulmadı.",
3114+ "classBlueprints.skippedClass": "Şube",
3115+ "classBlueprints.skippedCourse": "Ders",
3116+ "classBlueprints.skippedReason": "Sebep",
3117+ "classBlueprints.skipClassGone": "Şablon uygulanırken bu şube silindi.",
3118+ "classBlueprints.skipCoursePruned": "Bu ders artık yok ve şablondan çıkarıldı.",
3119+ "classBlueprints.skipCeiling": "Şube en fazla ders sayısına ulaşmış.",
3120+ "classBlueprints.skipOverloaded": "Şubede, tek seferde eklenebilecek olandan daha çok öğrenci var.",
3121+ "classBlueprints.skipNoSeat": "{course} dersinde tüm şube için yeterli kontenjan yok.",
3122+ "classBlueprints.skipCourseGone": "{course} artık yok — önce bu şubeden çıkar.",
3123+ "classBlueprints.skipOther": "Bu eşleşme eklenemedi.",
3124+ "profile.myProfile": "Profilim",
3125+ "profile.viewProfile": "Profili gör",
3126+ "profile.displayName": "Görünen ad",
3127+ "profile.displayNameHint": "Diğer kişilere kullanıcı adın yerine bu gösterilir.",
3128+ "profile.bio": "Hakkında",
3129+ "profile.bioHint": "Kendinle ilgili kısa bir not.",
3130+ "profile.bioEmpty": "Henüz bir not yok.",
3131+ "profile.classes": "Şubeler",
3132+ "profile.noClasses": "Hiçbir şubede değil.",
3133+ "profile.courses": "Dersler",
3134+ "profile.noCourses": "Gösterilecek ders yok.",
3135+ "profile.stats": "İstatistikler",
3136+ "profile.statFocusHours": "Odak saati",
3137+ "profile.statSessions": "Odak oturumu",
3138+ "profile.statHomework": "Teslim edilen ödev",
3139+ "profile.statOnTime": "Zamanında teslim",
3140+ "profile.statExams": "Girilen sınav",
3141+ "profile.statCourses": "Ders",
3142+ "profile.statClasses": "Şube",
3143+ "common.clearSearch": "Aramayı temizle",
3144+ "common.refresh": "Yenile",
3145+ "editor.bold": "Kalın (Ctrl+B)",
3146+ "editor.italic": "İtalik (Ctrl+I)",
3147+ "editor.underline": "Altı çizili (Ctrl+U)",
3148+ "editor.strike": "Üstü çizili",
3149+ "editor.bulletList": "Madde işaretli liste",
3150+ "editor.numberedList": "Numaralı liste",
3151+ "editor.clearFormatting": "Biçimlendirmeyi temizle",
3152+ "messages.refreshList": "Mesajları yenile",
3153+ "messages.deleteDraft": "Taslağı sil",
3154+ "messages.restoreFromTrash": "Çöp kutusundan çıkar",
3155+ "messages.labelsPlaceholder": "ör. Etüt, Sınav (isteğe bağlı)",
3156+ "messages.bodyPlaceholder": "Mesajınızı buraya yazın…",
3157+ "messages.replyPlaceholder": "Yanıtınızı yazın…",
3158+ "questions.deleteConfirm": "Bu soru silinsin mi?",
3159+ "profile.forbiddenParent": "Yalnızca kendi profilini ve çocuklarının profilini görebilirsin.",
3160+ "profile.notFound": "Böyle bir kişi yok.",
3161+ "parentLink.manage": "Bağlı öğrenciler",
3162+ "parentLink.title": "Bağlı öğrenciler",
3163+ "parentLink.subtitle": "{name} adlı velinin sorumlu olduğu öğrenciler.",
3164+ "parentLink.selectStudent": "Öğrenci seç",
3165+ "parentLink.add": "Bağla",
3166+ "parentLink.empty": "Bu veliye bağlı öğrenci yok.",
3167+ "parentLink.linked": "Öğrenci bağlandı.",
3168+ "parentLink.remove": "Bağlantıyı kaldır",
3169+ "parentLink.removeConfirm": "{student} öğrencisinin {parent} ile bağlantısı kaldırılsın mı? Veli, o öğrencinin kayıtlarına erişimini kaybeder.",
3170+ "parentLink.removed": "Bağlantı kaldırıldı.",
3171+ "avatar.title": "Fotoğraf",
3172+ "avatar.change": "Fotoğrafı değiştir",
3173+ "avatar.upload": "Fotoğraf yükle",
3174+ "avatar.remove": "Fotoğrafı kaldır",
3175+ "avatar.removeConfirm": "Profil fotoğrafın kaldırılsın mı?",
3176+ "avatar.removed": "Fotoğraf kaldırıldı.",
3177+ "avatar.uploaded": "Fotoğraf güncellendi.",
3178+ "avatar.hint": "PNG, JPEG, WebP veya GIF, en fazla {size}.",
3179+ "avatar.typeInvalid": "PNG, JPEG, WebP veya GIF bir görsel kullan.",
3180+ "avatar.tooLarge": "Bu görsel {size} sınırından büyük.",
3181+ "badges.title": "Rozetler",
3182+ "badges.subtitle": "Çalışma biriktikçe otomatik kazanılır.",
3183+ "badges.earnedOn": "{date} tarihinde kazanıldı",
3184+ "badges.locked": "Henüz kazanılmadı",
3185+ "badges.remaining": "{count} tane kaldı",
3186+ "badges.remainingHours": "{count} saat kaldı",
3187+ "badges.none": "Henüz rozet yok.",
3188+ "badges.earnedCount": "{earned} / {total} kazanıldı",
3189+ "badge.homework_submitted_1.name": "İlk Adım",
3190+ "badge.homework_submitted_1.desc": "İlk ödevini teslim et.",
3191+ "badge.homework_submitted_10.name": "Düzenli Teslim",
3192+ "badge.homework_submitted_10.desc": "10 ödev teslim et.",
3193+ "badge.homework_submitted_50.name": "Ödev Ustası",
3194+ "badge.homework_submitted_50.desc": "50 ödev teslim et.",
3195+ "badge.homework_on_time_10.name": "Dakik",
3196+ "badge.homework_on_time_10.desc": "10 ödevi zamanında teslim et.",
3197+ "badge.homework_on_time_25.name": "Saat Gibi",
3198+ "badge.homework_on_time_25.desc": "25 ödevi zamanında teslim et.",
3199+ "badge.exam_sat_1.name": "İlk Sınav",
3200+ "badge.exam_sat_1.desc": "İlk sınavına gir.",
3201+ "badge.exam_sat_10.name": "Sınav Yolcusu",
3202+ "badge.exam_sat_10.desc": "10 sınava gir.",
3203+ "badge.exam_sat_25.name": "Sınav Kurdu",
3204+ "badge.exam_sat_25.desc": "25 sınava gir.",
3205+ "badge.pomodoro_finished_10.name": "Odağa Başlangıç",
3206+ "badge.pomodoro_finished_10.desc": "10 odak oturumu tamamla.",
3207+ "badge.pomodoro_finished_50.name": "Odak Alışkanlığı",
3208+ "badge.pomodoro_finished_50.desc": "50 odak oturumu tamamla.",
3209+ "badge.pomodoro_finished_200.name": "Odak Şampiyonu",
3210+ "badge.pomodoro_finished_200.desc": "200 odak oturumu tamamla.",
3211+ "badge.pomodoro_focus_ms_36000000.name": "10 Saat Odak",
3212+ "badge.pomodoro_focus_ms_36000000.desc": "Odak oturumlarında toplam 10 saat geçir.",
3213+ "badge.pomodoro_focus_ms_180000000.name": "50 Saat Odak",
3214+ "badge.pomodoro_focus_ms_180000000.desc": "Odak oturumlarında toplam 50 saat geçir.",
3215+ "whiteboard.bulkInvite": "Toplu davet",
3216+ "whiteboard.bulkInviteHint":
3217+ "Gruptaki herkesi katılımcı olarak ekler. Veliler eklenmez, zaten tahtada olanların yeri korunur.",
3218+ "whiteboard.inviteSourceClass": "Şube",
3219+ "whiteboard.inviteSourceCourse": "Ders veya kulüp",
3220+ "whiteboard.inviteSourceEvent": "Etkinlik",
3221+ "whiteboard.inviteSelect": "Bir grup seç",
3222+ "whiteboard.inviteAction": "Davet et",
3223+ "whiteboard.inviteAdded": "{count} kişi eklendi.",
3224+ "whiteboard.inviteNoneAdded": "O gruptaki herkes zaten katılımcı.",
3225+ "whiteboard.inviteTooMany":
3226+ "Bu grup tahtayı {max} katılımcı sınırının üstüne çıkarırdı, bu yüzden kimse eklenmedi. Bazı katılımcıları çıkar veya daha küçük bir grup davet et.",
3227+ "whiteboard.inviteNotFound": "O grup artık yok. Listeyi yenile.",
3228+ "whiteboard.inviteEmptySource": "Burada henüz seçilecek bir şey yok.",
3229+ "nav.children": "Çocuklarım",
2653 "nav.school": "Okul",3230 "nav.school": "Okul",
2654 "nav.notes": "Defter",3231 "nav.notes": "Defter",
2655 "nav.events": "Etkinlikler",3232 "nav.events": "Etkinlikler",
@@ -2661,9 +3238,9 @@ const tr: Dict = {
2661 "nav.marks": "Karnem",3238 "nav.marks": "Karnem",
2662 "nav.messages": "Mesajlar",3239 "nav.messages": "Mesajlar",
2663 "rightPanel.messagesTitle": "Mesajlar",3240 "rightPanel.messagesTitle": "Mesajlar",
2664- "rightPanel.calendarTitle": "Takvim & Etkinlikler",3241+ "rightPanel.calendarTitle": "Takvim ve etkinlikler",
2665- "rightPanel.openFullMessages": "Tüm Mesajları Aç",3242+ "rightPanel.openFullMessages": "Tüm mesajları aç",
2666- "rightPanel.openFullCalendar": "Tüm Takvimi Aç",3243+ "rightPanel.openFullCalendar": "Tüm takvimi aç",
2667 "rightPanel.noUnread": "Okunmamış mesaj yok",3244 "rightPanel.noUnread": "Okunmamış mesaj yok",
2668 "rightPanel.noUpcoming": "Yaklaşan etkinlik veya sınav yok",3245 "rightPanel.noUpcoming": "Yaklaşan etkinlik veya sınav yok",
2669 "rightPanel.unreadBadge": "Okunmamış",3246 "rightPanel.unreadBadge": "Okunmamış",
@@ -2701,7 +3278,6 @@ const tr: Dict = {
2701 "nav.group.community": "Topluluk",3278 "nav.group.community": "Topluluk",
2702 "nav.group.services": "Okul hizmetleri",3279 "nav.group.services": "Okul hizmetleri",
2703 "nav.darkMode": "Karanlık mod",3280 "nav.darkMode": "Karanlık mod",
2704- "nav.myStudents": "Öğrencilerim",
2705 "parents.title": "Öğrencilerim",3281 "parents.title": "Öğrencilerim",
2706 "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.",3282 "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.",
2707 "common.loading": "Yükleniyor…",3283 "common.loading": "Yükleniyor…",
@@ -2767,9 +3343,9 @@ const tr: Dict = {
2767 "common.saved": "Başarıyla kaydedildi.",3343 "common.saved": "Başarıyla kaydedildi.",
2768 "common.createItem": "Yeni {item} oluştur",3344 "common.createItem": "Yeni {item} oluştur",
2769 "common.countItem": "{count} {item}",3345 "common.countItem": "{count} {item}",
2770- "pool.title": "Soru Havuzu",3346+ "pool.title": "Soru havuzu",
2771 "pool.subtitle": "Öğretmenlerinize ve arkadaşlarınıza soru sorun, çözümleri birlikte tartışın.",3347 "pool.subtitle": "Öğretmenlerinize ve arkadaşlarınıza soru sorun, çözümleri birlikte tartışın.",
2772- "pool.ask": "Soru Sor",3348+ "pool.ask": "Soru sor",
2773 "pool.subject": "Konu",3349 "pool.subject": "Konu",
2774 "pool.body": "Soru detayı",3350 "pool.body": "Soru detayı",
2775 "pool.image": "Görsel (İsteğe bağlı)",3351 "pool.image": "Görsel (İsteğe bağlı)",
@@ -2778,7 +3354,7 @@ const tr: Dict = {
2778 "pool.approved": "Onaylandı",3354 "pool.approved": "Onaylandı",
2779 "pool.author": "Yazar",3355 "pool.author": "Yazar",
2780 "pool.solutions": "Çözümler",3356 "pool.solutions": "Çözümler",
2781- "pool.offerSolution": "Çözüm Gönder",3357+ "pool.offerSolution": "Çözüm gönder",
2782 "pool.noQuestions": "Soru bulunamadı.",3358 "pool.noQuestions": "Soru bulunamadı.",
2783 "theme.light": "Açık",3359 "theme.light": "Açık",
2784 "theme.dark": "Koyu",3360 "theme.dark": "Koyu",
@@ -2918,6 +3494,11 @@ const tr: Dict = {
2918 "dashboard.successTrendSchool": "Son sınavların sınıf ortalamaları.",3494 "dashboard.successTrendSchool": "Son sınavların sınıf ortalamaları.",
2919 "dashboard.courseAveragesSchool": "Son sınavlara göre ders bazında ortalama.",3495 "dashboard.courseAveragesSchool": "Son sınavlara göre ders bazında ortalama.",
2920 "dashboard.examGraded": "{count} notlandırıldı",3496 "dashboard.examGraded": "{count} notlandırıldı",
3497+ "dashboard.chartExamCount": "Sınav",
3498+ "dashboard.chartLatest": "Son değer",
3499+ "dashboard.chartAverage": "Grafik ortalaması",
3500+ "dashboard.chartRange": "Değer aralığı",
3501+ "dashboard.chartLatestExam": "Son sınav",
2921 "dashboard.focusHeatmap": "Odaklanma etkinliği",3502 "dashboard.focusHeatmap": "Odaklanma etkinliği",
2922 "dashboard.focusHeatmapDesc": "Gün gün pomodoro oturumların.",3503 "dashboard.focusHeatmapDesc": "Gün gün pomodoro oturumların.",
2923 "dashboard.activityHeatmap": "Okul etkinliği",3504 "dashboard.activityHeatmap": "Okul etkinliği",
@@ -3146,11 +3727,11 @@ const tr: Dict = {
3146 "exams.gradeAfterExam": "Sınav bitince kullanılabilir",3727 "exams.gradeAfterExam": "Sınav bitince kullanılabilir",
3147 "exams.results": "Sonuç tablosu",3728 "exams.results": "Sonuç tablosu",
3148 "exams.noResults": "Henüz sonuç yok.",3729 "exams.noResults": "Henüz sonuç yok.",
3149- "exams.details": "Sınav Detayları",3730+ "exams.details": "Sınav detayları",
3150 "exams.schedule": "Zamanlama",3731 "exams.schedule": "Zamanlama",
3151- "exams.examStatistics": "Sınav İstatistikleri",3732+ "exams.examStatistics": "Sınav istatistikleri",
3152- "exams.examQuestions": "Sınav Soruları",3733+ "exams.examQuestions": "Sınav soruları",
3153- "exams.studentResults": "Öğrenci Notları",3734+ "exams.studentResults": "Öğrenci notları",
3154 "exams.window": "Aralık",3735 "exams.window": "Aralık",
3155 "exams.unscheduled": "Zamansız",3736 "exams.unscheduled": "Zamansız",
3156 "exams.mode": "Mod",3737 "exams.mode": "Mod",
@@ -3178,19 +3759,19 @@ const tr: Dict = {
3178 "exams.startTime": "Başlangıç saati",3759 "exams.startTime": "Başlangıç saati",
3179 "exams.endTime": "Bitiş saati",3760 "exams.endTime": "Bitiş saati",
3180 "exams.scheduleRequired": "Zamanlı sınav için başlangıç ve bitiş gerekli",3761 "exams.scheduleRequired": "Zamanlı sınav için başlangıç ve bitiş gerekli",
3181- "exams.step1Details": "1. Sınav Bilgileri",3762+ "exams.step1Details": "1. Sınav bilgileri",
3182 "exams.step2Questions": "2. Sorular",3763 "exams.step2Questions": "2. Sorular",
3183- "exams.hasDuration": "Süre Sınırı Ekle",3764+ "exams.hasDuration": "Süre sınırı ekle",
3184 "exams.hasDurationHelp": "Öğrencilerin sınav odasında kaç dakikası olacağını belirler.",3765 "exams.hasDurationHelp": "Öğrencilerin sınav odasında kaç dakikası olacağını belirler.",
3185- "exams.accessAndAttempts": "Erişim ve Haklar",3766+ "exams.accessAndAttempts": "Erişim ve haklar",
3186- "exams.singleAttempt": "Tek Hak (1)",3767+ "exams.singleAttempt": "Tek hak (1)",
3187- "exams.multipleAttempts": "Çoklu Hak",3768+ "exams.multipleAttempts": "Çoklu hak",
3188- "exams.finishAndClose": "Tamamla ve Kapat",3769+ "exams.finishAndClose": "Tamamla ve kapat",
3189- "exams.nextQuestions": "Kaydet ve Sorulara Geç",3770+ "exams.nextQuestions": "Kaydet ve sorulara geç",
3190- "exams.sectionBasic": "Temel Bilgiler",3771+ "exams.sectionBasic": "Temel bilgiler",
3191- "exams.sectionSchedule": "Mod ve Zamanlama",3772+ "exams.sectionSchedule": "Mod ve zamanlama",
3192- "exams.sectionDuration": "Süre Sınırı",3773+ "exams.sectionDuration": "Süre sınırı",
3193- "exams.sectionAccess": "Katılım ve Haklar",3774+ "exams.sectionAccess": "Katılım ve haklar",
3194 "exams.times": "defa",3775 "exams.times": "defa",
3195 "questions.title": "Sorular",3776 "questions.title": "Sorular",
3196 "questions.add": "Soru ekle",3777 "questions.add": "Soru ekle",
@@ -3334,9 +3915,9 @@ const tr: Dict = {
3334 "attempt.submitted": "Teslim edildi",3915 "attempt.submitted": "Teslim edildi",
3335 "attempt.submittedCanRetakeInfo": "Bu denemenizi teslim ettiniz. Kalan haklarınızı kullanarak sınava tekrardan başlayabilirsiniz.",3916 "attempt.submittedCanRetakeInfo": "Bu denemenizi teslim ettiniz. Kalan haklarınızı kullanarak sınava tekrardan başlayabilirsiniz.",
3336 "attempt.submittedFinalInfo": "Bu sınavı zaten teslim ettin. Yeniden açılamaz.",3917 "attempt.submittedFinalInfo": "Bu sınavı zaten teslim ettin. Yeniden açılamaz.",
3337- "attempt.submittedAt": "Teslim Tarihi",3918+ "attempt.submittedAt": "Teslim tarihi",
3338- "exams.startsAt": "Başlangıç Tarihi",3919+ "exams.startsAt": "Başlangıç tarihi",
3339- "exams.endsAt": "Bitiş Tarihi",3920+ "exams.endsAt": "Bitiş tarihi",
3340 "attempt.expired": "Süresi doldu",3921 "attempt.expired": "Süresi doldu",
3341 "attempt.expiredInfo": "Bu sınavın süresi doldu. Yeniden açılamaz.",3922 "attempt.expiredInfo": "Bu sınavın süresi doldu. Yeniden açılamaz.",
3342 "attempt.noAttemptsLeft": "Hak bitti",3923 "attempt.noAttemptsLeft": "Hak bitti",
@@ -3358,24 +3939,83 @@ const tr: Dict = {
3358 "admin.noUsers": "Henüz kayıtlı kullanıcı yok.",3939 "admin.noUsers": "Henüz kayıtlı kullanıcı yok.",
3359 "guide.title": "Ürün rehberi",3940 "guide.title": "Ürün rehberi",
3360 "guide.subtitle": "Derslerden sınavlara, karnelerden notlara ve etkinliklere kadar platformun nasıl bir arada çalıştığı.",3941 "guide.subtitle": "Derslerden sınavlara, karnelerden notlara ve etkinliklere kadar platformun nasıl bir arada çalıştığı.",
3361- "guide.step1.title": "1. Ana sayfa",3942+ "guide.roles.title": "Rol bazlı yetki haritası",
3362- "guide.step1.body":3943+ "guide.roles.subtitle": "Platformdaki her bir rolün erişebildiği ve yönetebildiği alanlar.",
3363- "Not, etkinlik, ders, sınav ve karne için canlı sayılar ve kısayollar.",3944+ "guide.roles.adminTab": "Yönetici ve admin",
3364- "guide.step2.title": "2. Notlar",3945+ "guide.roles.student.heading": "Öğrenci çalışma ve katılım araçları",
3365- "guide.step2.body":3946+ "guide.roles.student.i1": "Kendi özel defterinde not tutma, PDF aktarma ve çizim yapma",
3366- "Özel defter. Oluştur, düzenle, sil — silme/güncelleme özetli onay ister.",3947+ "guide.roles.student.i2": "Soru havuzunda soru sorma, diğer sorulara çözüm yazma",
3367- "guide.step3.title": "3. Etkinlik ve yoklama",3948+ "guide.roles.student.i3": "Kaydolunan derslerin sınav odasına girme ve süreli sınav çözme",
3368- "guide.step3.body":3949+ "guide.roles.student.i4": "Kendi karne ortalamasını ve devamsızlık durumunu izleme",
3369- "Öğretmenler ve yöneticiler etkinliği açar, öğrenciyi seçer ve var/yok/geç/mazeretli yoklama kaydeder.",3950+ "guide.roles.teacher.heading": "Öğretmen yönetim ve eğitici paneli",
3370- "guide.step4.title": "4. Eğitim",3951+ "guide.roles.teacher.i1": "Ders, etüt ve kulüp oluşturma, öğrencileri derse kaydetme",
3371- "guide.step4.body":3952+ "guide.roles.teacher.i2": "Ders oturumlarında öğrenci yoklaması alma (Var, Yok, Geç, Mazeretli)",
3372- "Öğretmen ders, etüt veya kulüp oluşturur, öğrenci kaydeder, içine türe göre sınav ekler.",3953+ "guide.roles.teacher.i3": "Sınav oluşturma, sorular ekleme ve canlı sınav takibi yürütme",
3373- "guide.step5.title": "5. Sınavlar",3954+ "guide.roles.teacher.i4": "Öğrenci sınav kağıtlarını inceleme, puan verme ve karne onaylama",
3374- "guide.step5.body":3955+ "guide.roles.parent.heading": "Veli takip ve bilgilendirme portalı",
3375- "Tüm sınavlar burada listelenir. Yeni sınav bu listeden değil, eğitim detayından eklenir.",3956+ "guide.roles.parent.i1": "Bağlı öğrencilerin ders devamsızlık kayıtlarını anlık izleme",
3376- "guide.step6.title": "6. Karnem",3957+ "guide.roles.parent.i2": "Öğrencinin ders bazlı karne başarı ortalamalarını görüntüleme",
3377- "guide.step6.body":3958+ "guide.roles.parent.i3": "Yaklaşan sınav ve etkinlik takvimini takip etme",
3378- "Ders ortalamaları ve genel ortalama. Öğretmen herhangi bir öğrencinin karnesine bakabilir.",3959+ "guide.roles.parent.i4": "Öğretmenler ve okul yönetimi ile doğrudan mesajlaşma",
3960+ "guide.roles.admin.heading": "Yönetici ve sistem politikaları paneli",
3961+ "guide.roles.admin.i1": "Kullanıcı hesapları oluşturma, rollerini atama (öğrenci, öğretmen, veli)",
3962+ "guide.roles.admin.i2": "Okul akademik dönemleri, sınav türleri ve ağırlık oranlarını tanımlama",
3963+ "guide.roles.admin.i3": "Tüm ders ve etkinlik kayıtlarını genel denetim seviyesinde yönetme",
3964+ "guide.roles.admin.i4": "Personel çalışma günlüklerini ve sistem loglarını inceleme",
3965+ "guide.modules.title": "Temel akışlar ve özellikler",
3966+ "guide.modules.subtitle": "Hezarfen platformundaki ana modülleri ve kullanım adımlarını inceleyin.",
3967+ "guide.step.ai.badge": "Yapay zeka",
3968+ "guide.step.ai.title": "Çelebi AI asistanı",
3969+ "guide.step.ai.description": "Tüm sayfalardan üst barda bulunan “Çelebi’ye Sor” butonuyla erişilebilir akıllı yapay zeka asistanı. Kampüs verileriniz, ders konularınız ve sistem hakkında anlık yanıtlar verir.",
3970+ "guide.step.ai.cta": "Çelebi'yi dene",
3971+ "guide.step.ai.f1": "Tüm sayfalardan tek tıkla erişim",
3972+ "guide.step.ai.f2": "Kampüs ve ders odaklı yanıtlar",
3973+ "guide.step.ai.f3": "Bağlamsal çalışma rehberliği",
3974+ "guide.step.notes.badge": "Notlar ve çizim",
3975+ "guide.step.notes.title": "Akıllı defter ve çizim tuvali",
3976+ "guide.step.notes.description": "PDF, TXT ve Markdown materyallerinizi temiz Markdown notlarına dönüştürün. Dahili .hzdraw tuvali ile derslerinize serbest el çizimleri ve grafikler ekleyin.",
3977+ "guide.step.notes.cta": "Notlara git",
3978+ "guide.step.notes.f1": "PDF ve TXT otomatik dönüştürücü",
3979+ "guide.step.notes.f2": "Dahili .hzdraw serbest çizim tuvali",
3980+ "guide.step.notes.f3": "Markdown biçimlendirme ve OCR uyarısı",
3981+ "guide.step.questions.badge": "Soru havuzu",
3982+ "guide.step.questions.title": "Soru havuzu ve çözümler",
3983+ "guide.step.questions.description": "Topluluk soru havuzunda sorularınızı paylaşın, yazılı ve çoktan seçmeli çözümler ekleyin. Öğretmen onaylı çözümlerle ders konularında uzmanlaşın.",
3984+ "guide.step.questions.cta": "Soru havuzu",
3985+ "guide.step.questions.f1": "Yazılı ve test çözümleri",
3986+ "guide.step.questions.f2": "Öğretmen onaylı çözüm rozeti",
3987+ "guide.step.questions.f3": "Filtrelenebilir konu ve durum kategorileri",
3988+ "guide.step.courses.badge": "Dersler ve etütler",
3989+ "guide.step.courses.title": "Dersler, etütler ve kulüpler",
3990+ "guide.step.courses.description": "Ders, etüt ve kulüp programı. Öğretmenler öğrenci kaydeder, ders içi oturum yoklaması (Var, Yok, Geç, Mazeretli) alır ve müfredat takibi yapar.",
3991+ "guide.step.courses.cta": "Derslerim",
3992+ "guide.step.courses.f1": "Öğrenci ders kayıt yönetimi",
3993+ "guide.step.courses.f2": "Anlık oturum yoklaması alma",
3994+ "guide.step.courses.f3": "Sınav ve etüt takvimi hizalaması",
3995+ "guide.step.exams.badge": "Sınav odası",
3996+ "guide.step.exams.title": "Sınav odası ve canlı takip",
3997+ "guide.step.exams.description": "Geri sayım ve otomatik kaydetmeli canlı sınav odası. Öğretmenler canlı izleme panelinden yanıt kağıtlarını ve anlık puanlama önerilerini takip eder.",
3998+ "guide.step.exams.cta": "Sınav odası",
3999+ "guide.step.exams.f1": "Sunucu saati senkronize geri sayım",
4000+ "guide.step.exams.f2": "WebSocket ve REST otomatik kaydetme",
4001+ "guide.step.exams.f3": "Canlı öğretmen izleme ve puanlama",
4002+ "guide.step.marks.badge": "Karne ve devam",
4003+ "guide.step.marks.title": "Karne ve ilerleme raporu",
4004+ "guide.step.marks.description": "Dönem ders ortalamaları ve sınav türü ağırlıklarına göre hesaplanan genel başarı puanı. Devamsızlık istatistikleri ile anlık gelişim takibi.",
4005+ "guide.step.marks.cta": "Karnem",
4006+ "guide.step.marks.f1": "Ağırlıklı sınav puan ortalaması",
4007+ "guide.step.marks.f2": "Devamsızlık ve mazeret özetleri",
4008+ "guide.step.marks.f3": "Detaylı grafik ve ders raporları",
4009+ "guide.tips.title": "Pratik ipuçları ve kısayollar",
4010+ "guide.tips.subtitle": "Hezarfen deneyimini en verimli şekilde kullanmanızı sağlayan püf noktaları.",
4011+ "guide.tips.locale.title": "Dil ve tema seçimi",
4012+ "guide.tips.locale.body": "Kenar çubuğunun altındaki hesap menüsünden Türkçe / İngilizce dilleri ve açık / koyu temalar arasında anında geçiş yapabilirsiniz.",
4013+ "guide.tips.sync.title": "Otomatik senkronizasyon",
4014+ "guide.tips.sync.body": "Sınav odasındaki yanıtlarınız ve çizim tuvalindeki taslaklarınız sunucu saatiyle arka planda güvenle kaydedilir.",
4015+ "guide.tips.import.title": "Hızlı not içe aktarma",
4016+ "guide.tips.import.body": "Notlar sayfasındaki içe aktar butonuyla PDF ve TXT ders dokümanlarınızı temiz Markdown metinlerine dönüştürebilirsiniz.",
4017+ "guide.tips.weights.title": "Ağırlıklı not hesaplaması",
4018+ "guide.tips.weights.body": "Sınav sonuçlarınız, okul yönetiminin tanımladığı sınav türü ağırlıklarına göre doğrudan karne ortalamanıza yansıtılır.",
3379 "guide.rolesTitle": "Kim ne yapabilir?",4019 "guide.rolesTitle": "Kim ne yapabilir?",
3380 "guide.rolesBody":4020 "guide.rolesBody":
3381 "Öğrenci: notlar, yoklama, ders/sınav görüntüleme, kendi sonucu ve karne. Öğretmen: ders/etkinlik, kayıt, sınav, not. Yönetici: her ders/etkinlik. Admin: roller.",4021 "Öğrenci: notlar, yoklama, ders/sınav görüntüleme, kendi sonucu ve karne. Öğretmen: ders/etkinlik, kayıt, sınav, not. Yönetici: her ders/etkinlik. Admin: roller.",
@@ -3428,7 +4068,7 @@ const tr: Dict = {
3428 "role.parent": "Veli",4068 "role.parent": "Veli",
3429 "role.teacher": "Öğretmen",4069 "role.teacher": "Öğretmen",
3430 "role.manager": "Yönetici",4070 "role.manager": "Yönetici",
3431- "role.admin": "ADMIN",4071+ "role.admin": "Sistem yöneticisi",
3432 "courses.title": "Eğitim",4072 "courses.title": "Eğitim",
3433 "courses.listTitle": "{item} kayıtları",4073 "courses.listTitle": "{item} kayıtları",
3434 "courses.subtitle": "{item}, kayıtları ve sınavları tek bir yerden yönetin.",4074 "courses.subtitle": "{item}, kayıtları ve sınavları tek bir yerden yönetin.",
@@ -3461,7 +4101,7 @@ const tr: Dict = {
3461 "courses.teacherAssigned": "Öğretmen başarıyla atandı.",4101 "courses.teacherAssigned": "Öğretmen başarıyla atandı.",
3462 "courses.teacherUnassigned": "Öğretmen başarıyla çıkarıldı.",4102 "courses.teacherUnassigned": "Öğretmen başarıyla çıkarıldı.",
3463 "courses.noTeachers": "Atanmış öğretmen yok.",4103 "courses.noTeachers": "Atanmış öğretmen yok.",
3464- "courses.overview": "Genel Bakış",4104+ "courses.overview": "Genel bakış",
3465 "courses.work": "Çalışmalar",4105 "courses.work": "Çalışmalar",
3466 "courses.people": "Kişiler",4106 "courses.people": "Kişiler",
3467 "courses.upcoming": "Yaklaşan çalışmalar",4107 "courses.upcoming": "Yaklaşan çalışmalar",
@@ -3524,11 +4164,11 @@ const tr: Dict = {
3524 "exams.finished": "Bitti",4164 "exams.finished": "Bitti",
3525 "exams.active": "Aktif",4165 "exams.active": "Aktif",
3526 "exams.upcoming": "Yakında",4166 "exams.upcoming": "Yakında",
3527- "exams.liveMonitor": "Canlı İzleme",4167+ "exams.liveMonitor": "Canlı izleme",
3528 "exams.liveMonitorDesc": "Sınav durumu, ilerleme ve notlar gerçek zamanlı.",4168 "exams.liveMonitorDesc": "Sınav durumu, ilerleme ve notlar gerçek zamanlı.",
3529- "exams.finalState": "Son Durum",4169+ "exams.finalState": "Son durum",
3530 "exams.finalStateDesc": "Sınav sonuçları, ilerleme ve notlar.",4170 "exams.finalStateDesc": "Sınav sonuçları, ilerleme ve notlar.",
3531- "exams.liveRoster": "Canlı Liste",4171+ "exams.liveRoster": "Canlı liste",
3532 "exams.notStarted": "Başlamadı",4172 "exams.notStarted": "Başlamadı",
3533 "exams.lastActivity": "Son hareket",4173 "exams.lastActivity": "Son hareket",
3534 "exams.answerSheet": "Cevap Kâğıdı",4174 "exams.answerSheet": "Cevap Kâğıdı",
@@ -3560,7 +4200,7 @@ const tr: Dict = {
3560 "exams.emptyRoster": "Henüz kayıtlı öğrenci yok.",4200 "exams.emptyRoster": "Henüz kayıtlı öğrenci yok.",
3561 "exams.selectStudent": "Listeden bir öğrenci seç",4201 "exams.selectStudent": "Listeden bir öğrenci seç",
3562 "exams.viewSheet": "Cevapları gör",4202 "exams.viewSheet": "Cevapları gör",
3563- "profile.title": "Profilim",4203+ "profile.title": "Profil",
3564 "profile.subtitle": "Kişisel bilgileriniz. Tüm alanların doldurulması isteğe bağlıdır.",4204 "profile.subtitle": "Kişisel bilgileriniz. Tüm alanların doldurulması isteğe bağlıdır.",
3565 "profile.name": "Ad",4205 "profile.name": "Ad",
3566 "profile.surname": "Soyad",4206 "profile.surname": "Soyad",
@@ -3691,7 +4331,7 @@ const tr: Dict = {
3691 "nav.payments": "Ücretler",4331 "nav.payments": "Ücretler",
3692 "nav.paymentStatement": "Ücretlerim",4332 "nav.paymentStatement": "Ücretlerim",
3693 "nav.whiteboards": "Beyaz tahtalar",4333 "nav.whiteboards": "Beyaz tahtalar",
3694- "whiteboard.title": "Beyaz Tahtalar",4334+ "whiteboard.title": "Beyaz tahtalar",
3695 "whiteboard.subtitle": "Canlı ortak çizim tahtaları.",4335 "whiteboard.subtitle": "Canlı ortak çizim tahtaları.",
3696 "whiteboard.empty": "Henüz beyaz tahta yok.",4336 "whiteboard.empty": "Henüz beyaz tahta yok.",
3697 "whiteboard.create": "Yeni tahta",4337 "whiteboard.create": "Yeni tahta",
@@ -3774,7 +4414,7 @@ const tr: Dict = {
3774 "payments.appendOnly": "Hesap yalnızca eklenir. Düzeltme, düzenleme değil dengeleyici kayıt gerektirir.",4414 "payments.appendOnly": "Hesap yalnızca eklenir. Düzeltme, düzenleme değil dengeleyici kayıt gerektirir.",
3775 "payments.tabCollect": "Tahsilat",4415 "payments.tabCollect": "Tahsilat",
3776 "payments.tabPlans": "Ücret planları",4416 "payments.tabPlans": "Ücret planları",
3777- "payments.collect": "Tahsilat Al",4417+ "payments.collect": "Tahsilat al",
3778 "payments.collectFrom": "Tahsilat al",4418 "payments.collectFrom": "Tahsilat al",
3779 "payments.totalDebt": "Toplam borç",4419 "payments.totalDebt": "Toplam borç",
3780 "payments.collected": "Tahsil edilen",4420 "payments.collected": "Tahsil edilen",
@@ -3865,8 +4505,8 @@ const tr: Dict = {
3865 "messages.inbox": "Gelenler",4505 "messages.inbox": "Gelenler",
3866 "messages.sent": "Gönderilenler",4506 "messages.sent": "Gönderilenler",
3867 "messages.archive": "Arşiv",4507 "messages.archive": "Arşiv",
3868- "messages.trash": "Çöp Kutusu",4508+ "messages.trash": "Çöp kutusu",
3869- "messages.newMessage": "Yeni Mesaj",4509+ "messages.newMessage": "Yeni mesaj",
3870 "messages.recipient": "Alıcı",4510 "messages.recipient": "Alıcı",
3871 "messages.recipientPlaceholder": "İsim veya kullanıcı adı ara...",4511 "messages.recipientPlaceholder": "İsim veya kullanıcı adı ara...",
3872 "messages.search": "Mesajlarda ara...",4512 "messages.search": "Mesajlarda ara...",
@@ -3876,8 +4516,8 @@ const tr: Dict = {
3876 "messages.send": "Gönder",4516 "messages.send": "Gönder",
3877 "messages.moveToArchive": "Arşivle",4517 "messages.moveToArchive": "Arşivle",
3878 "messages.moveOutOfArchive": "Arşivden çıkar",4518 "messages.moveOutOfArchive": "Arşivden çıkar",
3879- "messages.moveToTrash": "Çöp Kutusuna Taşı",4519+ "messages.moveToTrash": "Çöp kutusuna taşı",
3880- "messages.deleteForever": "Kalıcı Olarak Sil",4520+ "messages.deleteForever": "Kalıcı olarak sil",
3881 "messages.movedToast": "Mesaj taşındı.",4521 "messages.movedToast": "Mesaj taşındı.",
3882 "messages.deletedToast": "Mesaj silindi.",4522 "messages.deletedToast": "Mesaj silindi.",
3883 "messages.sentToast": "Mesaj gönderildi.",4523 "messages.sentToast": "Mesaj gönderildi.",
src/lib/avatar.tsadded+27 -0
@@ -0,0 +1,27 @@
1+import { createSignal } from "solid-js";
2+
3+// The whole set the avatar endpoint accepts — deliberately narrower than
4+// limits.file.image_content_types, which also carries SVG for other uploads
5+// and would be refused here.
6+export const AVATAR_CONTENT_TYPES = ["image/png", "image/jpeg", "image/webp", "image/gif"];
7+
8+export const AVATAR_ACCEPT = AVATAR_CONTENT_TYPES.join(",");
9+
10+// GET /users/{id}/avatar answers at one fixed URL, so an upload or a delete
11+// leaves the address unchanged and the browser's in-memory image cache can go
12+// on serving the old bytes. Every mounted avatar reads this counter into its
13+// `?v=` query, so bumping it once re-requests all of them — which is also how
14+// the sidebar chip picks up a photo changed on the profile page.
15+const [avatarRevision, setAvatarRevision] = createSignal(0);
16+
17+export { avatarRevision };
18+
19+export function bumpAvatarRevision(): void {
20+ setAvatarRevision((n) => n + 1);
21+}
22+
23+export function formatBytes(bytes: number): string {
24+ if (bytes >= 1024 * 1024) return `${Math.round(bytes / (1024 * 1024))} MB`;
25+ if (bytes >= 1024) return `${Math.round(bytes / 1024)} KB`;
26+ return `${bytes} B`;
27+}
src/lib/badges.test.tsadded+80 -0
@@ -0,0 +1,80 @@
1+import { describe, expect, it } from "vitest";
2+import {
3+ badgeDescKey,
4+ badgeNameKey,
5+ badgeProgress,
6+ badgeProgressLabel,
7+ badgeProgressRatio,
8+ badgeRemaining,
9+} from "./badges";
10+import type { ProfileStats } from "@/api/client";
11+
12+const stats: ProfileStats = {
13+ pomodoro_sessions: 0,
14+ pomodoro_focus_ms: 0,
15+ courses: 0,
16+ classes: 0,
17+ homework_submitted_total: 7,
18+ homework_on_time_total: 3,
19+ exam_sat_total: 0,
20+ pomodoro_finished_total: 12,
21+ pomodoro_focus_ms_total: 5_400_000, // 1.5 h
22+};
23+
24+describe("badge copy lookup", () => {
25+ it("resolves the known catalogue ids", () => {
26+ expect(badgeNameKey("homework_submitted_10")).toBe("badge.homework_submitted_10.name");
27+ expect(badgeDescKey("exam_sat_1")).toBe("badge.exam_sat_1.desc");
28+ });
29+
30+ it("returns null for an id shipped after this build, so the caller can fall back", () => {
31+ expect(badgeNameKey("streak_1000")).toBeNull();
32+ expect(badgeDescKey("streak_1000")).toBeNull();
33+ });
34+});
35+
36+describe("badgeProgress", () => {
37+ it("reads the lifetime counter behind each stat", () => {
38+ expect(badgeProgress("homework_submitted", stats)).toBe(7);
39+ expect(badgeProgress("pomodoro_focus_ms", stats)).toBe(5_400_000);
40+ });
41+
42+ it("is null for an unknown stat rather than zero, so the tile shows no bar", () => {
43+ expect(badgeProgress("streak_days", stats)).toBeNull();
44+ });
45+});
46+
47+describe("badgeProgressRatio", () => {
48+ it("clamps to 0..1", () => {
49+ expect(badgeProgressRatio(7, 10)).toBeCloseTo(0.7);
50+ expect(badgeProgressRatio(50, 10)).toBe(1);
51+ expect(badgeProgressRatio(-1, 10)).toBe(0);
52+ });
53+
54+ it("treats a zero threshold as complete instead of dividing by zero", () => {
55+ expect(badgeProgressRatio(0, 0)).toBe(1);
56+ });
57+});
58+
59+describe("badgeRemaining", () => {
60+ it("counts down plain totals", () => {
61+ expect(badgeRemaining("homework_submitted", 7, 10)).toBe(3);
62+ });
63+
64+ it("counts focus time down in whole hours, rounding up", () => {
65+ // 1.5 h done toward 10 h — 8.5 h left reads as 9, never 8.
66+ expect(badgeRemaining("pomodoro_focus_ms", 5_400_000, 36_000_000)).toBe(9);
67+ });
68+
69+ it("never goes negative — an award is permanent even if the counter falls back", () => {
70+ expect(badgeRemaining("homework_submitted", 12, 10)).toBe(0);
71+ expect(badgeRemaining("pomodoro_focus_ms", 40_000_000, 36_000_000)).toBe(0);
72+ });
73+});
74+
75+describe("badgeProgressLabel", () => {
76+ it("renders focus time as hours and everything else as a count", () => {
77+ expect(badgeProgressLabel("pomodoro_focus_ms", 5_400_000)).toBe("1");
78+ expect(badgeProgressLabel("homework_submitted", 7)).toBe("7");
79+ });
80+});
src/lib/badges.tsadded+76 -0
@@ -0,0 +1,76 @@
1+import type { BadgeStat, ProfileStats } from "@/api/client";
2+import type { MessageKey } from "@/i18n/messages";
3+
4+// The backend hands back badge ids and nothing else — the label and the icon
5+// behind one live here, exactly as they do for a role or a course kind. A
6+// badge shipped by the backend before this file has copy for it must still
7+// render, so every lookup falls back rather than throwing.
8+const KNOWN_BADGE_IDS = new Set([
9+ "homework_submitted_1",
10+ "homework_submitted_10",
11+ "homework_submitted_50",
12+ "homework_on_time_10",
13+ "homework_on_time_25",
14+ "exam_sat_1",
15+ "exam_sat_10",
16+ "exam_sat_25",
17+ "pomodoro_finished_10",
18+ "pomodoro_finished_50",
19+ "pomodoro_finished_200",
20+ "pomodoro_focus_ms_36000000",
21+ "pomodoro_focus_ms_180000000",
22+]);
23+
24+// Which lifetime counter on the profile's stats block a badge's stat reads.
25+const STAT_TOTAL_FIELD: Record<BadgeStat, keyof ProfileStats> = {
26+ homework_submitted: "homework_submitted_total",
27+ homework_on_time: "homework_on_time_total",
28+ exam_sat: "exam_sat_total",
29+ pomodoro_finished: "pomodoro_finished_total",
30+ pomodoro_focus_ms: "pomodoro_focus_ms_total",
31+};
32+
33+export function badgeNameKey(id: string): MessageKey | null {
34+ return KNOWN_BADGE_IDS.has(id) ? (`badge.${id}.name` as MessageKey) : null;
35+}
36+
37+export function badgeDescKey(id: string): MessageKey | null {
38+ return KNOWN_BADGE_IDS.has(id) ? (`badge.${id}.desc` as MessageKey) : null;
39+}
40+
41+/** Where the person stands on the counter this badge reads, or null if unknown. */
42+export function badgeProgress(stat: string, stats: ProfileStats): number | null {
43+ const field = STAT_TOTAL_FIELD[stat as BadgeStat];
44+ return field ? stats[field] : null;
45+}
46+
47+/**
48+ * Focus-time badges count milliseconds, which no one reads as a number. Every
49+ * other stat is already a plain count.
50+ */
51+export function badgeProgressLabel(stat: string, value: number): string {
52+ if (stat === "pomodoro_focus_ms") return `${Math.floor(value / 3_600_000)}`;
53+ return `${value}`;
54+}
55+
56+export function badgeThresholdLabel(stat: string, threshold: number): string {
57+ return badgeProgressLabel(stat, threshold);
58+}
59+
60+/** How much of the threshold is done, 0..1 — drives the progress bar's width. */
61+export function badgeProgressRatio(current: number, threshold: number): number {
62+ if (threshold <= 0) return 1;
63+ return Math.min(1, Math.max(0, current / threshold));
64+}
65+
66+/**
67+ * What is left to earn it, in the same unit the labels use (hours for focus
68+ * time, plain counts otherwise). Never negative — a permanent award whose
69+ * counter later fell back still reads as done.
70+ */
71+export function badgeRemaining(stat: string, current: number, threshold: number): number {
72+ if (stat === "pomodoro_focus_ms") {
73+ return Math.max(0, Math.ceil((threshold - current) / 3_600_000));
74+ }
75+ return Math.max(0, threshold - current);
76+}
src/lib/blueprint-skip.test.tsadded+33 -0
@@ -0,0 +1,33 @@
1+import { describe, expect, it } from "vitest";
2+import { skipReasonCopy } from "./blueprint-skip";
3+
4+describe("skipReasonCopy", () => {
5+ it("maps the fixed reasons", () => {
6+ expect(skipReasonCopy("the class is already at its course ceiling", "Algebra").key).toBe(
7+ "classBlueprints.skipCeiling",
8+ );
9+ expect(
10+ skipReasonCopy("The class was deleted while the blueprint was being applied.", "Algebra").key,
11+ ).toBe("classBlueprints.skipClassGone");
12+ });
13+
14+ it("survives the punctuation and casing normalization", () => {
15+ expect(skipReasonCopy(" THE CLASS IS ALREADY AT ITS COURSE CEILING! ", "x").key).toBe(
16+ "classBlueprints.skipCeiling",
17+ );
18+ });
19+
20+ it("re-parameterizes the course-named reasons with the resolved title", () => {
21+ const seat = skipReasonCopy("Algebra II has no free seat for the whole class", "Cebir II");
22+ expect(seat.key).toBe("classBlueprints.skipNoSeat");
23+ expect(seat.vars).toEqual({ course: "Cebir II" });
24+
25+ const gone = skipReasonCopy("Algebra II no longer exists — detach it from this class first", "Cebir II");
26+ expect(gone.key).toBe("classBlueprints.skipCourseGone");
27+ expect(gone.vars).toEqual({ course: "Cebir II" });
28+ });
29+
30+ it("falls back to the generic line rather than leaking unmapped English", () => {
31+ expect(skipReasonCopy("something the backend added later", "x").key).toBe("classBlueprints.skipOther");
32+ });
33+});
src/lib/blueprint-skip.tsadded+50 -0
@@ -0,0 +1,50 @@
1+import type { MessageKey } from "@/i18n/messages";
2+
3+// A blueprint's `skipped[]` rows carry the backend's own English prose. Raw
4+// backend text is never shown to a user anywhere else in this app, so it is
5+// not shown here either: each sentence maps to a localized key, and anything
6+// unmapped falls back to a generic line rather than leaking English.
7+//
8+// Normalization mirrors client.ts's normalizeApiMessage, so a change in
9+// punctuation or casing on the backend does not silently drop a mapping.
10+function normalize(reason: string): string {
11+ return reason
12+ .trim()
13+ .replace(/[’‘]/g, "'")
14+ .replace(/\s+/g, " ")
15+ .replace(/[.!?]+$/, "")
16+ .toLowerCase();
17+}
18+
19+const FIXED_REASONS: Record<string, MessageKey> = {
20+ "the class was deleted while the blueprint was being applied": "classBlueprints.skipClassGone",
21+ "this course no longer exists — it has been dropped from the blueprint": "classBlueprints.skipCoursePruned",
22+ "this course no longer exists - it has been dropped from the blueprint": "classBlueprints.skipCoursePruned",
23+ "the class is already at its course ceiling": "classBlueprints.skipCeiling",
24+ "the class holds more students than a course attach is allowed to enroll at once":
25+ "classBlueprints.skipOverloaded",
26+};
27+
28+// The two remaining reasons name the course, so they carry a parameter.
29+const NO_SEAT = /^(.+) has no free seat for the whole class$/;
30+const COURSE_GONE = /^(.+) no longer exists [—-] detach it from this class first$/;
31+
32+export type SkipCopy = { key: MessageKey; vars?: Record<string, string> };
33+
34+/**
35+ * `courseTitle` resolves the row's course id to a title; the backend's own
36+ * rendering of the course is discarded so the two locales read the same.
37+ */
38+export function skipReasonCopy(reason: string, courseTitle: string): SkipCopy {
39+ const normalized = normalize(reason);
40+
41+ const fixed = FIXED_REASONS[normalized];
42+ if (fixed) return { key: fixed };
43+
44+ if (NO_SEAT.test(normalized)) return { key: "classBlueprints.skipNoSeat", vars: { course: courseTitle } };
45+ if (COURSE_GONE.test(normalized)) {
46+ return { key: "classBlueprints.skipCourseGone", vars: { course: courseTitle } };
47+ }
48+
49+ return { key: "classBlueprints.skipOther" };
50+}
src/pages/admin-user-detail-page.tsxmodified+14 -3
@@ -11,7 +11,7 @@ import { Alert } from "@/components/ui/alert";
11 import { Button } from "@/components/ui/button";11 import { Button } from "@/components/ui/button";
12 import { ConfirmDialog } from "@/components/ui/confirm-dialog";12 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
13 import { DetailField } from "@/components/ui/detail-field";13 import { DetailField } from "@/components/ui/detail-field";
14-import { IconChevronLeft, IconEdit, IconUsers } from "@/components/ui/icons";14+import { IconChevronLeft, IconEdit, IconExternalLink, IconUsers } from "@/components/ui/icons";
15 import { PageSpinner } from "@/components/ui/page-spinner";15 import { PageSpinner } from "@/components/ui/page-spinner";
16 import { Select } from "@/components/ui/select";16 import { Select } from "@/components/ui/select";
17 import { SidePanel } from "@/components/ui/side-panel";17 import { SidePanel } from "@/components/ui/side-panel";
@@ -75,6 +75,12 @@ function AdminUserDetailContent() {
75 {t("common.back")}75 {t("common.back")}
76 </Button>76 </Button>
77 </Link>77 </Link>
78+ <Link to="/profile/$userId" params={{ userId: current().id }}>
79+ <Button variant="outline" size="sm">
80+ <IconExternalLink class="h-4 w-4" />
81+ {t("profile.viewProfile")}
82+ </Button>
83+ </Link>
78 <Button variant="outline" size="sm" onClick={() => setEditing(true)}>84 <Button variant="outline" size="sm" onClick={() => setEditing(true)}>
79 <IconEdit class="h-4 w-4" />85 <IconEdit class="h-4 w-4" />
80 {t("common.edit")}86 {t("common.edit")}
@@ -82,7 +88,7 @@ function AdminUserDetailContent() {
82 <Show when={current().role === "parent"}>88 <Show when={current().role === "parent"}>
83 <Button variant="outline" size="sm" onClick={() => setStudentsOpen(true)}>89 <Button variant="outline" size="sm" onClick={() => setStudentsOpen(true)}>
84 <IconUsers class="h-4 w-4" />90 <IconUsers class="h-4 w-4" />
85- {t("nav.myStudents")}91+ {t("parentLink.manage")}
86 </Button>92 </Button>
87 </Show>93 </Show>
88 </>94 </>
@@ -134,7 +140,12 @@ function AdminUserDetailContent() {
134 </SidePanel>140 </SidePanel>
135 141
136 <ParentStudentsPanel142 <ParentStudentsPanel
137- parent={{ id: current().id, username: current().username, display_name: current().name || current().username }}143+ parent={{
144+ id: current().id,
145+ username: current().username,
146+ // Both halves of the name, or the panel calls "Yusuf Baş" just "Yusuf".
147+ display_name: [current().name, current().surname].filter(Boolean).join(" ") || current().username,
148+ }}
138 open={studentsOpen()}149 open={studentsOpen()}
139 onOpenChange={setStudentsOpen}150 onOpenChange={setStudentsOpen}
140 />151 />
src/pages/admin-users-page.tsxmodified+1 -1
@@ -79,7 +79,7 @@ function AdminUsersContent() {
79 <Show when={selectedParent()} keyed>79 <Show when={selectedParent()} keyed>
80 {(u) => (80 {(u) => (
81 <ParentStudentsPanel 81 <ParentStudentsPanel
82- parent={{ id: u.id, username: u.username, display_name: u.name || u.username }} 82+ parent={{ id: u.id, username: u.username, display_name: [u.name, u.surname].filter(Boolean).join(" ") || u.username }}
83 open 83 open
84 onOpenChange={() => setSelectedParent(null)} 84 onOpenChange={() => setSelectedParent(null)}
85 />85 />
src/pages/class-detail-page.tsxmodified+61 -3
@@ -11,18 +11,20 @@ import {
11 getClassCourses,11 getClassCourses,
12 postClassCourse,12 postClassCourse,
13 deleteClassCourse,13 deleteClassCourse,
14+ postClassBlueprintApply,
14 } from "@/api/classes";15 } from "@/api/classes";
15 import { getCourses } from "@/api/courses";16 import { getCourses } from "@/api/courses";
16 import { getTerms } from "@/api/terms";17 import { getTerms } from "@/api/terms";
17 import { getLimits } from "@/api/limits";18 import { getLimits } from "@/api/limits";
18-import { formatApiError, type ClassCourse, type ClassMember } from "@/api/client";19+import { ApiError, formatApiError, type BlueprintSkip, type ClassCourse, type ClassMember } from "@/api/client";
20+import { BlueprintSkippedReport } from "@/components/classes/blueprint-skipped-report";
19 import { RouteGuard } from "@/components/layout/route-guard";21 import { RouteGuard } from "@/components/layout/route-guard";
20 import { Alert } from "@/components/ui/alert";22 import { Alert } from "@/components/ui/alert";
21 import { Badge } from "@/components/ui/badge";23 import { Badge } from "@/components/ui/badge";
22 import { Button } from "@/components/ui/button";24 import { Button } from "@/components/ui/button";
23 import { ConfirmDialog } from "@/components/ui/confirm-dialog";25 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
24 import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";26 import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
25-import { IconChevronLeft, IconPlus, IconTrash } from "@/components/ui/icons";27+import { IconChevronLeft, IconExternalLink, IconPlus, IconTrash } from "@/components/ui/icons";
26 import { Input } from "@/components/ui/input";28 import { Input } from "@/components/ui/input";
27 import { Label } from "@/components/ui/label";29 import { Label } from "@/components/ui/label";
28 import { PageSpinner } from "@/components/ui/page-spinner";30 import { PageSpinner } from "@/components/ui/page-spinner";
@@ -67,6 +69,8 @@ function ClassDetailContent() {
67 const [showAttachCourse, setShowAttachCourse] = createSignal(false);69 const [showAttachCourse, setShowAttachCourse] = createSignal(false);
68 const [attachCourseId, setAttachCourseId] = createSignal("");70 const [attachCourseId, setAttachCourseId] = createSignal("");
69 const [detachCourse, setDetachCourse] = createSignal<ClassCourse | null>(null);71 const [detachCourse, setDetachCourse] = createSignal<ClassCourse | null>(null);
72+ const [skipped, setSkipped] = createSignal<BlueprintSkip[]>([]);
73+ const [reportOpen, setReportOpen] = createSignal(false);
70 74
71 const [cls, { refetch: refetchClass }] = createResource(id, (classId) => getClassById(classId));75 const [cls, { refetch: refetchClass }] = createResource(id, (classId) => getClassById(classId));
72 const [terms] = createResource(async () => (await getTerms({ limit: 100 })).items);76 const [terms] = createResource(async () => (await getTerms({ limit: 100 })).items);
@@ -93,6 +97,29 @@ function ClassDetailContent() {
93 }97 }
94 };98 };
95 99
100+ // Applying is best-effort: the request succeeds and reports the pairs it
101+ // could not attach, so a shortfall is a warning with a report, not an error.
102+ const applyBlueprint = async (classGrade: string) => {
103+ setError("");
104+ setSkipped([]);
105+ setPending(true);
106+ try {
107+ const result = await postClassBlueprintApply(id());
108+ await refetchCourses();
109+ setSkipped(result.skipped);
110+ if (result.skipped.length === 0) setFlash(t("classBlueprints.applied"));
111+ } catch (err) {
112+ // A 404 here means no blueprint covers this grade, not a missing class.
113+ if (err instanceof ApiError && err.status === 404) {
114+ setError(t("classBlueprints.noBlueprintForGrade", { grade: classGrade }));
115+ } else {
116+ setError(formatApiError(err));
117+ }
118+ } finally {
119+ setPending(false);
120+ }
121+ };
122+
96 const memberColumns = createMemo<ColumnDef<ClassMember>[]>(() => [123 const memberColumns = createMemo<ColumnDef<ClassMember>[]>(() => [
97 {124 {
98 id: "student",125 id: "student",
@@ -114,7 +141,14 @@ function ClassDetailContent() {
114 <Show when={canManage()}>141 <Show when={canManage()}>
115 <TableRowActions142 <TableRowActions
116 label={t("common.actions")}143 label={t("common.actions")}
117- actions={[{ label: t("classGroups.removeStudent"), icon: <IconTrash class="h-4 w-4" />, destructive: true, onSelect: () => setRemoveMember(cell.row.original) }]}144+ actions={[
145+ {
146+ label: t("profile.viewProfile"),
147+ icon: <IconExternalLink class="h-4 w-4" />,
148+ onSelect: () => void navigate({ to: "/profile/$userId", params: { userId: cell.row.original.user.id } }),
149+ },
150+ { label: t("classGroups.removeStudent"), icon: <IconTrash class="h-4 w-4" />, destructive: true, onSelect: () => setRemoveMember(cell.row.original) },
151+ ]}
118 />152 />
119 </Show>153 </Show>
120 ),154 ),
@@ -171,6 +205,16 @@ function ClassDetailContent() {
171 </div>205 </div>
172 <Show when={canManage()}>206 <Show when={canManage()}>
173 <div class="flex flex-wrap gap-2">207 <div class="flex flex-wrap gap-2">
208+ <Button
209+ size="sm"
210+ variant="outline"
211+ class="rounded-lg"
212+ disabled={pending() || !c().grade}
213+ title={c().grade ? t("classBlueprints.applyHint") : t("classBlueprints.applyNoGrade")}
214+ onClick={() => void applyBlueprint(c().grade ?? "")}
215+ >
216+ {t("classBlueprints.apply")}
217+ </Button>
174 <Button size="sm" variant="outline" class="rounded-lg" onClick={() => { setName(c().name); setGrade(c().grade ?? ""); setTermId(c().term ?? ""); setTeacherId(c().teacher?.id ?? ""); setEditing(true); }}>{t("common.edit")}</Button>218 <Button size="sm" variant="outline" class="rounded-lg" onClick={() => { setName(c().name); setGrade(c().grade ?? ""); setTermId(c().term ?? ""); setTeacherId(c().teacher?.id ?? ""); setEditing(true); }}>{t("common.edit")}</Button>
175 <Button size="sm" variant="outline" class="rounded-lg text-destructive" onClick={() => setDeleteOpen(true)}>{t("classGroups.deleteClass")}</Button>219 <Button size="sm" variant="outline" class="rounded-lg text-destructive" onClick={() => setDeleteOpen(true)}>{t("classGroups.deleteClass")}</Button>
176 </div>220 </div>
@@ -179,6 +223,20 @@ function ClassDetailContent() {
179 223
180 <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show>224 <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show>
181 <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show>225 <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show>
226+ <Show when={skipped().length > 0}>
227+ <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200">
228+ <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span>
229+ <Button type="button" size="sm" variant="outline" class="shrink-0 rounded-lg" onClick={() => setReportOpen(true)}>
230+ {t("classBlueprints.skippedDetails")}
231+ </Button>
232+ </Alert>
233+ </Show>
234+ <BlueprintSkippedReport
235+ open={reportOpen()}
236+ onOpenChange={setReportOpen}
237+ skipped={skipped()}
238+ courseTitle={courseTitle}
239+ />
182 240
183 <Tabs value={tab()} onChange={setTab} class="space-y-3">241 <Tabs value={tab()} onChange={setTab} class="space-y-3">
184 <TabsList>242 <TabsList>
src/pages/classes-page.tsxmodified+41 -21
@@ -15,6 +15,8 @@ import { Label } from "@/components/ui/label";
15 import { Select } from "@/components/ui/select";15 import { Select } from "@/components/ui/select";
16 import { SidePanel } from "@/components/ui/side-panel";16 import { SidePanel } from "@/components/ui/side-panel";
17 import { TableRowActions } from "@/components/ui/table-row-actions";17 import { TableRowActions } from "@/components/ui/table-row-actions";
18+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
19+import { BlueprintsTab } from "@/components/classes/blueprints-tab";
18 import { UserSearchSelect } from "@/components/users/user-search-select";20 import { UserSearchSelect } from "@/components/users/user-search-select";
19 import { createFlash } from "@/lib/flash";21 import { createFlash } from "@/lib/flash";
20 import { personLabel } from "@/lib/person";22 import { personLabel } from "@/lib/person";
@@ -32,6 +34,7 @@ function ClassesContent() {
32 const t = useT();34 const t = useT();
33 const canManage = () => hasMinRole(auth.user()?.role, "manager");35 const canManage = () => hasMinRole(auth.user()?.role, "manager");
34 36
37+ const [tab, setTab] = createSignal("classes");
35 const [showForm, setShowForm] = createSignal(false);38 const [showForm, setShowForm] = createSignal(false);
36 const [name, setName] = createSignal("");39 const [name, setName] = createSignal("");
37 const [grade, setGrade] = createSignal("");40 const [grade, setGrade] = createSignal("");
@@ -127,27 +130,44 @@ function ClassesContent() {
127 130
128 <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show>131 <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show>
129 132
130- <Suspense fallback={<DataTableSkeleton />}>133+ <Tabs value={tab()} onChange={setTab}>
131- <DataTable134+ {/* Every blueprint endpoint is manager+, so a teacher must not be shown
132- columns={columns()}135+ a tab that would 403 the moment it opens. */}
133- data={listData() ?? []}136+ <Show when={canManage()}>
134- filterColumn="name"137+ <TabsList class="mb-4">
135- enablePagination138+ <TabsTrigger value="classes">{t("classBlueprints.classesTab")}</TabsTrigger>
136- pageSize={10}139+ <TabsTrigger value="blueprints">{t("classBlueprints.tab")}</TabsTrigger>
137- title={t("classGroups.title")}140+ </TabsList>
138- description={t("classGroups.subtitle")}141+ </Show>
139- empty={t("classGroups.empty")}142+
140- onRowClick={(row) => void navigate({ to: "/management/classes/$id", params: { id: row.id } })}143+ <TabsContent value="classes">
141- actions={144+ <Suspense fallback={<DataTableSkeleton />}>
142- <Show when={canManage()}>145+ <DataTable
143- <Button size="sm" class="min-w-30 rounded-lg" onClick={() => setShowForm(true)}>146+ columns={columns()}
144- <IconPlus class="h-4 w-4" />147+ data={listData() ?? []}
145- {t("classGroups.newClass")}148+ filterColumn="name"
146- </Button>149+ enablePagination
147- </Show>150+ pageSize={10}
148- }151+ title={t("classGroups.title")}
149- />152+ description={t("classGroups.subtitle")}
150- </Suspense>153+ empty={t("classGroups.empty")}
154+ onRowClick={(row) => void navigate({ to: "/management/classes/$id", params: { id: row.id } })}
155+ actions={
156+ <Show when={canManage()}>
157+ <Button size="sm" class="min-w-30 rounded-lg" onClick={() => setShowForm(true)}>
158+ <IconPlus class="h-4 w-4" />
159+ {t("classGroups.newClass")}
160+ </Button>
161+ </Show>
162+ }
163+ />
164+ </Suspense>
165+ </TabsContent>
166+
167+ <TabsContent value="blueprints">
168+ <BlueprintsTab canManage={canManage} active={() => tab() === "blueprints"} />
169+ </TabsContent>
170+ </Tabs>
151 </div>171 </div>
152 );172 );
153 }173 }
src/pages/my-students-page.tsxmodified+23 -2
@@ -1,4 +1,5 @@
1 import { For, Match, Show, Suspense, Switch, createEffect, createMemo, createResource, createSignal, type Component } from "solid-js";1 import { For, Match, Show, Suspense, Switch, createEffect, createMemo, createResource, createSignal, type Component } from "solid-js";
2+import { useNavigate } from "@tanstack/solid-router";
2 import type { ColumnDef } from "@tanstack/solid-table";3 import type { ColumnDef } from "@tanstack/solid-table";
3 import { getClassesByUserId } from "@/api/classes";4 import { getClassesByUserId } from "@/api/classes";
4 import { getMyStudents } from "@/api/parents";5 import { getMyStudents } from "@/api/parents";
@@ -16,7 +17,7 @@ import { Badge } from "@/components/ui/badge";
16 import { DataTable, DataTableEmpty } from "@/components/ui/data-table";17 import { DataTable, DataTableEmpty } from "@/components/ui/data-table";
17 import { personLabel } from "@/lib/person";18 import { personLabel } from "@/lib/person";
18 import { useT } from "@/stores/preferences-context";19 import { useT } from "@/stores/preferences-context";
19-import { IconBook, IconChart, IconChevronRight, IconClipboardCheck, IconExam, IconHomework } from "@/components/ui/icons";20+import { IconBook, IconChart, IconChevronRight, IconClipboardCheck, IconExam, IconExternalLink, IconHomework } from "@/components/ui/icons";
20 import { MarksReportView } from "@/components/marks/marks-report-view";21 import { MarksReportView } from "@/components/marks/marks-report-view";
21 import { AttendanceReportView } from "@/components/attendance/attendance-report-view";22 import { AttendanceReportView } from "@/components/attendance/attendance-report-view";
22 import { examKindLabel } from "@/lib/exam-labels";23 import { examKindLabel } from "@/lib/exam-labels";
@@ -52,7 +53,7 @@ function MyStudentsContent() {
52 return (53 return (
53 <div class="space-y-6">54 <div class="space-y-6">
54 <div class="space-y-2">55 <div class="space-y-2">
55- <PageHeader eyebrow={t("nav.group.students")} title={t("nav.myStudents")} description={t("parents.subtitle")} />56+ <PageHeader eyebrow={t("nav.group.students")} title={t("nav.children")} description={t("parents.subtitle")} />
56 </div>57 </div>
57 58
58 <Suspense fallback={<PageSpinner />}>59 <Suspense fallback={<PageSpinner />}>
@@ -86,6 +87,7 @@ function MyStudentsContent() {
86 87
87 function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => void }) {88 function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => void }) {
88 const t = useT();89 const t = useT();
90+ const navigate = useNavigate();
89 const [activeTab, setActiveTab] = createSignal<StudentTab>("overview");91 const [activeTab, setActiveTab] = createSignal<StudentTab>("overview");
90 92
91 const [marksRes] = createResource(93 const [marksRes] = createResource(
@@ -164,6 +166,25 @@ function StudentDetailPanel(props: { student: PersonRef | null; onClose: () => v
164 <SidePanel open={!!props.student} onOpenChange={(open) => !open && props.onClose()} title={props.student ? personLabel(props.student) : ""} description={`@${props.student?.username}`}>166 <SidePanel open={!!props.student} onOpenChange={(open) => !open && props.onClose()} title={props.student ? personLabel(props.student) : ""} description={`@${props.student?.username}`}>
165 <div class="flex h-full flex-col">167 <div class="flex h-full flex-col">
166 <div class="border-b p-4">168 <div class="border-b p-4">
169+ {/* A parent may read their linked students' profiles, so this is safe
170+ — it 403s only for someone else's child. Close the panel before
171+ navigating: a click that stays inside this modal never leaves it. */}
172+ <Show when={props.student}>
173+ {(s) => (
174+ <Button
175+ variant="outline"
176+ size="sm"
177+ class="mb-3 rounded-lg"
178+ onClick={() => {
179+ props.onClose();
180+ void navigate({ to: "/profile/$userId", params: { userId: s().id } });
181+ }}
182+ >
183+ <IconExternalLink class="mr-2 h-4 w-4" />
184+ {t("profile.viewProfile")}
185+ </Button>
186+ )}
187+ </Show>
167 <div class="flex flex-wrap gap-2">188 <div class="flex flex-wrap gap-2">
168 <For each={tabs}>189 <For each={tabs}>
169 {(tab) => {190 {(tab) => {
src/pages/profile-page.tsxadded+220 -0
@@ -0,0 +1,220 @@
1+import { Show, Suspense, createMemo, createResource, createSignal } from "solid-js";
2+import { useLocation, useParams } from "@tanstack/solid-router";
3+import { getClassesByUserId, getMyClasses } from "@/api/classes";
4+import { getLimits } from "@/api/limits";
5+import { getMyProfile, getUserProfile } from "@/api/users";
6+import { ApiError, formatApiError, type Profile } from "@/api/client";
7+import { RouteGuard } from "@/components/layout/route-guard";
8+import { RoleBadge } from "@/components/layout/role-badge";
9+import { Badge } from "@/components/ui/badge";
10+import { Button } from "@/components/ui/button";
11+import { ErrorAlert } from "@/components/ui/error-alert";
12+import { IconEdit, IconSchool } from "@/components/ui/icons";
13+import { PageSpinner } from "@/components/ui/page-spinner";
14+import { SidePanel } from "@/components/ui/side-panel";
15+import { AvatarUpload } from "@/components/users/avatar-upload";
16+import { BadgeGrid } from "@/components/users/badge-grid";
17+import { ProfileForm } from "@/components/users/profile-form";
18+import { ProfileMemberships } from "@/components/users/profile-memberships";
19+import { UserAvatar } from "@/components/users/user-avatar";
20+import { personLabel } from "@/lib/person";
21+import { useAuth } from "@/stores/auth-context";
22+import { useT } from "@/stores/preferences-context";
23+
24+export default function ProfilePage() {
25+ // No role floor: the backend lets any authenticated account read a profile.
26+ // A parent's narrower reach is enforced there with a 403, and a parent *may*
27+ // read their linked students — a client role gate would wrongly close that.
28+ return (
29+ <RouteGuard>
30+ <ProfileContent />
31+ </RouteGuard>
32+ );
33+}
34+
35+function ProfileContent() {
36+ const auth = useAuth();
37+ const t = useT();
38+ const location = useLocation();
39+ const params = useParams({ strict: false });
40+ // The location() touch works around TanStack's params memo not invalidating
41+ // on a same-route navigation; the class and admin detail pages do the same.
42+ const target = createMemo(() => {
43+ location();
44+ return (params() as { userId?: string }).userId ?? "me";
45+ });
46+
47+ const [profile, { refetch }] = createResource(target, (id) =>
48+ id === "me" ? getMyProfile() : getUserProfile(id),
49+ );
50+ const [limits] = createResource(() => getLimits());
51+ const [editing, setEditing] = createSignal(false);
52+
53+ const isSelf = (p: Profile) => target() === "me" || p.id === auth.user()?.id;
54+ const name = (p: Profile) => p.display_name || p.username;
55+
56+ // The profile payload's class refs carry no homeroom teacher, so read the
57+ // classes again through /classes, which does. `/classes/me` is open to every
58+ // role; `/classes/user/{id}` is teacher+ or a linked parent, so a student
59+ // looking at a peer skips the call entirely rather than earning a 403 — those
60+ // rows then simply render without a teacher.
61+ // A plain string key, not an object: createResource compares sources by
62+ // identity, and a fresh object each time the profile refetches would drag a
63+ // second request along with every avatar change.
64+ const classSource = createMemo<string | null>(() => {
65+ const p = profile.latest;
66+ if (!p) return null;
67+ if (isSelf(p)) return "me";
68+ const role = auth.user()?.role;
69+ const canObserve = role === "teacher" || role === "manager" || role === "admin" || role === "parent";
70+ return canObserve ? `user:${p.id}` : null;
71+ });
72+
73+ const [detailedClasses] = createResource(classSource, async (source) => {
74+ try {
75+ const page = source === "me"
76+ ? await getMyClasses({ limit: 50 })
77+ : await getClassesByUserId(source.slice("user:".length), { limit: 50 });
78+ return page.items;
79+ } catch {
80+ // A linked-parent guess that turned out wrong loses the teacher name, not
81+ // the page.
82+ return [];
83+ }
84+ });
85+
86+ // A person is normally in exactly one şube; when there are several the first
87+ // is the one the header calls out and the rest live in the tab below.
88+ const currentClass = () => detailedClasses.latest?.[0] ?? null;
89+
90+ const errorMessage = () => {
91+ const err = profile.error as unknown;
92+ if (err instanceof ApiError && err.status === 403 && auth.user()?.role === "parent") {
93+ return t("profile.forbiddenParent");
94+ }
95+ return formatApiError(err);
96+ };
97+
98+ return (
99+ <div class="space-y-6">
100+ <Show when={profile.error}>
101+ <ErrorAlert message={errorMessage()} onRetry={() => void refetch()} />
102+ </Show>
103+
104+ <Suspense fallback={<PageSpinner />}>
105+ <Show when={!profile.error && profile()}>
106+ {(p) => (
107+ <>
108+ <section class="flex flex-wrap items-start justify-between gap-4 rounded-xl border bg-card p-4 shadow-xs">
109+ <div class="flex min-w-0 flex-wrap items-center gap-4">
110+ <Show
111+ when={isSelf(p())}
112+ fallback={
113+ <UserAvatar
114+ userId={p().id}
115+ name={name(p())}
116+ hasAvatar={p().avatar !== null}
117+ size="xl"
118+ />
119+ }
120+ >
121+ <AvatarUpload
122+ userId={p().id}
123+ name={name(p())}
124+ hasAvatar={p().avatar !== null}
125+ onChanged={() => void refetch()}
126+ />
127+ </Show>
128+ <div class="min-w-0 space-y-1">
129+ <h1 class="truncate text-xl font-semibold">{name(p())}</h1>
130+ <div class="flex flex-wrap items-center gap-2">
131+ <span class="text-sm text-muted-foreground">@{p().username}</span>
132+ <RoleBadge role={p().role} />
133+ </div>
134+ <p class="max-w-prose whitespace-pre-wrap text-sm text-muted-foreground">
135+ {p().bio || t("profile.bioEmpty")}
136+ </p>
137+ <Show when={currentClass() ?? p().classes[0]}>
138+ {(c) => (
139+ <p class="flex flex-wrap items-center gap-x-2 gap-y-1 pt-1 text-sm">
140+ <span class="inline-flex items-center gap-1.5 font-medium">
141+ <IconSchool class="h-4 w-4 text-muted-foreground" />
142+ {c().name}
143+ </span>
144+ <Show when={c().grade}>
145+ {(g) => <Badge variant="secondary" class="rounded-md">{g()}</Badge>}
146+ </Show>
147+ <span class="text-muted-foreground">
148+ ·{" "}
149+ {currentClass()?.teacher
150+ ? `${t("classGroups.homeroomTeacher")}: ${personLabel(currentClass()!.teacher)}`
151+ : t("classGroups.noTeacher")}
152+ </span>
153+ </p>
154+ )}
155+ </Show>
156+ </div>
157+ </div>
158+ <Show when={isSelf(p()) && auth.user()}>
159+ <Button type="button" size="sm" variant="outline" class="rounded-lg" onClick={() => setEditing(true)}>
160+ <IconEdit class="mr-1.5 h-4 w-4" />
161+ {t("profile.edit")}
162+ </Button>
163+ </Show>
164+ </section>
165+
166+ <section class="grid gap-3 sm:grid-cols-3 lg:grid-cols-5">
167+ <StatCard label={t("profile.statFocusHours")} value={Math.floor(p().stats.pomodoro_focus_ms_total / 3_600_000)} />
168+ <StatCard label={t("profile.statSessions")} value={p().stats.pomodoro_finished_total} />
169+ <StatCard label={t("profile.statHomework")} value={p().stats.homework_submitted_total} />
170+ <StatCard label={t("profile.statOnTime")} value={p().stats.homework_on_time_total} />
171+ <StatCard label={t("profile.statExams")} value={p().stats.exam_sat_total} />
172+ </section>
173+
174+ <BadgeGrid
175+ catalog={limits.latest?.badges?.catalog ?? []}
176+ earned={p().badges}
177+ stats={p().stats}
178+ />
179+
180+ <ProfileMemberships
181+ classes={p().classes}
182+ courses={p().courses}
183+ detailed={detailedClasses.latest ?? []}
184+ classTotal={p().stats.classes}
185+ courseTotal={p().stats.courses}
186+ />
187+
188+ <SidePanel open={editing()} onOpenChange={setEditing} title={t("profile.edit")}>
189+ <Show when={auth.user()}>
190+ {(u) => (
191+ <ProfileForm
192+ user={u()}
193+ profile={{ display_name: p().display_name, bio: p().bio }}
194+ maxDisplayNameLen={limits.latest?.user.max_display_name_len}
195+ maxBioLen={limits.latest?.user.max_bio_len}
196+ onSaved={() => {
197+ setEditing(false);
198+ void auth.refresh();
199+ void refetch();
200+ }}
201+ />
202+ )}
203+ </Show>
204+ </SidePanel>
205+ </>
206+ )}
207+ </Show>
208+ </Suspense>
209+ </div>
210+ );
211+}
212+
213+function StatCard(props: { label: string; value: number }) {
214+ return (
215+ <div class="rounded-lg border bg-card p-3 shadow-xs">
216+ <p class="text-xs text-muted-foreground">{props.label}</p>
217+ <p class="text-xl font-semibold tabular-nums">{props.value}</p>
218+ </div>
219+ );
220+}
src/pages/whiteboard-page.tsxmodified+40 -19
@@ -21,7 +21,8 @@ import { Badge } from "@/components/ui/badge";
21 import { Button } from "@/components/ui/button";21 import { Button } from "@/components/ui/button";
22 import { ConfirmDialog } from "@/components/ui/confirm-dialog";22 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
23 import { DrawingPlayback } from "@/components/ui/drawing-playback";23 import { DrawingPlayback } from "@/components/ui/drawing-playback";
24-import { IconChevronLeft, IconLock, IconTrash, IconX } from "@/components/ui/icons";24+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
25+import { IconChevronLeft, IconDotsVertical, IconEraser, IconLock, IconTrash, IconX } from "@/components/ui/icons";
25 import { PageSpinner } from "@/components/ui/page-spinner";26 import { PageSpinner } from "@/components/ui/page-spinner";
26 import { SidePanel } from "@/components/ui/side-panel";27 import { SidePanel } from "@/components/ui/side-panel";
27 import { reassembleStrokes } from "@/lib/board-stroke-codec";28 import { reassembleStrokes } from "@/lib/board-stroke-codec";
@@ -198,7 +199,7 @@ function WhiteboardContent() {
198 compact199 compact
199 title={boardTitle()}200 title={boardTitle()}
200 actions={201 actions={
201- <div class="flex flex-wrap items-center gap-1.5">202+ <div class="flex flex-wrap items-center gap-2">
202 <Button type="button" variant="ghost" size="sm" onClick={() => navigate({ to: "/whiteboards" })}>203 <Button type="button" variant="ghost" size="sm" onClick={() => navigate({ to: "/whiteboards" })}>
203 <IconChevronLeft class="h-4 w-4" />204 <IconChevronLeft class="h-4 w-4" />
204 {t("common.back")}205 {t("common.back")}
@@ -206,26 +207,41 @@ function WhiteboardContent() {
206 <Button type="button" variant="outline" size="sm" onClick={() => setHistoryOpen(true)}>207 <Button type="button" variant="outline" size="sm" onClick={() => setHistoryOpen(true)}>
207 {t("whiteboard.history")}208 {t("whiteboard.history")}
208 </Button>209 </Button>
209- <Button type="button" variant="outline" size="sm" onClick={() => setSettingsOpen(true)}>210+ <Button type="button" size="sm" class="rounded-lg" onClick={() => setSettingsOpen(true)}>
210 {t("whiteboard.edit")}211 {t("whiteboard.edit")}
211 </Button>212 </Button>
212- <Show when={isCreator() && !closed()}>
213- <Button type="button" variant="outline" size="sm" disabled={busy()} onClick={() => void toggleLock()}>
214- {locked() ? t("whiteboard.unlock") : t("whiteboard.lock")}
215- </Button>
216- <Button type="button" variant="outline" size="sm" disabled={busy()} onClick={() => setClearOpen(true)}>
217- {t("whiteboard.clear")}
218- </Button>
219- <Button type="button" variant="outline" size="sm" class="border-amber-500/40 bg-amber-500/10 text-amber-700 hover:bg-amber-500/20 hover:text-amber-800 dark:text-amber-400" disabled={busy()} onClick={() => setCloseOpen(true)}>
220- <IconLock class="h-4 w-4" />
221- {t("whiteboard.close")}
222- </Button>
223- </Show>
224 <Show when={isCreator()}>213 <Show when={isCreator()}>
225- <Button type="button" variant="outline" size="sm" class="text-destructive" disabled={busy()} onClick={() => setDeleteOpen(true)}>214+ <DropdownMenu placement="bottom-end" gutter={8}>
226- <IconTrash class="h-4 w-4" />215+ <DropdownMenuTrigger
227- {t("whiteboard.delete")}216+ class="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-border/80 bg-muted/45 text-foreground outline-hidden transition-colors hover:border-primary/30 hover:bg-primary/8 hover:text-primary focus-visible:ring-2 focus-visible:ring-ring data-expanded:border-primary/30 data-expanded:bg-primary/10 data-expanded:text-primary"
228- </Button>217+ aria-label={t("common.actions")}
218+ title={t("common.actions")}
219+ >
220+ <IconDotsVertical class="h-4 w-4" />
221+ </DropdownMenuTrigger>
222+ <DropdownMenuContent class="w-52">
223+ <Show when={!closed()}>
224+ <DropdownMenuItem disabled={busy()} onSelect={() => void toggleLock()}>
225+ <IconLock class="h-4 w-4" />
226+ {locked() ? t("whiteboard.unlock") : t("whiteboard.lock")}
227+ </DropdownMenuItem>
228+ <DropdownMenuItem disabled={busy()} onSelect={() => setTimeout(() => setClearOpen(true), 0)}>
229+ <IconEraser class="h-4 w-4" />
230+ {t("whiteboard.clear")}
231+ </DropdownMenuItem>
232+ <DropdownMenuSeparator />
233+ <DropdownMenuItem class="text-amber-700 focus:bg-amber-500/10 focus:text-amber-800 data-highlighted:bg-amber-500/10 data-highlighted:text-amber-800 dark:text-amber-400" disabled={busy()} onSelect={() => setTimeout(() => setCloseOpen(true), 0)}>
234+ <IconLock class="h-4 w-4" />
235+ {t("whiteboard.close")}
236+ </DropdownMenuItem>
237+ </Show>
238+ <Show when={!closed()}><DropdownMenuSeparator /></Show>
239+ <DropdownMenuItem destructive disabled={busy()} onSelect={() => setTimeout(() => setDeleteOpen(true), 0)}>
240+ <IconTrash class="h-4 w-4" />
241+ {t("whiteboard.delete")}
242+ </DropdownMenuItem>
243+ </DropdownMenuContent>
244+ </DropdownMenu>
229 </Show>245 </Show>
230 </div>246 </div>
231 }247 }
@@ -299,6 +315,7 @@ function WhiteboardContent() {
299 <BoardSettingsPanel315 <BoardSettingsPanel
300 open={settingsOpen()}316 open={settingsOpen()}
301 onOpenChange={setSettingsOpen}317 onOpenChange={setSettingsOpen}
318+ boardId={id}
302 title={boardTitle}319 title={boardTitle}
303 participants={roster}320 participants={roster}
304 creatorId={() => live().creator ?? ""}321 creatorId={() => live().creator ?? ""}
@@ -308,6 +325,10 @@ function WhiteboardContent() {
308 roleOf={roleOf}325 roleOf={roleOf}
309 onTitleSave={(title) => updateBoard({ title })}326 onTitleSave={(title) => updateBoard({ title })}
310 onParticipantsSave={(participants) => updateBoard({ participants: participants.filter((participant) => participant !== live().creator) })}327 onParticipantsSave={(participants) => updateBoard({ participants: participants.filter((participant) => participant !== live().creator) })}
328+ // Merge in place rather than refetching the board resource, which
329+ // would re-suspend the page; the socket's `participants` frame
330+ // re-syncs anyway, this just avoids waiting on it.
331+ onInvited={(board) => mergeLive({ creator: board.creator, participants: board.participants })}
311 />332 />
312 333
313 <HistoryPanel open={historyOpen()} onOpenChange={setHistoryOpen} boardId={id()} />334 <HistoryPanel open={historyOpen()} onOpenChange={setHistoryOpen} boardId={id()} />
src/routes/router.tsxmodified+17 -0
@@ -61,6 +61,7 @@ const AppointmentsPage = lazyRoute(() => import("@/pages/appointments-page"));
61 const MealsPage = lazyRoute(() => import("@/pages/meals-page"));61 const MealsPage = lazyRoute(() => import("@/pages/meals-page"));
62 const MealDetailPage = lazyRoute(() => import("@/pages/meal-detail-page"));62 const MealDetailPage = lazyRoute(() => import("@/pages/meal-detail-page"));
63 const PaymentsPage = lazyRoute(() => import("@/pages/payments-page"));63 const PaymentsPage = lazyRoute(() => import("@/pages/payments-page"));
64+const ProfilePage = lazyRoute(() => import("@/pages/profile-page"));
64 const PaymentStatementPage = lazyRoute(() => import("@/pages/payment-statement-page"));65 const PaymentStatementPage = lazyRoute(() => import("@/pages/payment-statement-page"));
65 const WhiteboardsPage = lazyRoute(() => import("@/pages/whiteboards-page"));66 const WhiteboardsPage = lazyRoute(() => import("@/pages/whiteboards-page"));
66 const WhiteboardPage = lazyRoute(() => import("@/pages/whiteboard-page"));67 const WhiteboardPage = lazyRoute(() => import("@/pages/whiteboard-page"));
@@ -306,6 +307,20 @@ const guideRoute = createRoute({
306 component: GuidePage,307 component: GuidePage,
307 });308 });
308 309
310+// Declared (and registered) before the param route so the literal segment is
311+// never a candidate for $userId.
312+const myProfileRoute = createRoute({
313+ getParentRoute: () => rootRoute,
314+ path: "/profile/me",
315+ component: ProfilePage,
316+});
317+
318+const userProfileRoute = createRoute({
319+ getParentRoute: () => rootRoute,
320+ path: "/profile/$userId",
321+ component: ProfilePage,
322+});
323+
309 const myStudentsRoute = createRoute({324 const myStudentsRoute = createRoute({
310 getParentRoute: () => rootRoute,325 getParentRoute: () => rootRoute,
311 path: "/students",326 path: "/students",
@@ -425,6 +440,8 @@ const routeTree = rootRoute.addChildren([
425 paymentStatementRoute,440 paymentStatementRoute,
426 whiteboardsRoute,441 whiteboardsRoute,
427 whiteboardRoute,442 whiteboardRoute,
443+ myProfileRoute,
444+ userProfileRoute,
428 ]);445 ]);
429 446
430 function RouterPending() {447 function RouterPending() {