diff --git a/src/components/features/noticeList/customNotice.tsx b/src/components/features/noticeList/customNotice.tsx index bc5f093..a5ca026 100644 --- a/src/components/features/noticeList/customNotice.tsx +++ b/src/components/features/noticeList/customNotice.tsx @@ -20,11 +20,14 @@ const CustomNoticeList = () => { /> ) : ( - {notices.map(notice => ( -
  • - -
  • - ))} + {notices.map(notice => { + const href = `/notices/${notice.shopId}/${notice.id}`; + return ( +
  • + +
  • + ); + })}
    )} diff --git a/src/components/features/noticeList/noticeList.tsx b/src/components/features/noticeList/noticeList.tsx index 5294dc2..0cce027 100644 --- a/src/components/features/noticeList/noticeList.tsx +++ b/src/components/features/noticeList/noticeList.tsx @@ -24,9 +24,10 @@ const NoticeList = ({ notices, q, isLoading, isInitialized, reset, error }: Noti return (
    - {notices.map(notice => ( - - ))} + {notices.map(notice => { + const href = `/notices/${notice.shopId}/${notice.id}`; + return ; + })}
    ); }; diff --git a/src/components/features/noticeList/recentNoticeList.tsx b/src/components/features/noticeList/recentNoticeList.tsx index fbf9ecd..1fe8c7c 100644 --- a/src/components/features/noticeList/recentNoticeList.tsx +++ b/src/components/features/noticeList/recentNoticeList.tsx @@ -11,9 +11,10 @@ const RecentNoticeList = () => {

    최근에 본 공고

    - {recentNotices.map(notice => ( - - ))} + {recentNotices.map(notice => { + const href = `/notices/${notice.shopId}/${notice.id}`; + return ; + })}
    ); diff --git a/src/components/ui/card/notice/mockData/mockData.json b/src/components/ui/card/notice/mockData/mockData.json deleted file mode 100644 index 3803363..0000000 --- a/src/components/ui/card/notice/mockData/mockData.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "item": { - "id": "notice-001", - "hourlyPay": 20000, - "startsAt": "2025-10-11T11:00:00Z", - "workhour": 4, - "description": "주말 점심 시간대 근무자를 모집합니다.", - "closed": false, - "shop": { - "item": { - "id": "shop-bridge", - "name": "여의도 베이커리 카페", - "category": "카페", - "address1": "서울시 영등포구", - "address2": "여의도동 2가 123-45", - "description": "여의도 한강 뷰를 즐길 수 있는 베이커리 카페! 직장인이 많은 곳이라 평일 점심에만 많이바쁘고 그 외는 한가한 편입니다.", - "imageUrl": "https://picsum.photos/id/16/640/360", - "originalHourlyPay": 18000 - }, - "href": "/shops/shop-bridge" - }, - "currentUserApplication": null - }, - "links": [ - { - "rel": "self", - "description": "공고 정보", - "method": "GET", - "href": "/shops/shop-bridge/notices/notice-001" - }, - { - "rel": "update", - "description": "공고 수정", - "method": "PUT", - "href": "/shops/shop-bridge/notices/notice-001", - "body": { - "hourlyPay": "number", - "startsAt": "string", - "workhour": "string", - "description": "string" - } - }, - { - "rel": "applications", - "description": "지원 목록", - "method": "GET", - "href": "/shops/shop-bridge/notices/notice-001/applications", - "query": { - "offset": "undefined | number", - "limit": "undefined | number" - } - }, - { - "rel": "create", - "description": "지원하기", - "method": "POST", - "href": "/shops/shop-bridge/notices/notice-001/applications" - }, - { - "rel": "shop", - "description": "가게 정보", - "method": "GET", - "href": "/shops/shop-bridge" - }, - { - "rel": "list", - "description": "공고 목록", - "method": "GET", - "href": "/shops/shop-bridge/notices", - "query": { - "offset": "undefined | number", - "limit": "undefined | number" - } - } - ] -} diff --git a/src/components/ui/card/notice/mockData/noticeWrapper.tsx b/src/components/ui/card/notice/mockData/noticeWrapper.tsx deleted file mode 100644 index e1cb3b8..0000000 --- a/src/components/ui/card/notice/mockData/noticeWrapper.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { Button } from '@/components/ui/button'; -import Notice from '@/components/ui/card/notice/notice'; -import { getNoticeStatus } from '@/lib/utils/getNoticeStatus'; -import { type NoticeCard } from '@/types/notice'; -import { NoticeShopCard } from '@/types/shop'; -import Link from 'next/link'; -import mockResponse from './mockData.json'; -import shopMockResponse from './shopMockData.json'; - -// mockData -type RawNotice = typeof mockResponse; -type RawShopNotice = typeof shopMockResponse; - -const toNoticeCard = ({ item }: RawNotice): NoticeCard => { - const shop = item.shop.item; - - return { - id: item.id, - hourlyPay: item.hourlyPay, - startsAt: item.startsAt, - workhour: item.workhour, - description: item.description, - closed: item.closed, - shopId: shop.id, - name: shop.name, - category: shop.category, - address1: shop.address1, - shopDescription: shop.description, - imageUrl: shop.imageUrl, - originalHourlyPay: shop.originalHourlyPay, - }; -}; -const toShopCard = ({ item }: RawShopNotice): NoticeShopCard => { - const shop = item; - - return { - shopId: shop.id, - name: shop.name, - category: shop.category, - address1: shop.address1, - shopDescription: shop.description, - imageUrl: shop.imageUrl, - }; -}; - -const NoticeWrapper = () => { - // notice - const notice: NoticeCard = toNoticeCard(mockResponse); - const status = getNoticeStatus(notice.closed, notice.startsAt); - const href = `/shops/${notice.shopId}/notices/${notice.id}`; - // shop - const shopItem: NoticeShopCard = toShopCard(shopMockResponse); - return ( - <> - - - - - - - - ); -}; - -export default NoticeWrapper; diff --git a/src/components/ui/card/notice/mockData/shopMockData.json b/src/components/ui/card/notice/mockData/shopMockData.json deleted file mode 100644 index 95e2909..0000000 --- a/src/components/ui/card/notice/mockData/shopMockData.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "item": { - "id": "4490151c-5217-4157-b072-9c37b05bed47", - "name": "진주회관", - "category": "한식", - "address1": "서울시 중구", - "address2": "세종대로11길 26", - "description": "콩국수 맛집 인정따리", - "imageUrl": "https://bootcamp-project-api.s3.ap-northeast-2.amazonaws.com/0-1/the-julge/1bdb43c8-ff08-4a46-81b0-7f91efced98c-jinju4.png", - "originalHourlyPay": 10000, - "user": { - "item": { - "id": "4e560aa8-ae5a-40e1-a6e0-2a1e8b866d17", - "email": "test-employer1@codeit.com", - "type": "employer" - }, - "href": "/users/4e560aa8-ae5a-40e1-a6e0-2a1e8b866d17" - } - }, - "links": [ - { - "rel": "self", - "description": "가게 정보", - "method": "GET", - "href": "/shops/4490151c-5217-4157-b072-9c37b05bed47" - }, - { - "rel": "update", - "description": "가게 정보 수정", - "method": "PUT", - "href": "/shops/4490151c-5217-4157-b072-9c37b05bed47", - "body": { - "name": "string", - "category": "한식 | 중식 | 일식 | 양식 | 분식 | 카페 | 편의점 | 기타", - "address1": "서울시 종로구 | 서울시 중구 | 서울시 용산구 | 서울시 성동구 | 서울시 광진구 | 서울시 동대문구 | 서울시 중랑구 | 서울시 성북구 | 서울시 강북구 | 서울시 도봉구 | 서울시 노원구 | 서울시 은평구 | 서울시 서대문구 | 서울시 마포구 | 서울시 양천구 | 서울시 강서구 | 서울시 구로구 | 서울시 금천구 | 서울시 영등포구 | 서울시 동작구 | 서울시 관악구 | 서울시 서초구 | 서울시 강남구 | 서울시 송파구 | 서울시 강동구", - "address2": "string", - "description": "string", - "imageUrl": "string", - "originalHourlyPay": "number" - } - }, - { - "rel": "user", - "description": "가게 주인 정보", - "method": "GET", - "href": "/users/4e560aa8-ae5a-40e1-a6e0-2a1e8b866d17" - }, - { - "rel": "notices", - "description": "공고 목록", - "method": "GET", - "href": "/shops/4490151c-5217-4157-b072-9c37b05bed47/notices", - "query": { - "offset": "undefined | number", - "limit": "undefined | number" - } - } - ] -} diff --git a/src/components/ui/card/post/mockData/mockData.json b/src/components/ui/card/post/mockData/mockData.json deleted file mode 100644 index 019c0f9..0000000 --- a/src/components/ui/card/post/mockData/mockData.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "offset": 0, - "limit": 3, - "address": [], - "count": 6, - "hasNext": false, - "items": [ - { - "item": { - "id": "notice-001", - "hourlyPay": 18000, - "startsAt": "2025-10-11T11:00:00Z", - "workhour": 4, - "description": "주말 점심 시간대 근무자를 모집합니다.", - "closed": false, - "shop": { - "item": { - "id": "shop-bridge", - "name": "한강 브런치 카페", - "category": "카페", - "address1": "서울시 용산구", - "address2": "한강로 2가 123-45", - "description": "한강 뷰를 자랑하는 브런치 카페", - "imageUrl": "https://picsum.photos/id/1080/640/360", - "originalHourlyPay": 18000 - }, - "href": "/shops/shop-bridge" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-001" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-bridge" - } - ] - }, - { - "item": { - "id": "notice-002", - "hourlyPay": 20000, - "startsAt": "2026-08-15T18:30:00Z", - "workhour": 5, - "description": "저녁 피크 타임 대응 인력을 찾습니다.", - "closed": false, - "shop": { - "item": { - "id": "shop-chicken", - "name": "홍대 치킨 공방", - "category": "음식점", - "address1": "서울시 마포구", - "address2": "어울마당로 35", - "description": "수제 치킨 전문점", - "imageUrl": "https://picsum.photos/id/292/640/360", - "originalHourlyPay": 13000 - }, - "href": "/shops/shop-chicken" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-002" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-chicken" - } - ] - }, - { - "item": { - "id": "notice-003", - "hourlyPay": 9500, - "startsAt": "2023-07-10T09:00:00Z", - "workhour": 6, - "description": "오전 반찬 포장 보조 인력을 찾습니다.", - "closed": true, - "shop": { - "item": { - "id": "shop-deli", - "name": "성수 반찬가게", - "category": "식품", - "address1": "서울시 성동구", - "address2": "성수일로 55", - "description": "수제로 만든 반찬 판매점", - "imageUrl": "https://picsum.photos/id/1060/640/360", - "originalHourlyPay": 9000 - }, - "href": "/shops/shop-deli" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-003" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-deli" - } - ] - }, - { - "item": { - "id": "notice-004", - "hourlyPay": 16000, - "startsAt": "2025-09-10T10:00:00Z", - "workhour": 5, - "description": "평일 오전 카운터 지원 인력을 모집합니다.", - "closed": false, - "shop": { - "item": { - "id": "shop-bakery", - "name": "합정 베이커리", - "category": "카페", - "address1": "서울시 마포구", - "address2": "합정역로 80", - "description": "천연 발효종으로 빵을 만드는 베이커리", - "imageUrl": "https://picsum.photos/id/1040/640/360", - "originalHourlyPay": 14000 - }, - "href": "/shops/shop-bakery" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-004" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-bakery" - } - ] - }, - { - "item": { - "id": "notice-005", - "hourlyPay": 10000, - "startsAt": "2025-09-05T14:00:00Z", - "workhour": 3, - "description": "오후 피크 시간대 서빙 인력을 찾습니다.", - "closed": false, - "shop": { - "item": { - "id": "shop-ramen", - "name": "이태원 라멘집", - "category": "일식", - "address1": "서울시 용산구", - "address2": "이태원동 123-10", - "description": "후쿠오카식 진한 육수 라멘", - "imageUrl": "https://picsum.photos/id/1050/640/360", - "originalHourlyPay": 10000 - }, - "href": "/shops/shop-ramen" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-005" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-ramen" - } - ] - }, - { - "item": { - "id": "notice-006", - "hourlyPay": 9000, - "startsAt": "2023-07-15T07:00:00Z", - "workhour": 4, - "description": "새벽 도넛 포장 보조 인력을 찾습니다.", - "closed": true, - "shop": { - "item": { - "id": "shop-donut", - "name": "망원 도넛 하우스", - "category": "디저트", - "address1": "서울시 마포구", - "address2": "망원로 67", - "description": "수제 도넛 전문점", - "imageUrl": "https://picsum.photos/id/1062/640/360", - "originalHourlyPay": 8500 - }, - "href": "/shops/shop-donut" - } - }, - "links": [ - { - "rel": "self", - "description": "공고 상세", - "method": "GET", - "href": "/notices/notice-006" - }, - { - "rel": "shop", - "description": "가게 상세", - "method": "GET", - "href": "/shops/shop-donut" - } - ] - } - ] -} diff --git a/src/components/ui/card/post/mockData/postWrapper.tsx b/src/components/ui/card/post/mockData/postWrapper.tsx deleted file mode 100644 index 6db0407..0000000 --- a/src/components/ui/card/post/mockData/postWrapper.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import Post from '@/components/ui/card/post/post'; -import type { PostCard } from '@/types/notice'; -import mockResponse from './mockData.json'; - -// mockData 용 페이지 - -type RawNotice = (typeof mockResponse)['items'][number]; - -const toPostCard = ({ item }: RawNotice): PostCard => { - const shop = item.shop.item; - - return { - id: item.id, - hourlyPay: item.hourlyPay, - startsAt: item.startsAt, - workhour: item.workhour, - closed: item.closed, - shopId: shop.id, - name: shop.name, - address1: shop.address1, - imageUrl: shop.imageUrl, - originalHourlyPay: shop.originalHourlyPay, - }; -}; - -const PostWrapper = () => { - const notices: PostCard[] = mockResponse.items.map(toPostCard); - return ( -
    - {notices.map(notice => ( - - ))} -
    - ); -}; - -export default PostWrapper; diff --git a/src/components/ui/card/post/post.stories.tsx b/src/components/ui/card/post/post.stories.tsx index accae4c..8aaf4d1 100644 --- a/src/components/ui/card/post/post.stories.tsx +++ b/src/components/ui/card/post/post.stories.tsx @@ -31,6 +31,7 @@ type Story = StoryObj; export const Default: Story = { args: { notice: baseNotice, + href: '', }, }; @@ -44,6 +45,7 @@ export const Expired: Story = { originalHourlyPay: 13000, shopId: 'notice-002', }, + href: '', }, }; @@ -58,5 +60,6 @@ export const Closed: Story = { startsAt: '2023-07-01T09:00:00Z', shopId: 'notice-003', }, + href: '', }, }; diff --git a/src/components/ui/card/post/post.tsx b/src/components/ui/card/post/post.tsx index f05c490..215d75d 100644 --- a/src/components/ui/card/post/post.tsx +++ b/src/components/ui/card/post/post.tsx @@ -2,7 +2,6 @@ import { cardLayout, CardStatusVariant } from '@/components/ui/card/card.styles' import CardBadge from '@/components/ui/card/cardBadge'; import CardImage from '@/components/ui/card/cardImage'; import CardInfo from '@/components/ui/card/cardInfo'; -import useAuth from '@/hooks/useAuth'; import { getTime } from '@/lib/utils/dateFormatter'; import { formatNumber } from '@/lib/utils/formatNumber'; import { getNoticeStatus } from '@/lib/utils/getNoticeStatus'; @@ -12,31 +11,19 @@ import { postFrame, postImageDimmed } from './post.styles'; interface PostProps { notice: PostCard; + href: string; } const STATUS_LABEL = { expired: '지난 공고', closed: '공고 마감', } as const; -const Post = ({ notice }: PostProps) => { - const { user } = useAuth(); - const { - id, - hourlyPay, - startsAt, - workhour, - closed, - originalHourlyPay, - imageUrl, - name, - address1, - shopId, - } = notice; +const Post = ({ notice, href = '' }: PostProps) => { + const { hourlyPay, startsAt, workhour, closed, originalHourlyPay, imageUrl, name, address1 } = + notice; const status = getNoticeStatus(closed, startsAt); const { date, startTime, endTime } = getTime(startsAt, workhour); const statusVariant: CardStatusVariant = status === 'open' ? 'open' : 'inactive'; - const href = - user && user.shop ? `/employer/shops/${shopId}/notices/${id}` : `/notices/${shopId}/${id}`; return ( diff --git a/src/pages/my-shop/index.tsx b/src/pages/my-shop/index.tsx index 89d9205..838437e 100644 --- a/src/pages/my-shop/index.tsx +++ b/src/pages/my-shop/index.tsx @@ -145,7 +145,8 @@ const Myshop = () => { shopId: shopData.id, originalHourlyPay: shopData.originalHourlyPay, }; - return ; + const href = `/employer/shops/${mergedNotice.shopId}/notices/${item.id}`; + return ; })}