Skip to content

Conversation

@yummjin
Copy link
Member

@yummjin yummjin commented Aug 4, 2025

Summary

related #275

기존 작성되어 있던 시간표 관련 로직에 대해 재컴포넌트화, 커스텀 hook 생성 등을 통해 리팩토링했습니다.

Tasks

  • 디자인 변경 및 변경된 디자인에 맞는 기능 구현
  • 과목 데이터 패칭

To Reviewer

  • 'L' 시간표의 경우 디자인에 따라 따로 분리해야 할 것 같아서 일단 주석 처리 해 두었습니다.
  • 야간 시간표의 경우 접근은 가능하나 강의 추가 시 오류가 발생하여 추후 로직 개선이 필요합니다.
  • 시간표에 추가되는 과목 색상의 경우 추후 변경하기 위해 아직 구현하지 않았고 기존 구현되어 있던 색상 사용합니다.
  • 디자인에 명시되었던 새로운 시간표 추가 기능의 경우 다음 PR에 구현하고자 합니다.

Screenshot

image image image

yummjin added 25 commits August 4, 2025 02:07
@yummjin yummjin requested a review from seoJing August 4, 2025 06:17
@yummjin yummjin self-assigned this Aug 4, 2025
@yummjin yummjin requested a review from Jeong-Ag as a code owner August 4, 2025 06:17
@yummjin yummjin added ✨ Feature 새로운 기능 명세 및 개발 🔨 Refactor 코드 수정 및 최적화 labels Aug 4, 2025
@yummjin yummjin added the ⏰ Time time 프로젝트 관련 label Aug 4, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 4, 2025

⚠️ No Changeset found

Latest commit: 30e9e55

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Aug 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.71%. Comparing base (0c66f87) to head (30e9e55).
⚠️ Report is 124 commits behind head on main.

@@            Coverage Diff             @@
##             main     #281      +/-   ##
==========================================
- Coverage   94.06%   93.71%   -0.35%     
==========================================
  Files          14       14              
  Lines         219      207      -12     
  Branches       37       38       +1     
==========================================
- Hits          206      194      -12     
  Misses         11       11              
  Partials        2        2              

see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@Jeong-Ag Jeong-Ag left a comment

Choose a reason for hiding this comment

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

디자인 수정 PR이나 코드 리팩토링 관련은 별도 PR로 빼는게 좋을 것 같네요 간략하게만 남겨서 추후 리팩토링 진행할때 더 자세히 남길게요 스타일링 관련한 리뷰만 반영해주셔도 돼요 수고하셨습니다~ 🙌

Comment on lines +24 to +26
interface TimeTableProviderProps {
children: ReactNode;
}
Copy link
Member

Choose a reason for hiding this comment

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

TimeTableContext 위로 올려서 interface 모아놓으면 더 좋을 것 같아용

Comment on lines +32 to +34
const clearSelectedTimeInfo = () => {
setSelectedTimeInfo(null);
};
Copy link
Member

Choose a reason for hiding this comment

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

setSelectedTimeInfo 전달하니까 꼭 필요한 함수는 아니라고 생각하는데 명확하게 전달하기 위해서 넣으신걸까요?

Comment on lines +41 to +48
const hasTimeConflict = (time1: string, time2: string): boolean => {
const periods1 = parseLectureTime(time1);
const periods2 = parseLectureTime(time2);

return periods1.some((period1) =>
periods2.some((period2) => period1 === period2),
);
};
Copy link
Member

Choose a reason for hiding this comment

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

1,2 대신에 좋은 이름으로 바꿔주세요.... ㅎㅎㅎ

const router = useRouter();
const { searchParamsAction } = useTimeTableParams();

const addedLectureIds = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

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

단순 파싱같은데 메모이제이션 한 이유가 궁금해요 다른 함수들에도 적용되어 있는 메모이제이션이 꼭 필요하지 않을 수도 있다는 생각이 들어서 확인해보면 어떨따요


const addLecture = useCallback(
(lecture: GetLectureListResponseValue) => {
const currentParams = new URLSearchParams(window.location.search);
Copy link
Member

Choose a reason for hiding this comment

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

useSearchParams을 사용하지 않고 window.location.search를 사용한 이유가 있을까요? url이 변경됐을때 감지가 안될 것 같아요

},
set: (key: string, value: string) => {
searchParams.set(key, value);
router.push(`${PATH.TIMETABLE}?${searchParams.toString()}`);
Copy link
Member

Choose a reason for hiding this comment

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

url 생성하는 함수 만들어서 처리해도 좋을 것 같아요

},
);

LectureSearchPeriodDropdown.displayName = 'LectureSearchPeriodDropdown';
Copy link
Member

Choose a reason for hiding this comment

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

코드 아래에 모아서 작성하면 관리하기 더 편할 것 같아요

Comment on lines +69 to +73
className={`px-3 py-1 text-sm transition-colors hover:bg-gray-300/20 ${
selectedSet.has(item)
? 'bg-time-table-header'
: 'bg-white text-gray-700'
}`}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
className={`px-3 py-1 text-sm transition-colors hover:bg-gray-300/20 ${
selectedSet.has(item)
? 'bg-time-table-header'
: 'bg-white text-gray-700'
}`}
className={cn('px-3 py-1 text-sm transition-colors hover:bg-gray-300/20', selectedSet.has(item) ? 'bg-time-table-header' : 'bg-white text-gray-700')}

코드 전체적으로 cn 함수 사용해서 조건부 스타일 적용해주시면 될 것 같아요

Comment on lines +74 to +82
if (isAddedLecture) {
deleteLecture(lecture.id);
return;
}

if (isTimeConflict) {
alert('이미 추가된 강의와 시간이 충돌합니다.');
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (isAddedLecture) {
deleteLecture(lecture.id);
return;
}
if (isTimeConflict) {
alert('이미 추가된 강의와 시간이 충돌합니다.');
return;
}
if (isAddedLecture) {
return deleteLecture(lecture.id);
}
if (isTimeConflict) {
return alert('이미 추가된 강의와 시간이 충돌합니다.');
}

<LectureSearchItem.Dropdown
title="시간 선택"
isOpen={isOpen}
onToggle={() => setIsOpen(!isOpen)}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
onToggle={() => setIsOpen(!isOpen)}
onToggle={() => setIsOpen(prev => !prev)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 새로운 기능 명세 및 개발 🔨 Refactor 코드 수정 및 최적화 ⏰ Time time 프로젝트 관련

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants