✨ teacher question generator, live nav for pending approvals and analysis
Browse files at this commitf42459e3fb092d9852abfd595494e7efd1d023a7Parent: 078b459- feat
- ✨ teacher question generator, live nav for pending approvals and analysis
12 changed files +479 -28
- src/components/exams/bank-question-form.tsx +4 -1
- src/components/layout/command-palette.tsx +1 -1
- src/components/layout/mobile-nav-sheet.tsx +3 -2
- src/components/layout/nav-items.test.ts +14 -6
- src/components/layout/nav-items.ts +29 -9
- src/components/layout/side-nav.tsx +4 -3
- src/components/question-generation/generated-question-card.tsx +61 -0
- src/lib/__tests__/question-generation.test.ts +21 -0
- src/lib/question-generation.ts +73 -0
- src/pages/coming-soon-page.tsx +0 -3
- src/pages/question-generation-page.tsx +261 -0
- src/routes/router.tsx +8 -3
src/components/exams/bank-question-form.tsxmodified+4 -1
| @@ -24,6 +24,8 @@ import { useT } from "@/stores/preferences-context"; | |||
| 24 | */ | 24 | */ |
| 25 | export function BankQuestionForm(props: { | 25 | export function BankQuestionForm(props: { |
| 26 | initial?: BankQuestion; | 26 | initial?: BankQuestion; |
| 27 | + /** A new template started from generated text, filed under this course. */ | ||
| 28 | + draft?: { courseId: string; text: string }; | ||
| 27 | courses: Course[]; | 29 | courses: Course[]; |
| 28 | onSaved: (question: BankQuestion) => void; | 30 | onSaved: (question: BankQuestion) => void; |
| 29 | onCancel: () => void; | 31 | onCancel: () => void; |
| @@ -34,7 +36,7 @@ export function BankQuestionForm(props: { | |||
| 34 | () => props.initial?.subject ?? null, | 36 | () => props.initial?.subject ?? null, |
| 35 | async (subjectId) => (await getSubjectById(subjectId).catch(() => null))?.course ?? "", | 37 | async (subjectId) => (await getSubjectById(subjectId).catch(() => null))?.course ?? "", |
| 36 | ); | 38 | ); |
| 37 | - const [courseId, setCourseId] = createSignal(""); | 39 | + const [courseId, setCourseId] = createSignal(props.draft?.courseId ?? ""); |
| 38 | // Editing keeps the template's own course even when it is not one of ours (it is | 40 | // Editing keeps the template's own course even when it is not one of ours (it is |
| 39 | // shown as a disabled option); only a new template falls back to the first course. | 41 | // shown as a disabled option); only a new template falls back to the first course. |
| 40 | const selectedCourse = () => | 42 | const selectedCourse = () => |
| @@ -126,6 +128,7 @@ export function BankQuestionForm(props: { | |||
| 126 | 128 | ||
| 127 | <QuestionForm | 129 | <QuestionForm |
| 128 | initial={props.initial} | 130 | initial={props.initial} |
| 131 | + draft={props.draft ? { text: props.draft.text, kind: "text" } : undefined} | ||
| 129 | subjects={subjects() ?? []} | 132 | subjects={subjects() ?? []} |
| 130 | subjectsPending={initialCourse.loading || subjects.loading} | 133 | subjectsPending={initialCourse.loading || subjects.loading} |
| 131 | imageSrc={props.initial?.image ? `${imageBase()}/image` : undefined} | 134 | imageSrc={props.initial?.image ? `${imageBase()}/image` : undefined} |
src/components/layout/command-palette.tsxmodified+1 -1
| @@ -240,7 +240,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 240 | description: groupName, | 240 | description: groupName, |
| 241 | keywords: `${item.to} ${t(item.labelKey)} ${groupName}`, | 241 | keywords: `${item.to} ${t(item.labelKey)} ${groupName}`, |
| 242 | icon: item.Icon, | 242 | icon: item.Icon, |
| 243 | - onSelect: () => void navigate({ to: item.to }), | 243 | + onSelect: () => void navigate({ to: item.to, search: item.search as never }), |
| 244 | }); | 244 | }); |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
src/components/layout/mobile-nav-sheet.tsxmodified+3 -2
| @@ -35,11 +35,12 @@ export function MobileNavSheet(props: { | |||
| 35 | const feed = useShellFeed(); | 35 | const feed = useShellFeed(); |
| 36 | const modules = useModules(); | 36 | const modules = useModules(); |
| 37 | const pathname = useRouterState({ select: (state) => state.location.pathname }); | 37 | const pathname = useRouterState({ select: (state) => state.location.pathname }); |
| 38 | + const search = useRouterState({ select: (state) => state.location.search as Record<string, unknown> }); | ||
| 38 | 39 | ||
| 39 | // The primary destinations are already one tap away in the tab bar, so the | 40 | // The primary destinations are already one tap away in the tab bar, so the |
| 40 | // sheet lists everything else. | 41 | // sheet lists everything else. |
| 41 | const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); | 42 | const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); |
| 42 | - const current = () => routeNavItem(pathname(), auth.user()?.role); | 43 | + const current = () => routeNavItem(pathname(), auth.user()?.role, search()); |
| 43 | const badgeFor = (item: NavItem) => (item.id === "messages" ? feed.unreadMessages().total : 0); | 44 | const badgeFor = (item: NavItem) => (item.id === "messages" ? feed.unreadMessages().total : 0); |
| 44 | const runAction = (item: NavItem) => { | 45 | const runAction = (item: NavItem) => { |
| 45 | props.onClose(); | 46 | props.onClose(); |
| @@ -218,7 +219,7 @@ export function MobileNavSheet(props: { | |||
| 218 | </button> | 219 | </button> |
| 219 | } | 220 | } |
| 220 | > | 221 | > |
| 221 | - <Link to={item.to} onClick={props.onClose} aria-current={active() ? "page" : undefined} class={rowClass()}> | 222 | + <Link to={item.to} search={item.search as never} onClick={props.onClose} aria-current={active() ? "page" : undefined} class={rowClass()}> |
| 222 | {content} | 223 | {content} |
| 223 | </Link> | 224 | </Link> |
| 224 | </Show> | 225 | </Show> |
src/components/layout/nav-items.test.tsmodified+14 -6
| @@ -54,19 +54,18 @@ test("manager sees the same admin tree minus the admin-only entries", () => { | |||
| 54 | expect(ids).not.toContain("data-protection"); | 54 | expect(ids).not.toContain("data-protection"); |
| 55 | }); | 55 | }); |
| 56 | 56 | ||
| 57 | -test("teacher's sidebar splits into short labelled sections with the soon shelf last", () => { | 57 | +test("teacher's sidebar splits into short labelled sections, every entry live", () => { |
| 58 | expect( | 58 | expect( |
| 59 | visibleNavGroups("teacher").map((group) => ({ | 59 | visibleNavGroups("teacher").map((group) => ({ |
| 60 | id: group.id, | 60 | id: group.id, |
| 61 | items: group.items.map((item) => item.id), | 61 | items: group.items.map((item) => item.id), |
| 62 | })), | 62 | })), |
| 63 | ).toEqual([ | 63 | ).toEqual([ |
| 64 | - { id: "ai", items: ["ai-studio", "ai-study", "ai-insights", "ai-celebi"] }, | 64 | + { id: "ai", items: ["ai-studio", "ai-study", "ai-celebi"] }, |
| 65 | { id: "my-classroom", items: ["my-classes", "my-schedule", "courses"] }, | 65 | { id: "my-classroom", items: ["my-classes", "my-schedule", "courses"] }, |
| 66 | - { id: "tracking", items: ["student-attendance", "student-marks", "student-pomodoros"] }, | 66 | + { id: "tracking", items: ["student-attendance", "student-marks", "student-pomodoros", "student-analysis"] }, |
| 67 | - { id: "teaching", items: ["homework", "exams", "question-bank", "questions", "notes", "whiteboards"] }, | 67 | + { id: "teaching", items: ["homework", "exams", "question-bank", "question-generation", "questions", "pending-approvals", "notes", "whiteboards"] }, |
| 68 | { id: "other", items: ["parent-communication", "appointments", "events", "meals", "work", "settings-teacher"] }, | 68 | { id: "other", items: ["parent-communication", "appointments", "events", "meals", "work", "settings-teacher"] }, |
| 69 | - { id: "soon", items: ["student-analysis", "pending-approvals", "question-generation"] }, | ||
| 70 | ]); | 69 | ]); |
| 71 | }); | 70 | }); |
| 72 | 71 | ||
| @@ -152,7 +151,10 @@ test("entries with no backend yet are flagged soon and route to the shared place | |||
| 152 | }); | 151 | }); |
| 153 | 152 | ||
| 154 | test("the AI group exposes four separate module routes", () => { | 153 | test("the AI group exposes four separate module routes", () => { |
| 155 | - for (const role of ["student", "teacher", "manager", "admin"] as const) { | 154 | + // A teacher reaches the analysis board as "Öğrenci analizi" under Tracking. |
| 155 | + expect(visibleNavGroups("teacher").find((group) => group.id === "ai")?.items.map((item) => item.id)).toEqual(["ai-studio", "ai-study", "ai-celebi"]); | ||
| 156 | + expect(routeNavItem("/ai/insights", "teacher")?.id).toBe("student-analysis"); | ||
| 157 | + for (const role of ["student", "manager", "admin"] as const) { | ||
| 156 | const ai = visibleNavGroups(role).find((group) => group.id === "ai"); | 158 | const ai = visibleNavGroups(role).find((group) => group.id === "ai"); |
| 157 | expect(ai?.items.map((item) => item.id)).toEqual(["ai-studio", "ai-study", "ai-insights", "ai-celebi"]); | 159 | expect(ai?.items.map((item) => item.id)).toEqual(["ai-studio", "ai-study", "ai-insights", "ai-celebi"]); |
| 158 | expect(ai?.items.every((item) => !item.soon)).toBe(true); | 160 | expect(ai?.items.every((item) => !item.soon)).toBe(true); |
| @@ -252,3 +254,9 @@ test("module gate hides nests the school did not buy", () => { | |||
| 252 | test("ungated entries never drop on module filtering", () => { | 254 | test("ungated entries never drop on module filtering", () => { |
| 253 | expect(moduleVisible({ id: "x", to: "/calendar", labelKey: "nav.calendar", Icon: (() => null) as never }, [])).toBe(true); | 255 | expect(moduleVisible({ id: "x", to: "/calendar", labelKey: "nav.calendar", Icon: (() => null) as never }, [])).toBe(true); |
| 254 | }); | 256 | }); |
| 257 | + | ||
| 258 | +test("a search-carrying entry wins over the plain entry for the same path", () => { | ||
| 259 | + expect(routeNavItem("/questions", "teacher", { status: "pending" })?.id).toBe("pending-approvals"); | ||
| 260 | + expect(routeNavItem("/questions", "teacher", { status: "approved" })?.id).toBe("questions"); | ||
| 261 | + expect(routeNavItem("/questions", "teacher")?.id).toBe("questions"); | ||
| 262 | +}); | ||
src/components/layout/nav-items.tsmodified+29 -9
| @@ -48,6 +48,12 @@ export type NavItem = { | |||
| 48 | maxRole?: Role; | 48 | maxRole?: Role; |
| 49 | exactRole?: Role; | 49 | exactRole?: Role; |
| 50 | exact?: boolean; | 50 | exact?: boolean; |
| 51 | + /** | ||
| 52 | + * Search params the entry links with (`/questions?status=pending`). It is | ||
| 53 | + * active only while the URL carries them, and then wins over a plain entry | ||
| 54 | + * for the same path. | ||
| 55 | + */ | ||
| 56 | + search?: Record<string, string>; | ||
| 51 | /** Backend module nest behind this entry; hidden when the school did not buy it. */ | 57 | /** Backend module nest behind this entry; hidden when the school did not buy it. */ |
| 52 | module?: string; | 58 | module?: string; |
| 53 | /** No backend yet — routes to the shared placeholder and carries a "yakında" badge. */ | 59 | /** No backend yet — routes to the shared placeholder and carries a "yakında" badge. */ |
| @@ -112,6 +118,15 @@ const AI_GROUP: NavGroup = { | |||
| 112 | items: [AI_STUDIO_ITEM, AI_STUDY_ITEM, AI_INSIGHTS_ITEM, AI_CELEBI_ITEM], | 118 | items: [AI_STUDIO_ITEM, AI_STUDY_ITEM, AI_INSIGHTS_ITEM, AI_CELEBI_ITEM], |
| 113 | }; | 119 | }; |
| 114 | 120 | ||
| 121 | +// A teacher's student analysis is the same board, listed under Tracking as | ||
| 122 | +// "Öğrenci analizi" — so their AI group leaves it out instead of listing it twice. | ||
| 123 | +const TEACHER_AI_GROUP: NavGroup = { | ||
| 124 | + id: "ai", | ||
| 125 | + labelKey: "nav.group.ai", | ||
| 126 | + Icon: IconSparkles, | ||
| 127 | + items: [AI_STUDIO_ITEM, AI_STUDY_ITEM, AI_CELEBI_ITEM], | ||
| 128 | +}; | ||
| 129 | + | ||
| 115 | const PARENT_AI_GROUP: NavGroup = { | 130 | const PARENT_AI_GROUP: NavGroup = { |
| 116 | id: "ai", | 131 | id: "ai", |
| 117 | labelKey: "nav.group.ai", | 132 | labelKey: "nav.group.ai", |
| @@ -204,7 +219,7 @@ const ADMIN_GROUPS: NavGroup[] = [ | |||
| 204 | ]; | 219 | ]; |
| 205 | 220 | ||
| 206 | const TEACHER_GROUPS: NavGroup[] = [ | 221 | const TEACHER_GROUPS: NavGroup[] = [ |
| 207 | - AI_GROUP, | 222 | + TEACHER_AI_GROUP, |
| 208 | { | 223 | { |
| 209 | id: "my-classroom", | 224 | id: "my-classroom", |
| 210 | labelKey: "nav.group.myClassroom", | 225 | labelKey: "nav.group.myClassroom", |
| @@ -223,6 +238,7 @@ const TEACHER_GROUPS: NavGroup[] = [ | |||
| 223 | { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, module: "attendance" }, | 238 | { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, module: "attendance" }, |
| 224 | { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, module: "marks" }, | 239 | { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, module: "marks" }, |
| 225 | { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconTimer, module: "pomodoro" }, | 240 | { id: "student-pomodoros", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconTimer, module: "pomodoro" }, |
| 241 | + { id: "student-analysis", to: "/ai/insights", labelKey: "nav.studentAnalysis", Icon: IconChart }, | ||
| 226 | ], | 242 | ], |
| 227 | }, | 243 | }, |
| 228 | { | 244 | { |
| @@ -233,7 +249,11 @@ const TEACHER_GROUPS: NavGroup[] = [ | |||
| 233 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework, module: "homework" }, | 249 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework, module: "homework" }, |
| 234 | { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, module: "exams" }, | 250 | { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, module: "exams" }, |
| 235 | { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, module: "bank_questions" }, | 251 | { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, module: "bank_questions" }, |
| 252 | + { id: "question-generation", to: "/ai/question-generation", labelKey: "nav.questionGeneration", Icon: IconSparkles }, | ||
| 236 | { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" }, | 253 | { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" }, |
| 254 | + // The pool's own pending tab: for a teacher, `?status=pending` is the | ||
| 255 | + // approval queue (`POST /questions/{id}/approve`). | ||
| 256 | + { id: "pending-approvals", to: "/questions", search: { status: "pending" }, labelKey: "nav.pendingApprovals", Icon: IconClipboardCheck, module: "questions" }, | ||
| 237 | { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" }, | 257 | { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" }, |
| 238 | { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" }, | 258 | { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" }, |
| 239 | ], | 259 | ], |
| @@ -251,11 +271,6 @@ const TEACHER_GROUPS: NavGroup[] = [ | |||
| 251 | settingsAction("settings-teacher"), | 271 | settingsAction("settings-teacher"), |
| 252 | ], | 272 | ], |
| 253 | }, | 273 | }, |
| 254 | - soonGroup([ | ||
| 255 | - { id: "student-analysis", to: "/coming-soon/ogrenci-analizi", labelKey: "nav.studentAnalysis", Icon: IconChart, soon: true }, | ||
| 256 | - { id: "pending-approvals", to: "/coming-soon/bekleyen-onaylar", labelKey: "nav.pendingApprovals", Icon: IconHelpCircle, soon: true }, | ||
| 257 | - { id: "question-generation", to: "/coming-soon/soru-uretimi", labelKey: "nav.questionGeneration", Icon: IconEdit, soon: true }, | ||
| 258 | - ]), | ||
| 259 | ]; | 274 | ]; |
| 260 | 275 | ||
| 261 | const STUDENT_GROUPS: NavGroup[] = [ | 276 | const STUDENT_GROUPS: NavGroup[] = [ |
| @@ -408,10 +423,15 @@ export function primaryPathActive(pathname: string, item: NavItem) { | |||
| 408 | return pathActive(pathname, item.to, item.exact); | 423 | return pathActive(pathname, item.to, item.exact); |
| 409 | } | 424 | } |
| 410 | 425 | ||
| 411 | -export function routeNavItem(pathname: string, role: Role | undefined): NavItem | undefined { | 426 | +function searchMatches(item: NavItem, search: Record<string, unknown> | undefined) { |
| 427 | + if (!item.search) return true; | ||
| 428 | + return Object.entries(item.search).every(([key, value]) => search?.[key] === value); | ||
| 429 | +} | ||
| 430 | + | ||
| 431 | +export function routeNavItem(pathname: string, role: Role | undefined, search?: Record<string, unknown>): NavItem | undefined { | ||
| 412 | return [...primaryNavItems(role), ...visibleNavItems(role)] | 432 | return [...primaryNavItems(role), ...visibleNavItems(role)] |
| 413 | - .filter((item) => pathActive(pathname, item.to, item.exact)) | 433 | + .filter((item) => pathActive(pathname, item.to, item.exact) && searchMatches(item, search)) |
| 414 | - .sort((a, b) => b.to.length - a.to.length)[0]; | 434 | + .sort((a, b) => b.to.length - a.to.length || Number(!!b.search) - Number(!!a.search))[0]; |
| 415 | } | 435 | } |
| 416 | 436 | ||
| 417 | // Routes that are reachable but carry no sidebar entry — the account menu, a | 437 | // Routes that are reachable but carry no sidebar entry — the account menu, a |
src/components/layout/side-nav.tsxmodified+4 -3
| @@ -32,10 +32,11 @@ export function SideNav(props: { | |||
| 32 | const modules = useModules(); | 32 | const modules = useModules(); |
| 33 | const navigate = useNavigate(); | 33 | const navigate = useNavigate(); |
| 34 | const pathname = useRouterState({ select: (state) => state.location.pathname }); | 34 | const pathname = useRouterState({ select: (state) => state.location.pathname }); |
| 35 | + const search = useRouterState({ select: (state) => state.location.search as Record<string, unknown> }); | ||
| 35 | 36 | ||
| 36 | const home = () => (auth.user() ? [HOME_ITEM] : []); | 37 | const home = () => (auth.user() ? [HOME_ITEM] : []); |
| 37 | const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); | 38 | const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); |
| 38 | - const current = () => routeNavItem(pathname(), auth.user()?.role); | 39 | + const current = () => routeNavItem(pathname(), auth.user()?.role, search()); |
| 39 | const unread = () => feed.unreadMessages().total; | 40 | const unread = () => feed.unreadMessages().total; |
| 40 | const badgeFor = (item: NavItem) => (item.id === "messages" ? unread() : 0); | 41 | const badgeFor = (item: NavItem) => (item.id === "messages" ? unread() : 0); |
| 41 | 42 | ||
| @@ -143,7 +144,7 @@ export function SideNav(props: { | |||
| 143 | </button> | 144 | </button> |
| 144 | } | 145 | } |
| 145 | > | 146 | > |
| 146 | - <Link to={item.to} onClick={() => props.onNavigate?.()} title={t(item.labelKey)} aria-current={itemActive() ? "page" : undefined} class={linkClass()}> | 147 | + <Link to={item.to} search={item.search as never} onClick={() => props.onNavigate?.()} title={t(item.labelKey)} aria-current={itemActive() ? "page" : undefined} class={linkClass()}> |
| 147 | {content} | 148 | {content} |
| 148 | </Link> | 149 | </Link> |
| 149 | </Show> | 150 | </Show> |
| @@ -204,7 +205,7 @@ export function SideNav(props: { | |||
| 204 | return; | 205 | return; |
| 205 | } | 206 | } |
| 206 | props.onNavigate?.(); | 207 | props.onNavigate?.(); |
| 207 | - void navigate({ to: item.to }); | 208 | + void navigate({ to: item.to, search: item.search as never }); |
| 208 | }} | 209 | }} |
| 209 | > | 210 | > |
| 210 | <item.Icon class="h-4 w-4 shrink-0" /> | 211 | <item.Icon class="h-4 w-4 shrink-0" /> |
src/components/question-generation/generated-question-card.tsxadded+61 -0
| @@ -0,0 +1,61 @@ | |||
| 1 | +import { Show, createSignal } from "solid-js"; | ||
| 2 | +import { Button } from "@/components/ui/button"; | ||
| 3 | +import { IconCheck, IconCopy, IconPlus } from "@/components/ui/icons"; | ||
| 4 | +import { useT } from "@/stores/preferences-context"; | ||
| 5 | + | ||
| 6 | +/** One AI-generated practice question with its range-bounded answer. */ | ||
| 7 | +export function GeneratedQuestionCard(props: { | ||
| 8 | + index: number; | ||
| 9 | + question: string; | ||
| 10 | + answer: string; | ||
| 11 | + /** Absent when the school has no question bank. */ | ||
| 12 | + onAddToBank?: () => void; | ||
| 13 | +}) { | ||
| 14 | + const t = useT(); | ||
| 15 | + const [open, setOpen] = createSignal(false); | ||
| 16 | + const [copied, setCopied] = createSignal(false); | ||
| 17 | + const copy = async () => { | ||
| 18 | + try { | ||
| 19 | + await navigator.clipboard.writeText(`${props.question}\n\n${props.answer}`); | ||
| 20 | + setCopied(true); | ||
| 21 | + window.setTimeout(() => setCopied(false), 1500); | ||
| 22 | + } catch { | ||
| 23 | + // Clipboard can be blocked (insecure origin, permissions); nothing to undo. | ||
| 24 | + } | ||
| 25 | + }; | ||
| 26 | + | ||
| 27 | + return ( | ||
| 28 | + <li class="rounded-xl border border-border-line bg-surface-base p-4 shadow-xs"> | ||
| 29 | + <div class="flex gap-3"> | ||
| 30 | + <span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-xs font-semibold tabular-nums text-primary-text"> | ||
| 31 | + {props.index + 1} | ||
| 32 | + </span> | ||
| 33 | + <div class="min-w-0 flex-1 space-y-3"> | ||
| 34 | + <p class="whitespace-pre-wrap text-sm leading-6 text-text-strong">{props.question}</p> | ||
| 35 | + <Show when={open()}> | ||
| 36 | + <div class="rounded-lg border border-border-hairline bg-surface-tint px-3 py-2.5 text-sm leading-6 text-text-default"> | ||
| 37 | + <p class="whitespace-pre-wrap">{props.answer}</p> | ||
| 38 | + </div> | ||
| 39 | + </Show> | ||
| 40 | + <div class="flex flex-wrap items-center gap-2"> | ||
| 41 | + <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg" aria-expanded={open()} onClick={() => setOpen((value) => !value)}> | ||
| 42 | + {open() ? t("qgen.hideAnswer") : t("qgen.showAnswer")} | ||
| 43 | + </Button> | ||
| 44 | + <Button type="button" size="sm" variant="ghost" class="h-8 rounded-lg" onClick={() => void copy()}> | ||
| 45 | + <Show when={copied()} fallback={<IconCopy class="h-3.5 w-3.5" />}> | ||
| 46 | + <IconCheck class="h-3.5 w-3.5" /> | ||
| 47 | + </Show> | ||
| 48 | + {copied() ? t("qgen.copied") : t("qgen.copy")} | ||
| 49 | + </Button> | ||
| 50 | + <Show when={props.onAddToBank}> | ||
| 51 | + <Button type="button" size="sm" variant="ghost" class="ml-auto h-8 rounded-lg" onClick={() => props.onAddToBank?.()}> | ||
| 52 | + <IconPlus class="h-3.5 w-3.5" /> | ||
| 53 | + {t("qgen.addToBank")} | ||
| 54 | + </Button> | ||
| 55 | + </Show> | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + </li> | ||
| 60 | + ); | ||
| 61 | +} | ||
src/lib/__tests__/question-generation.test.tsadded+21 -0
| @@ -0,0 +1,21 @@ | |||
| 1 | +import { MAX_PAGES, parsePages } from "@/lib/question-generation"; | ||
| 2 | + | ||
| 3 | +describe("parsePages", () => { | ||
| 4 | + it("expands ranges and single pages, sorted and de-duplicated", () => { | ||
| 5 | + expect(parsePages("3-5, 10, 4")).toEqual([3, 4, 5, 10]); | ||
| 6 | + expect(parsePages(" 7 ")).toEqual([7]); | ||
| 7 | + }); | ||
| 8 | + | ||
| 9 | + it("refuses anything that is not a page list", () => { | ||
| 10 | + expect(parsePages("")).toBeNull(); | ||
| 11 | + expect(parsePages("abc")).toBeNull(); | ||
| 12 | + expect(parsePages("5-3")).toBeNull(); | ||
| 13 | + expect(parsePages("0")).toBeNull(); | ||
| 14 | + expect(parsePages("2,,x")).toBeNull(); | ||
| 15 | + }); | ||
| 16 | + | ||
| 17 | + it("refuses more pages than one request may name", () => { | ||
| 18 | + expect(parsePages(`1-${MAX_PAGES}`)).toHaveLength(MAX_PAGES); | ||
| 19 | + expect(parsePages(`1-${MAX_PAGES + 1}`)).toBeNull(); | ||
| 20 | + }); | ||
| 21 | +}); | ||
src/lib/question-generation.tsadded+73 -0
| @@ -0,0 +1,73 @@ | |||
| 1 | +import { getClasses } from "@/api/classes"; | ||
| 2 | +import type { ClassGroup, Course } from "@/api/client"; | ||
| 3 | +import { getCourseById } from "@/api/courses"; | ||
| 4 | +import { getMyInstances } from "@/api/instances"; | ||
| 5 | +import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; | ||
| 6 | + | ||
| 7 | +/** Pages one request may name; a wider range is almost always a typo. */ | ||
| 8 | +export const MAX_PAGES = 200; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * "3-7, 10" → [3, 4, 5, 6, 7, 10]. Null for anything that is not a list of | ||
| 12 | + * positive page numbers and ascending ranges, or that names more than | ||
| 13 | + * MAX_PAGES pages — the form says so instead of sending a guess. | ||
| 14 | + */ | ||
| 15 | +export function parsePages(input: string): number[] | null { | ||
| 16 | + const parts = input.split(",").map((part) => part.trim()).filter(Boolean); | ||
| 17 | + if (parts.length === 0) return null; | ||
| 18 | + const pages = new Set<number>(); | ||
| 19 | + for (const part of parts) { | ||
| 20 | + const range = /^(\d+)\s*-\s*(\d+)$/.exec(part); | ||
| 21 | + if (range) { | ||
| 22 | + const from = Number(range[1]); | ||
| 23 | + const to = Number(range[2]); | ||
| 24 | + if (from < 1 || to < from || to - from + 1 > MAX_PAGES) return null; | ||
| 25 | + for (let page = from; page <= to; page += 1) pages.add(page); | ||
| 26 | + } else if (/^\d+$/.test(part) && Number(part) >= 1) { | ||
| 27 | + pages.add(Number(part)); | ||
| 28 | + } else { | ||
| 29 | + return null; | ||
| 30 | + } | ||
| 31 | + if (pages.size > MAX_PAGES) return null; | ||
| 32 | + } | ||
| 33 | + return [...pages].sort((a, b) => a - b); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +/** One `(sinif, ders)` pair a teacher may generate over, with the catalog course behind it. */ | ||
| 37 | +export type StudyScopeOption = { | ||
| 38 | + key: string; | ||
| 39 | + ders: string; | ||
| 40 | + /** The şube grade; null for a school-wide club/etüt corpus. */ | ||
| 41 | + sinif: string | null; | ||
| 42 | + course: Course; | ||
| 43 | + label: string; | ||
| 44 | +}; | ||
| 45 | + | ||
| 46 | +/** | ||
| 47 | + * The backend derives a caller's RAG scope from their own sections' instances | ||
| 48 | + * — `ders` is the catalog course, `sinif` the şube's grade — and refuses any | ||
| 49 | + * other pair, so the picker offers exactly those. Several şubeler of the same | ||
| 50 | + * grade and course collapse into one pair. | ||
| 51 | + */ | ||
| 52 | +export async function loadStudyScopes(): Promise<StudyScopeOption[]> { | ||
| 53 | + const [instances, classes] = await Promise.all([ | ||
| 54 | + getMyInstances({ limit: 200 }), | ||
| 55 | + getClasses({ limit: 200 }).catch(() => ({ items: [] as ClassGroup[] })), | ||
| 56 | + ]); | ||
| 57 | + const gradeOf = new Map(classes.items.map((klass) => [klass.id, klass.grade])); | ||
| 58 | + const courseIds = [...new Set(instances.items.map((instance) => instance.course))]; | ||
| 59 | + const courses = await mapConcurrent(courseIds, FAN_OUT_LIMIT, (id) => getCourseById(id).catch(() => null)); | ||
| 60 | + const courseById = new Map(courses.filter((course): course is Course => course !== null).map((course) => [course.id, course])); | ||
| 61 | + | ||
| 62 | + const options = new Map<string, StudyScopeOption>(); | ||
| 63 | + for (const instance of instances.items) { | ||
| 64 | + const course = courseById.get(instance.course); | ||
| 65 | + if (!course) continue; | ||
| 66 | + const sinif = course.kind === "course" ? gradeOf.get(instance.class)?.trim() || null : null; | ||
| 67 | + const key = `${course.title}\u0000${sinif ?? ""}`; | ||
| 68 | + if (!options.has(key)) { | ||
| 69 | + options.set(key, { key, ders: course.title, sinif, course, label: sinif ? `${course.title} · ${sinif}` : course.title }); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + return [...options.values()].sort((a, b) => a.label.localeCompare(b.label, "tr")); | ||
| 73 | +} | ||
src/pages/coming-soon-page.tsxmodified+0 -3
| @@ -17,9 +17,6 @@ const COMING_SOON_LABELS: Record<string, MessageKey> = { | |||
| 17 | "optik-okuma": "nav.opticalReading", | 17 | "optik-okuma": "nav.opticalReading", |
| 18 | raporlar: "nav.reports", | 18 | raporlar: "nav.reports", |
| 19 | "kvkk-denetim": "nav.dataProtection", | 19 | "kvkk-denetim": "nav.dataProtection", |
| 20 | - "ogrenci-analizi": "nav.studentAnalysis", | ||
| 21 | - "bekleyen-onaylar": "nav.pendingApprovals", | ||
| 22 | - "soru-uretimi": "nav.questionGeneration", | ||
| 23 | "calisma-programim": "nav.studyPlan", | 20 | "calisma-programim": "nav.studyPlan", |
| 24 | }; | 21 | }; |
| 25 | 22 | ||
src/pages/question-generation-page.tsxadded+261 -0
| @@ -0,0 +1,261 @@ | |||
| 1 | +import { For, Match, Show, Switch, createMemo, createSignal } from "solid-js"; | ||
| 2 | +import { createResource } from "@/lib/create-resource"; | ||
| 3 | +import { ApiError, formatApiError, type RagQuestionSet } from "@/api/client"; | ||
| 4 | +import { postRagQuestions } from "@/api/rag"; | ||
| 5 | +import { BankQuestionForm } from "@/components/exams/bank-question-form"; | ||
| 6 | +import { PageHeader } from "@/components/layout/page-header"; | ||
| 7 | +import { RouteGuard } from "@/components/layout/route-guard"; | ||
| 8 | +import { GeneratedQuestionCard } from "@/components/question-generation/generated-question-card"; | ||
| 9 | +import { ragCopy } from "@/components/rag/rag-copy"; | ||
| 10 | +import { Alert } from "@/components/ui/alert"; | ||
| 11 | +import { Button } from "@/components/ui/button"; | ||
| 12 | +import { EmptyInline } from "@/components/ui/empty-inline"; | ||
| 13 | +import { IconSparkles } from "@/components/ui/icons"; | ||
| 14 | +import { Input } from "@/components/ui/input"; | ||
| 15 | +import { Label } from "@/components/ui/label"; | ||
| 16 | +import { SearchableSelect } from "@/components/ui/searchable-select"; | ||
| 17 | +import { SidePanel } from "@/components/ui/side-panel"; | ||
| 18 | +import { Textarea } from "@/components/ui/textarea"; | ||
| 19 | +import { createFlash } from "@/lib/flash"; | ||
| 20 | +import { cn } from "@/lib/cn"; | ||
| 21 | +import { loadStudyScopes, parsePages } from "@/lib/question-generation"; | ||
| 22 | +import { useModules } from "@/stores/modules-context"; | ||
| 23 | +import { usePreferences, useT } from "@/stores/preferences-context"; | ||
| 24 | + | ||
| 25 | +export default function QuestionGenerationPage() { | ||
| 26 | + return ( | ||
| 27 | + <RouteGuard minRole="teacher"> | ||
| 28 | + <QuestionGenerationContent /> | ||
| 29 | + </RouteGuard> | ||
| 30 | + ); | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +/** The service's own difficulty vocabulary; the backend defaults to `orta`. */ | ||
| 34 | +const DIFFICULTIES = ["kolay", "orta", "zor"] as const; | ||
| 35 | +type Difficulty = (typeof DIFFICULTIES)[number]; | ||
| 36 | +/** The door holds `n` to 1..=20. */ | ||
| 37 | +const MAX_COUNT = 20; | ||
| 38 | + | ||
| 39 | +type Draft = { courseId: string; text: string }; | ||
| 40 | + | ||
| 41 | +/** | ||
| 42 | + * A teacher's question generator: practice questions over a page range of | ||
| 43 | + * the course notes behind one of their own (grade, course) pairs, via | ||
| 44 | + * `POST /rag/questions`. Nothing is stored — a question worth keeping goes to | ||
| 45 | + * the bank through the ordinary bank form, prefilled. | ||
| 46 | + */ | ||
| 47 | +function QuestionGenerationContent() { | ||
| 48 | + const t = useT(); | ||
| 49 | + const { locale } = usePreferences(); | ||
| 50 | + const rag = () => ragCopy(locale()); | ||
| 51 | + const modules = useModules(); | ||
| 52 | + const [flash, setFlash] = createFlash(); | ||
| 53 | + | ||
| 54 | + const [scopes] = createResource(() => loadStudyScopes()); | ||
| 55 | + const [scopeKey, setScopeKey] = createSignal(""); | ||
| 56 | + const [pagesInput, setPagesInput] = createSignal(""); | ||
| 57 | + const [difficulty, setDifficulty] = createSignal<Difficulty>("orta"); | ||
| 58 | + const [count, setCount] = createSignal("5"); | ||
| 59 | + const [seed, setSeed] = createSignal(""); | ||
| 60 | + const [pending, setPending] = createSignal(false); | ||
| 61 | + const [error, setError] = createSignal(""); | ||
| 62 | + const [pagesError, setPagesError] = createSignal(""); | ||
| 63 | + const [result, setResult] = createSignal<RagQuestionSet | null>(null); | ||
| 64 | + const [draft, setDraft] = createSignal<Draft | null>(null); | ||
| 65 | + | ||
| 66 | + const scope = () => scopes()?.find((option) => option.key === scopeKey()) ?? null; | ||
| 67 | + const courses = createMemo(() => [...new Map((scopes() ?? []).map((option) => [option.course.id, option.course])).values()]); | ||
| 68 | + const canBank = () => modules.isEnabled("bank_questions"); | ||
| 69 | + const difficultyLabel = (value: Difficulty) => | ||
| 70 | + value === "kolay" ? rag().difficultyEasy : value === "zor" ? rag().difficultyHard : rag().difficultyMedium; | ||
| 71 | + | ||
| 72 | + const generate = async (event: SubmitEvent) => { | ||
| 73 | + event.preventDefault(); | ||
| 74 | + const current = scope(); | ||
| 75 | + if (!current || pending()) return; | ||
| 76 | + const pages = parsePages(pagesInput()); | ||
| 77 | + if (!pages) { | ||
| 78 | + setPagesError(t("qgen.pagesInvalid")); | ||
| 79 | + return; | ||
| 80 | + } | ||
| 81 | + setPagesError(""); | ||
| 82 | + setError(""); | ||
| 83 | + setPending(true); | ||
| 84 | + try { | ||
| 85 | + setResult( | ||
| 86 | + await postRagQuestions({ | ||
| 87 | + ders: current.ders, | ||
| 88 | + sinif: current.sinif, | ||
| 89 | + pages, | ||
| 90 | + n: Math.min(MAX_COUNT, Math.max(1, Math.trunc(Number(count())) || 5)), | ||
| 91 | + difficulty: difficulty(), | ||
| 92 | + seed_question: seed().trim() || null, | ||
| 93 | + }), | ||
| 94 | + ); | ||
| 95 | + } catch (err) { | ||
| 96 | + setResult(null); | ||
| 97 | + if (err instanceof ApiError && err.status === 503) setError(t("qgen.unavailable")); | ||
| 98 | + else if (err instanceof ApiError && err.status === 403) setError(t("qgen.outOfScope")); | ||
| 99 | + else setError(formatApiError(err)); | ||
| 100 | + } finally { | ||
| 101 | + setPending(false); | ||
| 102 | + } | ||
| 103 | + }; | ||
| 104 | + | ||
| 105 | + return ( | ||
| 106 | + <div class="mx-auto w-full max-w-[1100px] space-y-5"> | ||
| 107 | + <section class="data-shell p-4 sm:p-5"> | ||
| 108 | + <PageHeader title={t("nav.questionGeneration")} description={t("qgen.subtitle")} /> | ||
| 109 | + </section> | ||
| 110 | + | ||
| 111 | + <Show when={flash()}> | ||
| 112 | + <Alert variant="success">{flash()}</Alert> | ||
| 113 | + </Show> | ||
| 114 | + | ||
| 115 | + <div class="grid grid-cols-1 items-start gap-5 lg:grid-cols-[22rem_minmax(0,1fr)]"> | ||
| 116 | + <form class="data-shell space-y-4 p-4 sm:p-5" onSubmit={(event) => void generate(event)}> | ||
| 117 | + <Show | ||
| 118 | + when={scopes.loading || (scopes()?.length ?? 0) > 0} | ||
| 119 | + fallback={<p class="text-sm leading-6 text-muted-foreground">{t("qgen.noScopes")}</p>} | ||
| 120 | + > | ||
| 121 | + <div class="space-y-1.5"> | ||
| 122 | + <Label for="qgen-scope">{t("qgen.scope")}</Label> | ||
| 123 | + <SearchableSelect | ||
| 124 | + id="qgen-scope" | ||
| 125 | + value={scopeKey()} | ||
| 126 | + onChange={setScopeKey} | ||
| 127 | + placeholder={t("qgen.scopePlaceholder")} | ||
| 128 | + disabled={scopes.loading} | ||
| 129 | + options={(scopes() ?? []).map((option) => ({ value: option.key, label: option.label }))} | ||
| 130 | + /> | ||
| 131 | + </div> | ||
| 132 | + | ||
| 133 | + <div class="space-y-1.5"> | ||
| 134 | + <Label for="qgen-pages">{t("qgen.pages")}</Label> | ||
| 135 | + <Input | ||
| 136 | + id="qgen-pages" | ||
| 137 | + value={pagesInput()} | ||
| 138 | + placeholder="3-7, 10" | ||
| 139 | + inputmode="numeric" | ||
| 140 | + aria-invalid={pagesError() ? "true" : undefined} | ||
| 141 | + onInput={(event) => { | ||
| 142 | + setPagesInput(event.currentTarget.value); | ||
| 143 | + setPagesError(""); | ||
| 144 | + }} | ||
| 145 | + /> | ||
| 146 | + <p class={cn("text-xs", pagesError() ? "text-destructive-text" : "text-muted-foreground")}> | ||
| 147 | + {pagesError() || t("qgen.pagesHint")} | ||
| 148 | + </p> | ||
| 149 | + </div> | ||
| 150 | + | ||
| 151 | + <div class="grid grid-cols-[minmax(0,1fr)_5.5rem] gap-3"> | ||
| 152 | + <div class="space-y-1.5"> | ||
| 153 | + <Label>{t("qgen.difficulty")}</Label> | ||
| 154 | + <div class="flex gap-0.5 rounded-lg border bg-muted/40 p-0.5" role="radiogroup" aria-label={t("qgen.difficulty")}> | ||
| 155 | + <For each={DIFFICULTIES}> | ||
| 156 | + {(value) => ( | ||
| 157 | + <button | ||
| 158 | + type="button" | ||
| 159 | + role="radio" | ||
| 160 | + aria-checked={difficulty() === value} | ||
| 161 | + class={cn( | ||
| 162 | + "h-8 flex-1 rounded-md px-2 text-xs font-medium transition-colors", | ||
| 163 | + difficulty() === value ? "bg-primary text-primary-foreground shadow-2xs" : "text-muted-foreground hover:text-foreground", | ||
| 164 | + )} | ||
| 165 | + onClick={() => setDifficulty(value)} | ||
| 166 | + > | ||
| 167 | + {difficultyLabel(value)} | ||
| 168 | + </button> | ||
| 169 | + )} | ||
| 170 | + </For> | ||
| 171 | + </div> | ||
| 172 | + </div> | ||
| 173 | + <div class="space-y-1.5"> | ||
| 174 | + <Label for="qgen-count">{t("qgen.count")}</Label> | ||
| 175 | + <Input id="qgen-count" type="number" min={1} max={MAX_COUNT} value={count()} onInput={(event) => setCount(event.currentTarget.value)} /> | ||
| 176 | + </div> | ||
| 177 | + </div> | ||
| 178 | + | ||
| 179 | + <div class="space-y-1.5"> | ||
| 180 | + <Label for="qgen-seed">{t("qgen.seed")}</Label> | ||
| 181 | + <Textarea id="qgen-seed" rows={3} class="resize-none" value={seed()} maxlength={2000} onInput={(event) => setSeed(event.currentTarget.value)} /> | ||
| 182 | + <p class="text-xs text-muted-foreground">{t("qgen.seedHint")}</p> | ||
| 183 | + </div> | ||
| 184 | + | ||
| 185 | + <Button type="submit" size="sm" class="w-full rounded-lg" disabled={!scope() || !pagesInput().trim() || pending()}> | ||
| 186 | + <IconSparkles class="h-4 w-4" /> | ||
| 187 | + {pending() ? t("qgen.generating") : t("qgen.generate")} | ||
| 188 | + </Button> | ||
| 189 | + </Show> | ||
| 190 | + </form> | ||
| 191 | + | ||
| 192 | + <section class="data-shell min-h-[20rem] space-y-4 p-4 sm:p-5" aria-label={t("qgen.results")} aria-live="polite"> | ||
| 193 | + <h2 class="text-base font-semibold text-text-strong">{t("qgen.results")}</h2> | ||
| 194 | + <Show when={error()}> | ||
| 195 | + <Alert variant="destructive">{error()}</Alert> | ||
| 196 | + </Show> | ||
| 197 | + <Switch> | ||
| 198 | + <Match when={pending()}> | ||
| 199 | + <ul class="space-y-3" aria-hidden="true"> | ||
| 200 | + <For each={[0, 1, 2]}>{() => <li class="h-24 animate-pulse rounded-xl border border-border-hairline bg-surface-tint" />}</For> | ||
| 201 | + </ul> | ||
| 202 | + </Match> | ||
| 203 | + <Match when={result()}> | ||
| 204 | + {(set) => ( | ||
| 205 | + <Show | ||
| 206 | + when={!set().abstained && set().items.length > 0} | ||
| 207 | + fallback={ | ||
| 208 | + <p class="rounded-lg border border-border-hairline bg-surface-tint px-4 py-3 text-sm text-muted-foreground"> | ||
| 209 | + {set().reason ? rag().abstainedReason(set().reason) : t("qgen.noQuestions")} | ||
| 210 | + </p> | ||
| 211 | + } | ||
| 212 | + > | ||
| 213 | + <Show when={set().pages.length > 0}> | ||
| 214 | + <p class="text-xs text-muted-foreground">{t("qgen.coveredPages", { pages: set().pages.join(", ") })}</p> | ||
| 215 | + </Show> | ||
| 216 | + <ol class="space-y-3"> | ||
| 217 | + <For each={set().items}> | ||
| 218 | + {(item, index) => ( | ||
| 219 | + <GeneratedQuestionCard | ||
| 220 | + index={index()} | ||
| 221 | + question={item.question} | ||
| 222 | + answer={item.answer} | ||
| 223 | + onAddToBank={canBank() && scope() ? () => setDraft({ courseId: scope()!.course.id, text: item.question }) : undefined} | ||
| 224 | + /> | ||
| 225 | + )} | ||
| 226 | + </For> | ||
| 227 | + </ol> | ||
| 228 | + </Show> | ||
| 229 | + )} | ||
| 230 | + </Match> | ||
| 231 | + <Match when={!error()}> | ||
| 232 | + <EmptyInline class="py-12" size="md" illustration="exams" title={t("qgen.resultsEmpty")} /> | ||
| 233 | + </Match> | ||
| 234 | + </Switch> | ||
| 235 | + </section> | ||
| 236 | + </div> | ||
| 237 | + | ||
| 238 | + <SidePanel | ||
| 239 | + guardUnsaved | ||
| 240 | + size="wide" | ||
| 241 | + open={draft() != null} | ||
| 242 | + onOpenChange={(open) => !open && setDraft(null)} | ||
| 243 | + title={t("qgen.addToBank")} | ||
| 244 | + > | ||
| 245 | + <Show when={draft()} keyed> | ||
| 246 | + {(current) => ( | ||
| 247 | + <BankQuestionForm | ||
| 248 | + draft={current} | ||
| 249 | + courses={courses()} | ||
| 250 | + onSaved={() => { | ||
| 251 | + setDraft(null); | ||
| 252 | + setFlash(t("qgen.savedToBank")); | ||
| 253 | + }} | ||
| 254 | + onCancel={() => setDraft(null)} | ||
| 255 | + /> | ||
| 256 | + )} | ||
| 257 | + </Show> | ||
| 258 | + </SidePanel> | ||
| 259 | + </div> | ||
| 260 | + ); | ||
| 261 | +} | ||
src/routes/router.tsxmodified+8 -3
| @@ -76,6 +76,7 @@ const AiStudioPage = lazyRoute(() => import("@/pages/ai-studio-page")); | |||
| 76 | const AiStudyPage = lazyRoute(() => import("@/pages/ai-study-page")); | 76 | const AiStudyPage = lazyRoute(() => import("@/pages/ai-study-page")); |
| 77 | const AiInsightsPage = lazyRoute(() => import("@/pages/ai-insights-page")); | 77 | const AiInsightsPage = lazyRoute(() => import("@/pages/ai-insights-page")); |
| 78 | const AiInsightStudentPage = lazyRoute(() => import("@/pages/ai-insight-student-page")); | 78 | const AiInsightStudentPage = lazyRoute(() => import("@/pages/ai-insight-student-page")); |
| 79 | +const QuestionGenerationPage = lazyRoute(() => import("@/pages/question-generation-page")); | ||
| 79 | const ComingSoonPage = lazyRoute(() => import("@/pages/coming-soon-page")); | 80 | const ComingSoonPage = lazyRoute(() => import("@/pages/coming-soon-page")); |
| 80 | const StudentsRosterPage = lazyRoute(() => import("@/pages/students-roster-page")); | 81 | const StudentsRosterPage = lazyRoute(() => import("@/pages/students-roster-page")); |
| 81 | const TeachersRosterPage = lazyRoute(() => import("@/pages/teachers-roster-page")); | 82 | const TeachersRosterPage = lazyRoute(() => import("@/pages/teachers-roster-page")); |
| @@ -488,6 +489,12 @@ const aiInsightStudentRoute = createRoute({ | |||
| 488 | component: AiInsightStudentPage, | 489 | component: AiInsightStudentPage, |
| 489 | }); | 490 | }); |
| 490 | 491 | ||
| 492 | +const questionGenerationRoute = createRoute({ | ||
| 493 | + getParentRoute: () => rootRoute, | ||
| 494 | + path: "/ai/question-generation", | ||
| 495 | + component: QuestionGenerationPage, | ||
| 496 | +}); | ||
| 497 | + | ||
| 491 | // The audio workshop had its own route before the hub gathered it. | 498 | // The audio workshop had its own route before the hub gathered it. |
| 492 | const soundStudioRoute = createRoute({ | 499 | const soundStudioRoute = createRoute({ |
| 493 | getParentRoute: () => rootRoute, | 500 | getParentRoute: () => rootRoute, |
| @@ -543,9 +550,6 @@ const COMING_SOON_SLUGS = [ | |||
| 543 | "optik-okuma", | 550 | "optik-okuma", |
| 544 | "raporlar", | 551 | "raporlar", |
| 545 | "kvkk-denetim", | 552 | "kvkk-denetim", |
| 546 | - "ogrenci-analizi", | ||
| 547 | - "bekleyen-onaylar", | ||
| 548 | - "soru-uretimi", | ||
| 549 | "calisma-programim", | 553 | "calisma-programim", |
| 550 | ] as const; | 554 | ] as const; |
| 551 | 555 | ||
| @@ -616,6 +620,7 @@ const routeTree = rootRoute.addChildren([ | |||
| 616 | aiStudyRoute, | 620 | aiStudyRoute, |
| 617 | aiInsightsRoute, | 621 | aiInsightsRoute, |
| 618 | aiInsightStudentRoute, | 622 | aiInsightStudentRoute, |
| 623 | + questionGenerationRoute, | ||
| 619 | soundStudioRoute, | 624 | soundStudioRoute, |
| 620 | studentsRosterRoute, | 625 | studentsRosterRoute, |
| 621 | teachersRosterRoute, | 626 | teachersRosterRoute, |