[Feature/promotion-code] 프로모션 코드 다중 프로그램 지원 및 예약 결제 할인 표시 정리#197
[Feature/promotion-code] 프로모션 코드 다중 프로그램 지원 및 예약 결제 할인 표시 정리#197
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces support for multiple program IDs for influencers and promotion codes, updating the admin UI to manage these associations and refining the reservation summary logic to correctly calculate and display promotion discounts. The reviewer recommends simplifying the paymentAmountText logic, extracting currency-specific discount calculations into a shared utility function to improve maintainability, and debouncing the program ID input in the admin panel to enhance performance.
I am having trouble creating individual review comments. Click here to see my feedback.
src/pages/reservations/index.tsx (1002-1006)
The logic for paymentAmountText can be simplified. Since baseSummaryPrice.originalPriceText already represents the program's price before any base discounts (or the regular price if no base discount exists), and appliedPromotion.originalPrice should match the program's regular price when there is no base discount, baseSummaryPrice.originalPriceText can be used directly in all cases.
const paymentAmountText = baseSummaryPrice.originalPriceText;
src/pages/reservations/index.tsx (993-997)
The logic for calculating the discount amount based on currency (rounding for KRW vs. 2 decimal places for USD) is duplicated here and likely in other parts of the application (like the verifiedPromotionDiscountAmount calculation). Consider creating a shared utility function for this calculation to ensure consistency and improve maintainability.
src/pages/admin/influencers/index.tsx (115-128)
The uniqueProgramIds calculation and subsequent programQueries will re-run on every keystroke as the user types in the program_ids_input field. While React Query's caching helps, this still causes unnecessary re-renders and array mapping. Consider debouncing the promoForm.program_ids_input value before using it to derive uniqueProgramIds to improve performance during input.
📝 관련 문서 레퍼런스
💻 주요 변경 사항은 무엇인가요?
📚 추가된 라이브러리
📱 결과 화면 (선택)
🙇 코드 리뷰 중점사항, 예상되는 문제점 (선택)