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

[가게 생성] 가게 생성/수정 리팩토링 #352

Merged
merged 15 commits into from
Jun 13, 2024

Conversation

kimeodml
Copy link
Contributor

@kimeodml kimeodml commented Jun 11, 2024

What is this PR? 🔍

Changes 📝

  • 토스에 useFunnel이라는 기능이 있어서 참고해서 만들어 놓았습니다.
    • 단계별로 진행하는 입력 폼일시 사용하면 좋을 것 같습니다.
  • 운영 시간을 제외하고는 react-hook-form의 useFormContext를 활용해서 진행하였습니다.

ScreenShot 📷

  • 이전과 동일

Test CheckList ✅

  • PC/Mobile에서 가게 생성 잘 되는 지 확인
  • PC/Mobile에서 가게 수정이 잘 되는 지 확인

Precaution

✔️ 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

@github-actions github-actions bot requested review from daepan and junghaesung79 June 11, 2024 06:02
@kimeodml kimeodml changed the title [가게 생성] 가게 생성 로직 수정 [가게 생성] 가게 생성/수정 리팩토링 Jun 11, 2024
Copy link
Contributor

@daepan daepan left a comment

Choose a reason for hiding this comment

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

많은 로직 걷어내시고 추가하시느라 고생하셨네요
몇가지 useEffect 사용과 관련되어서 의견 남겨놨습니다. 읽어보시고 답변주세요.
특히 useFunnel 추가해서 구현된 부분은 잘 정리해두면 좋을 것 같습니다.

Comment on lines -66 to -90
const openTimeArray = Object.values(openTimeState);
const closeTimeArray = Object.values(closeTimeState);
const shopClosedArray = Object.values(shopClosedState);

useEffect(() => {
const openValue = DAY_OF_WEEK.map((day, index) => ({
close_time: closeTimeArray[index],
closed: shopClosedArray[index],
day_of_week: day,
open_time: openTimeArray[index],
}));
setValue('image_urls', imageUrls);
setValue('category_ids', [categoryId]);
setValue('name', name);
setValue('address', address);
setValue('phone', phone);
setValue('delivery_price', Number(deliveryPrice));
setValue('description', description);
setValue('delivery', delivery);
setValue('pay_bank', payBank);
setValue('pay_card', payCard);
setValue('open', openValue);
}, [openTimeArray, closeTimeArray, shopClosedArray, categoryId, name,
address, phone, deliveryPrice, description, delivery, payBank, payCard, imageUrls]);

Copy link
Contributor

Choose a reason for hiding this comment

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

키야~

src/page/ShopRegistration/view/Mobile/Sub/index.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@junghaesung79 junghaesung79 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@kimeodml kimeodml merged commit 4073f48 into develop Jun 13, 2024
1 check passed
@github-actions github-actions bot deleted the feat/#278/refactoring_shop_register branch June 13, 2024 07:12
@kimeodml kimeodml restored the feat/#278/refactoring_shop_register branch August 14, 2024 10:56
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.

[가게 정보] 가게 정보 로직 수정
3 participants