Skip to content

Conversation

@layout-SY
Copy link
Collaborator

@layout-SY layout-SY commented May 25, 2025

구현내용

  • 댓글 컴포넌트에서 대댓글 input 스타일이 flex : 1이 구조로 인해 block 처리 되어 input 태그의 가로가 잘리는 버그 해결
  • 프로필 사진이 원래 input 컴포넌트 옆에 붙어 있었던, 원래 상태로 복귀

연관이슈

close #314

Summary by CodeRabbit

  • 신규 기능

    • 댓글 입력 영역에 사용자의 프로필 이미지(아바타)가 표시됩니다.
  • 스타일

    • 답글 입력창의 레이아웃과 여백이 개선되어 더욱 깔끔하게 정렬됩니다.
  • 리팩터

    • 댓글 레이아웃에서 프로필 이미지 관련 요소가 제거되어 구조가 간소화되었습니다.
    • 답글 입력창의 위치가 변경되어 댓글 UI의 일관성이 향상되었습니다.

@layout-SY layout-SY requested a review from YouD0313 May 25, 2025 15:24
@layout-SY layout-SY self-assigned this May 25, 2025
@layout-SY layout-SY added the 👀버그 버그 label May 25, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 25, 2025

Walkthrough

댓글 컴포넌트의 대댓글 입력창 스타일이 수정되었습니다. 아바타(프로필 이미지) 관련 로직이 CommentLayout에서 CommentInput으로 이동하였으며, ReplyInput의 스타일이 flexbox 기반으로 변경되고, 대댓글 입력창의 위치가 컴포넌트 계층 구조 내에서 조정되었습니다.

Changes

파일/경로 변경 요약
src/components/user/comment/CommentLayout.tsx 아바타 및 프로필 이미지 관련 로직 삭제
src/components/user/comment/commentInput/CommentInput.tsx 아바타(프로필 이미지) 표시 기능 추가 및 관련 로직 도입
src/components/user/comment/commentComponent/commentComponent/CommentComponent.styled.ts ReplyInput의 flexbox 스타일 적용, 마진 및 레이아웃 조정
src/components/user/comment/commentComponent/commentComponent/CommentComponent.tsx 대댓글 입력창 렌더링 위치를 Container 내부로 이동

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CommentInput
  participant useMyProfileInfo
  participant Avatar

  User->>CommentInput: 댓글 입력 영역 진입
  CommentInput->>useMyProfileInfo: 사용자 프로필 정보 요청
  useMyProfileInfo-->>CommentInput: 프로필 정보 반환
  CommentInput->>Avatar: 프로필 이미지 URL 전달
  Avatar-->>CommentInput: 아바타 렌더링
  User->>CommentInput: 댓글 입력 및 제출
Loading

Assessment against linked issues

Objective Addressed Explanation
공고 상세의 댓글 컴포넌트에서 대댓글 입력창의 스타일 버그 수정 (#314)

Suggested labels

🛠개선

Poem

🐇
댓글창에 바람이 분다,
대댓글 입력창이 예쁘게 선다!
아바타는 이리로, 스타일은 저리로,
flex와 margin이 춤을 춘다.
버그는 가고, 토끼는 웃는다!
🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-25T15_26_07_851Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/user/comment/commentComponent/commentComponent/CommentComponent.styled.ts (1)

58-62: Flexbox 속성 조합에 대한 검토가 필요합니다.

flex: 1width: 94%를 동시에 사용하는 것이 의도한 레이아웃을 올바르게 구현하는지 확인해보세요. flex: 1은 요소가 사용 가능한 공간을 모두 차지하도록 하는 반면, width: 94%는 고정 너비를 지정합니다. 이 조합이 충돌할 수 있습니다.

대댓글 입력창의 너비 문제를 해결하려면 다음 중 하나를 고려해보세요:

  • flex: 1을 사용하고 width 제거
  • 또는 width: 94%를 사용하고 flex: 1 제거
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70d5331 and 272786e.

📒 Files selected for processing (4)
  • src/components/user/comment/CommentLayout.tsx (0 hunks)
  • src/components/user/comment/commentComponent/commentComponent/CommentComponent.styled.ts (1 hunks)
  • src/components/user/comment/commentComponent/commentComponent/CommentComponent.tsx (1 hunks)
  • src/components/user/comment/commentInput/CommentInput.tsx (4 hunks)
💤 Files with no reviewable changes (1)
  • src/components/user/comment/CommentLayout.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/components/user/comment/commentInput/CommentInput.tsx (2)
src/hooks/user/useMyInfo.ts (1)
  • useMyProfileInfo (21-33)
src/util/formatImgPath.ts (1)
  • formatImgPath (1-4)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run Chromatic
🔇 Additional comments (3)
src/components/user/comment/commentComponent/commentComponent/CommentComponent.tsx (1)

94-102: 구조적 변경이 스타일 문제를 해결합니다.

대댓글 입력 컴포넌트를 CommentWrapper 외부로 이동시킨 것은 올바른 접근입니다. 이 변경으로 대댓글 입력창이 댓글 내용과 독립적으로 레이아웃될 수 있어 너비 문제가 해결될 것으로 보입니다.

src/components/user/comment/commentInput/CommentInput.tsx (2)

9-12: 프로필 이미지 기능 추가가 적절합니다.

사용자 프로필 정보를 가져오고 아바타를 표시하는 기능이 잘 구현되었습니다. 필요한 의존성들이 모두 적절히 임포트되었습니다.


88-88: 아바타 컴포넌트 추가가 PR 목표와 일치합니다.

프로필 사진을 원래 위치로 되돌리는 PR 목표에 부합하는 변경사항입니다. 55px 크기로 일관성 있게 설정되었습니다.

setValue,
} = useForm<FormValue>();

const { myData } = useMyProfileInfo();
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

사용자 데이터 로딩에 대한 에러 처리를 확인해주세요.

useMyProfileInfo hook에서 반환하는 데이터가 로딩 중이거나 에러가 발생할 경우에 대한 처리가 필요할 수 있습니다. 현재는 myData만 사용하고 있지만, 로딩 상태나 에러 상태도 고려해보세요.


🏁 Script executed:

#!/bin/bash
# useMyProfileInfo hook의 구현을 확인하여 에러 처리 방식 검토
ast-grep --pattern 'export const useMyProfileInfo = $_'

Length of output: 812


에러 및 로딩 상태 핸들링 추가 필요

현재 useMyProfileInfo 훅이 myDataisLoading만 반환해, 컴포넌트에서 에러 상태를 처리할 수 없습니다. 아래를 참고해 수정하세요.

  • 훅 반환값 확장
    // src/hooks/user/useMyInfo.ts
    export const useMyProfileInfo = () => {
      const isLoggedIn = useAuthStore(state => state.isLoggedIn);
      const { data, isLoading, isError, error } = useQuery<ApiUserInfo>({
        queryKey: myInfoKey.myProfile,
        queryFn: () => getMyInfo(),
        staleTime: Infinity,
        gcTime: Infinity,
        enabled: isLoggedIn,
      });
      return {
        myData: data?.data,
        isLoading,
        isError,
        error,
      };
    };
  • 컴포넌트에서 로딩·에러 처리 추가
    // src/components/user/comment/commentInput/CommentInput.tsx
    const { myData, isLoading, isError, error } = useMyProfileInfo();
    if (isLoading) {
      return <Spinner />;
    }
    if (isError) {
      return <ErrorMessage message={error?.message || '데이터를 불러오는 중 오류가 발생했습니다.'} />;
    }
    // 정상 렌더링...
🤖 Prompt for AI Agents
In src/components/user/comment/commentInput/CommentInput.tsx at line 45, update
the useMyProfileInfo hook usage to also destructure isLoading, isError, and
error states. Add conditional rendering to handle loading and error states by
returning a Spinner component when loading and an ErrorMessage component with
the error message when an error occurs. This ensures proper user feedback during
data fetching issues.

Comment on lines +54 to +58
const profileImg = myData?.profileImg
? `${import.meta.env.VITE_APP_IMAGE_CDN_URL}/${formatImgPath(
myData.profileImg
)}?w=86&h=86&fit=crop&crop=entropy&auto=format,enhance&q=60`
: DefaultImg;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

환경변수 의존성과 이미지 처리 로직을 검증해주세요.

프로필 이미지 URL 생성 로직이 잘 구현되었지만, 몇 가지 확인이 필요합니다:

  1. VITE_APP_IMAGE_CDN_URL 환경변수가 모든 환경에서 정의되어 있는지
  2. formatImgPath 함수가 예상대로 작동하는지
  3. 이미지 로딩 실패 시 기본 이미지로 잘 fallback되는지

🏁 Script executed:

#!/bin/bash
# 환경변수 사용 현황과 formatImgPath 함수 구현 확인
echo "=== 환경변수 사용 현황 ==="
rg -n "VITE_APP_IMAGE_CDN_URL" 

echo "=== formatImgPath 함수 구현 ==="
cat src/util/formatImgPath.ts

Length of output: 713


🏁 Script executed:

#!/bin/bash
# DefaultImg 위치와 사용 맥락 확인
echo "=== DefaultImg 사용 ==="
rg -n "DefaultImg" -A3 src/components

# CommentInput 컴포넌트 내 <img> 태그 및 onError 핸들러 확인
echo "=== CommentInput.tsx <img> ==="
rg -n "<img" -A3 src/components/user/comment/commentInput/CommentInput.tsx

Length of output: 2430


🏁 Script executed:

#!/bin/bash
# avatar 디렉토리 파일 목록 확인
echo "=== avatar 디렉토리 목록 ==="
ls src/components/common/avatar

# Avatar.tsx 구현 확인
echo "=== Avatar.tsx 내용 ==="
cat src/components/common/avatar/Avatar.tsx

# onError 핸들러 확인
echo "=== Avatar.tsx onError 핸들러 ==="
rg -n "onError" -A3 src/components/common/avatar/Avatar.tsx || echo "No onError handler found"

Length of output: 1048


프로필 이미지 URL 생성 및 로딩 실패 대응

  • VITE_APP_IMAGE_CDN_URL는 README.md(64행)에 정의되어 있으며, AvatarList, Header, CommentInput 등에서 일관되게 사용 중입니다.
  • formatImgPath/로 분할 후 slice(3)부터 조합하는 단순 로직으로, 의도한 대로 경로를 추출하고 있습니다.
  • 그러나 <img> 요소에 onError 핸들러가 없어 404 또는 네트워크 오류 시 깨진 이미지가 표시됩니다.

수정 제안:

  • src/components/common/avatar/Avatar.tsx<S.AvatarImg>onError 속성을 추가하여 기본 이미지로 대체 처리하세요.
   <S.AvatarImg
     src={releasedImg}
+    onError={(e) => { e.currentTarget.src = defaultImg; }}
     alt='Avatar'
   />

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/components/user/comment/commentInput/CommentInput.tsx around lines 54 to
58, the profile image URL is constructed correctly using the environment
variable and formatImgPath function, but the <img> element lacks an onError
handler to fallback to the default image if loading fails. To fix this, add an
onError event handler to the <img> tag that sets the image source to DefaultImg
upon error, similar to the implementation in
src/components/common/avatar/Avatar.tsx, ensuring broken or missing images
gracefully fallback to the default avatar.

@layout-SY layout-SY merged commit 9cb894a into develop May 27, 2025
4 checks passed
@layout-SY layout-SY deleted the bug/#314 branch May 27, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

공고 상세의 댓글 컴포넌트에서 대댓글 입력창의 스타일 버그 수정

3 participants