diff --git a/src/pages/match/components/match-tab-pannel.tsx b/src/pages/match/components/match-tab-pannel.tsx index 0da161f9..94182a26 100644 --- a/src/pages/match/components/match-tab-pannel.tsx +++ b/src/pages/match/components/match-tab-pannel.tsx @@ -5,10 +5,16 @@ import { getColorType } from '@components/card/match-card/utils/get-color-type'; import EmptyState from '@components/ui/empty-state'; import { cn } from '@libs/cn'; import { CLICKABLE_STATUS_MAP } from '@pages/match/constants/matching'; -import { getCardColor, statusToCategory } from '@pages/match/utils/match-status'; +import { + getCardColor, + getPendingToast, + isClickable, + statusToCategory, +} from '@pages/match/utils/match-status'; import { ROUTES } from '@routes/routes-config'; import { useMutation } from '@tanstack/react-query'; import { useNavigate } from 'react-router-dom'; +import { showErrorToast } from '@/shared/utils/show-error-toast'; type MatchableCardProps = SingleCardProps | GroupCardProps; @@ -26,6 +32,12 @@ const MatchTabPanel = ({ cards, filter }: MatchTabPanelProps) => { filter === '전체' ? cards : cards.filter((card) => statusToCategory(card.status) === filter); const handleCardClick = async (card: MatchableCardProps) => { + const toastMsg = getPendingToast(card.status, card.type); + if (toastMsg) { + showErrorToast(toastMsg, '8.6rem', false); + return; + } + const query = CLICKABLE_STATUS_MAP[card.status ?? '']; if (!query) return; @@ -39,10 +51,6 @@ const MatchTabPanel = ({ cards, filter }: MatchTabPanelProps) => { } }; - const isClickable = (status?: string) => { - return Boolean(CLICKABLE_STATUS_MAP[status ?? '']); - }; - return (
{filteredCards.length === 0 ? ( @@ -56,10 +64,11 @@ const MatchTabPanel = ({ cards, filter }: MatchTabPanelProps) => {