{description}
+
{!closed && isPast && "지난 공고"}
{closed && !isPast && "마감 완료"}
diff --git a/src/components/Post/PostList.tsx b/src/components/Post/PostList.tsx
index cd6b31a..efda071 100644
--- a/src/components/Post/PostList.tsx
+++ b/src/components/Post/PostList.tsx
@@ -1,6 +1,6 @@
import Post from "./Post";
-interface PostData {
+export interface PostData {
id: string;
name: string;
imageUrl: string;
diff --git a/src/constants/applicationStatus.ts b/src/constants/applicationStatus.ts
new file mode 100644
index 0000000..6d30686
--- /dev/null
+++ b/src/constants/applicationStatus.ts
@@ -0,0 +1,6 @@
+export const APPLICATION_STATUS = {
+ PENDING: "pending",
+ ACCEPTED: "accepted",
+ REJECTED: "rejected",
+ CANCELED: "canceled",
+} as const;
diff --git a/src/constants/router.ts b/src/constants/router.ts
index 2446bc3..9b83ffa 100644
--- a/src/constants/router.ts
+++ b/src/constants/router.ts
@@ -16,7 +16,7 @@ const ROUTES = {
NOTICE: {
ROOT: "/",
REGISTER: "/notice/register",
- EDIT: "/notice/edit",
+ EDIT: "/notice/edit/:noticeId",
NOTICE_ID: {
EMPLOYER: `/notice/:shopId/:noticeId/employer`,
EMPLOYEE: `/notice/:shopId/:noticeId/employee`,
diff --git a/src/hooks/useUpdateRecentNotices.ts b/src/hooks/useUpdateRecentNotices.ts
new file mode 100644
index 0000000..24984cf
--- /dev/null
+++ b/src/hooks/useUpdateRecentNotices.ts
@@ -0,0 +1,56 @@
+import { useEffect } from "react";
+
+import { NoticeItem } from "../types";
+
+import { PostData } from "@/components/Post/PostList";
+import {
+ getLocalStorageValue,
+ setLocalStorageValue,
+} from "@/utils/localStorage";
+
+const RECENT_NOTICES = "recentNotices";
+
+const updateLocalStorageRecentNotices = (candidateNotice: PostData) => {
+ const storageValue: PostData[] = getLocalStorageValue(RECENT_NOTICES) ?? [];
+
+ if (!storageValue.some(({ id }) => id === candidateNotice.id)) {
+ if (storageValue.length === 7) {
+ storageValue.shift();
+ }
+ storageValue.push(candidateNotice);
+ }
+ setLocalStorageValue(RECENT_NOTICES, storageValue);
+};
+
+interface UseRecentNoticesParams {
+ noticeInfo: NoticeItem;
+ link: string;
+}
+
+const useUpdateRecentNotices = ({
+ noticeInfo,
+ link,
+}: UseRecentNoticesParams) => {
+ useEffect(() => {
+ const { id, hourlyPay, startsAt, workhour, closed } = noticeInfo;
+ const { name, imageUrl, address1, originalHourlyPay } =
+ noticeInfo.shop!.item;
+
+ const visitedNotice = {
+ id,
+ name,
+ imageUrl,
+ address1,
+ originalHourlyPay,
+ link,
+ hourlyPay,
+ startsAt,
+ workhour,
+ closed,
+ };
+
+ updateLocalStorageRecentNotices(visitedNotice);
+ }, [noticeInfo, link]);
+};
+
+export default useUpdateRecentNotices;
diff --git a/src/hooks/useUserStore.tsx b/src/hooks/useUserStore.tsx
index 12b0e87..3e976cc 100644
--- a/src/hooks/useUserStore.tsx
+++ b/src/hooks/useUserStore.tsx
@@ -1,7 +1,7 @@
import { create } from "zustand";
import { persist, createJSONStorage } from "zustand/middleware";
-type User = {
+export type User = {
id: string;
email: string;
type: "employer" | "employee";
diff --git a/src/pages/NoticeEmployeePage/NoticeEmployeePage.tsx b/src/pages/NoticeEmployeePage/NoticeEmployeePage.tsx
index 0231b57..a684757 100644
--- a/src/pages/NoticeEmployeePage/NoticeEmployeePage.tsx
+++ b/src/pages/NoticeEmployeePage/NoticeEmployeePage.tsx
@@ -1,16 +1,26 @@
import { useLoaderData, useParams } from "react-router-dom";
-import NoticeDetailInfo from "./components/NoticeDetailInfo";
+import NoticeDetailInfo from "../../components/NoticeDetailInfo/NoticeDetailInfo";
-import PostList from "@/components/Post/PostList";
+import PostList, { PostData } from "@/components/Post/PostList";
+import useUpdateRecentNotices from "@/hooks/useUpdateRecentNotices";
+import { NoticeItem } from "@/types/notice";
export default function NoticeEmployeePage() {
- const { noticeInfo, recentNotices } = useLoaderData();
+ const { noticeInfo, recentNotices } = useLoaderData<{
+ noticeInfo: NoticeItem;
+ recentNotices: PostData[];
+ }>();
const { shopId, noticeId } = useParams() as {
shopId: string;
noticeId: string;
};
+ useUpdateRecentNotices({
+ noticeInfo,
+ link: `/notice/${shopId}/${noticeId}/employee`,
+ });
+
return (
<>
{description}최근에 본 공고
- {name}
-
+ {isMyShop ? "신청자 목록" : "최근에 본 공고"}
+
+ {isMyShop && (
+ (
+