diff --git a/src/assets/icons/noWine.svg b/src/assets/icons/noWine.svg new file mode 100644 index 00000000..495c991d --- /dev/null +++ b/src/assets/icons/noWine.svg @@ -0,0 +1,6 @@ + diff --git a/src/components/my-profile/Empty.tsx b/src/components/my-profile/Empty.tsx new file mode 100644 index 00000000..f3f82ec6 --- /dev/null +++ b/src/components/my-profile/Empty.tsx @@ -0,0 +1,33 @@ +import React from 'react'; + +import Link from 'next/link'; + +import NoReviewIcon from '@/assets/icons/noReview.svg'; +import NoWineIcon from '@/assets/icons/noWine.svg'; +import { Button } from '@/components/ui/button'; + +interface MyPageEmptyProps { + type: 'reviews' | 'wines'; +} + +/** + * 내 프로필 페이지에서 데이터가 없을 때 표시되는 공통 Empty 컴포넌트 + * - type: 'reviews' | 'wines' (내가 쓴 후기 / 내가 등록한 와인) + * - 리뷰는 '와인 보러가기' 링크 + * - 와인은 와인 등록 버튼 + */ +export default function MyPageEmpty({ type }: MyPageEmptyProps) { + const isReview = type === 'reviews'; + + return ( +
불러오는 중…
; if (isError) return불러오기 실패
; - if (!data) return리뷰 데이터가 없습니다.
; - // 리뮤 목록 평탄화 + // 리뷰 목록 평탄화 const reviews: MyReview[] = data?.pages?.flatMap((page) => page.list ?? []) ?? []; + if (!data || data.pages[0].list.length === 0) { + return와인 불러오는 중…
; if (isError || !data) return와인 불러오기 실패
; // 와인 목록 평탄화 const wines: MyWine[] = data?.pages?.flatMap((page) => page?.list ?? []) ?? []; + if (!data || data.pages[0].list.length === 0) { + return