Skip to content

[fix] 프로필 페이지 개선#488

Merged
miniseung merged 6 commits into
Kernel360:developfrom
dolmeengii:fix/profile-#478
Aug 5, 2025
Merged

[fix] 프로필 페이지 개선#488
miniseung merged 6 commits into
Kernel360:developfrom
dolmeengii:fix/profile-#478

Conversation

@dolmeengii
Copy link
Copy Markdown
Collaborator

@dolmeengii dolmeengii commented Aug 5, 2025

🚀 풀 리퀘스트 제안

📋 작업 내용

closes #478

🔧 변경 사항

  • 📃 README.md
  • 📦 package.json
  • 🔥 파일 삭제
  • 🧹 그 외 ex) .gitignore 등

주요 변경 사항을 요약해 주세요.

📸 스크린샷 (선택 사항)

수정된 화면 또는 기능을 시연할 수 있는 스크린샷을 첨부해 주세요.

📄 기타

추가적으로 전달하고 싶은 내용이나 특별한 요구 사항이 있으면 작성해 주세요.

Sourcery 요약

편집 폼 UX 개선, 아바타 처리 강화 및 에러 관리 표준화를 통해 프로필 페이지 경험을 향상합니다.

버그 수정:

  • 프로필 이미지 업로더에서 지원되지 않는 SVG 업로드를 차단하고 토스트 메시지를 통해 사용자에게 알림

개선 사항:

  • 프로필 편집 폼에 로딩 스켈레톤을 추가하고, 업데이트 성공 시 프로필 페이지로 리디렉션
  • image prop을 필수로 지정하고 공유 아바타 에셋을 임포트하여 기본 아바타 사용을 통일
  • 프로필 데이터 액션을 리팩터링하여 로깅 및 null 반환 대신 에러를 throw하도록 변경
  • 불필요한 주석을 정리하고 폼 마크업 및 이벤트 처리를 간소화
Original summary in English

Summary by Sourcery

Enhance profile page experience by improving edit form UX, enforcing avatar handling, and standardizing error management

Bug Fixes:

  • Block unsupported SVG uploads in the profile image uploader and notify the user via toast

Enhancements:

  • Add loading skeletons to the profile edit form and redirect to the profile page on successful updates
  • Unify default avatar usage by requiring the image prop and importing a shared avatar asset
  • Refactor profile data actions to throw errors instead of logging and returning null
  • Clean up redundant comments and simplify form markup and event handling

@dolmeengii dolmeengii requested a review from geumyoung00 August 5, 2025 13:21
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Aug 5, 2025

검토자 가이드

이 PR은 프로필 페이지를 개선합니다. 편집 양식(탐색, 로더, 스타일링)을 리팩토링하고, SVG 유효성 검사 및 토스트 메시지 추가로 이미지 업로더를 강화하며, 표시 구성 요소에서 아바타 폴백을 표준화하고, 데이터 액션에서 일관된 오류 발생을 적용하고, 불필요한 코드를 정리합니다.

업데이트된 ProfileCard 및 ProfileImage 컴포넌트의 클래스 다이어그램

classDiagram
    class ProfileCard {
      - nickname: string
      - profileImg: string
      - location: string | null
      - children: React.ReactNode
      - className: string
    }
    class ProfileImage {
      - src: string
      - alt: string
      - size: 'small' | 'medium' | 'large'
      - className: string
      - priority: boolean
    }
    ProfileCard --> ProfileImage: uses
Loading

토스트 유효성 검사가 포함된 ProfileImageUploader 클래스 다이어그램

classDiagram
    class ProfileImageUploader {
      - defaultImage: string
      - onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
      - preview: string
      - fileInputRef: React.RefObject<HTMLInputElement>
      - showToast: function
      + handleFileChange(e)
    }
    ProfileImageUploader --> ToastStore: uses showToast
Loading

파일 수준 변경 사항

변경 사항 세부 정보 파일
프로필 편집 양식 동작 및 레이아웃 리팩토링
  • 불필요한 주석 및 사용되지 않는 훅 간격 제거
  • 성공적인 업데이트 시 router.refresh 및 router.push 추가
  • 기본 로더를 애니메이션 스켈레톤 플레이스홀더로 교체
  • 양식 ID, 패딩 조정 및 버튼 props 단순화
apps/web/src/components/common/profile/edit/form-edit.tsx
이미지 업로더에 SVG 제한 및 토스트 메시지 추가
  • 토스트 스토어 가져와 사용
  • "image/svg+xml" 파일 감지 및 알림 토스트 표시
  • 유효하지 않은 SVG에 대한 파일 미리보기 업데이트 방지
apps/web/src/components/common/profile/edit/profile-image-uploader.tsx
ProfileCard에서 profileImg prop 필수화
  • profileImg를 선택 사항에서 필수로 변경
  • 카드 내 아바타에 대한 인라인 폴백 로직 제거
apps/web/src/components/common/profile/card.tsx
프로필 페이지에서 가져온 defaultAvatar 사용
  • defaultAvatar 에셋 가져오기
  • 문자열 폴백을 defaultAvatar로 교체
  • 기본 닉네임 폴백을 빈 문자열로 지우기
apps/web/app/profile/page.tsx
ProfileImage 컴포넌트에서 아바타 폴백 인라인화
  • DEFAULT_AVATAR_URL 상수 제거
  • 폴백 src를 '/avatar-male.svg'로 인라인화
apps/web/src/components/common/profile/image.tsx
프로필 데이터 액션에서 오류 처리 표준화
  • getMyProfile에서 console.error 및 null 반환을 Error throw로 교체
  • getUserProfileFromDB에서 console.error 제거 및 Error throw
apps/web/src/lib/actions/profile.ts
apps/web/src/lib/data/user.ts
채팅 컴포넌트의 오래된 코드 정리
  • 오래된 TODO 주석 제거
apps/web/src/components/chat/messages/received-message.tsx

연결된 이슈에 대한 평가

이슈 목표 해결됨 설명
#478 프로필 페이지에 로딩 시 스켈레톤 추가
#478 프로필 페이지에 기본 이미지 설정
#478 프로필 정보 수정 기능 개선

관련 가능성이 있는 이슈


팁 및 명령어

Sourcery와 상호 작용하기

  • 새로운 리뷰 트리거: 풀 리퀘스트에 @sourcery-ai review라고 댓글을 달아주세요.
  • 논의 계속: Sourcery의 리뷰 댓글에 직접 답글을 달아주세요.
  • 리뷰 댓글에서 GitHub 이슈 생성: Sourcery에게 리뷰 댓글에 답글을 달아 이슈를 생성하도록 요청하세요. 또한 @sourcery-ai issue로 리뷰 댓글에 답글을 달아 이슈를 생성할 수도 있습니다.
  • 풀 리퀘스트 제목 생성: 풀 리퀘스트 제목 아무 곳에나 @sourcery-ai를 작성하여 언제든지 제목을 생성하세요. 또한 풀 리퀘스트에 @sourcery-ai title이라고 댓글을 달아 언제든지 제목을 (재)생성할 수 있습니다.
  • 풀 리퀘스트 요약 생성: 풀 리퀘스트 본문 아무 곳에나 @sourcery-ai summary를 작성하여 원하는 위치에 언제든지 PR 요약을 생성하세요. 또한 풀 리퀘스트에 @sourcery-ai summary라고 댓글을 달아 언제든지 요약을 (재)생성할 수 있습니다.
  • 검토자 가이드 생성: 풀 리퀘스트에 @sourcery-ai guide라고 댓글을 달아 언제든지 검토자 가이드를 (재)생성할 수 있습니다.
  • 모든 Sourcery 댓글 해결: 풀 리퀘스트에 @sourcery-ai resolve라고 댓글을 달아 모든 Sourcery 댓글을 해결하세요. 이미 모든 댓글을 처리했고 더 이상 보고 싶지 않을 때 유용합니다.
  • 모든 Sourcery 리뷰 해제: 풀 리퀘스트에 @sourcery-ai dismiss라고 댓글을 달아 기존의 모든 Sourcery 리뷰를 해제하세요. 새로운 리뷰를 처음부터 시작하고 싶을 때 특히 유용합니다. 새로운 리뷰를 트리거하려면 @sourcery-ai review라고 댓글을 다는 것을 잊지 마세요!

경험 사용자 정의

대시보드에 접속하여 다음을 수행할 수 있습니다:

  • Sourcery가 생성하는 풀 리퀘스트 요약, 검토자 가이드 등과 같은 검토 기능을 활성화 또는 비활성화합니다.
  • 검토 언어를 변경합니다.
  • 사용자 지정 검토 지침을 추가, 제거 또는 편집합니다.
  • 기타 검토 설정을 조정합니다.

도움 받기

Original review guide in English

Reviewer's Guide

This PR enhances the profile page by refactoring the edit form (navigation, loaders, styling), strengthening the image uploader with SVG validation and toasts, standardizing avatar fallbacks in display components, enforcing consistent error throwing in data actions, and cleaning up redundant code.

Class diagram for updated ProfileCard and ProfileImage components

classDiagram
    class ProfileCard {
      - nickname: string
      - profileImg: string
      - location: string | null
      - children: React.ReactNode
      - className: string
    }
    class ProfileImage {
      - src: string
      - alt: string
      - size: 'small' | 'medium' | 'large'
      - className: string
      - priority: boolean
    }
    ProfileCard --> ProfileImage: uses
Loading

Class diagram for ProfileImageUploader with toast validation

classDiagram
    class ProfileImageUploader {
      - defaultImage: string
      - onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
      - preview: string
      - fileInputRef: React.RefObject<HTMLInputElement>
      - showToast: function
      + handleFileChange(e)
    }
    ProfileImageUploader --> ToastStore: uses showToast
Loading

File-Level Changes

Change Details Files
Refactor profile edit form behavior and layout
  • remove redundant comments and unused hook spacing
  • add router.refresh and router.push on successful update
  • replace basic loader with animated skeleton placeholders
  • adjust form id, padding, and simplify button props
apps/web/src/components/common/profile/edit/form-edit.tsx
Add SVG restriction and toast in image uploader
  • import and use toast store
  • detect "image/svg+xml" files and show notice toast
  • prevent file preview update on invalid SVG
apps/web/src/components/common/profile/edit/profile-image-uploader.tsx
Enforce required profileImg prop in ProfileCard
  • change profileImg from optional to required
  • remove inline fallback logic for avatar in card
apps/web/src/components/common/profile/card.tsx
Use imported defaultAvatar in profile page
  • import defaultAvatar asset
  • replace string fallback with defaultAvatar
  • clear default nickname fallback to empty string
apps/web/app/profile/page.tsx
Inline avatar fallback in ProfileImage component
  • remove DEFAULT_AVATAR_URL constant
  • inline fallback src to '/avatar-male.svg'
apps/web/src/components/common/profile/image.tsx
Standardize error handling in profile data actions
  • replace console.error and return null with throwing Errors in getMyProfile
  • remove console.error in getUserProfileFromDB and throw Error
apps/web/src/lib/actions/profile.ts
apps/web/src/lib/data/user.ts
Clean up stale code in chat component
  • remove outdated TODO comment
apps/web/src/components/chat/messages/received-message.tsx

Assessment against linked issues

Issue Objective Addressed Explanation
#478 프로필 페이지에 로딩 시 스켈레톤 추가
#478 프로필 페이지에 기본 이미지 설정
#478 프로필 정보 수정 기능 개선

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 @dolmeengii - 변경 사항을 검토했으며 아주 좋습니다!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `apps/web/src/lib/data/user.ts:28` </location>
<code_context>
     }
     return profile;
   } catch (error) {
-    console.error('내 프로필 조회 에러:', error);
-    return null;
</code_context>

<issue_to_address>
Suppressing the error object in the catch block may hinder debugging.

Consider logging the error or storing it for diagnostics to help with issue tracking in production environments.
</issue_to_address>

### Comment 2
<location> `apps/web/src/components/common/profile/edit/profile-image-uploader.tsx:44` </location>
<code_context>

   const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+    const file = e.target.files?.[0];
+    if (file?.type === 'image/svg+xml') {
+      showToast({
+        status: 'notice',
+        title: 'svg 파일 제한',
+        subtext: '다른 확장 파일로 다시 시도해주세요.',
+        autoClose: true,
+      });
+      return;
+    }
+
</code_context>

<issue_to_address>
SVG file restriction is enforced, but user experience could be improved.

Consider clearing the file input value after showing the toast, so users can immediately re-select a file without extra steps.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    if (file?.type === 'image/svg+xml') {
      showToast({
        status: 'notice',
        title: 'svg 파일 제한',
        subtext: '다른 확장 파일로 다시 시도해주세요.',
        autoClose: true,
      });
      return;
    }
=======
    if (file?.type === 'image/svg+xml') {
      showToast({
        status: 'notice',
        title: 'svg 파일 제한',
        subtext: '다른 확장 파일로 다시 시도해주세요.',
        autoClose: true,
      });
      e.target.value = '';
      return;
    }
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
제가 더 유용해지도록 도와주세요! 각 댓글에 👍 또는 👎를 클릭해주시면, 피드백을 통해 검토를 개선하는 데 활용하겠습니다.
Original comment in English

Hey @dolmeengii - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `apps/web/src/lib/data/user.ts:28` </location>
<code_context>
     }
     return profile;
   } catch (error) {
-    console.error('내 프로필 조회 에러:', error);
-    return null;
</code_context>

<issue_to_address>
Suppressing the error object in the catch block may hinder debugging.

Consider logging the error or storing it for diagnostics to help with issue tracking in production environments.
</issue_to_address>

### Comment 2
<location> `apps/web/src/components/common/profile/edit/profile-image-uploader.tsx:44` </location>
<code_context>

   const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+    const file = e.target.files?.[0];
+    if (file?.type === 'image/svg+xml') {
+      showToast({
+        status: 'notice',
+        title: 'svg 파일 제한',
+        subtext: '다른 확장 파일로 다시 시도해주세요.',
+        autoClose: true,
+      });
+      return;
+    }
+
</code_context>

<issue_to_address>
SVG file restriction is enforced, but user experience could be improved.

Consider clearing the file input value after showing the toast, so users can immediately re-select a file without extra steps.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    if (file?.type === 'image/svg+xml') {
      showToast({
        status: 'notice',
        title: 'svg 파일 제한',
        subtext: '다른 확장 파일로 다시 시도해주세요.',
        autoClose: true,
      });
      return;
    }
=======
    if (file?.type === 'image/svg+xml') {
      showToast({
        status: 'notice',
        title: 'svg 파일 제한',
        subtext: '다른 확장 파일로 다시 시도해주세요.',
        autoClose: true,
      });
      e.target.value = '';
      return;
    }
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread apps/web/src/lib/data/user.ts
dolmeengii and others added 2 commits August 5, 2025 22:27
…ader.tsx

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@miniseung miniseung merged commit 6db3389 into Kernel360:develop Aug 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 프로필 페이지 개선

2 participants