-
Notifications
You must be signed in to change notification settings - Fork 4
[feat] 공고 상세 페이지 (사장님) 구현 #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f415606
feat: NoticeDetailInfo 컴포넌트 수정 (공고 상세 사장님 페이지용으로 확장)
cozy-ito ecbc45c
feat: NoticeApplicationTable 컴포넌트 구현
cozy-ito 1508438
feat: useShopApplications 커스텀 훅 구현
cozy-ito 353c7c7
feat: 사장님 아니면 알바생 공고 상세로 redirect, 서버 요청 성공 시, 기존 상태 업데이트
cozy-ito c4e6c81
feat: ROUTE.NOTICE.EDIT 변경 (/notice/edit -> /notice/edit/:noticeId)
cozy-ito ffa9ced
Merge branch 'NOTICE-65-JIN' into NOTICE-70-JIN
cozy-ito 40c4f86
style: PostCard opacity 오타 수정
cozy-ito d734761
feat: 리다이렉트 삭제, 내 가게에 따라 렌더링 변경, Modal, Toast 적용
cozy-ito 6bd733f
feat: 최근 본 공고 - 로컬 스토리지 적용
cozy-ito ff5e8e7
refactor: noticeEmployerLoader, noticeEmployeeLoader 로직 수정
cozy-ito 0afdedc
refactor: NoticeDetailInfoCard로 컴포넌트 변경 및 리팩토링
cozy-ito d8dd89a
fix: 최근 본 공고 나타나지 않는 버그 수정
cozy-ito 7fb0321
refactor: useShopApplications 커스텀 훅 의존성 배열 요소 추가
cozy-ito a67167e
Merge branch 'dev' of https://github.com/CodeitPart3/thejulge into NO…
cozy-ito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { getShopApplications } from "../services/applicationService"; | ||
| import { getNotice } from "../services/noticeService"; | ||
|
|
||
| import { PostData } from "@/components/Post/PostList"; | ||
| import { getLocalStorageValue } from "@/utils/localStorage"; | ||
|
|
||
| interface LoadNoticeParams { | ||
| shopId: string; | ||
| noticeId: string; | ||
| } | ||
|
|
||
| export const loadNotice = async ({ shopId, noticeId }: LoadNoticeParams) => { | ||
| const noticeResult = await getNotice(shopId, noticeId); | ||
|
|
||
| if (noticeResult.status === 200) { | ||
| return noticeResult.data.item; | ||
| } | ||
| }; | ||
|
|
||
| const MAX_VISIBLE_RECENT_NOTICES = 6; | ||
|
|
||
| export const loadRecentNotices = async (noticeId: string) => { | ||
| const allRecentNotices = | ||
| getLocalStorageValue<PostData[]>("recentNotices") ?? []; | ||
|
|
||
| const recentNotices = allRecentNotices | ||
| .filter(({ id }) => id !== noticeId) | ||
| .slice(0, MAX_VISIBLE_RECENT_NOTICES); | ||
|
|
||
| return recentNotices; | ||
| }; | ||
|
|
||
| interface LoadNoticeApplicationsParams { | ||
| shopId: string; | ||
| noticeId: string; | ||
| offset?: number; | ||
| limit?: number; | ||
| } | ||
|
|
||
| export const loadNoticeApplications = async ({ | ||
| shopId, | ||
| noticeId, | ||
| offset, | ||
| limit, | ||
| }: LoadNoticeApplicationsParams) => { | ||
| const noticeApplicationsResult = await getShopApplications( | ||
| shopId, | ||
| noticeId, | ||
| offset, | ||
| limit, | ||
| ); | ||
|
|
||
| if (noticeApplicationsResult.status === 200) { | ||
| return noticeApplicationsResult.data; | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| 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.length > 0 && | ||
| !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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.