File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,15 +47,13 @@ const HomeTabBar: React.FC<HomeTabBarProps> = ({ onOpenBottomSheet }) => {
4747 const handleSwiperChange = ( swiper : SwiperCore ) => {
4848 // 매칭 요청이 없고 1번 index에 있을 때 0번 탭 비활성화
4949 if ( ! hasMatchingRequests && swiper . activeIndex === 1 ) {
50+ console . log ( 1 ) ;
5051 swiper . allowSlidePrev = false ;
5152 setActiveIndex ( swiper . activeIndex ) ;
5253 }
53- // 매칭 요청이 없고 0번 index에 있을 때 1번 탭으로 이동
54- else if ( ! hasMatchingRequests && swiper . activeIndex === 0 ) {
55- swiper . slideNext ( ) ;
56- }
5754 // 매칭 요청이 있을 때 양쪽 스와이퍼 가능
5855 else {
56+ console . log ( 3 ) ;
5957 swiper . allowSlidePrev = true ;
6058 setActiveIndex ( swiper . activeIndex ) ;
6159 }
@@ -123,7 +121,13 @@ const HomeTabBar: React.FC<HomeTabBarProps> = ({ onOpenBottomSheet }) => {
123121 < SwiperSlide
124122 style = { { height : 'auto' , visibility : hasMatchingRequests && isMatchingReady ? 'visible' : 'hidden' } }
125123 >
126- < Matching tooltipRef = { cardRef } />
124+ < Matching
125+ tooltipRef = { cardRef }
126+ swipeToOOTD = { ( ) => {
127+ setHasMatchingRequests ( false ) ;
128+ swiperRef . current ?. slideNext ( ) ;
129+ } }
130+ />
127131 </ SwiperSlide >
128132 < SwiperSlide style = { { height : 'auto' } } >
129133 < OOTD tooltipRef = { ootdTooltipRef } onMoreClick = { onOpenBottomSheet } />
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ interface Relationship {
1010 requestStatus : string ; // 추가된 필드
1111}
1212
13- const Matching : React . FC < { tooltipRef : React . MutableRefObject < HTMLDivElement | null > } > = ( { tooltipRef } ) => {
13+ interface MatchingProps {
14+ tooltipRef : React . MutableRefObject < HTMLDivElement | null > ;
15+ swipeToOOTD : ( ) => void ;
16+ }
17+
18+ const Matching : React . FC < MatchingProps > = ( { tooltipRef, swipeToOOTD } ) => {
1419 const [ matchingCount , setMatchingCount ] = useState < number > ( 0 ) ;
1520
1621 useEffect ( ( ) => {
@@ -33,7 +38,11 @@ const Matching: React.FC<{ tooltipRef: React.MutableRefObject<HTMLDivElement | n
3338
3439 // 매칭 요청이 제거되었을 때 호출되는 함수
3540 const handleRemoveMatching = ( ) => {
36- setMatchingCount ( ( prevCount ) => Math . max ( 0 , prevCount - 1 ) ) ;
41+ if ( matchingCount !== 1 ) {
42+ setMatchingCount ( ( prevCount ) => Math . max ( 0 , prevCount - 1 ) ) ;
43+ } else {
44+ swipeToOOTD ( ) ;
45+ }
3746 } ;
3847
3948 return (
You can’t perform that action at this time.
0 commit comments