Skip to content

code review#183

Open
devdeun wants to merge 372 commits intoreview/code-reviewfrom
main
Open

code review#183
devdeun wants to merge 372 commits intoreview/code-reviewfrom
main

Conversation

@devdeun
Copy link
Collaborator

@devdeun devdeun commented Aug 9, 2024

🚀 풀 리퀘스트 제안

코드리뷰용 PR입니다

📋 작업 내용

수정한 내용이나 추가한 기능에 대해 자세히 설명해 주세요.

🔧 변경 사항

  • 📃 README.md
  • 📦 package.json
  • 🔥 파일 삭제
  • 🧹 그 외 ex) .gitignore 등

주요 변경 사항을 요약해 주세요.

📸 스크린샷 (선택 사항)

수정된 화면 또는 기능을 시연할 수 있는 스크린샷을 첨부해 주세요.

📄 기타

추가적으로 전달하고 싶은 내용이나 특별한 요구 사항이 있으면 작성해 주세요.

devdeun and others added 30 commits August 1, 2024 17:51
[design] 공통 레이아웃 최대 넓이 및 디자인 수정
[feat] 동료이벤트 컴포넌트 제작
[feat] Schedule Reducer 생성 및 firebase로 실제 데이터 불러오기
[refactor] 컴포넌트 사용성 개선
[feat] 프로필 페이지 UI 구현
kimisadev27 and others added 29 commits August 8, 2024 03:23
[design] 전체적인 스타일 수정
[feat] 급여명세서 저장된 이미지에서 저장 버튼 제거
[fix] 프로필 수정 시, 이미지 초기화 되는 버그 수정
[refactor] 최종 회의 중 발생한 문제 수정
[refactor] 최종테스트 중 발견한 사항 수정 누락부분
[fix] 하루 종일 일정이 오전12:00-오후11:59로 뜨는 오류 해결
[doc] 최종 README 업로드
[merge] 최종develop버전 main브랜치로 merge
Copy link

@iamidlek iamidlek left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.
실제 배포된 사이트 혹은 로컬에서 확인 할 수 있게 환경 변수를 공유주시면
리뷰할 때 더 자세히 볼 수 있을 것 같습니다.
반복된 부분은 코멘트 생략하였습니다.

git commit 컨벤션과 코드 분리 및 스타일 작성, 컴포넌트화를 잘 해주신 것 같습니다.

다만 작업자마다 다른 코드 스타일이 보이는 부분이 일부 있고
로직에 대해 에러가 발생 가능한 부분이 있는 점
불필요한 state가 존재하는 등 개선되었으면 하는 부분도 있었습니다.

시간에 대한 서버와 클라이언트의 처리 방법이나
예외 사항에 대한 처리나 실시간 데이터 변경 반영이나
라이브러리 없이 캘린더 만들어 보기 등
개선 사항을 찾아 개선해 보아도 좋을 것 같습니다.

import { firebaseConfig } from '@/constants/api';

export const checkAuth = (): boolean => {
const sessionKey = `firebase:authUser:${firebaseConfig.apiKey}:${auth.app.name}`;

Choose a reason for hiding this comment

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

firebaseConfig.apiKey 를 조회하여 클라이언트에게 내려주는 것은
env로 서버쪽에 두어 감추어두는 의미가 없어질 것 같습니다.

};

export const getUID = async (): Promise<string> =>
await auth.authStateReady().then(() => (auth.currentUser ? auth.currentUser.uid : ''));

Choose a reason for hiding this comment

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

auth.currentUser?.uid ?? ''
과 같이 작성하여도 좋을 것 같습니다.

const PrivateRoute = () => {
const { pathname, search } = useLocation();

return checkAuth() ? <Outlet /> : <Navigate to='/signin' replace state={pathname + search} />;

Choose a reason for hiding this comment

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

Navigate to='/signin'
이 부분만 PATH에서 값을 가져오지 않고 작성한 이유가 있을까요?
일관성 있게 관리되면 좋을 것 같습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

작성하다가 놓친부분 같습니다! 유의하겠습니다!


useEffect(() => {
if (checkAuth()) navigate(PATH.HOME);
}, [status]);

Choose a reason for hiding this comment

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

eslint react-hooks/exhaustive-deps 에러가 나오고 있는데
제 환경에서만 잡히는 에러일까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

저는 확인되지 않습니다.. 다른분들은 어떠신가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

status 부분에서 React Hook useEffect has a missing dependency: 'navigate'. Either include it or remove the dependency array.eslint[react-hooks/exhaustive-deps](https://github.com/facebook/react/issues/14920) 에러가 잡히고 있네요..!


const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [isInputError, setInputError] = useState(false);

Choose a reason for hiding this comment

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

일반적으로는 isInputError 이라면
setIsInputError 가 컨벤션에 맞을 것 같습니다.

const [existingFiles, setExistingFiles] = useState<string[]>([]);
const [isModalOpen, setIsModalOpen] = useState(false);

const categoryOptions = ['연장 근무', '휴일 근무', '무급 휴가', '기타'];

Choose a reason for hiding this comment

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

컴포넌트 외부에 작성되어도 좋을 것 같습니다.

const [isModalOpen, setIsModalOpen] = useState(false);
const [userData, setUserData] = useState<UserType>();

const defaultImg = userDefaultSvg;

Choose a reason for hiding this comment

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

할당한 이유가 있을까요?

const dispatch = useAppDispatch();

const handleModalLogout = async () => {
await dispatch(fetchSignOut()).then((state) => {

Choose a reason for hiding this comment

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

await과 then이 혼용되고 있는데
await이 의미 없는 형태가 된 것 같습니다.

Copy link
Contributor

@kimisadev27 kimisadev27 Aug 12, 2024

Choose a reason for hiding this comment

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

await dispatch(fetchSignOut()) 이 코드만 사용하고 response 결과에 대해서 성공(fulfilled)일때 처리를 하고싶었는데, const result = await dispatch(fetchSignOut()) 이렇게 호출하면 result에서 requestStatus 에 대한 값을 찾지 못해서 이런 코드가 작성되었습니다..

async await를 삭제하고 그대로 사용할지
then을 지우고 성공결과를 체크할지 선택이 필요하겠군요!

const formattedValue = value
.replace(/[^0-9]/g, '')
.slice(0, 11)
.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');

Choose a reason for hiding this comment

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

함수명에서 핸드폰 번호 입력을 위함을 유추할 수 있지만
정규 표현식이 어떤 처리를 위함인지 변수로 관리해도 좋을 것 같습니다.

Icon,
iconPosition = 'right',
backgroundButton = false,
type = 'submit',

Choose a reason for hiding this comment

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

사용되지 않는 props입니다.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants