Roadmap P0
- Ship /logo.svg fallback and rewire asset references (superseded later by
the project-manager PNG in a separate commit).
Roadmap P1
- Response envelope alignment ({items,total,page,size}) across services
and query hooks.
- Approval/ticket UX updates tied to the new backend rollback semantics.
Roadmap P2
- React.lazy + Vite manualChunks to split vendor-radix/charts/icons/forms
from the main bundle and cut initial JS.
- Fix the 181 tsc errors (PaginationParams class + per-service generics).
- Auto-refresh flow for JWT refresh tokens wired into api-client.ts.
Roadmap P3
- i18n: i18next + language detector, en/ar locales, RTL auto-switch,
LanguageToggle component in RoleLayout and AdminLmsLayout.
- GDPR: PrivacyCenter page for data export and right-to-erasure, backed
by gdpr.service.ts; logout via AuthContext after erasure.
- Human-in-the-loop exam review UI: admin ExamReviewQueue + ExamReviewDetail
pages, useExamReview hooks, exam-review.service.ts.
- AI quality loop: AIPromptEditor (versioning + render preview),
AIFeedbackButtons for students, AIFeedbackTriage admin page, dedicated
services, hooks, and types.
- Dark mode: ThemeProvider + ThemeToggle + chart color tokens.
- Accessibility: DialogDescription on every DialogContent; alert-dialog
and sheet updates.
- Retire dead pages: ExamPage marketing, Index, ProfilePage import.
- Playwright e2e scaffolding: playwright.config.ts + e2e/login.spec.ts
smoke tests, npm scripts test:e2e / test:e2e:install.
Made-with: Cursor
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
|
import { aiFeedbackService } from "@/services/ai-feedback.service";
|
|
import type {
|
|
AIFeedbackStatus,
|
|
AIFeedbackSubjectType,
|
|
AIFeedbackSubmitInput,
|
|
} from "@/types/ai-feedback";
|
|
|
|
const KEY_ROOT = ["ai", "feedback"] as const;
|
|
|
|
export function useAIFeedbackSummary(
|
|
subjectType: AIFeedbackSubjectType | undefined,
|
|
subjectId: number | undefined,
|
|
) {
|
|
return useQuery({
|
|
enabled: !!subjectType && !!subjectId,
|
|
queryKey: [...KEY_ROOT, "summary", subjectType, subjectId] as const,
|
|
queryFn: () =>
|
|
aiFeedbackService.summary(
|
|
subjectType as AIFeedbackSubjectType,
|
|
subjectId as number,
|
|
),
|
|
});
|
|
}
|
|
|
|
export function useSubmitAIFeedback() {
|
|
const qc = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: (input: AIFeedbackSubmitInput) => aiFeedbackService.submit(input),
|
|
onSuccess: (_res, vars) => {
|
|
qc.invalidateQueries({
|
|
queryKey: [...KEY_ROOT, "summary", vars.subject_type, vars.subject_id],
|
|
});
|
|
qc.invalidateQueries({ queryKey: [...KEY_ROOT, "list"] });
|
|
},
|
|
});
|
|
}
|
|
|
|
export function useAIFeedbackList(
|
|
params: {
|
|
status?: AIFeedbackStatus;
|
|
rating?: "up" | "down";
|
|
subject_type?: AIFeedbackSubjectType;
|
|
prompt_key?: string;
|
|
page?: number;
|
|
size?: number;
|
|
} = {},
|
|
) {
|
|
return useQuery({
|
|
queryKey: [...KEY_ROOT, "list", params] as const,
|
|
queryFn: () => aiFeedbackService.list(params),
|
|
});
|
|
}
|
|
|
|
export function useResolveAIFeedback() {
|
|
const qc = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: ({
|
|
id,
|
|
status,
|
|
notes,
|
|
}: {
|
|
id: number;
|
|
status: Exclude<AIFeedbackStatus, "open">;
|
|
notes?: string;
|
|
}) => aiFeedbackService.resolve(id, status, notes),
|
|
onSuccess: () => qc.invalidateQueries({ queryKey: KEY_ROOT }),
|
|
});
|
|
}
|