diff --git a/src/apis/bookmarks/type.ts b/src/apis/bookmarks/type.ts index 3841856..899891e 100644 --- a/src/apis/bookmarks/type.ts +++ b/src/apis/bookmarks/type.ts @@ -3,7 +3,8 @@ export interface BookmarkResponseType { } export interface BookmarkItemsType { - company_name: string; - recruitment_id: number; - created_at: string; -} + "company_logo_url": string; + "company_name": string; + "recruitment_id": number; + "created_at": string; +} \ No newline at end of file diff --git a/src/apis/recruitments/type.ts b/src/apis/recruitments/type.ts index 20d8cfa..78858e6 100644 --- a/src/apis/recruitments/type.ts +++ b/src/apis/recruitments/type.ts @@ -18,6 +18,8 @@ export interface RecruitmentsDetailType extends RecruitmentsDetailTable { company_id: number; company_profile_url: string; company_name: string; + bookmarked: boolean; + recruitment_id: number; } export interface RecruitmentsDetailTable { diff --git a/src/app/recruitments/detail/page.tsx b/src/app/recruitments/detail/page.tsx index 89d4233..79235a8 100644 --- a/src/app/recruitments/detail/page.tsx +++ b/src/app/recruitments/detail/page.tsx @@ -11,7 +11,7 @@ export default function RecruitmentsDetailPage() { const navigator = useRouter(); const { data: RecruitmentsDetial } = useGetRecruitmentsDetail(param.get("id")!); if (RecruitmentsDetial) { - const { company_id, company_name, company_profile_url, ...rest } = + const { company_id, company_name, company_profile_url, bookmarked, recruitment_id, ...rest } = RecruitmentsDetial; return ( @@ -20,6 +20,8 @@ export default function RecruitmentsDetailPage() { company_name={company_name} company_profile_url={company_profile_url} company_id={company_id} + bookmarked={bookmarked} + recruitmentId={recruitment_id} > { diff --git a/src/components/BookmarkCard.tsx b/src/components/BookmarkCard.tsx index db262a0..8a3f06a 100644 --- a/src/components/BookmarkCard.tsx +++ b/src/components/BookmarkCard.tsx @@ -1,10 +1,20 @@ -import { useGetBookmarks } from "@/apis/bookmarks"; +import { useGetBookmarks, useSetBookmarks } from "@/apis/bookmarks"; import { Icon } from "@team-return/design-system"; import Link from "next/link"; import HoverPrefetchLink from "./common/HoverPrefetchLink"; +import Image from "next/image"; +import { useEffect, useState } from "react"; +import { BookmarkItemsType } from "@/apis/bookmarks/type"; export default function BookmarkCard() { const { data: bookmarks } = useGetBookmarks(); + const { mutate: SetBookmarksMutate } = useSetBookmarks(); + + const [localBookmarks, setLocalBookmarks] = useState(bookmarks?.bookmarks || []) + + useEffect(()=>{ + if(bookmarks) setLocalBookmarks(bookmarks.bookmarks); + },[bookmarks?.bookmarks]) return (
@@ -17,17 +27,26 @@ export default function BookmarkCard() {
)} - {bookmarks?.bookmarks.map(({ company_name, recruitment_id }) => ( + {localBookmarks.map(({ company_name, recruitment_id, company_logo_url }) => (
+
+ 기업로고 +

{company_name}

-
diff --git a/src/components/company/CompanyTitle.tsx b/src/components/company/CompanyTitle.tsx index b817fac..8fe7b98 100644 --- a/src/components/company/CompanyTitle.tsx +++ b/src/components/company/CompanyTitle.tsx @@ -4,7 +4,10 @@ import Image from "next/image"; import { useRouter } from "next/navigation"; import { getCompanyKebabItems } from "@/util/object/kebabMenuItems"; import { KebabItemType } from "@/util/type/kebabMenu"; +import { useSetBookmarks } from "@/apis/bookmarks"; import KebabMenu from "../common/Dropdown/KebabMenu"; +import { Icon } from "@team-return/design-system"; +import { useState } from "react"; interface PropsType { business_number?: string; @@ -14,6 +17,8 @@ interface PropsType { onClickInterview?: () => void; children?: React.ReactNode; company_id?: number; + bookmarked?: boolean; + recruitmentId?: number; } export default function CompanyTitle({ @@ -24,11 +29,17 @@ export default function CompanyTitle({ onClickInterview, children, company_id, + bookmarked, + recruitmentId }: PropsType) { const kebabItems: KebabItemType[] = getCompanyKebabItems( onClickRecruitments, onClickInterview ); + const { mutate: SetBookmarksMutate } = useSetBookmarks(); + const [localBookmarked, setLocalBookmarked] = useState( + bookmarked || false + ); const navigator = useRouter(); @@ -45,7 +56,26 @@ export default function CompanyTitle({ />
-

{company_name}

+
+

{company_name}

+ { + recruitmentId && ( + + ) + } + +
{business_number && (

사업자 번호 : {business_number} diff --git a/src/components/recruitments/RecruitmentsCard.tsx b/src/components/recruitments/RecruitmentsCard.tsx index ab7c5eb..3e5f391 100644 --- a/src/components/recruitments/RecruitmentsCard.tsx +++ b/src/components/recruitments/RecruitmentsCard.tsx @@ -39,7 +39,6 @@ export default function RecruitmentsCard({ maxLength = 12 }: PropsType) { function RecruitmentsItem({ company_profile_url, company_name, - train_pay, hiring_jobs, bookmarked, id,