From 50f1a2dd26663acd7cce5289cb31f3d97dd09a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=91=ED=98=84?= Date: Sat, 16 Sep 2023 04:13:35 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=EB=B3=B4=EC=9C=A0=EC=A2=85=EB=AA=A9=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EC=A3=BC=EC=8B=9D=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?api=EC=99=80=20=EB=B3=B4=EC=9C=A0=EC=A3=BC=EC=8B=9D=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20api=EB=A5=BC=20hook=EC=9C=BC=EB=A1=9C=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20=EB=B3=B4=EC=9C=A0=EC=A2=85=EB=AA=A9=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=9C=84=EB=8A=94=20=EC=A3=BC=EC=8B=9D=EC=A0=95?= =?UTF-8?q?=EB=B3=B4,=20=EC=95=84=EB=9E=98=EB=8A=94=20=EB=B3=B4=EC=9C=A0?= =?UTF-8?q?=EC=A3=BC=EC=8B=9D=20=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EA=B8=B0=EC=97=85=EB=A1=9C=EA=B3=A0=20=EB=8C=80?= =?UTF-8?q?=EC=8B=A0=20=EC=8A=A4=ED=86=A1=ED=99=80=EB=A6=84=20=EB=A1=9C?= =?UTF-8?q?=EA=B3=A0=EB=A1=9C=20=EB=8C=80=EC=B2=B4=20Issues=20#19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/asset/images/StockHolmImage.png | Bin 0 -> 20166 bytes .../src/components/EntireList/StockItem.tsx | 2 +- .../components/HoldingList/HoldingList.tsx | 84 ++++---- .../src/components/HoldingList/StockItem.tsx | 189 +++++++++++++----- client/src/components/watchlist/StockItem.tsx | 2 +- client/src/hooks/useGetStockholds.ts | 23 +++ 6 files changed, 205 insertions(+), 95 deletions(-) create mode 100644 client/src/asset/images/StockHolmImage.png create mode 100644 client/src/hooks/useGetStockholds.ts diff --git a/client/src/asset/images/StockHolmImage.png b/client/src/asset/images/StockHolmImage.png new file mode 100644 index 0000000000000000000000000000000000000000..9b1fb1edc765f356bf128666ab89fa660400d2bc GIT binary patch literal 20166 zcmZU319TFDLI_KrP|9$tr>%F~JbyXL; zYIp5*_U;p*C@+BkivtS=28JLdDXRR5OFqFC2I}*=^EOrt1_p0yB_g6IB_cwk=;UB- zWorfoCK-{U0j;SrhLNL_7#~0T1xE5)*EeFeU&%vn`2 zi)o0Vt;2>>hU;mec^lA{QJxpjv#V|ee|6c^=;nAazw)2Seo<&+X?p_8dkLUPILOxq zJBWfSx-}Att}C~KpJ(~iO9=KgZ{%={v}$#g(gPZ**5BdU9{wb-QXaO(e;Tw>GJrYi z0Y-F+WC1Yi^a;-b@8!55o&N$B4%>E^{3YVcOn{~aEPk*@(-#YxTYAW8)xBZx--90P zgK6N3g-&hrwqUGRLR^LMX$YRI{2~{`M^S@dma)H9b14o0Kh&T3i3R)$pt#ZqX3))x946ka>Y14b!EiKw7_RyfRyjeCT6B687x3?(6K3-4IQ$-pg5 zHZzG5;zShM0r{JndWTfl7VMTdfRgQVWFvS%J0TaYdKyiSQeOz|S_JS20jVR6zzrG+N&8hX z%HZJC&NGaqAq+>^AxCn~QTzN6OvkF3M0ATB!M`CK4%EX4*OCh2{j#=N)~ER#xPxSN zvFaSaNhLINC!~yoR;wGOLh4yZ?Ykiyk69A0BX~hiBdb_FlmxePqzc&AN(@{TEzb2& z`p!YDeu~(QCkoCE0|ieM#)m5Vg-dX8S#Jg5I+-Q^7hDk$F3hhaY35d9GedFsk*|th zfxjfdOhwKEq0Axkkj8u9rBVt}M{&~W@H7+Pa)h%HiG>I{(-5mr5Vd5W6!Jvx5zlp3 zJ!iLhSJCf4`uvn1?#Dm}_@-L&t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h$E#Qy2&5Ct_+2Dk@4op8S*WliOmL9cgC_9(!7GUKYqZwIa@y0DA{>o#l+~ z?IA5nGE*J*eau`mc5N3;%6ac-kV2^O`5j9RZ7=!fyFzTeH>GPj2Ol%rpL%&+zmn9N z-lXqij>A8IphBFY;yX%Uv$($KL(h~{7_ifOc3u{U`wiAHcfX@z`YpZ!3_@VZESr83T_5dZ$U>r;Gx=>JkL*DVcoG7<6Ix z@%#FZrK0oJ3(b-3o_Er^)Ofm^_D_11$BZP_=otTXY?Y!}qh+ap=dI0;gu$Z|NuxS1 z7x&g)+g!TvQFEQol&FwRk*=JAuBSBbPU&7~*w(e=;*Ut_?&EeU43^gy6GR@@35{a}T6NrOjckQVJ2_iP$x7P@JFm0^}z<(=p} zT2!N6O(@5;AcZe8Y!sqO8V=(;Wpzs-H4b$wEr|;894E!&1F5B>miJ?_!j603(6!sS zl|g41AtY2oB;l3WP5XULzYSoJR~DOLOcePSrd;^JK=o@*c;;Vp?eAZFKKIQY`Ttb= z(?;&fiDVNI_mdOC4AOL>OkShA>l;?owk4`T>3)0p<2mJoWt)!cF6A^e3pp%pB{{s zLKmU=PXE~s_oDsp>Gv@!r<9g%UJ-@AcJ36iIgLvzT8Wfw&(it7lktBX<2RG}#zr?R z#ZW#5pdzDMntD&kOKRqG;QNqFiUMC(Jf+II+ZRz@KS~t=_@*YB9)oJqb4QaN49c_l!S^|he@cuqp2qkr z1bhcRXWiKe!Q+8$&-Iz?8~T~m?Am)Ju3|GQ<=QuuoHUqmpvq3tc{j29_)>!g@$Uou z-_!47hVgWI%jeF_BBk?oRoMy3?r3zeaHbuVtePc;&-d~BuXm@pA71_cH~wM~TW_+; QQ2+n{07*qoM6N<$f~T>U;s5{u literal 0 HcmV?d00001 diff --git a/client/src/components/EntireList/StockItem.tsx b/client/src/components/EntireList/StockItem.tsx index fade936a..f06bb014 100644 --- a/client/src/components/EntireList/StockItem.tsx +++ b/client/src/components/EntireList/StockItem.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styled from 'styled-components'; -import logo from '../../asset/logos/SK_logo.png'; +import logo from '../../asset/images/StockHolmImage.png'; const StockItem: React.FC = ({ company, setShowChangePrice, showChangePrice }) => { const isPositiveChange = parseFloat(company.stockChangeRate) > 0; diff --git a/client/src/components/HoldingList/HoldingList.tsx b/client/src/components/HoldingList/HoldingList.tsx index c4bad0aa..b62bbe17 100644 --- a/client/src/components/HoldingList/HoldingList.tsx +++ b/client/src/components/HoldingList/HoldingList.tsx @@ -2,17 +2,16 @@ import React, { useState } from 'react'; import styled from 'styled-components'; import Header from './Header'; import StockItem from './StockItem'; +import useGetStockHolds from '../../hooks/useGetStockholds'; +import { StockItemProps } from './StockItem'; import useCompanyData from '../../hooks/useCompanyData'; -const WatchList: React.FC = ({ currentListType, onChangeListType }) => { +const HoldingList: React.FC = ({ currentListType, onChangeListType }) => { const [isMenuOpen, setMenuOpen] = useState(false); const [showChangePrice, setShowChangePrice] = useState(false); - // useCompanyData 훅 사용하여 데이터 가져오기 - const { data: companies, isLoading, isError } = useCompanyData(1, 14); - - // 'companies'가 'undefined'인 경우를 처리하기 위해 빈 배열로 초기화 - const companiesList = companies || []; + const { stockHolds, stockHoldsLoading: isLoading, stockHoldsError: isError } = useGetStockHolds(); + const { data: companyData, isLoading: isCompanyDataLoading, isError: isCompanyDataError } = useCompanyData(1, 14); return ( @@ -23,21 +22,24 @@ const WatchList: React.FC = ({ currentListType, onChangeListType setMenuOpen={setMenuOpen} /> - 평가 수익금: +5,000,000원 {/* 임의의 평가 수익금 */} + 평가 수익금: +5,000,000원 - {isLoading ? ( + {isLoading || isCompanyDataLoading ? (
Loading...
- ) : isError ? ( + ) : isError || isCompanyDataError ? (
Error fetching data
) : ( - companiesList.map((company) => ( - + stockHolds.map((stockHold: StockItemProps['stockData']) => ( + companyData ? ( + + ) : null )) )}
@@ -45,13 +47,13 @@ const WatchList: React.FC = ({ currentListType, onChangeListType ); }; -// Props와 상태에 대한 타입 정의 +export default HoldingList; + type WatchListProps = { currentListType: '전체종목' | '관심종목' | '보유종목'; onChangeListType: (type: '전체종목' | '관심종목' | '보유종목') => void; }; -// WatchList 컴포넌트에 대한 스타일드 컴포넌트 정의 const WatchListContainer = styled.div` display: flex; flex-direction: column; @@ -59,38 +61,34 @@ const WatchListContainer = styled.div` `; const Divider1 = styled.div` -margin:0px; -padding:0px; -width: 100%; -height: 10px; -display: flex; -flex-direction: row; -border-bottom: 1px solid #2f4f4f; + margin: 0px; + padding: 0px; + width: 100%; + height: 10px; + display: flex; + flex-direction: row; + border-bottom: 1px solid #2f4f4f; `; const Divider2 = styled.div` -margin:0px; -padding:0px; -width: 100%; -height: 4.5px; -display: flex; -flex-direction: row; -border-bottom: 1px solid #2f4f4f; + margin: 0px; + padding: 0px; + width: 100%; + height: 4.5px; + display: flex; + flex-direction: row; + border-bottom: 1px solid #2f4f4f; `; - - const EvaluationProfit = styled.div` -font-size: 16px; -font-weight: bold; -margin: 8px 0; -text-align: center; -color: red; // 수익금이 플러스일 경우 초록색으로 표시 + font-size: 16px; + font-weight: bold; + margin: 8px 0; + text-align: center; + color: red; `; const StockList = styled.div` width: 90%; - max-height: 800px; /* 스크롤이 발생할 최대 높이를 지정하세요 */ - overflow-y: auto; /* 세로 스크롤을 활성화합니다 */ + max-height: 800px; + overflow-y: auto; `; - -export default WatchList; diff --git a/client/src/components/HoldingList/StockItem.tsx b/client/src/components/HoldingList/StockItem.tsx index fade936a..7f1aab0e 100644 --- a/client/src/components/HoldingList/StockItem.tsx +++ b/client/src/components/HoldingList/StockItem.tsx @@ -1,57 +1,95 @@ import React from 'react'; import styled from 'styled-components'; -import logo from '../../asset/logos/SK_logo.png'; +import logo from '../../asset/images/StockHolmImage.png'; -const StockItem: React.FC = ({ company, setShowChangePrice, showChangePrice }) => { - const isPositiveChange = parseFloat(company.stockChangeRate) > 0; - const priceColor = isPositiveChange ? 'red' : 'blue'; - - return ( - - - - {company.korName} - {company.code} - - - {company.stockPrice} - setShowChangePrice(true)} - onMouseLeave={() => setShowChangePrice(false)} - > - {showChangePrice ? `${company.stockChangeAmount}%` : `${company.stockChangeRate}%`} - - - - ); +export type StockItemProps = { + stockData: { + stockHoldId: number; + memberId: number; + companyId: number; + companyKorName: string; + stockCount: number; + totalPrice: number; + percentage: number; + stockReturn: number; + reserveSellStockCount: number; + }; + companyData?: { + companyId: number; + code: string; + korName: string; + stockPrice: string; + stockChangeAmount: string; + stockChangeRate: string; +}[]; + setShowChangePrice: (value: boolean) => void; + showChangePrice: boolean; }; -type NewCompanyData = { - companyId: number; - code: string; - korName: string; - stockPrice: string; - stockChangeAmount: string; - stockChangeRate: string; -}; -type StockItemProps = { - company: NewCompanyData; - setShowChangePrice: React.Dispatch>; - showChangePrice: boolean; + +const StockItem: React.FC = ({ companyData, stockData, setShowChangePrice, showChangePrice }) => { + const { stockCount, reserveSellStockCount, totalPrice, percentage, stockReturn } = stockData; + const totalStocksHeld = stockCount + reserveSellStockCount; + const company = companyData ? companyData[0] : undefined; + + const { + code = '', + korName = '', + stockPrice='', + stockChangeAmount = '', + stockChangeRate = '' + } = company || {}; + + // Format percentage to two decimal places + const formattedPercentage = parseFloat(percentage.toFixed(2)); + + + return ( + <> + + + + {korName} + {code} + + + {stockPrice.toLocaleString()} 원 + setShowChangePrice(true)} + onMouseLeave={() => setShowChangePrice(false)} + > + {showChangePrice ? stockChangeAmount.toLocaleString() : `${stockChangeRate}%`} + + + + + + 수익 + 보유 + + + {stockReturn.toLocaleString()} 원 + {totalPrice.toLocaleString()} 원 + + + {formattedPercentage}% + {totalStocksHeld}주 + + + + + ); }; -const StockItemWrapper = styled.div` +const ItemContainer = styled.div` display: flex; - flex-direction: row; /* 수평으로 정렬 */ - justify-content: flex-start; /* 왼쪽 정렬 */ - align-items: flex-start; /* 위로 정렬 */ - padding: 8px 0; - border-bottom: 1px solid #e0e0e0; + justify-content: space-between; + align-items: center; width: 100%; - background-color: transparent; - cursor: pointer; + padding: 8px 0; + border-bottom: 1px solid #e0e0e0; // Holdings에서의 스타일 추가 `; const Logo = styled.img` @@ -80,16 +118,67 @@ const StockPriceSection = styled.div` display: flex; flex-direction: column; align-items: flex-start; - margin-left: auto; /* 자동으로 왼쪽 여백 추가 */ `; -const StockPrice = styled.span<{ change: string }>` - color: ${(props) => props.change}; -`; +const getColorByChange = (change: string) => { + if (change.startsWith('')) return 'red'; + if (change.startsWith('-')) return 'blue'; + return 'black'; +}; + +const StockPrice = styled.span.attrs<{ change: string }>(({ change }) => ({ + style: { + color: getColorByChange(change), + }, +}))``; -const StockChange = styled.span<{ change: string }>` - color: ${(props) => props.change}; +const StockChange = styled.span.attrs<{ change: string }>(({ change }) => ({ + style: { + color: getColorByChange(change), + }, +}))` cursor: pointer; `; +const StockDetails = styled.div` + display: flex; + justify-content: space-between; + padding: 8px 0; + width: 100%; +`; + +const DetailSection = styled.div` + display: flex; + flex-direction: column; + align-items: center; +`; + +const DetailTitle = styled.span` + font-weight: light; + font-size : 14px; +`; + +const DetailData = styled.span` + font-size: 14px; // Setting standardized font size for all data +`; + +const getColorByValue = (value: string) => { + if (value.startsWith('')) return 'red'; + if (value.startsWith('-')) return 'blue'; + return 'black'; +}; + +const ColoredDetailData = styled.span.attrs<{ value: string }>(({ value }) => ({ + style: { + color: getColorByValue(value), + }, +}))` + font-size: 14px; // Setting standardized font size for all data +`; + +const ThickDivider = styled.div` + height: 3px; + background-color: #aaa; + margin: 8px 0; +`; export default StockItem; diff --git a/client/src/components/watchlist/StockItem.tsx b/client/src/components/watchlist/StockItem.tsx index fade936a..f06bb014 100644 --- a/client/src/components/watchlist/StockItem.tsx +++ b/client/src/components/watchlist/StockItem.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styled from 'styled-components'; -import logo from '../../asset/logos/SK_logo.png'; +import logo from '../../asset/images/StockHolmImage.png'; const StockItem: React.FC = ({ company, setShowChangePrice, showChangePrice }) => { const isPositiveChange = parseFloat(company.stockChangeRate) > 0; diff --git a/client/src/hooks/useGetStockholds.ts b/client/src/hooks/useGetStockholds.ts new file mode 100644 index 00000000..d5f3179b --- /dev/null +++ b/client/src/hooks/useGetStockholds.ts @@ -0,0 +1,23 @@ +import { useQuery } from "react-query"; +import axios from "axios"; + +const useGetStockHolds = () => { + const { data, isLoading, error } = useQuery("stockHolds", getStockHolds, {}); + + return { stockHolds: data, stockHoldsLoading: isLoading, stockHoldsError: error }; +}; + +export default useGetStockHolds; + +// 서버에서 StockHolds 목록 fetch 하는 함수 +const getStockHolds = async () => { + const token = localStorage.getItem('Authorization'); // 로컬 스토리지에서 토큰 가져오기 + const res = await axios.get("http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com:8080/stock/stockholds", { + headers: { + 'Authorization': token + } + }); + const stockHoldsList = await res.data; + + return stockHoldsList; +};