diff --git a/client/src/components/CentralChart/CompareChartBtn.tsx b/client/src/components/CentralChart/CompareChartBtn.tsx index 335bdc72..328ba751 100644 --- a/client/src/components/CentralChart/CompareChartBtn.tsx +++ b/client/src/components/CentralChart/CompareChartBtn.tsx @@ -29,11 +29,8 @@ const CompareChartBtn = () => { {compare && ( - {companyList?.map((company) => { - const corpName = company.korName; - const companyId = company.companyId; - - return ; + {companyList?.map(({ korName, companyId }) => { + return ; })} diff --git a/client/src/components/CentralChart/CompareList.tsx b/client/src/components/CentralChart/CompareList.tsx index 4345ab3e..c842fc79 100644 --- a/client/src/components/CentralChart/CompareList.tsx +++ b/client/src/components/CentralChart/CompareList.tsx @@ -10,10 +10,9 @@ const CompareList = (props: OwnProps) => { const currentCompanyid = useSelector((state: StateProps) => state.companyId); const handleSelectCompareStock = () => { - if (currentCompanyid === compareCompanyId) { - return; + if (currentCompanyid !== compareCompanyId) { + dispatch(setCompareStock(compareCompanyId)); } - dispatch(setCompareStock(compareCompanyId)); }; return {corpName}; diff --git a/client/src/components/MarketComponents/MarketKospiChart.tsx b/client/src/components/MarketComponents/MarketKospiChart.tsx index b13142e2..aa337988 100644 --- a/client/src/components/MarketComponents/MarketKospiChart.tsx +++ b/client/src/components/MarketComponents/MarketKospiChart.tsx @@ -2,7 +2,8 @@ import * as echarts from "echarts"; import { styled } from "styled-components"; import { useState, useEffect } from "react"; import { useQuery } from "react-query"; -import { getKospiData } from "../../hooks/useGetKospiChart.ts"; +import axios from "axios"; + const MarketkospiChart = () => { const [kospiData, setKospiData] = useState([]); @@ -117,6 +118,14 @@ const MarketkospiChart = () => { export default MarketkospiChart; +const getKospiData = async () => { + const res = await axios.get("http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com/kospi"); + const chartData = res.data.output2; + const kospiData = chartData.reverse(); + + return kospiData; +}; + interface KospiProps { acml_tr_pbmn: string; acml_vol: string; diff --git a/client/src/components/StockOrderSection/CancelConfirm.tsx b/client/src/components/StockOrderSection/CancelConfirm.tsx index c607e544..82aefdf4 100644 --- a/client/src/components/StockOrderSection/CancelConfirm.tsx +++ b/client/src/components/StockOrderSection/CancelConfirm.tsx @@ -5,9 +5,12 @@ import { toast } from "react-toastify"; import { StateProps } from "../../models/stateProps"; import useDeleteStockOrder from "../../hooks/useDeleteStockOrder"; import { dummyLogo } from "../../dummy/dummyLogo"; +import { priceUnit, volumeUnit } from "../../constant/constant"; -const priceUnit: string = "원"; -const volumeUnit: string = "주"; +const directionType = { + Up: "Up", + Down: "Down", +}; const CancelConfirm = (props: CancelConfirmProps) => { const { corpName, orderType, orderPrice, orderVolume, orderId, setCancle } = props; @@ -16,24 +19,22 @@ const CancelConfirm = (props: CancelConfirmProps) => { const companyId = useSelector((state: StateProps) => state.companyId); const deleteOrder = useDeleteStockOrder(); - const orderCancleText: string = "취소"; + const cancelText: string = "취소"; const orderPriceText: string = "주문단가"; const cancleVolumeText: string = "취소수량"; const maximumCancleVolumeText01: string = "최대"; - const maximumCancleVolumeText02: string = "주"; const totalCancleAmountText: string = "총 취소금액"; const closeButtonText: string = "닫기"; const confirmButtonText: string = "확인"; - const toastText01: string = "취소"; - const toastText02: string = " 처리가 완료되었습니다"; + const toastText: string = " 처리가 완료되었습니다"; const price = orderPrice.toLocaleString(); const totalPrice = (orderPrice * cancleVolume).toLocaleString(); const handleChangeCancleVolume = (direction: string) => { - if (direction === "Up") { + if (direction === directionType.Up) { cancleVolume < orderVolume && setCancleVolume((previousState) => previousState + 1); } - if (direction === "Down") { + if (direction === directionType.Down) { 0 < cancleVolume && setCancleVolume((previousState) => previousState - 1); } }; @@ -83,9 +84,9 @@ const CancelConfirm = (props: CancelConfirmProps) => {