diff --git a/docker-compose.yml b/docker-compose.yml index 3fe5001..080a229 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: react-app: build: diff --git a/src/components/common/ListCard/index.tsx b/src/components/common/ListCard/index.tsx index 259b6c1..bb1b5db 100644 --- a/src/components/common/ListCard/index.tsx +++ b/src/components/common/ListCard/index.tsx @@ -5,7 +5,7 @@ import { Props } from './ListCard.types'; export const ListCard = forwardRef(({ children, ...props }, ref) => { return (
diff --git a/src/components/common/Typography/index.tsx b/src/components/common/Typography/index.tsx index 5134f89..be21810 100644 --- a/src/components/common/Typography/index.tsx +++ b/src/components/common/Typography/index.tsx @@ -1,5 +1,7 @@ import { cva, type VariantProps } from 'class-variance-authority'; +import { cn } from '@/lib/core'; + import { Props, TypographyVariant } from './Typography.types'; const variantClasses = cva('whitespace-pre-wrap select-none', { @@ -37,10 +39,8 @@ const Typography = ({ className, ...props }: Props & TypographyVariants) => { - const classes = variantClasses({ type: variant, weight, className }); - return ( -

+

{children}

); diff --git a/src/components/features/BookmarkDetail/BookmarkDetail.tsx b/src/components/features/BookmarkDetail/BookmarkDetail.tsx index 303dd70..49772ee 100644 --- a/src/components/features/BookmarkDetail/BookmarkDetail.tsx +++ b/src/components/features/BookmarkDetail/BookmarkDetail.tsx @@ -8,6 +8,7 @@ import { Body1, Body2, Body4 } from '@/components/common/Typography'; import { markersAtom } from '@/contexts/MarkerAtom'; import { useMarkerList } from '@/hooks/api/marker/useMarkerList'; import { useAuth } from '@/hooks/auth/useAuth'; +import { Category } from '@/types/naver'; type Props = { bookmarkId: number; onPrev: () => void }; export const BookmarkDetail = ({ bookmarkId, onPrev }: Props) => { @@ -46,8 +47,12 @@ export const BookmarkDetail = ({ bookmarkId, onPrev }: Props) => {
{item.title} - {typeof item.category === 'object' && ( - {item.category.majorCategory} + {item.category && ( + + {typeof item.category === 'object' + ? (item.category as Category).majorCategory + : item.category} + )}
diff --git a/src/components/features/BottomSheetContent/BottomSheetContent.tsx b/src/components/features/BottomSheetContent/BottomSheetContent.tsx index 71de4a9..8d15226 100644 --- a/src/components/features/BottomSheetContent/BottomSheetContent.tsx +++ b/src/components/features/BottomSheetContent/BottomSheetContent.tsx @@ -1,11 +1,11 @@ import { FlowType } from '@/constants/funnelStep'; +import { ExtractResponse } from '@/hooks/api/link/useYoutubePlace'; import { useBottomFunnel } from '@/hooks/common/useBottomFunnel'; import { BottomSheetContentProps } from './types'; -import { YoutubeResponse } from '../../../hooks/api/link/useYoutubePlace'; import { Place } from '../../../types/naver'; export const BottomSheetContent = ({ type, data }: BottomSheetContentProps) => { - return useBottomFunnel({ type: type as FlowType, data: data as Place[] | YoutubeResponse }); + return useBottomFunnel({ type: type as FlowType, data: data as Place[] | ExtractResponse }); }; diff --git a/src/components/features/ExtractedPlacesList/ExtractedPlacesList.tsx b/src/components/features/ExtractedPlacesList/ExtractedPlacesList.tsx index d38267c..b875f2e 100644 --- a/src/components/features/ExtractedPlacesList/ExtractedPlacesList.tsx +++ b/src/components/features/ExtractedPlacesList/ExtractedPlacesList.tsx @@ -5,21 +5,25 @@ import { Chip } from '@/components/common/Chip'; import { Icon } from '@/components/common/Icon'; import { ListCard } from '@/components/common/ListCard'; import { Body2, Body3, Body4 } from '@/components/common/Typography'; +import { findyIconNames } from '@/constants/findyIcons'; +import { useNaverBookmark } from '@/hooks/api/bookmarks/useNaverBookmark'; import { useYoutubeBookmark } from '@/hooks/api/bookmarks/useYoutubeBookmark'; -import { YoutubeResponse } from '@/hooks/api/link/useYoutubePlace'; +import { ExtractResponse } from '@/hooks/api/link/useYoutubePlace'; import { useAuth } from '@/hooks/auth/useAuth'; import { useMarkers } from '@/hooks/common/useMarkers'; +import { Category } from '@/types/naver'; import { Login } from '../LoginModal'; -type Props = { places: YoutubeResponse; onNext: () => void }; -export const ExtractedPlacesList = ({ places, onNext }: Props) => { +type Props = { data: ExtractResponse; onNext: () => void }; +export const ExtractedPlacesList = ({ data, onNext }: Props) => { const [selectedIds, setSelectedIds] = useState([]); const [isOpen, setIsOpen] = useState(false); const { token } = useAuth(); const { clearMarkers } = useMarkers(); - const { mutate: bookmarkMutate } = useYoutubeBookmark(token); + const { mutate: youtubeMutate } = useYoutubeBookmark(token); + const { mutate: naverMutate } = useNaverBookmark(token); const handleToggleSelect = (id: number) => { setSelectedIds((prev) => @@ -32,53 +36,69 @@ export const ExtractedPlacesList = ({ places, onNext }: Props) => { setIsOpen(true); return; } - - const savePlaces = { - ...places, - places: places.places + const savePlaces: ExtractResponse = { + ...data, + places: data.places .filter((place) => selectedIds.includes(place.id as number)) // eslint-disable-next-line @typescript-eslint/no-unused-vars .map(({ id, ...placeData }) => placeData), }; - bookmarkMutate(savePlaces, { - onSuccess: () => { - sessionStorage.clear(); - clearMarkers(); - onNext(); - }, - }); + if (data.youtuberId) { + youtubeMutate(savePlaces, { + onSuccess: () => { + sessionStorage.clear(); + clearMarkers(); + onNext(); + }, + }); + } + if (data.name) { + naverMutate(savePlaces, { + onSuccess: () => { + sessionStorage.clear(); + clearMarkers(); + onNext(); + }, + }); + } }; return (
- {/* TODO : 이미지가 없을 경우 대체 이미지 추가 */} - {`${places.youtuberName}의 -
- {places.youtuberName} + {data.youtuberProfile ? ( + {`${data.youtuberName}프로필 + ) : ( + + )} +
+ {data.youtuberName ?? data.name}
- - {places.places.length} + + {data.places.length}
{/* TODO 컴포넌트화 */} - {places.places.map((item, index) => ( - <> + {data?.places.map((item, index) => ( +
{item.title} - {typeof item.category === 'object' && ( - {item.category.majorCategory} + {item.category && ( + + {typeof item.category === 'object' + ? (item.category as Category).majorCategory + : item.category} + )}
@@ -92,8 +112,8 @@ export const ExtractedPlacesList = ({ places, onNext }: Props) => { onClick={() => handleToggleSelect(item.id as number)} />
- {index < places.places.length - 1 &&
} - + {index < data.places.length - 1 &&
} +
))}