11import ItemTokenList from '@/common/components/ItemTokenList' ;
22import PriceToken from '@/features/home/components/ItemCard/PriceToken' ;
3- import { Link } from 'react-router' ;
43import * as s from './style.css' ;
54import getImageUrl from '@/common/utils/getImageUrl' ;
65import { cx } from '@styled-system/css' ;
76import type { NotificationInterface } from '../../types' ;
87import { parsePickDate , parsePickTime } from '@/common/utils/parseDate' ;
8+ import { useToast } from '@/common/hooks/useToast' ;
9+ import { useNavigate } from 'react-router' ;
910
1011interface Props {
1112 data : NotificationInterface ;
@@ -19,6 +20,10 @@ const NotificationItemCard = ({ data }: Props) => {
1920 const isRemind = type === 'APPOINTMENT_RENTAL_REMIND' || type === 'APPOINTMENT_RETURN_REMIND' ;
2021 const remindDate =
2122 type === 'APPOINTMENT_RENTAL_REMIND' ? data . appointmentInfo . rentalDate : data . appointmentInfo . returnDate ;
23+ const isDeleted = data . itemInfo . isDeleted ;
24+ const { openToast } = useToast ( ) ;
25+ const navigate = useNavigate ( ) ;
26+ const title = data . itemInfo . title ;
2227
2328 const label = ( ( ) => {
2429 if ( type === 'APPOINTMENT_CANCEL' ) return '나의 Pick이 취소됐어요.' ;
@@ -39,11 +44,19 @@ const NotificationItemCard = ({ data }: Props) => {
3944 if ( type === 'APPOINTMENT_RENTAL_REMIND' ) return 'mgc_t_shirt_fill' ;
4045 if ( type === 'APPOINTMENT_RETURN_REMIND' ) return 'mgc_t_shirt_fill' ;
4146 if ( type === 'APPOINTMENT_CONFIRM' ) return 'mgc_emoji_fill' ;
42- if ( type === 'APPOINTMENT_SUCCESS' ) return 'hands_clapping_fill ' ;
47+ if ( type === 'APPOINTMENT_SUCCESS' ) return 'mgc_hands_clapping_fill ' ;
4348 } ) ( ) ;
4449
50+ const onClick = ( ) => {
51+ if ( isDeleted ) {
52+ openToast ( { message : '삭제된 게시글에 대한 PICK입니다.' } ) ;
53+ return ;
54+ }
55+ navigate ( `/pick-detail/${ data . appointmentInfo . id } ` ) ;
56+ } ;
57+
4558 return (
46- < div className = { s . Wrapper ( { isRemind } ) } >
59+ < div className = { s . Wrapper ( { isRemind, isDeleted } ) } >
4760 < div className = { s . RemindTime } >
4861 < div className = { s . Type } >
4962 < div className = { cx ( `${ icon } ` , s . Icon ( { icon } ) ) } />
@@ -56,11 +69,11 @@ const NotificationItemCard = ({ data }: Props) => {
5669 </ div >
5770 ) }
5871 </ div >
59- < Link className = { s . Container } to = { `/pick-detail/ ${ data . appointmentInfo . id } ` } >
72+ < button className = { s . Container } onClick = { onClick } >
6073 < img className = { s . Image } src = { getImageUrl ( data . itemInfo . thumbnail ) } aria-hidden />
6174 < div className = { s . Info } >
6275 < div className = { s . Header } >
63- < h2 className = { s . Title } > { data . itemInfo . title } </ h2 >
76+ < h2 className = { s . Title } > { title } </ h2 >
6477 < div className = { s . Price } >
6578 { isRental && < PriceToken price = { data . itemInfo . rentalFee } deposit = { data . itemInfo . deposit } /> }
6679 { isSale && < PriceToken price = { data . itemInfo . salePrice } /> }
@@ -91,7 +104,7 @@ const NotificationItemCard = ({ data }: Props) => {
91104 </ div >
92105 </ div >
93106 </ div >
94- </ Link >
107+ </ button >
95108 </ div >
96109 ) ;
97110} ;
0 commit comments