Skip to content

Conversation

@GleamingStar
Copy link

현재까지의 작업 상황

  • View & OAuth 구현 지난 PR
  • 진루 애니메이션 구현
  • OAuth 인증을 담당하는 Home.jsx 컴포넌트 추가
  • useContext 추가, component/Main.jsx에서 활용
  • BE의 API를 호출해 컴포넌트 렌더링

API

앞으로 작업할 것

  • 백엔드에게 투구 결과 POST
  • 1회 초 부터 게임 진행
  • 리팩토링을 통한 useReducer 적용 및 useContext 심화 활용

진루 애니메이션

GIF 2021-05-11 오후 6-09-28

Home

image
image

Dae-Hwa and others added 30 commits May 3, 2021 14:48
[FE] 글로벌 백그라운드 이미지 삽입 및 포지셔닝
resolve #21
인트로 하위 컴포넌트인 TeamSelect, Game 추가

react-router-dom 설치
[FE] Intro 컴포넌트 완료
[FE] : Pitch 결과 산출 함수 추가
Main을별개의 컴포넌트로 만들까? 구디에게 물어볼 것
InGame 어두워 지는 효과도 구현, LineUp 구현 때 재활용 가능할 듯
표 부분 fetch 및 parse 기능 제외한 스타일만 구현
[FE] 가운데 정렬 및 ScoreBoard 컴포넌트 일부 구현
@crongro crongro self-assigned this May 11, 2021
@crongro crongro self-requested a review May 11, 2021 11:09
Copy link

@crongro crongro left a comment

Choose a reason for hiding this comment

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

열코하셨군요~
노력의 흔적이 보여서 좋았네요.
리뷰 참고하세요~

const { loginStatus, setLoginStatus, userId, setUserId } = useContext(MainContext);

const handleOnClick = async (provider) => {
const res = await socialMediaAuth(provider);
Copy link

Choose a reason for hiding this comment

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

코드 들여쓰기가 꽤 깊네요?

const { loginStatus, setLoginStatus, userId, setUserId } = useContext(MainContext);

const handleOnClick = async (provider) => {
const res = await socialMediaAuth(provider);
Copy link

Choose a reason for hiding this comment

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

비동기 코드 구현시 습관적으로 try/catch 처리를 해보시면 좋겠어요.
catch 에서는 사용자에게 적절한 메시지를 보여주면 좋겠고요.(console로 노출하는것 말고, 별도 뷰에서 메시지를 노출)


const handleOnClick = async (provider) => {
const res = await socialMediaAuth(provider);
if (res) {
Copy link

Choose a reason for hiding this comment

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

res 가 true/false로 오나요? 아니면 res.ok 값이 혹시 있는건 아니죠?

}
};
const getOnlyId = (email) => {
const arr = email.split("@");
Copy link

Choose a reason for hiding this comment

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

arr은 맥락이 없는 이름이네요. 좀더 구체적인 이름으로.

id를 뽑는 것이면 getId라고만 해도 될 듯.
또는 이렇게 파라미터까지 이어져서 풀네이밍이 되도록~

const getIdBy = (email) => {}

</Link>
<Login>
{loginStatus ? (
<></>
Copy link

Choose a reason for hiding this comment

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

삼항연산자보다 && 를 사용하면 더 간단해질 듯 합니다.

Comment on lines +83 to +88
const baseLocation = [
{ base: 0, top: "560px", left: "492px" },
{ base: 1, top: "318px", left: "631px" },
{ base: 2, top: "144px", left: "407px" },
{ base: 3, top: "357px", left: "253px" },
];
Copy link

Choose a reason for hiding this comment

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

이렇게 객체로 정의해서 관리하는 것은 좋네요.

Copy link

Choose a reason for hiding this comment

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

top, left 값이 어떤 공식에 의해서 결정되면 매우 훌륭할텐데 말이죠.
(가능한지 모름)

const { gameId, teamId, loginStatus } = useContext(MainContext);

const [data, setData] = useState();
const reloadData = async () => {
Copy link

Choose a reason for hiding this comment

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

이 코드는 useEffect 안으로 옮겨서 선언해도 될 듯.

Comment on lines +19 to +20
toggle(true);
setDark(true);
Copy link

Choose a reason for hiding this comment

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

toggle과 dark가 fetching이후에 처리되는거 맞죠?

Comment on lines +16 to +17
console.log("fetch error in TeamSelect : ", error);
setAlertMessage("게임 목록을 불러올 수 없습니다")
Copy link

Choose a reason for hiding this comment

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

에리 처리 좋고요.
실제로 에러 상황을 재현해서 테스트도 해보세요.

);
};

const RouterComponent = () => (
Copy link

Choose a reason for hiding this comment

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

요렇게 하시면 더 좋을 듯.

state가 변경될때, Main컴포넌트 하위에 있는 컴포넌트들 중에 context의 상태에 의존하지 않는 컴포넌트들은,
불필요하게 re-rendering 이 되지 않습니다.

const Main = () => {
    <MainContextProvider> 
       <switch><route></route>.....</switch>
   </MainContextProvider>
}

const MainContexProvider = (props) => {
    const [gameId, setGameId] = useState();
	const [teamId, setTeamId] = useState();
	const [loginStatus, setLoginStatus] = useState(false);
	const [userId, setUserId] = useState();
	return (
		<MainContext.Provider value={{ gameId, setGameId, teamId, setTeamId, loginStatus, setLoginStatus, userId, setUserId }}>
			<StyledMain>
				{props.children}
			</StyledMain>
		</MainContext.Provider>
	);
}

@crongro crongro merged commit cc61d3d into codesquad-members-2021:Ah-puh May 11, 2021
@GleamingStar GleamingStar deleted the FE/dev branch May 12, 2021 05:31
ehgud0670 pushed a commit that referenced this pull request May 14, 2021
ksundong pushed a commit that referenced this pull request May 16, 2021
useFetch _ useState 관리 상태 1개로 정리.
ehgud0670 pushed a commit that referenced this pull request May 17, 2021
- ViewDidAppear 시점에서 layer 구성하도록 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants