feat: add Monaco diff editor for submission changes

This commit is contained in:
2026-08-06 16:16:30 +09:00
parent 4b2e25d385
commit 604da5d6e1
8 changed files with 480 additions and 313 deletions
+2 -2
View File
@@ -25,12 +25,12 @@ export type CurriculumWeek = {
references?: CurriculumReference[];
exampleCodes?: CurriculumReference[];
deliverable: string;
requiresSourceSubmission: boolean;
};
modules?: CurriculumModule[];
environmentProfiles?: CurriculumEnvironmentProfile[];
visualizationPlatforms?: CurriculumVisualizationPlatform[];
mapKeys?: string[];
isTeamProject?: boolean;
};
export type CurriculumMap = {
@@ -145,7 +145,7 @@ export async function updateInstructorCurriculum(
duration?: string;
overview?: string;
deliverable?: string;
requiresSourceSubmission?: boolean;
isTeamProject?: boolean;
topics?: string[];
learningSteps?: Array<{
title?: string;
+56
View File
@@ -2,6 +2,8 @@ export type InstructorSubmissionCommitFile = {
path: string;
status: string;
patch: string;
originalRef?: string | null;
modifiedRef?: string | null;
};
export type InstructorSubmissionCommit = {
@@ -30,12 +32,14 @@ export type InstructorSubmissionItem = {
id: string;
week: number;
title: string;
isTeamProject: boolean;
};
module: {
id: string;
name: string;
folderName: string;
sortOrder: number;
sourceType?: 'CUSTOM' | 'GIT';
};
student: {
id: string;
@@ -43,6 +47,17 @@ export type InstructorSubmissionItem = {
email: string;
group: string;
};
team?: {
id: string;
name: string;
members: Array<{
id: string;
name: string;
email: string;
commitCount: number;
lastCommittedAt: string | null;
}>;
} | null;
repository: {
id: string;
owner: string;
@@ -73,6 +88,7 @@ export type InstructorSubmissionsResponse = {
id: string;
week: number;
title: string;
isTeamProject: boolean;
modules: Array<{
id: string;
name: string;
@@ -88,6 +104,7 @@ export type InstructorSubmissionsResponse = {
group: string;
}>;
items: InstructorSubmissionItem[];
teamItems: InstructorSubmissionItem[];
};
const LMS_API_BASE_URL = (import.meta.env.VITE_API_BASE_URL ?? 'https://workspace.autonomystudio.net/lms-api/api').replace(/\/+$/, '');
@@ -106,6 +123,45 @@ export async function listInstructorSubmissions(accessToken: string): Promise<In
return response.json() as Promise<InstructorSubmissionsResponse>;
}
export async function getInstructorSubmissionFile(
accessToken: string,
input: {
owner: string;
repoName: string;
path: string;
baseRef?: string | null;
headRef?: string | null;
},
): Promise<{
original: string;
modified: string;
originalAvailable: boolean;
modifiedAvailable: boolean;
}> {
const query = new URLSearchParams({
owner: input.owner,
repo: input.repoName,
path: input.path,
});
if (input.baseRef) query.set('baseRef', input.baseRef);
if (input.headRef) query.set('headRef', input.headRef);
const response = await fetch(`${LMS_API_BASE_URL}/instructor/submissions/file?${query.toString()}`, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
if (!response.ok) {
throw new Error(`파일 내용을 불러오지 못했습니다. (${response.status})`);
}
return response.json() as Promise<{
original: string;
modified: string;
originalAvailable: boolean;
modifiedAvailable: boolean;
}>;
}
export async function saveInstructorSubmissionScore(
accessToken: string,
input: { studentId: string; weekId: string; score: number },