All files / types conceptGraph.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89                                                                                                                                                                                 
// Response shapes for the backend endpoints used by ConceptGraphPage and the
// components/Scaffold/* tree, which fetch via useBackend/useBackendMutation.
// The legacy counterparts live in main/api/legacyClient.ts and are deliberately
// separate copies — do not consolidate (see LegacyHomePage isolation).
 
// id is the PlAssessment row id (as a string); pl_assessment_id is PrairieLearn's own numeric
// assessment id, null until the PL-API sync job (issue #71) fills it in.
export interface Assessment {
  id: string;
  pl_assessment_id: string | null;
  name: string;
}
 
export interface Question {
  id: string;
  assessment_id: string;
  pl_question_uuid: string;
  title: string;
}
 
// Instructor-facing view of an assessment for the UnlockAssessmentsModal: includes locked
// assessments (which the plain Assessment list above excludes) and their lock state.
export interface AssessmentManagementDTO {
  id: string;
  name: string;
  locked: boolean;
}
 
export interface QuestionConcept {
  id: string;
  question_id: string;
  concept_id: string;
  subconcept_label: string | null;
}
 
export interface Course {
  id: number;
  courseName: string;
}
 
/**
 * An HTML string that has already been rendered from Markdown and sanitized
 * server-side (OWASP HTML sanitizer) — see MarkdownService on the backend.
 * Safe to render via `dangerouslySetInnerHTML`; do not re-escape or otherwise
 * transform it before doing so.
 */
export type SafeHtml = string;
 
export interface SubconceptDTO {
  id: number;
  parentId: number;
  labelHtml: SafeHtml;
}
 
export interface MajorConceptDTO {
  id: number;
  labelHtml: SafeHtml;
  color: string;
  subconcepts: SubconceptDTO[];
}
 
export interface ConceptContentDTO {
  id: number;
  parentId: number | null;
  descriptionHtml: SafeHtml | null;
  exampleHtml: SafeHtml | null;
  practiceUrl: string | null;
}
 
export interface PositionDTO {
  x: number;
  y: number;
}
 
export interface EdgeDTO {
  id: number;
  sourceId: number;
  targetId: number;
  // Set (bright red) when the edge is part of a prerequisite cycle; null otherwise.
  color: string | null;
}
 
export interface UserStateResponse {
  starred_ids: string[];
  detail_cards: unknown[];
  mastered_subconcepts: string[];
  top_level_positions: Record<string, { x: number; y: number }>;
}