Skip to content
New issue

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

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

Already on GitHub? # to your account

[클린코드 리액트 3기 김양하] 페이먼츠 미션 Step2 #165

Open
wants to merge 16 commits into
base: ummaeha
Choose a base branch
from

Conversation

ummaeha
Copy link

@ummaeha ummaeha commented Apr 4, 2024

안녕하세요. 정혁 리뷰어님. 👋🏻
페이먼츠 미션2 목록기능 내 몇 가지 기능적 요구사항이 미구현 된 상태이긴한데,
일단 리뷰를 받고싶어서 PR을 올립니다.

(merge 컨플릭트는 왜나는걸까요.. ?? pr 생성후에 컨플릭트 한 번 해결 하겠습니다.)_
=> 해결 완료(원인: 대소문자 구분 설정하면서 이전파일과의 변동사항이 conflict처럼 됨)

PR내용 + 리뷰어에게 드리고 싶은 말
지난 코드리뷰 피드백 반영 요약

  • 콘솔로그 및 불필요 파일정리
  • 상수화 적용 > 폴더 분리
  • 대소문자 구분 관련 > git 옵션으로 대소문자 구분할 수 있도록 처리
  • 추가 리뷰사항 반영

추가 구현사항

  • 지난 미션 구현하면서 제가 미션을 잘못이해하고있던 비지니스로직을 다시 짰습니다.
  • 해당 과정에서 모달뷰 추가했고, 모달뷰 내 카드사 선택시 카드 정보 값에 추가될 수 있도록했습니다.
  • 카드추가단계 > UI 개선 못나니 css들을 조금 손봤습니다.
  • 지금 저장될때 카드에 설정한 닉네임이 이전값을 가지는데, 이 부분 아직 수정 못한 채로 리뷰 올립니당..
  • 이전에 코드들을 짤때 했던 고민들에 대한 주석은 commit 이력을 믿고 날렸습니다..조금 더 보기 좋은 코드가 되었는지 궁금합니다.

추가 필요한 내용

  • step에서 form에 input을 제 3자가 쉽게 사용할 수 있도록 훅으로 빼내보는것
  • 카드 닉네임 설정시 이전 값을 가지는 이슈 해결

++잡담
시간이 되신다면 끝나기전에 페어프로그래밍 시간을 한 번 더 갖고싶은데 가능하실까요 ~?

프리뷰
https://github.com/next-step/react-payments/assets/48500209/5961cfa7-e238-402c-b115-c1b198034281

Copy link

@zereight zereight left a comment

Choose a reason for hiding this comment

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

오 안녕하세요 양하님!

네네 DM으로 페어프로그램 가능하신 날짜와 시간대 알려주시면 시간맞춰보시죠~!

은행모달 css 예쁘네요 ㅋㅋ 좋습니당
코드도 깔끔하게 작성해주시려한게 보여요 감동..

ㅎㅎ 감동끊고 제가 찾은(?) 미구현된 사항 확인해주시면 감사하겠습니다!

  • 카드 소유자 이름 최대길이
  • 보안코드 최대길이
  • 카드별칭 최대길이
  • 카드목록에서 카드 클릭시 수정페이지로 이동하지 않음
  • 카드삭제
  • 카드를 여러개 추가하다보면 사라지는 목록에서 카드들이 생김
    • Map의 key값이 유니크한지 체크해볼 필요가 있겠네요

문의 주신사항

지금 저장될때 카드에 설정한 닉네임이 이전값을 가지는데, 이 부분 아직 수정 못한 채로 리뷰 올립니당..

RegistEndonClickButtonNextHandler 에서 문제가 있는거같아요.

  1. onClickButtonNextHandler 호출
  2. handleSetCardName 호출로 cardName 상태변경
  3. onNext 호출
  4. addMapElement 호출 이때 최신의 cardName을 가지고 수행할지는 신뢰할 수 없습니다.
    2~3 사이가 동기적으로 동작할까요?!

addMapElement가 어떻게 최신의 cardName을 알 수 있게 할 수 있을까요!!!

Comment on lines +52 to +63
{[...cardList].map(([key, value]) => (
<>
<CardBox
ownerName={value.ownerName}
expirationDate={value.expirationDate}
cardNumber={value.cardNumber}
theme={value.theme}
cardSelectionTypeName={value.cardSelectionTypeName}
/>
<div>{key}</div>
</>
))}
Copy link

Choose a reason for hiding this comment

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

음 key가 제대로 주어지지 않고 있는거같아요. 브라우저에서 console에러 확인해보시면 좋을거같습니다!

handleSetCardName={setCardName}
registCardInfo={registeredData}
onNext={() => {
addMapElement()
Copy link

Choose a reason for hiding this comment

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

함수이름을 바꿔보는건 어떨까요? cardList에 현재 카드정보를 추가하는 액션같은데요!

const [cardName, setCardName] = useState<string>('')
const [registeredData, setRegisteredData] = useState<RegisteredDataType>(INITIAL_CARD_STATE)
const [cardName, setCardName] = useState<string>(registeredData.cardSelectionTypeName)
const [cardList, setCardList] = useState<Map<string, RegisteredDataType>>(new Map())
Copy link

Choose a reason for hiding this comment

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

음 이름이 list인데 자료형이 Map이군요.. 읽는이로 하여금 헷갈릴거같습니다!

Comment on lines +13 to +15
const CardBox = <T,>(props: CardProps<T>) => {
const { ownerName, expirationDate, cardNumber, onClick, theme, cardSelectionTypeName } = props

Copy link

Choose a reason for hiding this comment

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

props로 받고 desctucting하는것보다 바로 descturct해서 가져오면 불필요한 line을 줄일 수 있을거같아요!

({ownerName, ex..} : CardProps<T>)

Comment on lines +11 to +19
export const Header = ({ children }: PropsWithChildren) => {
return <header>{children}</header>
}

export const Main = ({ className, children }: PropsWithChildren<MainProps>) => {
return <main className={className}>{children}</main>
}

export const Footer = ({ className, children }: PropsWithChildren<FooterProps>) => {
Copy link

Choose a reason for hiding this comment

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

불필요한 export같아요! 바깥에서 단독으로 쓰일일 없을거같아용

</button>
</BasicLayout.Header>
<BasicLayout.Main>
<CardBox<ThemeColorType>
Copy link

Choose a reason for hiding this comment

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

오잉 이렇게 제네릭으로 컴포넌트를 쓰는건 처음보네요.
아마 넣은 prop으로 자동추론이 될거같습니다!

}

return (
<>
Copy link

Choose a reason for hiding this comment

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

불필요한 Fragment같네용!

)
}

export default RegistCard
Copy link

Choose a reason for hiding this comment

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

요거 반복코드 줄일 수 있으면 정말 이쁠거같아요 👍

import CardBox from '../CardBox'

type RegistEndProps = {
registCardInfo: RegisterDataType
registCardInfo: RegisteredDataType
handleSetCardName: (value: string) => void
Copy link

Choose a reason for hiding this comment

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

ㅋㅋ 그냥 setCardName으로 prop받아도 될거같습니다!

Comment on lines +45 to +48
const [cardSelectionInfo, setCardSelectionInfo] = useState<CardItemType<ThemeColorType>>({
name: '',
theme: '',
})
Copy link

Choose a reason for hiding this comment

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

요거 초기값이랑 들어가는 값 보기 전까지, 어떤 값을 저장하는 상태인지 확 와닿지가 않았던거 같아요!
카드선택정보? -> 어떤정보지..?

결국에 타고타고 들어가서보니, 은행이었군요!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants