diff --git a/src/app/(sidebar)/(my-info)/apis/useGetInfoCardList.ts b/src/app/(sidebar)/(my-info)/apis/useGetInfoCardList.ts index 0a931dd6..6ab9ec3d 100644 --- a/src/app/(sidebar)/(my-info)/apis/useGetInfoCardList.ts +++ b/src/app/(sidebar)/(my-info)/apis/useGetInfoCardList.ts @@ -1,4 +1,4 @@ -import { useQuery } from '@tanstack/react-query'; +import { useSuspenseQuery } from '@tanstack/react-query'; import { http } from '../../../../apis/http'; import { InfoCardType, InfoType } from '@/types/info'; @@ -11,7 +11,7 @@ const getInfoCardList = (cardType: InfoType) => { }; export const useGetInfoCardList = (cardType: InfoType) => { - return useQuery({ + return useSuspenseQuery({ queryKey: [GET_INFO_CARD_LIST, cardType], queryFn: async () => { const res = await getInfoCardList(cardType); diff --git a/src/app/(sidebar)/(my-info)/apis/usePostCard.ts b/src/app/(sidebar)/(my-info)/apis/usePostCard.ts index a007670e..7cb0c512 100644 --- a/src/app/(sidebar)/(my-info)/apis/usePostCard.ts +++ b/src/app/(sidebar)/(my-info)/apis/usePostCard.ts @@ -12,6 +12,7 @@ const postCard = (cardType: InfoType, tagIdList: number[]) => { return http.post({ url: `/card`, data: { + cardTypeValueGroup: '내_정보', cardTypeValueList: [cardType], tagIdList, }, diff --git a/src/app/(sidebar)/(my-info)/components/InfoCardList.tsx b/src/app/(sidebar)/(my-info)/components/InfoCardList.tsx index b5080679..c87edd3f 100644 --- a/src/app/(sidebar)/(my-info)/components/InfoCardList.tsx +++ b/src/app/(sidebar)/(my-info)/components/InfoCardList.tsx @@ -1,54 +1,18 @@ 'use client'; -import { useState } from 'react'; -import { cn } from '@/utils/tailwind-util'; -import { Button, Icon } from '@/system/components'; -import { AddInfoCardDialog } from './AddInfoCardDialog'; -import { INFO_TYPES, InfoType } from '@/types/info'; +import { InfoType } from '@/types/info'; import { useGetInfoCardList } from '../apis/useGetInfoCardList'; -import { useGetCardTypeCount } from '../apis/useGetCardTypeCount'; import { InfoCard } from '@/components/InfoCard'; -import { TouchButton } from '@/components/TouchButton'; -export function InfoCardList() { - const [currentCardType, setCurrentCardType] = useState('경험_정리'); +interface InfoCardListProps { + cardType: InfoType; +} - const { data: infoCardList } = useGetInfoCardList(currentCardType); - const { data: cardCount } = useGetCardTypeCount(); +export function InfoCardList({ cardType }: InfoCardListProps) { + const { data: infoCardList } = useGetInfoCardList(cardType); return (
-
-
- {INFO_TYPES.map((type) => ( - setCurrentCardType(type)}> -
- {type.replaceAll('_', ' ')} -
-
- {cardCount?.[type] || 0} -
-
- ))} -
- - - -
카드 추가
-
-
-
{infoCardList?.length ? (
    {infoCardList?.map((info) => ( diff --git a/src/app/(sidebar)/(my-info)/components/InfoCardSkeleton.tsx b/src/app/(sidebar)/(my-info)/components/InfoCardSkeleton.tsx new file mode 100644 index 00000000..1b77c7aa --- /dev/null +++ b/src/app/(sidebar)/(my-info)/components/InfoCardSkeleton.tsx @@ -0,0 +1,35 @@ +import { motion } from 'framer-motion'; +import { match } from 'ts-pattern'; + +interface InfoCardSkeletonProps { + count: number; +} + +export function InfoCardSkeleton({ count }: InfoCardSkeletonProps) { + return ( + + {Array(count) + .fill(0) + .map((_, index) => ( + + ))} + + ); +} diff --git a/src/app/(sidebar)/(my-info)/page.tsx b/src/app/(sidebar)/(my-info)/page.tsx index 2916bdc6..15cf54be 100644 --- a/src/app/(sidebar)/(my-info)/page.tsx +++ b/src/app/(sidebar)/(my-info)/page.tsx @@ -1,19 +1,118 @@ 'use client'; -import { Icon } from '@/system/components'; +import { Dropdown, Icon } from '@/system/components'; import { InfoCardList } from './components/InfoCardList'; +import { Suspense, useEffect, useRef, useState } from 'react'; +import { AddInfoCardDialog } from './components/AddInfoCardDialog'; +import { TouchButton } from '@/components/TouchButton'; +import { INFO_TYPES, InfoType } from '@/types'; +import { useScroll } from '@/hooks/useScroll'; +import { cn } from '@/utils/tailwind-util'; +import { useGetCardTypeCount } from './apis/useGetCardTypeCount'; +import { If } from '@/system/utils/If'; +import { motion } from 'framer-motion'; +import { InfoCardSkeleton } from './components/InfoCardSkeleton'; +import { AsyncBoundaryWithQuery } from '@/lib'; export default function MyInfo() { + const [showHeader, setShowHeader] = useState(false); + const headerRef = useRef(null); + + const [currentCardType, setCurrentCardType] = useState('경험_정리'); + + const { data: cardCount } = useGetCardTypeCount(); + + useScroll(headerRef, (y) => setShowHeader(y > 192)); + return ( -
    -
    -

    내 정보

    - +
    +
    +
    +

    내 정보

    +
    +
    +
    + +
    + + 내 정보 + + + + + + + {currentCardType.replaceAll('_', ' ')} + + + + + + + {INFO_TYPES.map((type) => ( + setCurrentCardType(type)}> + {type.replace('_', ' ')} + + ))} + + +
    +
    + +
    + {INFO_TYPES.map((type) => ( + setCurrentCardType(type)}> +
    + {type.replaceAll('_', ' ')} +
    +
    + {cardCount?.[type] || 0} +
    +
    + ))} +
    +
    + + + + + {!showHeader && 카드 추가} + + + +
    + + + +
    + } + pendingFallback={}> + +
    -
    ); } diff --git a/src/app/(sidebar)/my-recruit/page.tsx b/src/app/(sidebar)/my-recruit/page.tsx index 2fa65ea7..dcf79106 100644 --- a/src/app/(sidebar)/my-recruit/page.tsx +++ b/src/app/(sidebar)/my-recruit/page.tsx @@ -82,7 +82,7 @@ export default function MyRecruit() { variants={{ longPadding: { padding: '8px 16px' }, shortPadding: { padding: '8px 8px' } }} animate={isSticky ? 'shortPadding' : 'longPadding'} className="bg-neutral-95 flex items-center gap-[4px] rounded-[6px]"> - + {!isSticky && 새 공고} diff --git a/src/components/InfoCard.tsx b/src/components/InfoCard.tsx index aeb99f30..d98224e6 100644 --- a/src/components/InfoCard.tsx +++ b/src/components/InfoCard.tsx @@ -9,7 +9,6 @@ import { } from '@/system/components/DropdownMenu/DropdownMenu'; import { InfoCardType, TAG_TYPE_COLOR } from '@/types/info'; import { color } from '@/system/token/color'; -import { If } from '@/system/utils/If'; import { useDeleteCard } from '@/app/(sidebar)/(my-info)/apis/useDeleteCard'; import Link from 'next/link'; import { MouseEventHandler } from 'react'; @@ -63,15 +62,6 @@ export function InfoCard({ id, title, updatedDate, tagList }: InfoCardProps) { ))}
    - -
    - {tagList?.map(({ id, type, name }) => ( - - {name} - - ))} -
    -
    ); } diff --git a/src/system/components/Icon/SVG/Add.tsx b/src/system/components/Icon/SVG/Add.tsx index 86f3338b..f1b608d0 100644 --- a/src/system/components/Icon/SVG/Add.tsx +++ b/src/system/components/Icon/SVG/Add.tsx @@ -4,7 +4,7 @@ export function Add({ size, color }: IconBaseType) { return ( - - + + );