From 07ad85570806caa728d344a68c9f997a081374d8 Mon Sep 17 00:00:00 2001 From: Savien/Woo Jun Han <49388937+MrMirror21@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:03:43 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Step=20Indicator=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=EA=B3=B5=EA=B3=A0=20=EB=93=B1=EB=A1=9D/=EC=88=98=EC=A0=95=20st?= =?UTF-8?q?ep=20indicator=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EA=B9=A8?= =?UTF-8?q?=EC=A7=90=20=EC=A0=95=EC=83=81=ED=99=94=20#127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Employer/Post/EmployerCreatePostPage.tsx | 1 + src/pages/Employer/Post/EmployerEditPostPage.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/Employer/Post/EmployerCreatePostPage.tsx b/src/pages/Employer/Post/EmployerCreatePostPage.tsx index bb24dc08..60f49efe 100644 --- a/src/pages/Employer/Post/EmployerCreatePostPage.tsx +++ b/src/pages/Employer/Post/EmployerCreatePostPage.tsx @@ -61,6 +61,7 @@ const EmployerCreatePostPage = () => { length={5} currentStep={currentStep} mainColor="#1E1926" + textColor='#FFFFFF' />
diff --git a/src/pages/Employer/Post/EmployerEditPostPage.tsx b/src/pages/Employer/Post/EmployerEditPostPage.tsx index e9605a81..b566b926 100644 --- a/src/pages/Employer/Post/EmployerEditPostPage.tsx +++ b/src/pages/Employer/Post/EmployerEditPostPage.tsx @@ -90,7 +90,7 @@ const EmployerEditPostPage = () => { hasBackButton onClickBackButton={() => navigate(-1)} hasMenuButton={false} - title="공고등록" + title="공고수정" /> {devIsModal ? ( { length={5} currentStep={currentStep} mainColor="#1E1926" + textColor='#FFFFFF' />
From 1ee220e97cfeeb78aff4885153e9a7c04739395b Mon Sep 17 00:00:00 2001 From: Savien/Woo Jun Han <49388937+MrMirror21@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:47:08 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EA=B3=B5=EA=B3=A0?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=8B=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=B2=A8=EB=B6=80=20=EA=B8=B0=EB=8A=A5=20=EB=88=84=EB=9D=BD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Employer/PostCreate/Step4.tsx | 1 + src/types/postCreate/postCreate.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Employer/PostCreate/Step4.tsx b/src/components/Employer/PostCreate/Step4.tsx index 09f6819b..ff259557 100644 --- a/src/components/Employer/PostCreate/Step4.tsx +++ b/src/components/Employer/PostCreate/Step4.tsx @@ -239,6 +239,7 @@ const Step4 = ({ ...newPostInfo.body, recruiter_phone_number: formatPhoneNumber(phoneNum), }, + images: newPostInfo.images, }) } /> diff --git a/src/types/postCreate/postCreate.ts b/src/types/postCreate/postCreate.ts index 692a1bd4..b62281f0 100644 --- a/src/types/postCreate/postCreate.ts +++ b/src/types/postCreate/postCreate.ts @@ -73,7 +73,7 @@ export type Image = { } export type JobPostingForm = { - images: File[] | Image[]; + images: (File | Image)[]; body: { title: string; job_category: JobCategory | string; From 4a159fdc49f43fce6fb8355a93f85fd998fd0f11 Mon Sep 17 00:00:00 2001 From: Savien/Woo Jun Han <49388937+MrMirror21@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:34:10 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20isPending?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=ED=95=B4=20=EB=A1=9C=EB=94=A9=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EA=B0=84=EA=B2=B0=ED=99=94=20=EC=8B=9C=ED=97=98=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20#160?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WriteDocument/EmployerLaborContractForm.tsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/components/Employer/WriteDocument/EmployerLaborContractForm.tsx b/src/components/Employer/WriteDocument/EmployerLaborContractForm.tsx index 8d853365..96b07bcc 100644 --- a/src/components/Employer/WriteDocument/EmployerLaborContractForm.tsx +++ b/src/components/Employer/WriteDocument/EmployerLaborContractForm.tsx @@ -76,21 +76,12 @@ const EmployerLaborContractForm = ({ setAddressInput, } = useAddressSearch(); - const [isLoading, setIsLoading] = useState(false); const [isInvalid, setIsInvalid] = useState(false); // 근무시간, 요일 선택 모달 활성화 플래그 const [isModal, setIsModal] = useState(false); // 입력 완료 시 제출 - const { mutate: putDocument } = usePutLaborContractEmployer( + const { mutate: putDocument, isPending } = usePutLaborContractEmployer( Number(currentDocumentId), - { - onMutate: () => { - setIsLoading(true); - }, - onSettled: () => { - setIsLoading(false); - }, - }, ); useEffect(() => { if (isEdit && document?.employer_information) { @@ -162,7 +153,7 @@ const EmployerLaborContractForm = ({ return ( <> - {isLoading && ( + {isPending && (
)}
{/* 회사/점포명 입력 */} From f01332b9a3578bb1a2803b7ebef1867ec6523597 Mon Sep 17 00:00:00 2001 From: Savien/Woo Jun Han <49388937+MrMirror21@users.noreply.github.com> Date: Fri, 24 Jan 2025 17:14:26 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EA=B3=B5=EA=B3=A0?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=A4=91=20=EB=92=A4=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=8B=9C=EC=97=90=EB=8F=84=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=EA=B0=80=20=EC=A0=80=EC=9E=A5=EB=90=98=EC=96=B4?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20#127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Employer/PostCreate/Step4.tsx | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/Employer/PostCreate/Step4.tsx b/src/components/Employer/PostCreate/Step4.tsx index ff259557..d9d8b627 100644 --- a/src/components/Employer/PostCreate/Step4.tsx +++ b/src/components/Employer/PostCreate/Step4.tsx @@ -6,7 +6,7 @@ import InputLayout from '@/components/WorkExperience/InputLayout'; import { buttonTypeKeys } from '@/constants/components'; import { phone } from '@/constants/information'; import { InputType } from '@/types/common/input'; -import { Image, JobPostingForm } from '@/types/postCreate/postCreate'; +import type { Image, JobPostingForm } from '@/types/postCreate/postCreate'; import { useEffect, useState } from 'react'; import AddFileIcon from '@/assets/icons/FileAddIcon.svg?react'; import { @@ -29,11 +29,16 @@ const Step4 = ({ }) => { // 현재 step내에서 입력받는 정보를 따로 관리할 state, 추후 다음 step으로 넘어갈 때 funnel 관리 페이지의 state로 통합된다. const [newPostInfo, setNewPostInfo] = useState({ - images: [], + images: postInfo.images.filter( + (image): image is File => image instanceof File, + ), body: { ...postInfo.body }, }); const [storedImageUrls, setStoredImageUrls] = useState( - isEdit ? (postInfo.images as Image[]) : [], + // 이미지 수정 시 기존 이미지를 불러와 저장 (id, img_url이 있는 경우 기존 이미지) + isEdit + ? postInfo.images.filter((image) => 'id' in image && 'img_url' in image) + : [], ); // 세 부분으로 나누어 입력받는 방식을 위해 전화번호만 별도의 state로 분리, 추후 유효성 검사 단에서 통합 const [phoneNum, setPhoneNum] = useState({ @@ -56,10 +61,11 @@ const Step4 = ({ const { recruiter_name, recruiter_email } = newPostInfo.body; const isFormValid = - recruiter_name !== '' && - basicEmailRegex.test(recruiter_email) && - isValidPhoneNumber(phoneNum) && - newPostInfo.images.length > 0 || storedImageUrls.length > 0; + (recruiter_name !== '' && + basicEmailRegex.test(recruiter_email) && + isValidPhoneNumber(phoneNum) && + newPostInfo.images.length > 0) || + storedImageUrls.length > 0; setIsInvalid(!isFormValid); }, [newPostInfo, phoneNum]); @@ -153,6 +159,7 @@ const Step4 = ({ /> )} + {/* 기존 이미지들(cdn 링크를 반환 받으므로 신규로 추가한 이미지와 분리해 처리) */} {storedImageUrls[0] && storedImageUrls.map((image, idx) => (
@@ -239,7 +246,7 @@ const Step4 = ({ ...newPostInfo.body, recruiter_phone_number: formatPhoneNumber(phoneNum), }, - images: newPostInfo.images, + images: [...newPostInfo.images, ...storedImageUrls], }) } /> From df27ec87c27fff9039c26018a0fc78cc982cca47 Mon Sep 17 00:00:00 2001 From: Savien/Woo Jun Han <49388937+MrMirror21@users.noreply.github.com> Date: Fri, 24 Jan 2025 18:21:56 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=90=9B=20fix=20:=20=EA=B3=B5=EA=B3=A0?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EC=8B=9C=20api=20=EB=AA=85=EC=84=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=9E=85=EB=A0=A5=20=EB=88=84=EB=9D=BD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Employer/PostCreate/Step2.tsx | 2 +- src/hooks/api/useAddressSearch.ts | 13 +++++++++---- src/pages/Employer/Post/EmployerEditPostPage.tsx | 15 +++++++++++---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/Employer/PostCreate/Step2.tsx b/src/components/Employer/PostCreate/Step2.tsx index fb003e87..9792d13c 100644 --- a/src/components/Employer/PostCreate/Step2.tsx +++ b/src/components/Employer/PostCreate/Step2.tsx @@ -33,7 +33,7 @@ const Step2 = ({ handleAddressSearch, // 검색할 주소 입력 시 실시간 검색 handleAddressSelect, // 검색 결과 중 원하는 주소를 선택할 시 state에 입력 setAddressInput, - } = useAddressSearch(); + } = useAddressSearch(postInfo.body.address); const handleAddressSelection = (selectedAddressName: string) => { const result = handleAddressSelect(selectedAddressName); diff --git a/src/hooks/api/useAddressSearch.ts b/src/hooks/api/useAddressSearch.ts index eb60496b..4a59044e 100644 --- a/src/hooks/api/useAddressSearch.ts +++ b/src/hooks/api/useAddressSearch.ts @@ -1,5 +1,6 @@ import { useSearchAddress } from '@/hooks/api/useKaKaoMap'; import { Document, AddressType, GeoPosition } from '@/types/api/map'; +import { Address } from '@/types/postCreate/postCreate'; import { pick } from '@/utils/map'; import { Dispatch, SetStateAction, useCallback, useState } from 'react'; @@ -27,14 +28,18 @@ interface UseAddressSearchReturn { setCurrentGeoInfo: Dispatch>; } -export const useAddressSearch = (): UseAddressSearchReturn => { - const [addressInput, setAddressInput] = useState(''); +export const useAddressSearch = ( + addressBeforeEdit?: Address, +): UseAddressSearchReturn => { + const [addressInput, setAddressInput] = useState( + addressBeforeEdit?.address_name || '', + ); const [addressSearchResult, setAddressSearchResult] = useState( [], ); const [currentGeoInfo, setCurrentGeoInfo] = useState({ - lat: 0, - lon: 0, + lat: addressBeforeEdit?.latitude || 0, + lon: addressBeforeEdit?.longitude || 0, }); const { searchAddress } = useSearchAddress({ diff --git a/src/pages/Employer/Post/EmployerEditPostPage.tsx b/src/pages/Employer/Post/EmployerEditPostPage.tsx index b566b926..8132ed54 100644 --- a/src/pages/Employer/Post/EmployerEditPostPage.tsx +++ b/src/pages/Employer/Post/EmployerEditPostPage.tsx @@ -20,7 +20,7 @@ const EmployerEditPostPage = () => { const { isEdit } = location.state || {}; const { id } = useParams(); const { currentPostId } = useCurrentPostIdStore(); - console.log(currentPostId) + console.log(currentPostId); const [currentStep, setCurrentStep] = useState(1); const [postInfo, setPostInfo] = useState( initialJobPostingState, @@ -56,8 +56,15 @@ const EmployerEditPostPage = () => { work_period: serverData.working_conditions.work_period, hourly_rate: serverData.working_conditions.hourly_rate, employment_type: serverData.working_conditions.employment_type, - address: {...postInfo.body.address, address_name: serverData.company_information.company_address}, - recruitment_dead_line: serverData.recruitment_conditions.recruitment_deadline, + address: { + ...postInfo.body.address, + address_name: serverData.workplace_information.main_address, + latitude: serverData.workplace_information.latitude, + longitude: serverData.workplace_information.longitude, + address_detail: serverData.workplace_information.detailed_address, + }, + recruitment_dead_line: + serverData.recruitment_conditions.recruitment_deadline, recruitment_number: serverData.recruitment_conditions.number_of_recruits, gender: serverData.recruitment_conditions.gender, age_restriction: initialJobPostingState.body.age_restriction, @@ -107,7 +114,7 @@ const EmployerEditPostPage = () => { length={5} currentStep={currentStep} mainColor="#1E1926" - textColor='#FFFFFF' + textColor="#FFFFFF" />