Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[시간표] 빈 강의 목록에 대한 문구 추가 #519

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

Gwak-Seungju
Copy link
Contributor

What is this PR? 🔍

Changes 📝

코드 이동으로 추가 코드가 많은 만큼 삭제 코드도 많습니다. 변경한 내용은 별로 없습니다!

  • 코드 길이를 줄이고자 시간표 테이블 헤더(코드, 과목명, 분반 등..) 코드 위치를 변경했습니다.
  • 강의 목록이 비어 있을 시, 내 시간표에 강의가 없을 시 안내 문구를 보여줍니다.

ScreenShot 📷

-빈 강의 목록

image

  • 시간표에 추가한 과목이 없을 시

image

✔️ Please check if the PR fulfills these requirements

  • It's submitted to the correct branch, not the develop branch unconditionally?
  • If on a hotfix branch, ensure it targets main?
  • There are no warning message when you run yarn lint

@Gwak-Seungju Gwak-Seungju added 🖌 UI UI 개발 👤 User 유저, 시간표 도메인 labels Sep 26, 2024
@Gwak-Seungju Gwak-Seungju self-assigned this Sep 26, 2024
Copy link
Contributor

@D0Dam D0Dam left a comment

Choose a reason for hiding this comment

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

겸사겸사 코드를 읽어봤는데 시간표 코드가 전체적으로 읽기 어려운 부분이 있네요..
우선 순위에서 밀렸을 수 있지만 이벤트 effect와 아닌 effect, hooks와 데이터 가공을 위한 로직, jsx를 쉽게 파악할 수 있는 구조를 그린다음 이에 맞는 이름을 잘 붙혀주기만 해도 가독성이 크게 오를거에요!
급한 내용이라고 했는데 느긋하게 리뷰를 남겨서 조금 죄송하지만, 분명 도움이 되리라고 생각합니다!
우선 기능적 오류는 보이지 않아서 approve 해두겠습니다! 뒤늦게라도 참고해 봐도 괜찮아요!
정말 열심히 하시던데... 응원해요!😆

value: LectureInfo | TimetableLectureInfoV2,
): value is LectureInfo => 'name' in value;

export const LECTURE_TABLE_HEADER = [
Copy link
Contributor

Choose a reason for hiding this comment

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

이 constant는 다른곳에서도 쓰이는 것 같네요?
저라면 선언 위치가 올바른지 고민해볼것 같아요.
다시 보니 코인이 constant를 관리하는 구조가 제대로 안 되어 있는 느낌도 있군요..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

생각해보니 static 폴더에 timetable.ts가 있네요! 거기에 선언을 하면 더 좋을까요??

src/components/TimetablePage/LectureTable/index.tsx Outdated Show resolved Hide resolved
src/components/TimetablePage/LectureTable/index.tsx Outdated Show resolved Hide resolved
[styles['table__row-button--toggled']]: version === 'myLectureList',
})}
onClick={(e) => {
setCursor(index);
Copy link
Contributor

Choose a reason for hiding this comment

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

index말고 list가 가지는 고유 값으로 Cursor를 구분할 수는 없을까요?
index를 사용하는 용도가 특정 엘리먼트를 찾기 위함이라면 지양하는 습관을 들이는게 좋은 것 같아요!

Copy link
Contributor Author

@Gwak-Seungju Gwak-Seungju Sep 26, 2024

Choose a reason for hiding this comment

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

cursor가 사용되는 경우가 키보드 방향키 위, 아래를 눌렀을 때 LectureList 중 클릭해서 선택한 lecture를 기준으로 위, 아래로 이동이 될 때 사용됩니다! 따라서 index를 사용했습니다..!

Comment on lines +68 to +73
list={(lectureList ?? []).filter((lecture) => {
const searchFilter = filter.search.toUpperCase();
const departmentFilter = filter.department;
const searchCondition = lecture.name.toUpperCase().includes(searchFilter)
|| lecture.code.toUpperCase().includes(searchFilter)
|| lecture.professor.toUpperCase().includes(searchFilter);
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 작업은 연산이 많아보이네요..
list의 크기가 충분히 커질 수 있는 작업이라면 메모이제이션을 생각해봐도 좋을 것 같고, jsx 내부에 있어서 읽기가 힘드니 따로 꺼내서 선언해 네이밍을 해줌으로써 결과값을 수월하게 읽을 수 있도록 하면 좋을 듯 합니다~!

Comment on lines +174 to +177
onClick={(e) => {
setCursor(index);
handleTableRowClick(lecture, e);
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

좀 개선해 보고 싶은 구조네요.
커링과 list가 가지는 고유값을 사용한다면 이벤트의 특성을 살리면서 핸들러 함수도 깔끔하게 분리가 될 것 같단말이죠..!
아마

const handleTableRowClick = (e) => (lecture) => {...}
...
onClick={handleTableRowClick(lecture)}

이런 느낌으로 떨어질 것 같습니다!

@Gwak-Seungju Gwak-Seungju merged commit ef9565c into develop Sep 26, 2024
2 checks passed
@github-actions github-actions bot deleted the feat/#518/text-empty-lecture branch September 26, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖌 UI UI 개발 👤 User 유저, 시간표 도메인
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[시간표] 빈 강의 목록, 빈 내 강의에 대한 문구 추가하기
2 participants