From 76e7535630b2dc393ccb8ce922cde34031bcbc77 Mon Sep 17 00:00:00 2001 From: novice1993 Date: Sun, 10 Sep 2023 12:50:41 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EA=B5=AC=EB=A7=A4=EC=88=98=EB=9F=89?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=A0=9C=ED=95=9C=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 최대 구매 가능수량 초과한 값으로는 구매량 설정 못하도록 하는 로직 다시 복구 - 관련한 알림창 띄우는 것보다 초기에 설정을 못하도록 셋팅을 해놓은 것이 더 낫다고 생각되어 다시 복구기로 결정함 - 해당 기능 삭제 후 CSS 관련된 일부 수정 작업이 이루어진 상황이라, Git Reset이 아닌 다시 Commit 남기는 방법을 선택함 Issues #17 --- .../StockOrderSection/VolumeSetteing.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/components/StockOrderSection/VolumeSetteing.tsx b/client/src/components/StockOrderSection/VolumeSetteing.tsx index 6eee754a..53cd06ed 100644 --- a/client/src/components/StockOrderSection/VolumeSetteing.tsx +++ b/client/src/components/StockOrderSection/VolumeSetteing.tsx @@ -1,3 +1,4 @@ +import { useEffect } from "react"; import { useSelector, useDispatch } from "react-redux"; import { styled } from "styled-components"; import { StateProps } from "../../models/stateProps"; @@ -26,7 +27,14 @@ const VolumeSetting = () => { const maximumBuyingVolume = Math.trunc(dummyMoney / orderPrice); const handlePlusOrderVolume = () => { - dispatch(plusStockOrderVolume()); + // 매수 -> 증가 버튼 클릭 시, 최대 구매수량 보다 낮으면 개수 1증가 + if (!orderType) { + orderVolume < maximumBuyingVolume && dispatch(plusStockOrderVolume()); + } + // 매도 -> 증가 버튼 클릭 시, 보유 주식수량 보다 낮으면 개수 1증가 + if (orderType) { + orderVolume < dummyholdingStock && dispatch(plusStockOrderVolume()); + } }; const handleMinusOrderVolume = () => { @@ -49,6 +57,13 @@ const VolumeSetting = () => { } }; + // 지정가 증가 -> (현재 주문수량 > 최대 주문가능 수량)일 경우 -> 현재 주문수량을 최대 주문수량으로 변경 + useEffect(() => { + if (maximumBuyingVolume < orderVolume) { + dispatch(setStockOrderVolume(maximumBuyingVolume)); + } + }, [maximumBuyingVolume]); + return (