@@ -3,9 +3,11 @@ import { useEffect, useRef, useState } from 'react';
33import { useLocation , useNavigate } from 'react-router-dom' ;
44import { MARKET_CODES } from '@ts/Constants' ;
55import useAuthInfo from '@hooks/useAuthInfo' ;
6+ import { useQueryComponent } from '@hooks/useQueryComponent' ;
67import { webPath } from '@router/index' ;
78import Button from '@components/Common/Button' ;
89import { useBuyExperimentMutation } from '@controllers/experiment/query' ;
10+ import { useScoreQuery } from '@controllers/stocks/query' ;
911import { StockDetailInfo } from '@controllers/stocks/types' ;
1012import KoreaPNG from '@assets/flags/korea.png' ;
1113import OverseaPNG from '@assets/flags/oversea.png' ;
@@ -16,11 +18,14 @@ import {
1618 SearchTitleHeaderContainer ,
1719 SearchTitleHeaderText ,
1820 SearchTitleHeaderTextAnimated ,
21+ SearchTitlePrice ,
22+ SearchTitlePriceWrapper ,
23+ SearchTitleScoreBadge ,
1924} from './SearchTitle.Style' ;
2025
2126const BASE_DELAY = 1500 ;
2227
23- const SearchTitleName = ( { stockInfo : { symbolName, country, price } } : { stockInfo : StockDetailInfo } ) => {
28+ const SearchTitleName = ( { stockInfo : { symbolName, country, price, stockId } } : { stockInfo : StockDetailInfo } ) => {
2429 const { state } = useLocation ( ) ;
2530
2631 const titleTextRef = useRef < HTMLDivElement > ( null ) ;
@@ -32,6 +37,7 @@ const SearchTitleName = ({ stockInfo: { symbolName, country, price } }: { stockI
3237 instant : BASE_DELAY ,
3338 } ) ;
3439 const [ animation , cycleAnimation ] = useCycle ( ...Object . keys ( animationDelay ) ) ;
40+ const [ stockScore , suspend ] = useQueryComponent ( { query : useScoreQuery ( stockId , country ) } ) ;
3541 const concurrency = country === 'KOREA' ? '₩' : '$' ;
3642 useEffect ( ( ) => {
3743 if ( titleTextRef . current ) {
@@ -83,10 +89,17 @@ const SearchTitleName = ({ stockInfo: { symbolName, country, price } }: { stockI
8389 </ SearchTitleHeaderTextAnimated >
8490 </ AnimatePresence >
8591 </ SearchTitleHeaderText >
86- < p className = "price" >
87- { concurrency }
88- { price . toLocaleString ( ) }
89- </ p >
92+ < SearchTitlePriceWrapper >
93+ < SearchTitlePrice >
94+ { concurrency }
95+ { price . toLocaleString ( ) }
96+ </ SearchTitlePrice >
97+ { ! suspend && stockScore && (
98+ < SearchTitleScoreBadge >
99+ < p > 인간지표 { stockScore . score } 점</ p >
100+ </ SearchTitleScoreBadge >
101+ ) }
102+ </ SearchTitlePriceWrapper >
90103 </ SearchTitleHeaderContainer >
91104 ) ;
92105} ;
0 commit comments