Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function App() {
<Route path='center/signup' element={<CenterSignUp />} />
<Route path='helper/signup' element={<HelperSignUp />} />

<Route path='helper/address' element={<HelperAddress />} />

{/* Center */}
<Route
path='center/*'
Expand Down Expand Up @@ -124,7 +126,6 @@ function App() {
<Route path='account/pay' element={<AccountPay />} />
<Route path='account/care-type' element={<AccountCareType />} />
<Route path='location' element={<HelperLocation />} />
<Route path='address' element={<HelperAddress />} />
<Route path='*' element={<Navigate to='/404' replace />} />
</Routes>
</RequireAuth>
Expand Down
25 changes: 21 additions & 4 deletions src/components/Auth/SignUp/helper/EmailAuth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SignUpButton from '@/components/Auth/SignUp/helper/SignUpButton';

export default function EmailAuth() {
const emailCodeRef = useRef(null);
const { signUpForm, setEmailAuthField } = useSignUpStore();
const { signUpForm, setEmailAuthField, isEmailFirstCheck } = useSignUpStore();
const { sendEmail, verifyEmail, sendEmailStatus, verifyEmailStatus } = useEmailAuthMutation();
const { email, emailCode, isVerified, mailSeq, password, passwordConfirm } = signUpForm.emailAuth;

Expand All @@ -28,7 +28,7 @@ export default function EmailAuth() {

return (
<div className='flex flex-col mb-[0.56rem]'>
<FormField label='이메일 입력' required>
<FormField label='이메일 입력' required className='mb-5'>
<div className='flex justify-between items-center gap-2'>
<Input
placeholder='이메일을 입력해주세요.'
Expand Down Expand Up @@ -64,19 +64,30 @@ export default function EmailAuth() {
{verifyEmailStatus.isPending ? '인증중...' : isVerified ? '인증완료' : '인증하기'}
</Button>
</div>

{!isEmailFirstCheck && !email && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
이메일을 입력해주세요
</p>
)}
</FormField>

<FormField label='비밀번호 입력' required>
<FormField label='비밀번호 입력' required className='mb-5'>
<Input
placeholder='비밀번호를 입력해주세요.'
type='password'
value={password}
onChange={(e) => setEmailAuthField('password', e.target.value)}
className='rounded-lg h-[4.0625rem] text-base font-normal text-[var(--button-black)] border border-[var(--outline)] placeholder:text-[var(--placeholder-gray)] w-[100%]'
/>
{!isEmailFirstCheck && !password && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
비밀번호를 입력해주세요
</p>
)}
</FormField>

<FormField label='비밀번호 확인' required>
<FormField label='비밀번호 확인' required className='mb-5'>
<Input
placeholder='비밀번호를 다시 한 번 입력해주세요.'
type='password'
Expand All @@ -85,6 +96,12 @@ export default function EmailAuth() {
onBlur={() => setEmailAuthField('passwordCheck', true)}
className='rounded-lg h-[4.0625rem] text-base font-normal text-[var(--button-black)] border border-[var(--outline)] placeholder:text-[var(--placeholder-gray)] w-[100%]'
/>

{!isEmailFirstCheck && !passwordConfirm && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
비밀번호를 확인해주세요
</p>
)}
</FormField>

<SignUpButton />
Expand Down
18 changes: 12 additions & 6 deletions src/components/Auth/SignUp/helper/HelperInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export default function HelperInfo() {
setHelperInfoField('profilePic', value);
};

const handleBirthday = (e) => {
let str = e.target.value.replace(/\D/g, '');
if (str.length > 8) str = str.slice(0, 8);
setHelperInfoField('birthday', str);
};

return (
<div>
<h1 className='text-[var(--text)] text-[1.44rem] font-semibold leading-normal text-start mb-5'>
Expand All @@ -25,13 +31,12 @@ export default function HelperInfo() {
</h1>

<FormField label='이름' required className='mb-5'>
{console.log(isFirstCheck)}
<Input
placeholder='예) 홍길동'
value={name}
maxLength={10}
onChange={(e) => setHelperInfoField('name', e.target.value)}
className={`rounded-lg h-[4.0625rem] text-base font-normal text-[var(--button-black)] border placeholder:text-[var(--placeholder-gray)] w-[100%] ${
className={`rounded-lg h-[4.0625rem] text-base font-normal text-[var(--button-black)] border placeholder:text-[var(--placeholder-gray)] w-[100%] ${
!isFirstCheck && !name ? 'border-[var(--required-red)]' : 'border-[var(--outline)]'
}`}
/>
Expand Down Expand Up @@ -72,7 +77,7 @@ export default function HelperInfo() {
여성
</RadioItem>
</Radio>
{!isFirstCheck && !gender && (
{!isFirstCheck && gender === null && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
성별을 입력해주세요
</p>
Expand All @@ -85,7 +90,8 @@ export default function HelperInfo() {
inputMode='numeric'
maxLength={8}
value={birthday}
onChange={(e) => setHelperInfoField('birthday', e.target.value)}
// onChange={(e) => setHelperInfoField('birthday', e.target.value)}
onChange={handleBirthday}
className={`rounded-lg h-[4.0625rem] text-base font-normal text-[var(--button-black)] border placeholder:text-[var(--placeholder-gray)] w-[100%] ${
!isFirstCheck && !birthday ? 'border-[var(--required-red)]' : 'border-[var(--outline)]'
}`}
Expand Down Expand Up @@ -128,7 +134,7 @@ export default function HelperInfo() {
아니오
</RadioItem>
</Radio>
{!isFirstCheck && !carOwnYn && (
{!isFirstCheck && carOwnYn === null && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
차량소유여부를 입력해주세요
</p>
Expand All @@ -144,7 +150,7 @@ export default function HelperInfo() {
아니오
</RadioItem>
</Radio>
{!isFirstCheck && !eduYn && (
{!isFirstCheck && eduYn === null && (
<p className='text-start text-sm text-[var(--required-red)] font-medium'>
치매교육 이수 여부를 입력해주세요
</p>
Expand Down
9 changes: 7 additions & 2 deletions src/components/Auth/SignUp/helper/SignUpButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ export default function SignUpButton() {

const signUpForm = useSignUpStore((state) => state.signUpForm);
const submitSignUp = useSignUpStore((state) => state.submitHelper);
const { setIsFirstCheck } = useSignUpStore();
const setIsFirstCheck = useSignUpStore((state) => state.setIsFirstCheck);
const setIsEmailFirstCheck = useSignUpStore((state) => state.setIsEmailFirstCheck);
// const { setIsFirstCheck, setIsEmailFirstCheck } = useSignUpStore();

const handleNext = async () => {
setIsFirstCheck(false);
if (currentStep === 0) {
setIsEmailFirstCheck(false);
} else if (currentStep === 1) setIsFirstCheck(false);

if (currentStep === 2) {
// 만약 선택된 자격증이 있다면, 그 항목 하위의 모든 필드가 입력되었는지 체크
const incomplete = Object.entries(signUpForm.licenseInfo).find(([key, certData]) => {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Auth/SignUp/helper/SignUpComplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default function SignUpComplete() {
navigate('/signin');
};

const handleInfo = () => {
navigate('/helper/account');
const handleHome = () => {
navigate('/');
};

return (
Expand All @@ -33,8 +33,8 @@ export default function SignUpComplete() {
<Button onClick={handleLogin} className='w-full'>
로그인하기
</Button>
<Button onClick={handleInfo} variant='white' className='w-full'>
내 정보 설정하기
<Button onClick={handleHome} variant='white' className='w-full'>
홈으로 이동
</Button>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/components/helper/Matching/CompleteDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default function CompleteDetail({ patientLogSeq, returnPath }) {
);

useEffect(() => {
window.scrollTo(0, 0);

setHeaderProps({
type: 'back',
title: '어르신 상세정보',
Expand Down Expand Up @@ -111,7 +113,10 @@ export default function CompleteDetail({ patientLogSeq, returnPath }) {
<InfoField label='몸무게' text={data.weight ? `${data.weight}kg` : '정보 없음'} />
<InfoField label='근무종류' text={data.careChoiceFormatted?.workType || '정보 없음'} />
<InfoField label='주소지' text={data.fullAddress || '주소 정보 없음'} />
<InfoField label='희망요일/시간' text={data.formattedTimeList || '시간 정보 없음'} />
<InfoField
label='희망요일/시간'
text={data.formattedTimeList.join('\n') || '시간 정보 없음'}
/>
<InfoField label='보유질병' text={data.diseases || '정보 없음'} />
<InfoField
label='장기요양등급'
Expand Down
6 changes: 5 additions & 1 deletion src/components/helper/Matching/RequestDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function RequestDetail({ patientLogSeq, returnPath }) {
const getHelperSeq = useAuthStore((state) => state.getHelperSeq);

useEffect(() => {
window.scrollTo(0, 0);
setHeaderProps({
type: 'back',
title: '어르신 상세정보',
Expand Down Expand Up @@ -163,7 +164,10 @@ export default function RequestDetail({ patientLogSeq, returnPath }) {
<section className='grid gap-y-5 px-0'>
<InfoField label='근무종류' text={data.careChoiceFormatted?.workType || '정보 없음'} />
<InfoField label='주소지' text={data.fullAddress || '주소 정보 없음'} />
<InfoField label='희망요일/시간' text={data.formattedTimeList || '시간 정보 없음'} />
<InfoField
label='희망요일/시간'
text={data.formattedTimeList.join('\n') || '시간 정보 없음'}
/>
<InfoField label='보유질병' text={data.diseases || '정보 없음'} />
<InfoField label='돌봄필요' text={getCareNeedItems(data.careChoice)} />
<InfoField label='희망시급' text={data.formattedWage || '시급 정보 없음'} />
Expand Down
14 changes: 1 addition & 13 deletions src/pages/helper/AccountEdit/AccountEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function AccountEdit() {
const { helper } = useHelperAccountStore();

useEffect(() => {
setHeaderProps({ type: 'back', title: '나의 계정' });
setHeaderProps({ type: 'back', title: '나의 계정', onBack: () => navigate('/helper/account') });
return () => {
clearHeaderProps();
};
Expand All @@ -48,18 +48,6 @@ export default function AccountEdit() {

const handleSave = async () => {
try {
// 모든 Store의 현재 상태로 새 프로필 생성
const newProfile = {
// ...editedProfile,
// pay: {
// amount: selectedPay,
// type: payType,
// },
// careTypes: selectedTypes,
// locations: selectedDistricts,
// schedules: schedules,
};

await request('put', '/helper/complete-profile', {
introduce: helper.introduce,
careExperience: helper.careExperience,
Expand Down
12 changes: 10 additions & 2 deletions src/pages/helper/AccountEdit/CareerSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ const CareExperienceSelector = () => {
className='flex items-center gap-8'
value={helper.careExperience} // Zustand에서 직접 가져옴
>
<RadioItem className='hover:cursor-pointer' value={false}>
<RadioItem
className='hover:cursor-pointer'
value={false}
checked={helper.careExperience === false}
>
신입
</RadioItem>
<RadioItem className='hover:cursor-pointer' value={true}>
<RadioItem
className='hover:cursor-pointer'
value={true}
checked={helper.careExperience === true}
>
경력
</RadioItem>
</Radio>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/helper/HelperAddress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function HelperAddress() {

return (
<AddressRegister
backPath='helper/signup'
backPath='/helper/signup'
title='나의 주소지를 등록해 주세요!'
description='요양보호사 등록을 위해 주소지를 등록해 주세요.'
onComplete={({ addressLabel }) => {
Expand Down
14 changes: 10 additions & 4 deletions src/store/auth/helper/useSignUpStore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { create } from 'zustand';
import { omit } from '@/utils/omit';
import { signUpHelper, uploadHelperImg } from '@/services/signUpService';
import { devtools } from 'zustand/middleware';

// 선택 해제 시 key 삭제
function removeLicenseField(licenseInfo, key) {
Expand Down Expand Up @@ -61,6 +62,7 @@ const createHelperDataSlice = (set) => ({
kakaoUser: null,
},
isFirstCheck: true,
isEmailFirstCheck: true,

setEmailAuth: (data) =>
set((state) => ({
Expand Down Expand Up @@ -138,6 +140,8 @@ const createHelperDataSlice = (set) => ({
})),

setIsFirstCheck: (newBool) => set({ isFirstCheck: newBool }),
setIsEmailFirstCheck: (newBool) => set({ isEmailFirstCheck: newBool }),

reset: () =>
set({
signUpForm: {
Expand Down Expand Up @@ -258,9 +262,11 @@ const createHelperSubmissionSlice = (set, get) => ({
},
});

export const useSignUpStore = create((set, get) => ({
...createHelperDataSlice(set),
...createHelperSubmissionSlice(set, get),
}));
export const useSignUpStore = create(
devtools((set, get) => ({
...createHelperDataSlice(set),
...createHelperSubmissionSlice(set, get),
})),
);

export default useSignUpStore;
Loading