forge
Explore
Log in

Don't you dare go Hollow

✨ refine AI insights and studio outputs

Browse files at this commit

67be1284fd630ea7cf61004a7c5de4327a5f7ff6Burak BoduroğluParent: e80f64f
  • feat
    • ✨ refine AI insights and studio outputs
Show full message
feat: ✨ refine AI insights and studio outputs

- replace repeated insight metrics with denser charts and expandable evidence

- add a generated-output library for summaries and podcasts in AI Studio

- localize the new analysis and studio interactions and cover the library flow
src/components/ai/note-studio-panel.tsxmodified+52 -37
@@ -6,13 +6,13 @@ import { getMyCourses } from "@/api/reports";
6 import { formatApiError, type CourseNote } from "@/api/client";6 import { formatApiError, type CourseNote } from "@/api/client";
7 import { PodcastPanel } from "@/components/notes/podcast-panel";7 import { PodcastPanel } from "@/components/notes/podcast-panel";
8 import { RagOutputsPanel } from "@/components/notes/rag-outputs-panel";8 import { RagOutputsPanel } from "@/components/notes/rag-outputs-panel";
9+import { StudioOutputLibrary } from "@/components/ai/studio-output-library";
9 import { EmptyState } from "@/components/ui/empty-state";10 import { EmptyState } from "@/components/ui/empty-state";
10 import { ErrorAlert } from "@/components/ui/error-alert";11 import { ErrorAlert } from "@/components/ui/error-alert";
11 import { IconSparkles, IconWaveform } from "@/components/ui/icons";12 import { IconSparkles, IconWaveform } from "@/components/ui/icons";
12 import { Label } from "@/components/ui/label";13 import { Label } from "@/components/ui/label";
13 import { PageSpinner } from "@/components/ui/page-spinner";14 import { PageSpinner } from "@/components/ui/page-spinner";
14 import { SearchableSelect } from "@/components/ui/searchable-select";15 import { SearchableSelect } from "@/components/ui/searchable-select";
15-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
16 import { useAuth } from "@/stores/auth-context";16 import { useAuth } from "@/stores/auth-context";
17 import { useT } from "@/stores/preferences-context";17 import { useT } from "@/stores/preferences-context";
18 import { courseNoteFiles } from "@/lib/note-source";18 import { courseNoteFiles } from "@/lib/note-source";
@@ -26,7 +26,7 @@ export function NoteStudioPanel() {
26 const t = useT();26 const t = useT();
27 const auth = useAuth();27 const auth = useAuth();
28 const [selectedId, setSelectedId] = createSignal("");28 const [selectedId, setSelectedId] = createSignal("");
29- const [activeTab, setActiveTab] = createSignal<"summary" | "podcast">("summary");29+ let outputsSection: HTMLElement | undefined;
30 const [notes, { refetch }] = createResource(30 const [notes, { refetch }] = createResource(
31 () => auth.user()?.role ?? null,31 () => auth.user()?.role ?? null,
32 async (role) => {32 async (role) => {
@@ -55,6 +55,10 @@ export function NoteStudioPanel() {
55 const user = auth.user();55 const user = auth.user();
56 return !!note && !!user && (hasMinRole(user.role, "manager") || note.courseCreatorId === user.id);56 return !!note && !!user && (hasMinRole(user.role, "manager") || note.courseCreatorId === user.id);
57 };57 };
58+ const selectLibraryNote = (noteId: string) => {
59+ setSelectedId(noteId);
60+ requestAnimationFrame(() => outputsSection?.scrollIntoView({ behavior: "smooth", block: "start" }));
61+ };
58 62
59 return (63 return (
60 <Suspense fallback={<PageSpinner />}>64 <Suspense fallback={<PageSpinner />}>
@@ -66,23 +70,35 @@ export function NoteStudioPanel() {
66 when={(notes()?.length ?? 0) > 0}70 when={(notes()?.length ?? 0) > 0}
67 fallback={<EmptyState kind="notes" title={t("podcast.noNotes")} description={t("podcast.noNotesHint")} />}71 fallback={<EmptyState kind="notes" title={t("podcast.noNotes")} description={t("podcast.noNotesHint")} />}
68 >72 >
69- <div class="w-full space-y-4">73+ <div class="w-full space-y-5">
70- <section class="data-shell w-full space-y-2 p-4">74+ <section class="overflow-hidden rounded-2xl border border-border-line bg-surface-base shadow-xs">
71- <Label for="sound-studio-note">{t("podcast.source")}</Label>75+ <div class="flex items-start gap-3 border-b border-border-line bg-primary/[0.035] px-4 py-4 sm:px-5">
72- <SearchableSelect76+ <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary-text">
73- id="sound-studio-note"77+ <IconSparkles class="h-5 w-5" />
74- class="w-full"78+ </div>
75- value={selectedId()}79+ <div class="min-w-0">
76- onChange={setSelectedId}80+ <p class="text-xs font-medium uppercase tracking-[0.12em] text-primary-text">{t("aiHub.tab.studio")}</p>
77- options={options()}81+ <h1 class="mt-1 text-lg font-semibold tracking-tight text-text-strong">{t("aiHub.tab.studio")}</h1>
78- placeholder={t("podcast.selectNote")}82+ <p class="mt-1 max-w-2xl text-sm text-muted-foreground">{t("aiHub.description")}</p>
79- />83+ </div>
84+ </div>
85+ <div class="space-y-2 px-4 py-4 sm:px-5">
86+ <Label for="sound-studio-note">{t("podcast.source")}</Label>
87+ <SearchableSelect
88+ id="sound-studio-note"
89+ class="w-full"
90+ value={selectedId()}
91+ onChange={setSelectedId}
92+ options={options()}
93+ placeholder={t("podcast.selectNote")}
94+ />
95+ </div>
80 </section>96 </section>
81 <Show97 <Show
82 when={selected()}98 when={selected()}
83 fallback={99 fallback={
84- <section class="flex min-h-44 flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-primary/25 bg-primary/[0.03] px-6 py-8 text-center">100+ <section class="flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl border border-dashed border-primary/25 bg-primary/[0.03] px-6 py-8 text-center">
85- <div class="flex h-11 w-11 items-center justify-center rounded-full bg-primary/10 text-primary-text">101+ <div class="flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary-text">
86 <IconWaveform class="h-5 w-5" />102 <IconWaveform class="h-5 w-5" />
87 </div>103 </div>
88 <div>104 <div>
@@ -93,36 +109,35 @@ export function NoteStudioPanel() {
93 }109 }
94 >110 >
95 {(note) => (111 {(note) => (
96- <Tabs112+ <section ref={outputsSection} class="scroll-mt-20 space-y-3 rounded-2xl border border-border-line bg-surface-base p-3 shadow-xs sm:p-4">
97- value={activeTab()}113+ <div class="flex flex-wrap items-center justify-between gap-2 px-1">
98- onChange={(value) => setActiveTab(value as "summary" | "podcast")}114+ <div class="min-w-0">
99- class="w-full space-y-4"115+ <p class="text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground">{t("aiStudio.outputs.title")}</p>
100- >116+ <h2 class="mt-1 truncate text-base font-semibold text-text-strong">{note().title}</h2>
101- <TabsList class="w-full">117+ <p class="mt-1 text-xs text-muted-foreground">{t("aiStudio.outputs.description")}</p>
102- <TabsTrigger value="summary" class="min-w-0 flex-1">118+ </div>
103- <IconSparkles class="h-4 w-4" />119+ <span class="rounded-full border border-border-line bg-background px-2.5 py-1 text-xs text-muted-foreground">
104- {t("aiStudio.tab.summary")}120+ {note().courseTitle}
105- </TabsTrigger>121+ </span>
106- <TabsTrigger value="podcast" class="min-w-0 flex-1">122+ </div>
107- <IconWaveform class="h-4 w-4" />123+ <div class="grid gap-4 xl:grid-cols-2">
108- {t("aiStudio.tab.podcast")}
109- </TabsTrigger>
110- </TabsList>
111- <TabsContent value="summary" class="mt-0 w-full">
112 <RagOutputsPanel124 <RagOutputsPanel
113 noteId={note().id}125 noteId={note().id}
114 source={courseNoteFiles}126 source={courseNoteFiles}
115 canManage={canManageSelected()}127 canManage={canManageSelected()}
116- active={activeTab() === "summary"}128+ active
117 noteTitle={note().title}129 noteTitle={note().title}
118 />130 />
119- </TabsContent>131+ <PodcastPanel noteId={note().id} noteTitle={note().title} active />
120- <TabsContent value="podcast" class="mt-0 w-full">132+ </div>
121- <PodcastPanel noteId={note().id} noteTitle={note().title} active={activeTab() === "podcast"} />133+ </section>
122- </TabsContent>
123- </Tabs>
124 )}134 )}
125 </Show>135 </Show>
136+ <StudioOutputLibrary
137+ notes={(notes() ?? []).map((note) => ({ id: note.id, title: note.title, courseTitle: note.courseTitle }))}
138+ selectedId={selectedId()}
139+ onSelect={selectLibraryNote}
140+ />
126 </div>141 </div>
127 </Show>142 </Show>
128 </Show>143 </Show>
src/components/ai/studio-output-library.test.tsxadded+92 -0
@@ -0,0 +1,92 @@
1+import { cleanup, fireEvent, render, screen, waitFor } from "@solidjs/testing-library";
2+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3+import type { PodcastJobSummary, RagOutput } from "@/api/client";
4+import { StudioOutputLibrary } from "@/components/ai/studio-output-library";
5+import { PreferencesProvider } from "@/stores/preferences-context";
6+
7+const podcastApi = vi.hoisted(() => ({ listPodcastJobs: vi.fn() }));
8+const courseNotesApi = vi.hoisted(() => ({ getCourseNoteRag: vi.fn() }));
9+
10+vi.mock("@/api/podcast", () => podcastApi);
11+vi.mock("@/api/course-notes", () => courseNotesApi);
12+
13+const notes = [
14+ { id: "note-1", title: "Hücre", courseTitle: "Biyoloji" },
15+ { id: "note-2", title: "Kuvvet", courseTitle: "Fizik" },
16+ { id: "note-3", title: "Polinomlar", courseTitle: "Matematik" },
17+];
18+
19+function page<T>(items: T[]) {
20+ return { items, total: items.length, limit: 100, offset: 0 };
21+}
22+
23+function podcast(over: Partial<PodcastJobSummary>): PodcastJobSummary {
24+ return {
25+ job_id: "job-1",
26+ state: "done",
27+ format: "duz_okuma",
28+ source_id: "note-1",
29+ source_title: "Hücre",
30+ created_at: Date.UTC(2026, 0, 2),
31+ finished_at: Date.UTC(2026, 0, 2),
32+ duration_secs: 120,
33+ error_code: null,
34+ ...over,
35+ };
36+}
37+
38+function summary(noteId: string): RagOutput {
39+ return {
40+ id: `rag-${noteId}`,
41+ course_note: noteId,
42+ course: "course-1",
43+ sources: [],
44+ payload: { summary: "Hazır" },
45+ generated_at: Date.UTC(2026, 0, 3),
46+ };
47+}
48+
49+describe("StudioOutputLibrary", () => {
50+ beforeEach(() => {
51+ localStorage.setItem("hezarfen.locale", "tr");
52+ podcastApi.listPodcastJobs.mockResolvedValue(page([
53+ podcast({ job_id: "job-1" }),
54+ podcast({ job_id: "job-2" }),
55+ podcast({ job_id: "job-failed", source_id: "note-3", state: "failed" }),
56+ ]));
57+ courseNotesApi.getCourseNoteRag.mockImplementation(async (noteId: string) =>
58+ page(noteId === "note-2" ? [summary(noteId)] : []),
59+ );
60+ });
61+
62+ afterEach(() => {
63+ cleanup();
64+ localStorage.clear();
65+ vi.clearAllMocks();
66+ });
67+
68+ it("shows only notes with finished outputs and selects one directly", async () => {
69+ const onSelect = vi.fn();
70+
71+ render(() => (
72+ <PreferencesProvider>
73+ <StudioOutputLibrary notes={notes} selectedId="note-1" onSelect={onSelect} />
74+ </PreferencesProvider>
75+ ));
76+
77+ await waitFor(() => expect(screen.getByText("Hücre")).toBeTruthy());
78+ expect(screen.getByText("Kuvvet")).toBeTruthy();
79+ expect(screen.queryByText("Polinomlar")).toBeNull();
80+ expect(screen.getByText("2 podcast")).toBeTruthy();
81+ expect(screen.getByText("Yapay zekâ özeti")).toBeTruthy();
82+ expect(screen.getByText("2 not")).toBeTruthy();
83+
84+ const selected = screen.getByRole("button", { name: /Hücre/ });
85+ expect(selected.getAttribute("aria-current")).toBe("true");
86+
87+ fireEvent.click(screen.getByRole("button", { name: /Kuvvet/ }));
88+ expect(onSelect).toHaveBeenCalledWith("note-2");
89+ expect(podcastApi.listPodcastJobs).toHaveBeenCalledWith({ limit: 100 });
90+ expect(courseNotesApi.getCourseNoteRag).toHaveBeenCalledTimes(3);
91+ });
92+});
src/components/ai/studio-output-library.tsxadded+146 -0
@@ -0,0 +1,146 @@
1+import { For, Show, Suspense, createMemo } from "solid-js";
2+import { createResource } from "@/lib/create-resource";
3+import { getCourseNoteRag } from "@/api/course-notes";
4+import { listPodcastJobs } from "@/api/podcast";
5+import { Badge } from "@/components/ui/badge";
6+import { EmptyInline } from "@/components/ui/empty-inline";
7+import { IconChevronRight, IconNote, IconSparkles, IconWaveform } from "@/components/ui/icons";
8+import { PageSpinner } from "@/components/ui/page-spinner";
9+import { cn } from "@/lib/cn";
10+import { useT } from "@/stores/preferences-context";
11+
12+export type StudioLibraryNote = {
13+ id: string;
14+ title: string;
15+ courseTitle: string;
16+};
17+
18+type StudioLibraryItem = StudioLibraryNote & {
19+ podcastCount: number;
20+ hasSummary: boolean;
21+ latestAt: number;
22+};
23+
24+const LIBRARY_LIMIT = 100;
25+
26+export function StudioOutputLibrary(props: {
27+ notes: StudioLibraryNote[];
28+ selectedId: string;
29+ onSelect: (noteId: string) => void;
30+}) {
31+ const t = useT();
32+ const source = createMemo(() => props.notes.map((note) => note.id).join(","));
33+ const [items] = createResource(source, async (): Promise<StudioLibraryItem[]> => {
34+ const [podcastResult, ...summaryResults] = await Promise.allSettled([
35+ listPodcastJobs({ limit: LIBRARY_LIMIT }),
36+ ...props.notes.map((note) => getCourseNoteRag(note.id, { limit: 1 })),
37+ ]);
38+ const podcasts = podcastResult.status === "fulfilled" ? podcastResult.value.items : [];
39+ const podcastsByNote = new Map<string, { count: number; latestAt: number }>();
40+
41+ for (const podcast of podcasts) {
42+ if (podcast.state !== "done") continue;
43+ const current = podcastsByNote.get(podcast.source_id) ?? { count: 0, latestAt: 0 };
44+ podcastsByNote.set(podcast.source_id, {
45+ count: current.count + 1,
46+ latestAt: Math.max(current.latestAt, podcast.finished_at ?? podcast.created_at),
47+ });
48+ }
49+
50+ return props.notes
51+ .map((note, index): StudioLibraryItem | null => {
52+ const summaryResult = summaryResults[index];
53+ const summary = summaryResult?.status === "fulfilled" ? summaryResult.value.items[0] : undefined;
54+ const podcast = podcastsByNote.get(note.id);
55+ if (!summary && !podcast) return null;
56+ return {
57+ ...note,
58+ podcastCount: podcast?.count ?? 0,
59+ hasSummary: !!summary,
60+ latestAt: Math.max(summary?.generated_at ?? 0, podcast?.latestAt ?? 0),
61+ };
62+ })
63+ .filter((item): item is StudioLibraryItem => item != null)
64+ .sort((a, b) => b.latestAt - a.latestAt);
65+ });
66+
67+ return (
68+ <section class="overflow-hidden rounded-xl border border-border-line bg-surface-base">
69+ <header class="flex flex-wrap items-start justify-between gap-3 border-b border-border-hairline px-4 py-4 sm:px-5">
70+ <div class="flex min-w-0 items-start gap-3">
71+ <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-surface-tint text-text-subtle">
72+ <IconNote class="h-4 w-4" />
73+ </span>
74+ <div class="min-w-0">
75+ <h2 class="text-sm font-semibold text-text-strong">{t("aiStudio.library.title")}</h2>
76+ <p class="mt-0.5 text-xs text-muted-foreground">{t("aiStudio.library.description")}</p>
77+ </div>
78+ </div>
79+ <Show when={(items()?.length ?? 0) > 0}>
80+ <Badge variant="secondary" class="rounded-md">
81+ {t("aiStudio.library.count", { count: items()?.length ?? 0 })}
82+ </Badge>
83+ </Show>
84+ </header>
85+
86+ <Suspense fallback={<div class="py-8"><PageSpinner /></div>}>
87+ <Show
88+ when={(items()?.length ?? 0) > 0}
89+ fallback={
90+ <div class="px-4 py-5 sm:px-5">
91+ <EmptyInline title={t("aiStudio.library.empty")} hint={t("aiStudio.library.emptyHint")} />
92+ </div>
93+ }
94+ >
95+ <ul class="grid gap-3 p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-3">
96+ <For each={items()}>
97+ {(item) => (
98+ <li>
99+ <button
100+ type="button"
101+ aria-current={props.selectedId === item.id ? "true" : undefined}
102+ class={cn(
103+ "group flex h-full w-full flex-col rounded-xl border bg-background p-4 text-left outline-hidden transition-colors hover:border-primary/35 hover:bg-surface-tint focus-visible:ring-2 focus-visible:ring-ring",
104+ props.selectedId === item.id ? "border-primary/40 bg-primary/[0.035]" : "border-border-hairline",
105+ )}
106+ onClick={() => props.onSelect(item.id)}
107+ >
108+ <div class="flex w-full items-start gap-3">
109+ <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text">
110+ <IconNote class="h-4 w-4" />
111+ </span>
112+ <div class="min-w-0 flex-1">
113+ <p class="truncate text-sm font-semibold text-text-strong">{item.title}</p>
114+ <p class="mt-0.5 truncate text-xs text-muted-foreground">{item.courseTitle}</p>
115+ </div>
116+ </div>
117+
118+ <div class="mt-4 flex flex-wrap gap-1.5">
119+ <Show when={item.hasSummary}>
120+ <Badge variant="outline" class="gap-1 rounded-md font-normal">
121+ <IconSparkles class="h-3 w-3" />
122+ {t("aiStudio.library.summary")}
123+ </Badge>
124+ </Show>
125+ <Show when={item.podcastCount > 0}>
126+ <Badge variant="outline" class="gap-1 rounded-md font-normal">
127+ <IconWaveform class="h-3 w-3" />
128+ {t("aiStudio.library.podcastCount", { count: item.podcastCount })}
129+ </Badge>
130+ </Show>
131+ </div>
132+
133+ <span class="mt-4 inline-flex items-center gap-1 text-xs font-medium text-primary-text">
134+ {t("aiStudio.library.open")}
135+ <IconChevronRight class="h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5" />
136+ </span>
137+ </button>
138+ </li>
139+ )}
140+ </For>
141+ </ul>
142+ </Show>
143+ </Suspense>
144+ </section>
145+ );
146+}
src/components/insights/insight-module-views.tsxmodified+82 -8
@@ -1,10 +1,12 @@
1-import { For, Show, type JSX } from "solid-js";1+import { For, Show, createSignal, type JSX } from "solid-js";
2 import { Badge } from "@/components/ui/badge";2 import { Badge } from "@/components/ui/badge";
3 import { detailText, dimensionLabel, type InsightDetailKey } from "@/i18n/insights-detail";3 import { detailText, dimensionLabel, type InsightDetailKey } from "@/i18n/insights-detail";
4 import type { Locale } from "@/i18n/messages";4 import type { Locale } from "@/i18n/messages";
5 import { cn } from "@/lib/cn";5 import { cn } from "@/lib/cn";
6 import { formatDateTime } from "@/lib/format";6 import { formatDateTime } from "@/lib/format";
7 import { isRecord, type UnknownRecord } from "@/lib/is-record";7 import { isRecord, type UnknownRecord } from "@/lib/is-record";
8+import { SidePanel } from "@/components/ui/side-panel";
9+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
8 import { usePreferences } from "@/stores/preferences-context";10 import { usePreferences } from "@/stores/preferences-context";
9 11
10 /**12 /**
@@ -236,7 +238,7 @@ const BAND_KEYS: Record<string, InsightDetailKey> = {
236 insufficient_data: "marks.band.insufficient_data",238 insufficient_data: "marks.band.insufficient_data",
237 };239 };
238 240
239-function MarksCourseCard(props: { id: string; statRaw: unknown; courseTitle: CourseTitle; index: number }) {241+function MarksCourseDetail(props: { id: string; statRaw: unknown; courseTitle: CourseTitle; index: number }) {
240 const stat = () => obj(props.statRaw);242 const stat = () => obj(props.statRaw);
241 const placement = () => obj(stat().placement);243 const placement = () => obj(stat().placement);
242 const trend = () => obj(stat().trend);244 const trend = () => obj(stat().trend);
@@ -356,23 +358,95 @@ function MarksCourseCard(props: { id: string; statRaw: unknown; courseTitle: Cou
356 function MarksView(props: { value: Rec; courseTitle: CourseTitle }) {358 function MarksView(props: { value: Rec; courseTitle: CourseTitle }) {
357 const courses = () => Object.entries(obj(props.value.courses));359 const courses = () => Object.entries(obj(props.value.courses));
358 const contrast = () => obj(props.value.within_student_contrast);360 const contrast = () => obj(props.value.within_student_contrast);
361+ const [selectedCourse, setSelectedCourse] = createSignal<{ id: string; stat: unknown; index: number } | null>(null);
359 const contrastTitle = () =>362 const contrastTitle = () =>
360 str(contrast().course_title) ??363 str(contrast().course_title) ??
361 (str(contrast().course) ? props.courseTitle(contrast().course as string) : null);364 (str(contrast().course) ? props.courseTitle(contrast().course as string) : null);
365+ const selectedTitle = () => {
366+ const selected = selectedCourse();
367+ return selected
368+ ? str(obj(selected.stat).course_title) ?? courseLabel(selected.id, props.courseTitle, selected.index)
369+ : "";
370+ };
371+ const placement = (statRaw: unknown) => obj(obj(statRaw).placement);
372+ const trend = (statRaw: unknown) => obj(obj(statRaw).trend);
373+ const bandLabel = (statRaw: unknown) => {
374+ const band = str(placement(statRaw).band);
375+ const key = (band === null ? undefined : BAND_KEYS[band]) ?? "marks.band.insufficient_data";
376+ return detailText(key);
377+ };
378+ const bandVariant = (statRaw: unknown) => {
379+ const band = str(placement(statRaw).band);
380+ return band === "review" ? ("warning" as const) : band === "strong" ? ("success" as const) : ("secondary" as const);
381+ };
382+ const trendLabel = (statRaw: unknown) => {
383+ const current = trend(statRaw);
384+ if (current.rising === true) return detailText("marks.rising");
385+ if (current.dropped === true) return detailText("marks.dropped");
386+ return current.available === true ? detailText("marks.trend") : detailText("marks.band.insufficient_data");
387+ };
362 388
363 return (389 return (
364 <div class="space-y-3">390 <div class="space-y-3">
365 <dl class="space-y-1.5">391 <dl class="space-y-1.5">
366 <LabeledRow label={detailText("marks.classCount")} value={String((props.value.classes as unknown[] | undefined)?.length ?? 0)} mono />392 <LabeledRow label={detailText("marks.classCount")} value={String((props.value.classes as unknown[] | undefined)?.length ?? 0)} mono />
367 </dl>393 </dl>
368- <div class="max-h-[28rem] space-y-2 overflow-y-auto pr-1">394+ <div class="overflow-x-auto rounded-lg border border-border-hairline">
369- <For each={courses()}>395+ <Table class="min-w-[42rem]">
370- {([id, stat], index) => (396+ <TableHeader>
371- <MarksCourseCard id={id} statRaw={stat} courseTitle={props.courseTitle} index={index()} />397+ <TableRow>
372- )}398+ <TableHead>{detailText("marks.course")}</TableHead>
373- </For>399+ <TableHead class="text-center">{detailText("marks.average")}</TableHead>
400+ <TableHead class="text-center">{detailText("marks.nMarks")}</TableHead>
401+ <TableHead class="text-center">{detailText("marks.placement")}</TableHead>
402+ <TableHead class="text-center">{detailText("marks.trend")}</TableHead>
403+ </TableRow>
404+ </TableHeader>
405+ <TableBody>
406+ <For each={courses()}>
407+ {([id, stat], index) => (
408+ <TableRow
409+ class="cursor-pointer focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"
410+ tabIndex={0}
411+ onClick={() => setSelectedCourse({ id, stat, index: index() })}
412+ onKeyDown={(event) => {
413+ if (event.key === "Enter" || event.key === " ") {
414+ event.preventDefault();
415+ setSelectedCourse({ id, stat, index: index() });
416+ }
417+ }}
418+ >
419+ <TableCell class="font-medium text-text-strong">{str(obj(stat).course_title) ?? courseLabel(id, props.courseTitle, index())}</TableCell>
420+ <TableCell class="text-center font-mono">{nText(obj(stat).average) ?? "—"}</TableCell>
421+ <TableCell class="text-center font-mono">{String(num(obj(stat).n_marks) ?? 0)}</TableCell>
422+ <TableCell class="text-center"><Badge variant={bandVariant(stat)} class="rounded-full">{bandLabel(stat)}</Badge></TableCell>
423+ <TableCell class="text-center text-xs text-muted-foreground">{trendLabel(stat)}</TableCell>
424+ </TableRow>
425+ )}
426+ </For>
427+ </TableBody>
428+ </Table>
374 </div>429 </div>
375 430
431+ <SidePanel
432+ open={selectedCourse() != null}
433+ onOpenChange={(open) => { if (!open) setSelectedCourse(null); }}
434+ title={selectedTitle()}
435+ description={detailText("marks.average")}
436+ size="wide"
437+ >
438+ <Show when={selectedCourse()}>
439+ {(selected) => (
440+ <MarksCourseDetail
441+ id={selected().id}
442+ statRaw={selected().stat}
443+ courseTitle={props.courseTitle}
444+ index={selected().index}
445+ />
446+ )}
447+ </Show>
448+ </SidePanel>
449+
376 <div class="space-y-1.5 border-t border-border-hairline pt-3">450 <div class="space-y-1.5 border-t border-border-hairline pt-3">
377 <p class="text-xs font-medium text-text-strong">{detailText("marks.contrast")}</p>451 <p class="text-xs font-medium text-text-strong">{detailText("marks.contrast")}</p>
378 <Show452 <Show
src/components/insights/insight-student-analysis-tabs.tsxmodified+132 -127
@@ -2,7 +2,10 @@ import { For, Show } from "solid-js";
2 import type { StudentInsight } from "@/api/client";2 import type { StudentInsight } from "@/api/client";
3 import { InsightDetail } from "@/components/insights/insight-detail";3 import { InsightDetail } from "@/components/insights/insight-detail";
4 import { InsightModuleView } from "@/components/insights/insight-module-views";4 import { InsightModuleView } from "@/components/insights/insight-module-views";
5+import { ChartBar, type ChartBarItem } from "@/components/ui/chart-bar";
6+import { ChartProgressRing, type ProgressRingSegment } from "@/components/ui/chart-progress-ring";
5 import { EmptyInline } from "@/components/ui/empty-inline";7 import { EmptyInline } from "@/components/ui/empty-inline";
8+import { IconAlert, IconChart, IconChevronDown } from "@/components/ui/icons";
6 import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";9 import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
7 import { isRecord, type UnknownRecord } from "@/lib/is-record";10 import { isRecord, type UnknownRecord } from "@/lib/is-record";
8 import { usePreferences } from "@/stores/preferences-context";11 import { usePreferences } from "@/stores/preferences-context";
@@ -13,90 +16,48 @@ const obj = (value: unknown): Rec => (isRecord(value) ? value : {});
13 const num = (value: unknown): number | null =>16 const num = (value: unknown): number | null =>
14 typeof value === "number" && Number.isFinite(value) ? value : null;17 typeof value === "number" && Number.isFinite(value) ? value : null;
15 18
16-function ChartCard(props: { label: string; value: string; hint?: string }) {
17- return (
18- <div class="rounded-xl border border-border-line bg-surface-base px-4 py-3">
19- <p class="text-xs text-muted-foreground">{props.label}</p>
20- <p class="mono mt-1 text-xl font-semibold tabular-nums text-text-strong">{props.value}</p>
21- <Show when={props.hint}>
22- <p class="mt-1 text-[11px] text-muted-foreground">{props.hint}</p>
23- </Show>
24- </div>
25- );
26-}
27-
28-function BarChart(props: {
29- items: Array<{ label: string; value: number | null; color?: string }>;
30- format?: (value: number) => string;
31-}) {
32- const max = () => Math.max(...props.items.map((item) => item.value ?? 0), 1);
33- const format = (value: number) => props.format?.(value) ?? String(value);
34- return (
35- <div class="space-y-3">
36- <For each={props.items}>
37- {(item) => (
38- <div class="space-y-1.5">
39- <div class="flex items-center justify-between gap-3 text-xs">
40- <span class="truncate text-muted-foreground">{item.label}</span>
41- <span class="mono shrink-0 font-semibold text-text-strong">
42- {item.value == null ? "—" : format(item.value)}
43- </span>
44- </div>
45- <div class="h-2 overflow-hidden rounded-full bg-surface-fill">
46- <div
47- class={`h-full rounded-full ${item.color ?? "bg-primary"}`}
48- style={{ width: `${item.value == null ? 0 : Math.max(3, (item.value / max()) * 100)}%` }}
49- />
50- </div>
51- </div>
52- )}
53- </For>
54- </div>
55- );
56-}
57-
58 function AttendanceChart(props: { value: unknown; t: (key: string) => string }) {19 function AttendanceChart(props: { value: unknown; t: (key: string) => string }) {
59 const overall = () => obj(obj(props.value).overall);20 const overall = () => obj(obj(props.value).overall);
60 const count = (key: string) => num(overall()[key]) ?? 0;21 const count = (key: string) => num(overall()[key]) ?? 0;
61 const rate = () => num(overall().rate);22 const rate = () => num(overall().rate);
23+ const segments = (): ProgressRingSegment[] => [
24+ { id: "present", label: props.t("insights.analysis.present"), value: count("present"), colorClass: "bg-success" },
25+ { id: "absent", label: props.t("insights.analysis.absent"), value: count("absent"), colorClass: "bg-destructive" },
26+ { id: "late", label: props.t("insights.analysis.late"), value: count("late"), colorClass: "bg-warning" },
27+ { id: "excused", label: props.t("insights.analysis.excused"), value: count("excused"), colorClass: "bg-info" },
28+ ];
62 return (29 return (
63- <div class="space-y-4">30+ <ChartProgressRing
64- <div class="grid gap-3 sm:grid-cols-3">31+ title={props.t("insights.modules.attendance")}
65- <ChartCard label={props.t("insights.analysis.rate")} value={rate() == null ? "—" : `%${Math.round(rate()! * 100)}`} />32+ subtitle={props.t("insights.analysis.currentSnapshot")}
66- <ChartCard label={props.t("insights.analysis.present")} value={String(count("present"))} />33+ valueText={rate() == null ? "—" : `%${Math.round(rate()! * 100)}`}
67- <ChartCard label={props.t("insights.analysis.absent")} value={String(count("absent"))} />34+ subtext={props.t("insights.analysis.rate")}
68- </div>35+ segments={segments()}
69- <BarChart36+ />
70- items={[
71- { label: props.t("insights.analysis.present"), value: count("present"), color: "bg-success" },
72- { label: props.t("insights.analysis.absent"), value: count("absent"), color: "bg-destructive" },
73- { label: props.t("insights.analysis.late"), value: count("late"), color: "bg-warning" },
74- { label: props.t("insights.analysis.excused"), value: count("excused"), color: "bg-info" },
75- ]}
76- />
77- </div>
78 );37 );
79 }38 }
80 39
81 function MarksChart(props: { value: unknown; t: (key: string) => string }) {40 function MarksChart(props: { value: unknown; t: (key: string) => string }) {
82 const courses = () => Object.entries(obj(obj(props.value).courses));41 const courses = () => Object.entries(obj(obj(props.value).courses));
83- const items = () => courses().map(([id, raw]) => {42+ const items = (): ChartBarItem[] => courses().flatMap(([id, raw]) => {
84 const stat = obj(raw);43 const stat = obj(raw);
85- return { label: String(stat.course_title ?? id).slice(0, 32), value: num(stat.average) };44+ const value = num(stat.average);
45+ return value == null ? [] : [{
46+ id,
47+ label: String(stat.course_title ?? id).slice(0, 32),
48+ value,
49+ max: 100,
50+ formattedValue: value.toLocaleString("tr-TR", { maximumFractionDigits: 1 }),
51+ }];
86 });52 });
87- const averages = () => items().map((item) => item.value).filter((value): value is number => value != null);
88- const average = () => averages().length ? averages().reduce((sum, value) => sum + value, 0) / averages().length : null;
89 return (53 return (
90- <div class="space-y-4">54+ <ChartBar
91- <div class="grid gap-3 sm:grid-cols-3">55+ title={props.t("insights.modules.marks")}
92- <ChartCard label={props.t("insights.analysis.average")} value={average() == null ? "—" : average()!.toLocaleString("tr-TR", { maximumFractionDigits: 1 })} />56+ subtitle={props.t("insights.analysis.courseComparison")}
93- <ChartCard label={props.t("insights.analysis.courses")} value={String(items().length)} />57+ items={items()}
94- <ChartCard label={props.t("insights.analysis.bestMark")} value={averages().length ? Math.max(...averages()).toLocaleString("tr-TR", { maximumFractionDigits: 1 }) : "—"} />58+ maxScale={100}
95- </div>59+ itemsPerPage={8}
96- <Show when={items().length > 0} fallback={<EmptyInline title={props.t("insights.noSummary")} illustration="charts" />}>60+ />
97- <BarChart items={items()} format={(value) => value.toLocaleString("tr-TR", { maximumFractionDigits: 1 })} />
98- </Show>
99- </div>
100 );61 );
101 }62 }
102 63
@@ -106,21 +67,49 @@ function StudyChart(props: { value: unknown; t: (key: string) => string }) {
106 const milliseconds = num(recent().total_focus_ms);67 const milliseconds = num(recent().total_focus_ms);
107 return milliseconds == null ? null : milliseconds / 3_600_000;68 return milliseconds == null ? null : milliseconds / 3_600_000;
108 };69 };
70+ const previous = () => obj(obj(props.value).previous_28d);
71+ const focusItems = (): ChartBarItem[] => {
72+ const currentHours = hours();
73+ const previousMs = num(previous().total_focus_ms);
74+ const previousHours = previousMs == null ? null : previousMs / 3_600_000;
75+ const items: ChartBarItem[] = [];
76+ if (currentHours != null) {
77+ items.push({
78+ id: "current",
79+ label: props.t("insights.analysis.currentPeriod"),
80+ value: currentHours,
81+ formattedValue: currentHours.toLocaleString("tr-TR", { maximumFractionDigits: 1 }),
82+ colorClass: "bg-primary",
83+ });
84+ }
85+ if (previousHours != null) {
86+ items.push({
87+ id: "previous",
88+ label: props.t("insights.analysis.previousPeriod"),
89+ value: previousHours,
90+ formattedValue: previousHours.toLocaleString("tr-TR", { maximumFractionDigits: 1 }),
91+ colorClass: "bg-info",
92+ });
93+ }
94+ return items;
95+ };
109 return (96 return (
110- <div class="space-y-4">97+ <div class="grid gap-3 lg:grid-cols-[minmax(0,1fr)_14rem]">
111- <div class="grid gap-3 sm:grid-cols-3">98+ <ChartBar
112- <ChartCard label={props.t("insights.analysis.focusHours")} value={hours() == null ? "—" : hours()!.toLocaleString("tr-TR", { maximumFractionDigits: 1 })} />99+ title={props.t("insights.analysis.focusHours")}
113- <ChartCard label={props.t("insights.analysis.activeDays")} value={String(num(recent().active_days) ?? "—")} />100+ subtitle={props.t("insights.analysis.periodComparison")}
114- <ChartCard label={props.t("insights.analysis.regularity")} value={num(recent().regularity) == null ? "—" : `%${Math.round(num(recent().regularity)! * 100)}`} />101+ items={focusItems()}
115- </div>
116- <BarChart
117- items={[
118- { label: props.t("insights.analysis.focusHours"), value: hours(), color: "bg-primary" },
119- { label: props.t("insights.analysis.activeDays"), value: num(recent().active_days), color: "bg-info" },
120- { label: props.t("insights.analysis.sessions"), value: num(recent().n_stints), color: "bg-success" },
121- ]}
122- format={(value) => value.toLocaleString("tr-TR", { maximumFractionDigits: 1 })}
123 />102 />
103+ <dl class="grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-border-line bg-border-line lg:grid-cols-1">
104+ <div class="bg-surface-base p-4">
105+ <dt class="text-xs text-muted-foreground">{props.t("insights.analysis.activeDays")}</dt>
106+ <dd class="mt-1 font-mono text-2xl font-semibold tabular-nums text-text-strong">{String(num(recent().active_days) ?? "—")}</dd>
107+ </div>
108+ <div class="bg-surface-base p-4">
109+ <dt class="text-xs text-muted-foreground">{props.t("insights.analysis.sessions")}</dt>
110+ <dd class="mt-1 font-mono text-2xl font-semibold tabular-nums text-text-strong">{String(num(recent().n_stints) ?? "—")}</dd>
111+ </div>
112+ </dl>
124 </div>113 </div>
125 );114 );
126 }115 }
@@ -130,21 +119,21 @@ function SubmissionChart(props: { value: unknown; t: (key: string) => string })
130 const count = (key: string) => num(overall()[key]) ?? 0;119 const count = (key: string) => num(overall()[key]) ?? 0;
131 const total = () => count("n");120 const total = () => count("n");
132 const submittedRate = () => total() > 0 ? count("n_submitted") / total() : null;121 const submittedRate = () => total() > 0 ? count("n_submitted") / total() : null;
122+ const onTime = () => Math.max(0, count("n_submitted") - count("n_late"));
123+ const segments = (): ProgressRingSegment[] => [
124+ { id: "on-time", label: props.t("insights.analysis.onTime"), value: onTime(), colorClass: "bg-success" },
125+ { id: "late", label: props.t("insights.analysis.late"), value: count("n_late"), colorClass: "bg-warning" },
126+ { id: "missing", label: props.t("insights.analysis.missing"), value: count("n_missing"), colorClass: "bg-destructive" },
127+ ];
133 return (128 return (
134- <div class="space-y-4">129+ <ChartProgressRing
135- <div class="grid gap-3 sm:grid-cols-3">130+ title={props.t("insights.modules.submission")}
136- <ChartCard label={props.t("insights.analysis.submittedRate")} value={submittedRate() == null ? "—" : `%${Math.round(submittedRate()! * 100)}`} />131+ subtitle={props.t("insights.analysis.currentSnapshot")}
137- <ChartCard label={props.t("insights.analysis.submitted")} value={String(count("n_submitted"))} />132+ valueText={submittedRate() == null ? "—" : `%${Math.round(submittedRate()! * 100)}`}
138- <ChartCard label={props.t("insights.analysis.missing")} value={String(count("n_missing"))} />133+ subtext={props.t("insights.analysis.submittedRate")}
139- </div>134+ segments={segments()}
140- <BarChart135+ total={total()}
141- items={[136+ />
142- { label: props.t("insights.analysis.submitted"), value: count("n_submitted"), color: "bg-success" },
143- { label: props.t("insights.analysis.late"), value: count("n_late"), color: "bg-warning" },
144- { label: props.t("insights.analysis.missing"), value: count("n_missing"), color: "bg-destructive" },
145- ]}
146- />
147- </div>
148 );137 );
149 }138 }
150 139
@@ -162,17 +151,30 @@ function ModuleTab(props: {
162 };151 };
163 return (152 return (
164 <Show when={props.value != null} fallback={<EmptyInline title={props.t("insights.sectionNotComputed")} illustration="charts" />}>153 <Show when={props.value != null} fallback={<EmptyInline title={props.t("insights.sectionNotComputed")} illustration="charts" />}>
165- <div class="space-y-5">154+ <div class="space-y-3">
166- <section class="rounded-xl border border-border-line bg-surface-base p-4">155+ {chart()}
167- <div class="mb-4 flex items-center justify-between gap-3">156+ <details class="group overflow-hidden rounded-xl border border-primary/20 bg-gradient-to-br from-primary/10 via-surface-base to-info/5 shadow-xs">
168- <h2 class="text-sm font-semibold text-text-strong">{props.t(`insights.modules.${props.module}`)}</h2>157+ <summary class="flex cursor-pointer list-none items-center justify-between gap-4 p-4 sm:p-5 [&::-webkit-details-marker]:hidden">
169- <span class="text-xs text-muted-foreground">{props.t("insights.analysis.visual")}</span>158+ <span class="flex min-w-0 items-center gap-3">
159+ <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-primary/20 bg-primary/10 text-primary-text shadow-xs">
160+ <IconChart class="h-5 w-5" />
161+ </span>
162+ <span class="min-w-0">
163+ <span class="block text-sm font-semibold text-text-strong">{props.t("insights.analysis.details")}</span>
164+ <span class="mt-0.5 block text-xs leading-5 text-muted-foreground">{props.t("insights.analysis.detailsHint")}</span>
165+ </span>
166+ </span>
167+ <span class="flex shrink-0 items-center gap-2 rounded-lg border border-border-line bg-surface-base px-3 py-2 text-xs font-medium text-text-strong shadow-xs transition-colors group-hover:border-primary/30 group-hover:text-primary-text">
168+ <span class="hidden sm:inline">{props.t("insights.analysis.detailsAction")}</span>
169+ <IconChevronDown class="h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180" />
170+ </span>
171+ </summary>
172+ <div class="border-t border-primary/15 bg-surface-base/90 p-4 sm:p-5">
173+ <div class="rounded-xl border border-border-hairline bg-surface-overlay/40 p-3 sm:p-4">
174+ <InsightModuleView module={props.module} value={props.value} courseTitle={props.courseTitle} />
175+ </div>
170 </div>176 </div>
171- {chart()}177+ </details>
172- </section>
173- <section class="rounded-xl border border-border-line bg-surface-base p-4">
174- <InsightModuleView module={props.module} value={props.value} courseTitle={props.courseTitle} />
175- </section>
176 </div>178 </div>
177 </Show>179 </Show>
178 );180 );
@@ -199,25 +201,28 @@ export function InsightStudentAnalysisTabs(props: { insight: StudentInsight }) {
199 <TabsTrigger value="submission">{t("insights.modules.submission")}</TabsTrigger>201 <TabsTrigger value="submission">{t("insights.modules.submission")}</TabsTrigger>
200 </TabsList>202 </TabsList>
201 203
202- <TabsContent value="overview" class="mt-0 space-y-5">204+ <TabsContent value="overview" class="mt-0">
203- <section class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">205+ <div class="grid gap-3 lg:grid-cols-2">
204- <ChartCard label={t("insights.modules.attendance")} value={num(obj(obj(moduleValue("attendance")).overall).rate) == null ? "—" : `%${Math.round(num(obj(obj(moduleValue("attendance")).overall).rate)! * 100)}`} />206+ <section class="space-y-3 rounded-xl border border-border-line bg-surface-base p-4">
205- <ChartCard label={t("insights.modules.marks")} value={(() => {207+ <div class="flex items-center gap-2">
206- const values = Object.values(obj(obj(moduleValue("marks")).courses)).map((raw) => num(obj(raw).average)).filter((value): value is number => value != null);208+ <IconAlert class="h-4 w-4 text-warning-text" />
207- return values.length ? (values.reduce((sum, value) => sum + value, 0) / values.length).toLocaleString("tr-TR", { maximumFractionDigits: 1 }) : "—";209+ <h2 class="text-sm font-semibold text-text-strong">{t("insights.attention")}</h2>
208- })()} />210+ </div>
209- <ChartCard label={t("insights.modules.study")} value={(() => {211+ <Show
210- const milliseconds = num(obj(obj(moduleValue("study")).recent_28d).total_focus_ms);212+ when={props.insight.attention.length > 0}
211- return milliseconds == null ? "—" : `${(milliseconds / 3_600_000).toLocaleString("tr-TR", { maximumFractionDigits: 1 })} sa`;213+ fallback={<EmptyInline title={t("insights.noAttention")} illustration="empty" />}
212- })()} />214+ >
213- <ChartCard label={t("insights.modules.submission")} value={(() => {215+ <div class="space-y-2">
214- const overall = obj(obj(moduleValue("submission")).overall);216+ <For each={props.insight.attention}>
215- const total = num(overall.n) ?? 0;217+ {(item) => <article class="rounded-lg border border-warning/25 bg-warning/5 p-3 text-sm text-text-strong">{item.fact}</article>}
216- const submitted = num(overall.n_submitted) ?? 0;218+ </For>
217- return total > 0 ? `%${Math.round((submitted / total) * 100)}` : "—";219+ </div>
218- })()} />220+ </Show>
219- </section>221+ </section>
220- <InsightDetail insight={props.insight} mode="cards" />222+ <div class="rounded-xl border border-border-line bg-surface-base p-4">
223+ <InsightDetail insight={props.insight} mode="cards" />
224+ </div>
225+ </div>
221 </TabsContent>226 </TabsContent>
222 227
223 <TabsContent value="attendance" class="mt-0">228 <TabsContent value="attendance" class="mt-0">
src/i18n/insights-detail.tsmodified+1 -0
@@ -42,6 +42,7 @@ export const insightsDetailTr = {
42 "attendance.coursesEmpty": "Ders bazında devam kaydı yok.",42 "attendance.coursesEmpty": "Ders bazında devam kaydı yok.",
43 43
44 // --- marks -------------------------------------------------------------44 // --- marks -------------------------------------------------------------
45+ "marks.course": "Ders",
45 "marks.courseFallback": "Ders {n}",46 "marks.courseFallback": "Ders {n}",
46 "marks.nMarks": "Not sayısı",47 "marks.nMarks": "Not sayısı",
47 "marks.average": "Ağırlıklı ortalama",48 "marks.average": "Ağırlıklı ortalama",
src/i18n/messages.tsmodified+61 -4
@@ -651,6 +651,16 @@ export type MessageKey =
651 | "aiHub.tab.study"651 | "aiHub.tab.study"
652 | "aiStudio.tab.podcast"652 | "aiStudio.tab.podcast"
653 | "aiStudio.tab.summary"653 | "aiStudio.tab.summary"
654+ | "aiStudio.outputs.title"
655+ | "aiStudio.outputs.description"
656+ | "aiStudio.library.title"
657+ | "aiStudio.library.description"
658+ | "aiStudio.library.count"
659+ | "aiStudio.library.empty"
660+ | "aiStudio.library.emptyHint"
661+ | "aiStudio.library.summary"
662+ | "aiStudio.library.podcastCount"
663+ | "aiStudio.library.open"
654 | "today.titleStudent"664 | "today.titleStudent"
655 | "today.inProgress"665 | "today.inProgress"
656 | "childHomework.title"666 | "childHomework.title"
@@ -1047,6 +1057,15 @@ export type MessageKey =
1047 | "insights.analysis.submittedRate"1057 | "insights.analysis.submittedRate"
1048 | "insights.analysis.submitted"1058 | "insights.analysis.submitted"
1049 | "insights.analysis.missing"1059 | "insights.analysis.missing"
1060+ | "insights.analysis.currentSnapshot"
1061+ | "insights.analysis.courseComparison"
1062+ | "insights.analysis.currentPeriod"
1063+ | "insights.analysis.previousPeriod"
1064+ | "insights.analysis.periodComparison"
1065+ | "insights.analysis.onTime"
1066+ | "insights.analysis.details"
1067+ | "insights.analysis.detailsHint"
1068+ | "insights.analysis.detailsAction"
1050 | "insights.runs"1069 | "insights.runs"
1051 | "insights.runsSubtitle"1070 | "insights.runsSubtitle"
1052 | "insights.runDay"1071 | "insights.runDay"
@@ -2872,6 +2891,16 @@ const en: Dict = {
2872 "aiHub.tab.study": "Study",2891 "aiHub.tab.study": "Study",
2873 "aiStudio.tab.podcast": "Podcast creation",2892 "aiStudio.tab.podcast": "Podcast creation",
2874 "aiStudio.tab.summary": "AI summary",2893 "aiStudio.tab.summary": "AI summary",
2894+ "aiStudio.outputs.title": "Studio outputs",
2895+ "aiStudio.outputs.description": "Select a lesson note and keep its summary and podcast together for quick access.",
2896+ "aiStudio.library.title": "Your generated library",
2897+ "aiStudio.library.description": "Return to notes that already have a summary or podcast, just like a NotebookLM studio.",
2898+ "aiStudio.library.count": "{count} notes",
2899+ "aiStudio.library.empty": "Your generated content will appear here",
2900+ "aiStudio.library.emptyHint": "Create a summary or podcast for a lesson note to add it to this area.",
2901+ "aiStudio.library.summary": "AI summary",
2902+ "aiStudio.library.podcastCount": "{count} podcasts",
2903+ "aiStudio.library.open": "Open note",
2875 "today.titleStudent": "Today's lessons",2904 "today.titleStudent": "Today's lessons",
2876 "today.inProgress": "On now",2905 "today.inProgress": "On now",
2877 "childHomework.title": "Homework",2906 "childHomework.title": "Homework",
@@ -3233,9 +3262,9 @@ const en: Dict = {
3233 "insights.sectionNotComputed": "This section was not computed.",3262 "insights.sectionNotComputed": "This section was not computed.",
3234 "insights.noEvidence": "No supporting data.",3263 "insights.noEvidence": "No supporting data.",
3235 "insights.modules.attendance": "Attendance",3264 "insights.modules.attendance": "Attendance",
3236- "insights.modules.marks": "Marks",3265+ "insights.modules.marks": "Report card",
3237 "insights.modules.study": "Study",3266 "insights.modules.study": "Study",
3238- "insights.modules.submission": "Submissions",3267+ "insights.modules.submission": "Homework",
3239 "insights.attention": "Attention signals",3268 "insights.attention": "Attention signals",
3240 "insights.noAttention": "No attention signal.",3269 "insights.noAttention": "No attention signal.",
3241 "insights.schoolWide": "School-wide",3270 "insights.schoolWide": "School-wide",
@@ -3268,6 +3297,15 @@ const en: Dict = {
3268 "insights.analysis.submittedRate": "Submission rate",3297 "insights.analysis.submittedRate": "Submission rate",
3269 "insights.analysis.submitted": "Submitted",3298 "insights.analysis.submitted": "Submitted",
3270 "insights.analysis.missing": "Missing",3299 "insights.analysis.missing": "Missing",
3300+ "insights.analysis.currentSnapshot": "Current measured distribution",
3301+ "insights.analysis.courseComparison": "Course averages on a 100-point scale",
3302+ "insights.analysis.currentPeriod": "Last 28 days",
3303+ "insights.analysis.previousPeriod": "Previous 28 days",
3304+ "insights.analysis.periodComparison": "Focus time by period (hours)",
3305+ "insights.analysis.onTime": "On time",
3306+ "insights.analysis.details": "What supports this analysis?",
3307+ "insights.analysis.detailsHint": "Explore comparisons, trends and the limits of the available data.",
3308+ "insights.analysis.detailsAction": "Explore",
3271 "insights.runs": "Analysis runs",3309 "insights.runs": "Analysis runs",
3272 "insights.runsSubtitle": "Nightly and manually queued school analyses.",3310 "insights.runsSubtitle": "Nightly and manually queued school analyses.",
3273 "insights.runDay": "Run day",3311 "insights.runDay": "Run day",
@@ -5095,6 +5133,16 @@ const tr: Dict = {
5095 "aiHub.tab.study": "Çalışma",5133 "aiHub.tab.study": "Çalışma",
5096 "aiStudio.tab.podcast": "Podcast oluşturma",5134 "aiStudio.tab.podcast": "Podcast oluşturma",
5097 "aiStudio.tab.summary": "Yapay zekâ özeti",5135 "aiStudio.tab.summary": "Yapay zekâ özeti",
5136+ "aiStudio.outputs.title": "Hazır çıktılar",
5137+ "aiStudio.outputs.description": "Bir ders notu seçin; özetini ve podcast'ini hızlı erişim için aynı alanda üretin.",
5138+ "aiStudio.library.title": "Üretim kitaplığın",
5139+ "aiStudio.library.description": "NotebookLM'deki gibi, özeti veya podcast'i hazır olan notlarına doğrudan dön.",
5140+ "aiStudio.library.count": "{count} not",
5141+ "aiStudio.library.empty": "Ürettiğin içerikler burada görünecek",
5142+ "aiStudio.library.emptyHint": "Bu alana eklemek için bir ders notundan özet veya podcast oluştur.",
5143+ "aiStudio.library.summary": "Yapay zekâ özeti",
5144+ "aiStudio.library.podcastCount": "{count} podcast",
5145+ "aiStudio.library.open": "Nota git",
5098 "today.titleStudent": "Bugünkü derslerin",5146 "today.titleStudent": "Bugünkü derslerin",
5099 "today.inProgress": "Şimdi",5147 "today.inProgress": "Şimdi",
5100 "childHomework.title": "Ödevler",5148 "childHomework.title": "Ödevler",
@@ -5456,9 +5504,9 @@ const tr: Dict = {
5456 "insights.sectionNotComputed": "Bu bölüm hesaplanmadı.",5504 "insights.sectionNotComputed": "Bu bölüm hesaplanmadı.",
5457 "insights.noEvidence": "Destekleyici veri yok.",5505 "insights.noEvidence": "Destekleyici veri yok.",
5458 "insights.modules.attendance": "Yoklama",5506 "insights.modules.attendance": "Yoklama",
5459- "insights.modules.marks": "Notlar",5507+ "insights.modules.marks": "Karne",
5460 "insights.modules.study": "Çalışma",5508 "insights.modules.study": "Çalışma",
5461- "insights.modules.submission": "Teslimler",5509+ "insights.modules.submission": "Ödevler",
5462 "insights.attention": "Dikkat sinyalleri",5510 "insights.attention": "Dikkat sinyalleri",
5463 "insights.noAttention": "Dikkat sinyali yok.",5511 "insights.noAttention": "Dikkat sinyali yok.",
5464 "insights.schoolWide": "Okul geneli",5512 "insights.schoolWide": "Okul geneli",
@@ -5491,6 +5539,15 @@ const tr: Dict = {
5491 "insights.analysis.submittedRate": "Teslim oranı",5539 "insights.analysis.submittedRate": "Teslim oranı",
5492 "insights.analysis.submitted": "Teslim",5540 "insights.analysis.submitted": "Teslim",
5493 "insights.analysis.missing": "Eksik",5541 "insights.analysis.missing": "Eksik",
5542+ "insights.analysis.currentSnapshot": "Güncel ölçüm dağılımı",
5543+ "insights.analysis.courseComparison": "100 puan üzerinden ders ortalamaları",
5544+ "insights.analysis.currentPeriod": "Son 28 gün",
5545+ "insights.analysis.previousPeriod": "Önceki 28 gün",
5546+ "insights.analysis.periodComparison": "Dönemlere göre odak süresi (saat)",
5547+ "insights.analysis.onTime": "Zamanında",
5548+ "insights.analysis.details": "Bu analizin dayanağı ne?",
5549+ "insights.analysis.detailsHint": "Karşılaştırmaları, eğilimleri ve mevcut verinin sınırlarını keşfet.",
5550+ "insights.analysis.detailsAction": "İncele",
5494 "insights.runs": "Analiz çalıştırmaları",5551 "insights.runs": "Analiz çalıştırmaları",
5495 "insights.runsSubtitle": "Gece çalışan ve elle sıraya alınan okul analizleri.",5552 "insights.runsSubtitle": "Gece çalışan ve elle sıraya alınan okul analizleri.",
5496 "insights.runDay": "Çalışma günü",5553 "insights.runDay": "Çalışma günü",
src/pages/ai-insight-student-page.tsxmodified+24 -31
@@ -10,7 +10,7 @@ import { Alert } from "@/components/ui/alert";
10 import { Button } from "@/components/ui/button";10 import { Button } from "@/components/ui/button";
11 import { ErrorAlert } from "@/components/ui/error-alert";11 import { ErrorAlert } from "@/components/ui/error-alert";
12 import { Badge } from "@/components/ui/badge";12 import { Badge } from "@/components/ui/badge";
13-import { IconAlert, IconChart, IconDownload, IconSparkles } from "@/components/ui/icons";13+import { IconDownload, IconSparkles } from "@/components/ui/icons";
14 import { PageSpinner } from "@/components/ui/page-spinner";14 import { PageSpinner } from "@/components/ui/page-spinner";
15 import { createFlash } from "@/lib/flash";15 import { createFlash } from "@/lib/flash";
16 import { loadInsightStudents } from "@/lib/insight-students";16 import { loadInsightStudents } from "@/lib/insight-students";
@@ -110,17 +110,33 @@ function AiInsightStudentContent() {
110 <Show when={!insight.error} fallback={null}>110 <Show when={!insight.error} fallback={null}>
111 <Show when={insight()} fallback={<PageSpinner />}>111 <Show when={insight()} fallback={<PageSpinner />}>
112 {(value) => (112 {(value) => (
113- <div class="space-y-5">113+ <div class="space-y-4">
114- <section class="overflow-hidden rounded-2xl border border-border-line bg-surface-base shadow-xs">114+ <section class="rounded-xl border border-border-line bg-surface-base shadow-xs">
115- <div class="flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6">115+ <div class="flex flex-col gap-4 p-4 sm:flex-row sm:items-center sm:justify-between sm:p-5">
116 <div class="flex min-w-0 items-center gap-4">116 <div class="flex min-w-0 items-center gap-4">
117- <div class="flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-primary text-lg font-semibold text-primary-foreground shadow-xs">117+ <div class="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-primary text-base font-semibold text-primary-foreground shadow-xs">
118 {initials()}118 {initials()}
119 </div>119 </div>
120 <div class="min-w-0">120 <div class="min-w-0">
121 <p class="text-xs font-semibold uppercase tracking-[0.14em] text-primary-text">{t("insights.title")}</p>121 <p class="text-xs font-semibold uppercase tracking-[0.14em] text-primary-text">{t("insights.title")}</p>
122- <h1 class="mt-1 truncate text-2xl font-semibold tracking-tight text-text-strong">{studentName()}</h1>122+ <div class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1">
123- <p class="mt-1 text-sm text-muted-foreground">{t("insights.studentAnalysis")}</p>123+ <h1 class="truncate text-2xl font-semibold tracking-tight text-text-strong">{studentName()}</h1>
124+ <Show
125+ when={value().summary}
126+ fallback={<span class="text-xs text-muted-foreground">{t("insights.noSummary")}</span>}
127+ >
128+ {(summary) => (
129+ <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
130+ <span class="font-mono tabular-nums">{numericDate(summary().computed_at)}</span>
131+ <span aria-hidden="true">·</span>
132+ <Badge variant={confidenceVariant(summary().confidence)} class="rounded-full">
133+ {confidenceLabel(summary().confidence)}
134+ </Badge>
135+ </div>
136+ )}
137+ </Show>
138+ </div>
139+ <p class="mt-0.5 text-sm text-muted-foreground">{t("insights.studentAnalysis")}</p>
124 </div>140 </div>
125 </div>141 </div>
126 <div class="flex flex-wrap items-center gap-2">142 <div class="flex flex-wrap items-center gap-2">
@@ -136,32 +152,9 @@ function AiInsightStudentContent() {
136 </Show>152 </Show>
137 </div>153 </div>
138 </div>154 </div>
139- <div class="grid border-t border-border-line sm:grid-cols-4">
140- <div class="border-border-line px-5 py-3 sm:border-r">
141- <p class="text-xs text-muted-foreground">{t("insights.computedAt")}</p>
142- <p class="mono mt-1 text-sm font-semibold text-text-strong">{numericDate(value().summary?.computed_at)}</p>
143- </div>
144- <div class="border-border-line px-5 py-3 sm:border-r">
145- <p class="text-xs text-muted-foreground">{t("insights.confidence")}</p>
146- <Show
147- when={value().summary}
148- fallback={<span class="mt-1 block text-sm text-muted-foreground">—</span>}
149- >
150- {(summary) => <Badge variant={confidenceVariant(summary().confidence)} class="mt-1 rounded-full">{confidenceLabel(summary().confidence)}</Badge>}
151- </Show>
152- </div>
153- <div class="border-border-line px-5 py-3 sm:border-r">
154- <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconAlert class="h-3.5 w-3.5" />{t("insights.attention")}</p>
155- <p class="mono mt-1 text-lg font-semibold text-text-strong">{value().attention.length}</p>
156- </div>
157- <div class="px-5 py-3">
158- <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconChart class="h-3.5 w-3.5" />{t("insights.recommendations")}</p>
159- <p class="mono mt-1 text-lg font-semibold text-text-strong">{value().cards.length}</p>
160- </div>
161- </div>
162 </section>155 </section>
163 156
164- <section class="data-shell p-5">157+ <section class="data-shell p-4 sm:p-5">
165 <InsightStudentAnalysisTabs insight={value()} />158 <InsightStudentAnalysisTabs insight={value()} />
166 </section>159 </section>
167 </div>160 </div>