From 510ea31ca45130dbc6be567c677d8b58e2ead9bf Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 17:15:08 +0900 Subject: [PATCH 01/19] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=A6=84,=20?= =?UTF-8?q?=EC=97=B0=EB=9D=BD=EC=B2=98=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my-page/ui/profile-edit-modal.tsx | 27 +++++++++++++------ src/shared/ui/form/form-field.tsx | 7 ++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index 02cdb8a0..40cac8f0 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -29,9 +29,15 @@ export default function ProfileEditModal({ const [name, setName] = useState( memberProfile.memberName ?? '', ); + // 이름 유효성 검사: 2~10자, 한글 또는 영문만 허용 + const isNameValid = /^[가-힣a-zA-Z]{2,10}$/.test(name); + const [tel, setTel] = useState( memberProfile.tel ?? '', ); + // 연락처 유효성 검사: "(2~3자리 지역번호)-(3~4자리 번호)-(4자리 번호)" 형식 + const isTelValid = /^\d{2,3}-\d{3,4}-\d{4}$/.test(tel); + const [githubLink, setGithubLink] = useState< UpdateUserProfileRequest['githubLink'] >(memberProfile.githubLink?.url ?? ''); @@ -70,12 +76,6 @@ export default function ProfileEditModal({ }; const handleSubmit = async () => { - if (!name || !tel) { - alert('모든 필수 정보를 입력해주세요!'); - - return; - } - const file = fileInputRef.current?.files?.[0]; const hasImageFile = !!file; @@ -158,7 +158,12 @@ export default function ProfileEditModal({ 수정 완료 diff --git a/src/shared/ui/form/form-field.tsx b/src/shared/ui/form/form-field.tsx index f617a5d6..737f3edf 100644 --- a/src/shared/ui/form/form-field.tsx +++ b/src/shared/ui/form/form-field.tsx @@ -21,10 +21,12 @@ interface FormFieldProps { value: T; direction?: 'horizontal' | 'vertical'; onChange: (value: T) => void; + error?: boolean; } export function FormField({ label, + error = false, description, type, required = false, @@ -42,10 +44,13 @@ export function FormField({ onChange(e.target.value as T)} /> {description && ( -
+
{description}
)} From ff35c9007ddf9d5c7dc63230590796033f570307 Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 17:20:52 +0900 Subject: [PATCH 02/19] =?UTF-8?q?refactor:=20=EC=97=B0=EB=9D=BD=EC=B2=98?= =?UTF-8?q?=20input=EC=97=90=20=EC=88=AB=EC=9E=90=EC=99=80=20-=EB=A7=8C=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=A0=9C?= =?UTF-8?q?=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile-edit-modal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index 40cac8f0..a8d81b0d 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -178,7 +178,10 @@ export default function ProfileEditModal({ : '연락처는 숫자와 하이픈(-)을 포함한 형식으로 입력해주세요.' } value={tel} - onChange={setTel} + onChange={(value) => { + const onlyNumberAndHyphen = value.replace(/[^\d-]/g, ''); + setTel(onlyNumberAndHyphen); + }} required /> Date: Fri, 18 Jul 2025 17:29:33 +0900 Subject: [PATCH 03/19] =?UTF-8?q?refactor:=20=EB=82=B4=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EC=88=98=EC=A0=95=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EC=9D=98=20Footer=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile-edit-modal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index a8d81b0d..47d537e5 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -223,16 +223,16 @@ export default function ProfileEditModal({
-
+
); From 6724fde5226ebca7e4b7b8cc737af558a0b189c2 Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 22:14:39 +0900 Subject: [PATCH 06/19] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/consts/my-page-const.ts | 2 ++ src/features/my-page/ui/profile-edit-modal.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/features/my-page/consts/my-page-const.ts b/src/features/my-page/consts/my-page-const.ts index 15b20a72..5f909266 100644 --- a/src/features/my-page/consts/my-page-const.ts +++ b/src/features/my-page/consts/my-page-const.ts @@ -29,3 +29,5 @@ export const MBTI_OPTIONS = [ { label: 'ENFJ', value: 'ENFJ' }, { label: 'ENTJ', value: 'ENTJ' }, ]; + +export const DEFAULT_PROFILE_IMAGE_URL = '/profile-default.svg'; diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index 5bb94386..48147397 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -10,7 +10,11 @@ import Button from '@/shared/ui/button'; import { Modal } from '@/shared/ui/modal'; import { FormField } from '../../../shared/ui/form/form-field'; import { UpdateUserProfileRequest } from '../api/types'; -import { DEFAULT_OPTIONS, MBTI_OPTIONS } from '../consts/my-page-const'; +import { + DEFAULT_OPTIONS, + DEFAULT_PROFILE_IMAGE_URL, + MBTI_OPTIONS, +} from '../consts/my-page-const'; import { useUpdateUserProfileMutation } from '../model/use-update-user-profile-mutation'; interface Props { @@ -58,7 +62,7 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { const [image, setImage] = useState( memberProfile.profileImage?.resizedImages?.[0]?.resizedImageUrl ?? - '/profile-default.svg', + DEFAULT_PROFILE_IMAGE_URL, ); const queryClient = useQueryClient(); @@ -119,6 +123,7 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { alert('이미지 업로드에 실패했습니다.'); } } + console.log('memberinfo 업데이트'); await queryClient.invalidateQueries({ queryKey: ['memberInfo'] }); }; From 6ec6122e68a04e35e52f2cb062000ece9b7a669d Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 22:44:11 +0900 Subject: [PATCH 07/19] =?UTF-8?q?style:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/auth/api/auth.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/features/auth/api/auth.ts b/src/features/auth/api/auth.ts index a055640c..26828943 100644 --- a/src/features/auth/api/auth.ts +++ b/src/features/auth/api/auth.ts @@ -19,13 +19,10 @@ export async function uploadProfileImage( filename: string, file: FormData, ) { - console.log('uploadProfileImage 요청직전', file); - // Bug : 여기서 에러발생중 const res = await axiosInstanceForMultipart.put( `/files/members/${memberId}/profile/image/${filename}`, file, ); - console.log('auth.ts - uploadProfileImage 응답', res); return res.data; } From 7e89030d06bf5f97b8cece4d7c9c67914f2f16fd Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 22:48:49 +0900 Subject: [PATCH 08/19] =?UTF-8?q?style:=20--color-background-dimmer=20opac?= =?UTF-8?q?ity=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/global.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/global.css b/app/global.css index bcbecc55..74119091 100644 --- a/app/global.css +++ b/app/global.css @@ -185,7 +185,7 @@ https://velog.io/@oneook/tailwindcss-4.0-%EB%AC%B4%EC%97%87%EC%9D%B4-%EB%8B%AC%E --color-background-alternative: var(--color-gray-50); --color-background-default: var(--color-gray-0); - --color-background-dimmer: rgba(24, 29, 39, 80); + --color-background-dimmer: rgba(24, 29, 39, 0.8); --color-background-disabled: var(--color-gray-100); --color-background-brand-subtle: var(--color-rose-300); From 4153fd3d6e10040e3ebc8f04c54c4c5144203992 Mon Sep 17 00:00:00 2001 From: aken-you Date: Fri, 18 Jul 2025 23:23:01 +0900 Subject: [PATCH 09/19] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=ED=8E=B8=EC=A7=91=20=EB=AA=A8=EB=8B=AC=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=8F=BC=EA=B3=BC=20=EA=B4=80=EB=A0=A8=EB=90=9C=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my-page/ui/profile-edit-modal.tsx | 107 +++++++++--------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index 48147397..b9275896 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -25,46 +25,29 @@ interface Props { export type MbtiValue = (typeof MBTI_OPTIONS)[number]['value']; export default function ProfileEditModal({ memberProfile, memberId }: Props) { - const [isOpen, setIsOpen] = useState(false); const fileInputRef = useRef(null); + const [isOpen, setIsOpen] = useState(false); - const [name, setName] = useState( - memberProfile.memberName ?? '', - ); - // 이름 유효성 검사: 2~10자, 한글 또는 영문만 허용 - const isNameValid = /^[가-힣a-zA-Z]{2,10}$/.test(name); - - const [tel, setTel] = useState( - memberProfile.tel ?? '', - ); - // 연락처 유효성 검사: "(2~3자리 지역번호)-(3~4자리 번호)-(4자리 번호)" 형식 - const isTelValid = /^\d{2,3}-\d{3,4}-\d{4}$/.test(tel); - - const [githubLink, setGithubLink] = useState< - UpdateUserProfileRequest['githubLink'] - >(memberProfile.githubLink?.url ?? ''); - - const [blogOrSnsLink, setBlogOrSnsLink] = useState< - UpdateUserProfileRequest['blogOrSnsLink'] - >(memberProfile.blogOrSnsLink?.url ?? ''); - - const [mbti, setMbti] = useState( - memberProfile.mbti ?? '', - ); - - const [simpleIntroduction, setSimpleIntroduction] = useState< - UpdateUserProfileRequest['simpleIntroduction'] - >(memberProfile.simpleIntroduction ?? ''); - - const [interests, setInterests] = useState< - UpdateUserProfileRequest['interests'] - >(memberProfile.interests?.map((item) => item.name) ?? []); + const [profileForm, setProfileForm] = useState({ + name: memberProfile.memberName ?? '', + tel: memberProfile.tel ?? '', + githubLink: memberProfile.githubLink?.url ?? '', + blogOrSnsLink: memberProfile.blogOrSnsLink?.url ?? '', + mbti: memberProfile.mbti ?? '', + simpleIntroduction: memberProfile.simpleIntroduction ?? '', + interests: memberProfile.interests?.map((item) => item.name) ?? [], + }); const [image, setImage] = useState( memberProfile.profileImage?.resizedImages?.[0]?.resizedImageUrl ?? DEFAULT_PROFILE_IMAGE_URL, ); + // 이름 유효성 검사: 2~10자, 한글 또는 영문만 허용 + const isNameValid = /^[가-힣a-zA-Z]{2,10}$/.test(profileForm.name); + // 연락처 유효성 검사: "(2~3자리 지역번호)-(3~4자리 번호)-(4자리 번호)" 형식 + const isTelValid = /^\d{2,3}-\d{3,4}-\d{4}$/.test(profileForm.tel); + const queryClient = useQueryClient(); const { mutateAsync: updateProfile, data: updatedProfile } = useUpdateUserProfileMutation(memberId); @@ -86,13 +69,14 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { ext && ['JPG', 'PNG', 'GIF', 'WEBP'].includes(ext) ? ext : undefined; const rawFormData: UpdateUserProfileRequest = { - name, - tel, - githubLink: githubLink.trim() || undefined, - blogOrSnsLink: blogOrSnsLink.trim() || undefined, - simpleIntroduction: simpleIntroduction.trim() || undefined, - mbti: mbti.trim() || undefined, - interests: interests.length > 0 ? interests : undefined, + name: profileForm.name, + tel: profileForm.tel, + githubLink: profileForm.githubLink.trim() || undefined, + blogOrSnsLink: profileForm.blogOrSnsLink.trim() || undefined, + simpleIntroduction: profileForm.simpleIntroduction.trim() || undefined, + mbti: profileForm.mbti.trim() || undefined, + interests: + profileForm.interests.length > 0 ? profileForm.interests : undefined, profileImageExtension: hasImageFile ? profileImageExtension : undefined, }; @@ -168,8 +152,14 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { ? '소셜 계정에서 불러온 닉네임 대신 이름을 입력해 주세요.' : '이름은 2~10자의 한글 또는 영문만 허용됩니다.' } - value={name} - onChange={setName} + value={profileForm.name} + onChange={(value) => { + // 공백 입력하지 못하도록 제한 + setProfileForm({ + ...profileForm, + name: value.replace(/\s/g, ''), + }); + }} required /> { + // 숫자와 하이픈(-)만 입력 허용 const onlyNumberAndHyphen = value.replace(/[^\d-]/g, ''); - setTel(onlyNumberAndHyphen); + setProfileForm({ ...profileForm, tel: onlyNumberAndHyphen }); }} required /> @@ -192,37 +183,47 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { label="Github" type="text" description="스터디 진행을 위한 연락 가능한 정보를 입력해 주세요." - value={githubLink} - onChange={setGithubLink} + value={profileForm.githubLink} + onChange={(value) => + setProfileForm({ ...profileForm, githubLink: value }) + } /> + setProfileForm({ ...profileForm, mbti: value }) + } options={MBTI_OPTIONS} /> + setProfileForm({ ...profileForm, interests: value }) + } options={DEFAULT_OPTIONS} /> + setProfileForm({ ...profileForm, simpleIntroduction: value }) + } /> + setProfileForm({ ...profileForm, blogOrSnsLink: value }) + } /> From 71e0dcbd6db4d7cfc423ab34452117962a4a9a20 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 00:02:39 +0900 Subject: [PATCH 10/19] =?UTF-8?q?fix:=20=EB=AA=A8=EB=8B=AC=EC=9D=84=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EC=97=B4=EC=96=B4=EB=8F=84=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=EC=97=90=20=EC=88=98=EC=A0=95=ED=95=9C=20=ED=8F=BC=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EC=9C=A0=EC=A7=80=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile-edit-modal.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index b9275896..37806d92 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -60,6 +60,22 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { } }; + const resetForm = () => { + setProfileForm({ + name: memberProfile.memberName ?? '', + tel: memberProfile.tel ?? '', + githubLink: memberProfile.githubLink?.url ?? '', + blogOrSnsLink: memberProfile.blogOrSnsLink?.url ?? '', + mbti: memberProfile.mbti ?? '', + simpleIntroduction: memberProfile.simpleIntroduction ?? '', + interests: memberProfile.interests?.map((item) => item.name) ?? [], + }); + setImage( + memberProfile.profileImage?.resizedImages?.[0]?.resizedImageUrl ?? + DEFAULT_PROFILE_IMAGE_URL, + ); + }; + const handleSubmit = async () => { const file = fileInputRef.current?.files?.[0]; @@ -121,7 +137,7 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { - +
내 프로필 수정 From d2e95181e1cadac13da49f9ed44da8922c4872d7 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 00:27:15 +0900 Subject: [PATCH 11/19] =?UTF-8?q?fix:=20github=20=EB=A7=81=ED=81=AC?= =?UTF-8?q?=EC=99=80=20blog/sns=20=EB=A7=81=ED=81=AC=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0,=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EB=B6=80=ED=83=81=20=EB=A9=94=EC=84=B8=EC=A7=80=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/my-page/ui/profile.tsx b/src/features/my-page/ui/profile.tsx index 2b277bde..811cbc3f 100644 --- a/src/features/my-page/ui/profile.tsx +++ b/src/features/my-page/ui/profile.tsx @@ -65,7 +65,7 @@ export default function Profile({ memberId, memberProfile }: ProfileProps) { width={16} height={16} /> - {memberProfile.githubLink?.url ?? '깃허브 링크를 입력해주세요!'} + {memberProfile.githubLink?.url || '깃허브 링크를 입력해주세요!'}
- {memberProfile.blogOrSnsLink?.url ?? + {memberProfile.blogOrSnsLink?.url || '블로그 링크를 입력해주세요!'}
From af97facddf5186917adff442511693e9c61ec63e Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 00:28:29 +0900 Subject: [PATCH 12/19] =?UTF-8?q?refactor:=20=EA=B3=B5=EB=B0=B1=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=ED=9B=84=20github,=20=EB=B8=94=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8/SNS=20=EB=A7=81=ED=81=AC=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile-edit-modal.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index 37806d92..ee15d672 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -87,10 +87,10 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { const rawFormData: UpdateUserProfileRequest = { name: profileForm.name, tel: profileForm.tel, - githubLink: profileForm.githubLink.trim() || undefined, - blogOrSnsLink: profileForm.blogOrSnsLink.trim() || undefined, + githubLink: profileForm.githubLink, + blogOrSnsLink: profileForm.blogOrSnsLink, simpleIntroduction: profileForm.simpleIntroduction.trim() || undefined, - mbti: profileForm.mbti.trim() || undefined, + mbti: profileForm.mbti || undefined, interests: profileForm.interests.length > 0 ? profileForm.interests : undefined, profileImageExtension: hasImageFile ? profileImageExtension : undefined, @@ -201,7 +201,10 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { description="스터디 진행을 위한 연락 가능한 정보를 입력해 주세요." value={profileForm.githubLink} onChange={(value) => - setProfileForm({ ...profileForm, githubLink: value }) + setProfileForm({ + ...profileForm, + githubLink: value.replace(/\s/g, ''), + }) } /> - setProfileForm({ ...profileForm, blogOrSnsLink: value }) + setProfileForm({ + ...profileForm, + blogOrSnsLink: value.replace(/\s/g, ''), + }) } /> From 8909fedf0a6a772a483d6b2cad200c882c63acec Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 09:05:28 +0900 Subject: [PATCH 13/19] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=ED=8F=BC=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ProfileEditModal에서 폼상태를 관리하면 memberProfile이 변경돼도, 폼 상태가 변경되지 않음 --- .../my-page/ui/profile-edit-modal.tsx | 318 +++++++++--------- 1 file changed, 156 insertions(+), 162 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index ee15d672..a9325855 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -25,9 +25,44 @@ interface Props { export type MbtiValue = (typeof MBTI_OPTIONS)[number]['value']; export default function ProfileEditModal({ memberProfile, memberId }: Props) { - const fileInputRef = useRef(null); const [isOpen, setIsOpen] = useState(false); + return ( + + setIsOpen(true)} + className="rounded-100 bg-fill-brand-default-default font-designer-16b text-text-inverse w-full px-150 py-100" + > + 내 프로필 수정 + + + + + +
+ 내 프로필 수정 + + + +
+
+ setIsOpen(false)} + /> +
+
+
+ ); +} + +function ProfileEditForm({ + memberProfile, + memberId, + onClose, +}: Props & { onClose: () => void }) { + const fileInputRef = useRef(null); const [profileForm, setProfileForm] = useState({ name: memberProfile.memberName ?? '', tel: memberProfile.tel ?? '', @@ -60,22 +95,6 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { } }; - const resetForm = () => { - setProfileForm({ - name: memberProfile.memberName ?? '', - tel: memberProfile.tel ?? '', - githubLink: memberProfile.githubLink?.url ?? '', - blogOrSnsLink: memberProfile.blogOrSnsLink?.url ?? '', - mbti: memberProfile.mbti ?? '', - simpleIntroduction: memberProfile.simpleIntroduction ?? '', - interests: memberProfile.interests?.map((item) => item.name) ?? [], - }); - setImage( - memberProfile.profileImage?.resizedImages?.[0]?.resizedImageUrl ?? - DEFAULT_PROFILE_IMAGE_URL, - ); - }; - const handleSubmit = async () => { const file = fileInputRef.current?.files?.[0]; @@ -128,150 +147,125 @@ export default function ProfileEditModal({ memberProfile, memberId }: Props) { }; return ( - - setIsOpen(true)} - className="rounded-100 bg-fill-brand-default-default font-designer-16b text-text-inverse w-full px-150 py-100" - > - 내 프로필 수정 - - - - - -
- 내 프로필 수정 - - - -
-
- -
-
-
- 이미지 설정 -
- -
- { - // 공백 입력하지 못하도록 제한 - setProfileForm({ - ...profileForm, - name: value.replace(/\s/g, ''), - }); - }} - required - /> - { - // 숫자와 하이픈(-)만 입력 허용 - const onlyNumberAndHyphen = value.replace(/[^\d-]/g, ''); - setProfileForm({ ...profileForm, tel: onlyNumberAndHyphen }); - }} - required - /> - - setProfileForm({ - ...profileForm, - githubLink: value.replace(/\s/g, ''), - }) - } - /> - - setProfileForm({ ...profileForm, mbti: value }) - } - options={MBTI_OPTIONS} - /> - - setProfileForm({ ...profileForm, interests: value }) - } - options={DEFAULT_OPTIONS} - /> - - setProfileForm({ ...profileForm, simpleIntroduction: value }) - } - /> - - setProfileForm({ - ...profileForm, - blogOrSnsLink: value.replace(/\s/g, ''), - }) - } - /> -
-
- -
- - -
-
-
-
-
+ <> + +
+
+
이미지 설정
+ +
+ { + // 공백 입력하지 못하도록 제한 + setProfileForm({ + ...profileForm, + name: value.replace(/\s/g, ''), + }); + }} + required + /> + { + // 숫자와 하이픈(-)만 입력 허용 + const onlyNumberAndHyphen = value.replace(/[^\d-]/g, ''); + setProfileForm({ ...profileForm, tel: onlyNumberAndHyphen }); + }} + required + /> + + setProfileForm({ + ...profileForm, + githubLink: value.replace(/\s/g, ''), + }) + } + /> + + setProfileForm({ ...profileForm, mbti: value }) + } + options={MBTI_OPTIONS} + /> + + setProfileForm({ ...profileForm, interests: value }) + } + options={DEFAULT_OPTIONS} + /> + + setProfileForm({ ...profileForm, simpleIntroduction: value }) + } + /> + + setProfileForm({ + ...profileForm, + blogOrSnsLink: value.replace(/\s/g, ''), + }) + } + /> +
+
+ +
+ + +
+
+ ); } From 81d58b024745d4e2c8e6e1b7925d43f67186b988 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 11:21:22 +0900 Subject: [PATCH 14/19] =?UTF-8?q?style:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/my-page/ui/profile-edit-modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index a9325855..c4fea137 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -142,7 +142,7 @@ function ProfileEditForm({ alert('이미지 업로드에 실패했습니다.'); } } - console.log('memberinfo 업데이트'); + await queryClient.invalidateQueries({ queryKey: ['memberInfo'] }); }; From b910c3811ac778c98998f187404dffe9c476497e Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 11:24:01 +0900 Subject: [PATCH 15/19] =?UTF-8?q?refactor:=201024px=20=EA=B8=B0=EC=A4=80?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20layout=20=EC=8A=A4=ED=83=80=EC=9D=BC=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B4=EA=B2=8C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(my)/layout.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/(my)/layout.tsx b/app/(my)/layout.tsx index 76a6fae5..c4c054fd 100644 --- a/app/(my)/layout.tsx +++ b/app/(my)/layout.tsx @@ -14,7 +14,9 @@ export default function MyLayout({ return (
-
{children}
+
+ {children} +
); } From a738ab45b99be58361fe8683e2b835fbc14f59f8 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 12:01:38 +0900 Subject: [PATCH 16/19] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20input=EC=97=90=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=99=95=EC=9E=A5=EC=9E=90=EC=99=80=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EA=B0=9C=EC=88=98=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/auth/ui/sign-up-image-selector.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/features/auth/ui/sign-up-image-selector.tsx b/src/features/auth/ui/sign-up-image-selector.tsx index 4e7fe757..4b0ffb78 100644 --- a/src/features/auth/ui/sign-up-image-selector.tsx +++ b/src/features/auth/ui/sign-up-image-selector.tsx @@ -20,7 +20,7 @@ export default function SignupImageSelector({
프로필 - next최적화안쓴프로필 + next최적화안쓴프로필
@@ -53,8 +53,9 @@ export default function SignupImageSelector({
From dd6dd4996d63e9c7e3e5e88a251599b310818524 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 12:05:45 +0900 Subject: [PATCH 17/19] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my-page/ui/profile-edit-modal.tsx | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index c4fea137..acac51f4 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -84,8 +84,7 @@ function ProfileEditForm({ const isTelValid = /^\d{2,3}-\d{3,4}-\d{4}$/.test(profileForm.tel); const queryClient = useQueryClient(); - const { mutateAsync: updateProfile, data: updatedProfile } = - useUpdateUserProfileMutation(memberId); + const { mutateAsync: updateProfile } = useUpdateUserProfileMutation(memberId); const { mutateAsync: uploadProfileImage } = useUploadProfileImageMutation(); const handleImageChange = (e: React.ChangeEvent) => { @@ -97,11 +96,7 @@ function ProfileEditForm({ const handleSubmit = async () => { const file = fileInputRef.current?.files?.[0]; - - const hasImageFile = !!file; - const ext = file?.name.split('.').pop()?.toUpperCase(); - const profileImageExtension = - ext && ['JPG', 'PNG', 'GIF', 'WEBP'].includes(ext) ? ext : undefined; + const profileImageExtension = file?.name.split('.').pop(); const rawFormData: UpdateUserProfileRequest = { name: profileForm.name, @@ -112,21 +107,18 @@ function ProfileEditForm({ mbti: profileForm.mbti || undefined, interests: profileForm.interests.length > 0 ? profileForm.interests : undefined, - profileImageExtension: hasImageFile ? profileImageExtension : undefined, + profileImageExtension: profileImageExtension, }; const formData = Object.fromEntries( Object.entries(rawFormData).filter(([_, v]) => v !== undefined), ) as UpdateUserProfileRequest; - await updateProfile(formData); + const updatedProfile = await updateProfile(formData); - if ( - fileInputRef.current?.files?.[0] && - updatedProfile.profileImageUploadUrl - ) { + if (file && updatedProfile.profileImageUploadUrl) { const imageFormData = new FormData(); - imageFormData.append('file', fileInputRef.current.files[0]); + imageFormData.append('file', file); const filename = updatedProfile.profileImageUploadUrl.split('/').pop(); if (!filename) return; @@ -143,7 +135,9 @@ function ProfileEditForm({ } } - await queryClient.invalidateQueries({ queryKey: ['memberInfo'] }); + await queryClient.invalidateQueries({ + queryKey: ['userProfile', memberId], + }); }; return ( From d48ef193780adb49cc47ffbf038e0fa66ffa5dd0 Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 12:15:31 +0900 Subject: [PATCH 18/19] =?UTF-8?q?style:=20=ED=8C=8C=EC=9D=BC=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=EB=A5=BC=20=EC=97=AC=EB=8A=94=20=ED=95=B8=EB=93=A4?= =?UTF-8?q?=EB=9F=AC=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/auth/ui/sign-up-image-selector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/auth/ui/sign-up-image-selector.tsx b/src/features/auth/ui/sign-up-image-selector.tsx index 4b0ffb78..8a8f9ce0 100644 --- a/src/features/auth/ui/sign-up-image-selector.tsx +++ b/src/features/auth/ui/sign-up-image-selector.tsx @@ -14,7 +14,7 @@ export default function SignupImageSelector({ handleImageChange: (event: React.ChangeEvent) => void; }) { const setDefaultImage = () => setImage('/profile-default.svg'); - const openFileDialog = () => fileInputRef.current?.click(); + const openFileFolder = () => fileInputRef.current?.click(); return (
@@ -44,7 +44,7 @@ export default function SignupImageSelector({ 앨범에서 선택 From d773b55eca1e62d92729d1db420151463eda695a Mon Sep 17 00:00:00 2001 From: aken-you Date: Sat, 19 Jul 2025 12:38:03 +0900 Subject: [PATCH 19/19] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A1=9C=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=ED=95=98=EB=A9=B4,=20=EC=84=9C=EB=B2=84=EC=97=90=EA=B2=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/profile-default.jpg | Bin 0 -> 7003 bytes .../my-page/ui/profile-edit-modal.tsx | 27 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 public/profile-default.jpg diff --git a/public/profile-default.jpg b/public/profile-default.jpg new file mode 100644 index 0000000000000000000000000000000000000000..46ce5400c3215ec3c00d42dc7cb915d22c50a664 GIT binary patch literal 7003 zcmbuEXH-*Nm&b#E6cwZwDN2;n4DT%T3%WGv9`W}C+z*&KR7%h9{>KsMFJrGx6A$o_CL5Toj`Jh zjEt0w;tv}R`9G2U8|=ThrU2JTNiJU=DIGu+aDILl@bStkk(t@)DS?w{W66FJg%@28 z57X@TIs7|h$|$6LmW=r@2olZP+LGNWOTgRWHC7D{nrg=nI@2LI0R@*jlPQ5c%@I1+ z?`zFI^8z^^V%$VAM~K9hIX~6j5rA2tO@nCc`DUDI;>T-)_}_7YtM!RpUa|rdgk&FD z;x*D~dF1n}v*po7i|z~46Wv!qXHQ)H0ZNM#zr~#`3ly~kBYsGV(u+pHqV*oFe_be{ z!GEQjF?tOIFan;EJRk==!`Ba+{kRrdX?X#lQ${G9AFBNNE#RqGcg_s8q!ET9b03Kg z%OuGe+b3^QJfm=61$Y9O?07GssR4hpi&|LeL2su~QA>1c?$)0FEZ4BHA1S)MFi7E3 z=saXo)_FxKl`Y`cUhOvF`AT_lcBNxd+YgD+2p5Ato|CA?7;ZvW9>9j5v)vo-jw3Xj z9j?FqgymkmK3vNo$(N-4=Uhn&sIV~19t|m??YH2oGAc#rjJoYf1Xte7$2-Yc&}ruy4ZB% zgRB~GwcWF-w1EG1d{%Gn1BJasZElXO4oji_f~q@0E!%}#_(SW`{k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ucD@v)pqIqJDl|mM)AQFBz`tLLiCRCi~!RenZm!{WpzG*52J&F!QL0 z%I0TJNY|3^I&yP)Dre-lXWP04s?xQpZ~=&Ew8#}2LdCw&PD1}P*v XljZOBrNj+CJz9aIyo|Gei^=~0tTkT@ literal 0 HcmV?d00001 diff --git a/src/features/my-page/ui/profile-edit-modal.tsx b/src/features/my-page/ui/profile-edit-modal.tsx index acac51f4..9c26e4a8 100644 --- a/src/features/my-page/ui/profile-edit-modal.tsx +++ b/src/features/my-page/ui/profile-edit-modal.tsx @@ -116,6 +116,33 @@ function ProfileEditForm({ const updatedProfile = await updateProfile(formData); + // todo: 서버 측에서 api 수정되면, 리팩토링 + // 기본 프로필 이미지를 선택할 경우, 기본 프로필 이미지 전송 -> 서버 측에서 나중에 리팩토링 예정 + // public 폴더의 profile-default.jpg 파일을 fetch해서 FormData에 추가 + // profile-default.jpg를 추가한 이유는 서버에서 프로필 이미지 확장자에 svg 파일을 고려하지 못함 -> 서버 측에서 리팩토링 예정 + if (image === DEFAULT_PROFILE_IMAGE_URL) { + try { + const defaultProfileImage = 'profile-default.jpg'; + const response = await fetch(defaultProfileImage); + const blob = await response.blob(); + const defaultFile = new File([blob], defaultProfileImage, { + type: 'image/jpeg', + }); + const imageFormData = new FormData(); + imageFormData.append('file', defaultFile); + + await uploadProfileImage({ + memberId, + filename: defaultProfileImage, + file: imageFormData, + }); + } catch (error) { + console.error('기본 프로필 이미지 업로드 실패:', error); + alert('기본 프로필 이미지 업로드에 실패했습니다.'); + } + } + + // 폴더에서 이미지를 선택한 경우 if (file && updatedProfile.profileImageUploadUrl) { const imageFormData = new FormData(); imageFormData.append('file', file);