Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bug report
description: 버그를 보고하여 서비스를 개선하는 데 도움을 주세요.
title: "[bug]: "
body:
- type: markdown
attributes:
value: |
## 버그 보고서
문제를 정확히 파악하기 위해 아래 정보를 최대한 자세히 작성해 주세요.
- type: textarea
id: bug-description
attributes:
label: 어떤 버그인가요?
description: 발생한 버그를 간략하고 명확하게 설명해 주세요.
placeholder: 예시) 로그인 버튼을 눌렀을 때 반응이 없습니다.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: 재현 경로
description: 버그가 발생하는 상황을 단계별로 설명해 주세요 (가능하면 Given-When-Then 형식).
placeholder: |
1. 메인 페이지에 접속합니다.
2. 로그인 버튼을 클릭합니다.
3. ...
validations:
required: true
- type: textarea
id: expected-results
attributes:
label: 예상 결과
description: 원래 기대했던 동작은 무엇이었나요?
placeholder: 로그인 팝업이 뜨고 아이디/비밀번호 입력창이 보여야 합니다.
validations:
required: true
- type: textarea
id: references
attributes:
label: 참고 자료 (선택)
description: 스크린샷, 오류 로그, 또는 관련 문서 링크를 첨부해 주세요.
placeholder: 이미지나 로그 파일을 드래그 앤 드롭 하세요.
validations:
required: false
35 changes: 0 additions & 35 deletions .github/ISSUE_TEMPLATE/etc.md

This file was deleted.

45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/etc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ETC
description: 리팩토링, 성능 개선 등 기타 작업을 위한 템플릿입니다.
title: "[etc]: "
body:
- type: markdown
attributes:
value: |
## 기타 작업
기능 추가나 버그 수정 외의 작업(리팩토링, 환경 설정 등) 내용을 작성해 주세요.
- type: checkboxes
id: development-type
attributes:
label: 작업 유형
description: 해당되는 항목을 모두 선택해 주세요.
options:
- label: 리팩토링 (Refactoring)
- label: 성능 개선 (Performance)
- label: 환경 설정 (Config)
- label: 문서 수정 (Docs)
- label: 기타 (Etc)
- type: textarea
id: rationale
attributes:
label: 작업 배경
description: 왜 이 작업이 필요한지 설명해 주세요.
placeholder: 코드의 가독성을 높이기 위해 불필요한 코드를 제거합니다.
validations:
required: true
- type: textarea
id: task-details
attributes:
label: 작업 상세 내용
description: 어떤 작업을 진행할 것인지 자세히 적어주세요.
placeholder: |
- [ ] 컴포넌트 A 분리
- [ ] 공통 훅 추출
validations:
required: true
- type: textarea
id: references
attributes:
label: 참고 자료 (선택)
description: 관련 링크, 스크린샷 등이 있다면 첨부해 주세요.
validations:
required: false
25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Feature request
description: 새로운 기능이나 아이디어를 제안해 주세요.
title: "[feat]: "
body:
- type: markdown
attributes:
value: |
## 기능 제안
새로운 기능을 제안하거나 기존 기능을 개선하고 싶으신가요? 아래 내용을 작성해 주세요.
- type: textarea
id: feature-description
attributes:
label: 어떤 기능인가요?
description: 제안하려는 기능의 목적과 기대 효과를 간략히 설명해 주세요.
placeholder: 예시) 다크 모드 기능을 추가하여 시력을 보호하고 싶습니다.
validations:
required: true
- type: textarea
id: task-details
attributes:
label: 작업 상세 내용
description: 어떻게 구현하면 좋을지, 어떤 작업들이 필요한지 적어주세요.
placeholder: |
- [ ] 테마 상태 관리 추가
- [ ] CSS 변수 적용
validations:
required: true
- type: textarea
id: references
attributes:
label: 참고 자료 (선택)
description: 디자인 시안, 관련 라이브러리, 또는 참고할 만한 예시 링크를 첨부해 주세요.
validations:
required: false
4 changes: 4 additions & 0 deletions src/assets/svg/retrieveIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/entities/assignment/api/assignmentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
assignmentCodeSchema,
assignmentDetailSchema,
assignmentScheduleSchema,
assignmentSubmissionHistorySchema,
assignmentSubmissionResultSchema,
type TAssignmentForm,
} from '@/entities/assignment/model/schemas';
Expand Down Expand Up @@ -110,3 +111,17 @@ export const submitAssignment = async (
);
return parsed.response;
};

// 과제 제출 이력 조회 API
export const getAssignmentSubmissionHistory = async (
unitId: number,
assignmentId: number
) => {
const response = await privateAxios.get(
ENDPOINTS.ASSIGNMENTS.SUBMIT(unitId, assignmentId)
);
const parsed = apiResponseSchema(assignmentSubmissionHistorySchema).parse(
response.data
);
return parsed.response;
};
9 changes: 9 additions & 0 deletions src/entities/assignment/api/assignmentQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getAssignment,
getAssignmentsByCourse,
getAssignmentSchedules,
getAssignmentSubmissionHistory,
} from '@/entities/assignment/api/assignmentApi';

export const assignmentQueries = {
Expand Down Expand Up @@ -48,4 +49,12 @@ export const assignmentQueries = {
queryKey: ['code', codeId],
queryFn: () => getAssignmentCode(codeId),
}),

// 과제 제출 이력 조회 쿼리 옵션
getAssignmentSubmissionHistory: (unitId: number, assignmentId: number) =>
queryOptions({
queryKey: ['assignments', unitId, assignmentId, 'submissionHistory'],
queryFn: () => getAssignmentSubmissionHistory(unitId, assignmentId),
select: (data) => [...data.submissionList].reverse(),
}),
};
14 changes: 14 additions & 0 deletions src/entities/assignment/model/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,24 @@ export const assignmentCodeSchema = z.object({
language: z.string(),
});

export const assignmentSubmissionHistorySchema = z.object({
assignmentId: z.number(),
submissionList: z.array(
z.object({
codeId: z.number(),
isSuccess: z.boolean(),
submittedAt: z.string(),
})
),
});

export type TAssignment = z.infer<typeof assignmentSchema>;
export type TAssignmentSchedule = z.infer<typeof assignmentScheduleSchema>;
export type TAssignmentForm = z.infer<typeof assignmentFormSchema>;
export type TAssignmentDetail = z.infer<typeof assignmentDetailSchema>;
export type TAssignmentSubmissionResult = z.infer<
typeof assignmentSubmissionResultSchema
>;
export type TAssignmentSubmissionHistory = z.infer<
typeof assignmentSubmissionHistorySchema
>;
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import {assignmentMutations} from '@/entities/assignment/api/assignmentMutations';
import {assignmentQueries} from '@/entities/assignment/api/assignmentQueries';
import type {TAssignmentSubmissionResult} from '@/entities/assignment/model/schemas';
import {courseQueries} from '@/entities/course/api/courseQueries';
import type {TCourseOverview} from '@/entities/course/model/schemas';
import {useMutation, useQueryClient} from '@tanstack/react-query';
import {useState} from 'react';

export const useAssignmentSubmission = (
unitId: number,
courseDetails: TCourseOverview,
assignmentId: number
assignmentId: number,
onSubmitSuccess?: (codeId: number) => void
) => {
const [result, setResult] = useState<TAssignmentSubmissionResult | null>(
null
);
const [isModalOpen, setIsModalOpen] = useState(false);

// unitId 찾기
const unitId = courseDetails.units.find((unit) =>
unit.assignments.some((assignment) => assignment.id === assignmentId)
)?.id;

const queryClient = useQueryClient();

// 과제 제출 API 호출
Expand All @@ -28,6 +26,10 @@ export const useAssignmentSubmission = (
queryClient.invalidateQueries({
queryKey: courseQueries.getCourseDetails(courseDetails.id).queryKey,
});
queryClient.invalidateQueries({
queryKey: assignmentQueries.getAssignmentSubmissionHistory(unitId, assignmentId).queryKey,
});
onSubmitSuccess?.(data.codeId);
setIsModalOpen(true);
setResult(data);
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/ui/ScheduleCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ScheduleCard = ({
<Badge
variant='schedule'
schedule={remainingDays <= 1 ? 'upcoming' : 'later'}>
{remainingDays}
{remainingDays == 0 ? '오늘' : `${remainingDays}일 전`}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

엄격한 동등 연산자(===)를 사용하세요.

느슨한 동등 연산자(==) 대신 엄격한 동등 연산자(===)를 사용해야 합니다. TypeScript/JavaScript에서는 타입 강제 변환을 방지하기 위해 항상 ===를 사용하는 것이 권장됩니다.

📚 참고: MDN - 동등 비교 및 동일성

🔧 제안하는 수정
-          {remainingDays == 0 ? '오늘' : `${remainingDays}일 전`}
+          {remainingDays === 0 ? '오늘' : `${remainingDays}일 전`}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{remainingDays == 0 ? '오늘' : `${remainingDays}일 전`}
{remainingDays === 0 ? '오늘' : `${remainingDays}일 전`}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/dashboard/ui/ScheduleCard.tsx` at line 23, In ScheduleCard.tsx
replace the loose equality check with a strict one: update the conditional that
renders {remainingDays == 0 ? '오늘' : `${remainingDays}일 전`} to use === for
remainingDays (use remainingDays === 0) so the comparison in the ScheduleCard
component is type-safe and avoids implicit coercion.

</Badge>
</div>

Expand Down
Loading
Loading