Skip to content

Conversation

@bokeeeey
Copy link
Member

@bokeeeey bokeeeey commented Jan 7, 2025

🚀 작업 내용

  • members 페이지 sidepanel 레이아웃 수정
  • teams 페이지 crud error 수정

📝 참고 사항

-settings페이지 401에러는 fix하려는데 나오질 않네요 추후 다시 문제가 발생하면 수정 하겠슴둥

🚨 관련 이슈 (이슈 번호)

✅ 체크리스트

  • Code Review 요청
  • Label 설정
  • PR 제목 규칙에 맞는지 확인

Summary by CodeRabbit

  • 기능 변경

    • 팀 모델의 order 필드를 선택적으로 변경하고 고유성 제약 조건 추가
    • 멤버 양식의 레이아웃 및 스타일 개선
    • 사이드 패널의 레이아웃 및 간격 최적화
    • 팀 이름 업데이트 후 선택적 콜백 기능 추가
  • 버그 수정

    • 없음
  • 스타일

    • 폼 및 모달 컴포넌트의 레이아웃 및 스타일링 조정

@bokeeeey bokeeeey added the 🐞 BugFix Something isn't working label Jan 7, 2025
@bokeeeey bokeeeey requested a review from miraclee1226 January 7, 2025 15:47
@bokeeeey bokeeeey self-assigned this Jan 7, 2025
@bokeeeey bokeeeey linked an issue Jan 7, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2025

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.

apps/api/src/models/teamModel.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@repo/eslint-config/server.js" to extend from. Please check that the name of the config is correct.

The config "@repo/eslint-config/server.js" was referenced from the config file in "/apps/api/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

워크스루

이 풀 리퀘스트는 여러 파일에 걸쳐 레이아웃, 스키마, 그리고 훅의 작은 변경 사항을 포함하고 있습니다. 팀 모델의 order 필드 속성 변경, 웹 애플리케이션의 여러 컴포넌트 레이아웃 리팩토링, 그리고 팀 이름 업데이트 훅에 선택적 콜백 파라미터 추가 등의 수정이 이루어졌습니다.

변경 사항

파일 변경 요약
apps/api/src/models/teamModel.ts TeamSchemaorder 필드 속성 변경: requiredfalse로, uniquetrue로 설정
apps/web/app/admin/members/_components/sidepanel/Form.tsx 폼 레이아웃 구조 재구성 및 스타일링 개선
apps/web/app/admin/members/_components/sidepanel/Header.tsx 버튼 및 헤더 마진 클래스 제거
apps/web/app/admin/members/_components/sidepanel/index.tsx 사이드 패널 레이아웃 및 플렉스 스타일링 업데이트
apps/web/app/admin/teams/_hooks/useTeamsMutations.ts useUpdateTeamName 훅에 선택적 onClose 콜백 파라미터 추가
apps/web/app/settings/_components/modals/ManageTeamModal.tsx 모달 컴포넌트 JSX 구조 재구성

시퀀스 다이어그램

sequenceDiagram
    participant User
    participant UpdateTeamNameHook
    participant API
    User->>UpdateTeamNameHook: 팀 이름 변경 요청
    UpdateTeamNameHook->>API: 팀 이름 업데이트 뮤테이션
    alt 성공
        API-->>UpdateTeamNameHook: 성공 응답
        UpdateTeamNameHook->>User: onClose 콜백 실행 (선택적)
    else 실패
        API-->>UpdateTeamNameHook: 에러 응답
        UpdateTeamNameHook->>User: 에러 알림
    end
Loading

시 (토끼의 노래)

🐰 코드의 변화, 부드러운 춤
레이아웃 다듬고 훅을 손보니
작은 수정의 마법같은 힘
효율성은 토끼의 미소처럼
코드는 계속 진화하네! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@github-actions
Copy link

github-actions bot commented Jan 7, 2025

🚀 Preview URL

Branch: 185-fix-members-페이지-css-수정-및-teams페이지-에러-수정
Commit: 429114c

Preview URL: https://codeit.click?pr=191

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: 1

🔭 Outside diff range comments (1)
apps/web/app/admin/teams/_hooks/useTeamsMutations.ts (1)

Line range hint 62-81: useUpdateTeamName 훅 개선 제안

현재 구현에 대해 다음과 같은 개선사항을 제안드립니다:

  1. useCreateTeam처럼 onClose 콜백에 디바운싱 적용
  2. 에러 처리 개선
  3. 타입 안전성 강화
 export const useUpdateTeamName = (
   onClose?: () => void,
 ): UseMutationResult<MessageResponse, AxiosError<MessageResponse>, UpdateRequest> => {
   const queryClient = useQueryClient();
   const prevTeamsRef = useRef<TeamType[] | undefined>();
+  const debouncedOnClose = useDebouncedCallback(onClose ?? (() => {}), 800);

   return useMutation({
     mutationFn: ({ teamId, newName }: UpdateRequest) => updateTeamName({ teamId, newName }),

     onSuccess: (res) => {
       notify("success", res.message);
-      onClose?.();
+      debouncedOnClose();
     },
     onError: (error) => {
       if (prevTeamsRef.current) void queryClient.setQueryData<TeamType[]>(QUERY_KEYS.TEAMS.ALL, prevTeamsRef.current);
       notifyMutationError(error);
+      // 에러 발생 시 모달 닫지 않음
     },
   });
 };
🧹 Nitpick comments (5)
apps/web/app/admin/members/_components/sidepanel/index.tsx (1)

23-24: 사이드 패널의 레이아웃이 개선되었습니다!

flex 레이아웃과 간격 조정을 통해 구조가 개선되었습니다. 하지만 접근성 향상을 위해 몇 가지 제안사항이 있습니다:

  1. aria-modal="true"를 추가하여 모달 역할을 명시
  2. role="dialog"를 추가하여 대화상자 역할을 명시
  3. aria-labelledby를 추가하여 패널의 제목을 연결
 <div
   ref={sidePanelRef}
+  role="dialog"
+  aria-modal="true"
+  aria-labelledby="panel-title"
   className={`md:w-414 border-custom-black/20 fixed right-0 top-0 z-20 flex h-full w-full transform flex-col gap-32 border-l bg-white px-32 pb-40 pt-16 shadow-[0px_2px_14px_0px_rgba(0,0,0,0.08)] transition-transform duration-300 ease-in-out ${
     isOpen ? "translate-x-0" : "translate-x-full"
   }`}
 >
apps/web/app/admin/members/_components/sidepanel/Form.tsx (3)

60-63: 폼 레이아웃이 개선되었습니다!

flex 레이아웃을 사용하여 폼 요소들의 배치가 개선되었습니다. 하지만 폼 제출 시 사용자 피드백을 위해 다음 사항을 고려해보세요:

  1. noValidate 속성 추가로 브라우저 기본 검증 비활성화
  2. 제출 중일 때 폼 비활성화
 <form
   className="flex h-full flex-col justify-between"
+  noValidate
+  disabled={isPending}
   onSubmit={(...args) => void handleSubmit(membersFormSubmit)(...args)}
 >

65-82: 역할 선택 로직을 단순화할 수 있습니다.

현재 구현은 불필요한 변환 함수들을 사용하고 있습니다. 다음과 같이 단순화할 수 있습니다:

 <Controller
   name="role"
   control={control}
   rules={{ required: MEMBER_FORM_MESSAGES.VALIDATION.ROLE.REQUIRED }}
   render={({ field: { value, onChange } }) => (
     <Radio.Group
-      value={getRoleDisplay(value)}
-      onChange={(displayText) => {
-        onChange(getRoleValue(displayText));
-      }}
+      value={value}
+      onChange={onChange}
     >
-      <Radio.Option value={ROLE_LABELS.member}>{ROLE_LABELS.member}</Radio.Option>
-      <Radio.Option value={ROLE_LABELS.admin}>{ROLE_LABELS.admin}</Radio.Option>
+      <Radio.Option value="member">{ROLE_LABELS.member}</Radio.Option>
+      <Radio.Option value="admin">{ROLE_LABELS.admin}</Radio.Option>
     </Radio.Group>
   )}
 />

83-103: 입력값 검증을 개선할 수 있습니다.

현재 구현된 검증 로직에 다음 사항들을 추가하면 좋을 것 같습니다:

  1. 입력값의 앞뒤 공백 제거
  2. 이메일 형식 오류에 대한 더 구체적인 메시지
 {...register("name", {
   required: MEMBER_FORM_MESSAGES.VALIDATION.NAME.REQUIRED,
+  setValueAs: (value: string) => value.trim(),
   minLength: {
     value: 2,
     message: MEMBER_FORM_MESSAGES.VALIDATION.NAME.MIN_LENGTH,
   },
 })}

 {...register("email", {
   required: MEMBER_FORM_MESSAGES.VALIDATION.EMAIL.REQUIRED,
+  setValueAs: (value: string) => value.trim(),
   pattern: {
     value: REGEXP_PATTERNS.EMAIL,
-    message: MEMBER_FORM_MESSAGES.VALIDATION.EMAIL.PATTERN,
+    message: "올바른 이메일 형식이 아닙니다. (예: [email protected])",
   },
 })}
apps/web/app/admin/members/_components/sidepanel/Header.tsx (1)

23-38: 접근성 및 반응형 디자인 개선 제안

현재 구현에 대해 다음과 같은 개선사항을 제안드립니다:

  1. 닫기 버튼에 aria-label 추가
  2. 반응형 디자인을 위한 spacing 조정
  3. 버튼 크기 최소값 지정
- <button onClick={onClose} type="button" className="flex flex-row">
+ <button 
+   onClick={onClose} 
+   type="button" 
+   aria-label="사이드 패널 닫기"
+   className="flex flex-row items-center min-w-[24px] min-h-[24px] p-1"
+ >

withdraw 버튼도 마찬가지로 개선이 필요합니다:

   <button
     type="button"
     onClick={handleWithdraw}
-    className="text-sm-medium text-custom-black/80 hover:bg-custom-black/5 hover:text-custom-black w-71 rounded-6 border-custom-black/20 h-32 border transition-all duration-300"
+    className="text-sm-medium text-custom-black/80 hover:bg-custom-black/5 hover:text-custom-black w-71 rounded-6 border-custom-black/20 h-32 border transition-all duration-300 min-w-[120px]"
+    aria-label="회원 탈퇴"
   >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between eee4f93 and 883d6a4.

📒 Files selected for processing (6)
  • apps/api/src/models/teamModel.ts (1 hunks)
  • apps/web/app/admin/members/_components/sidepanel/Form.tsx (1 hunks)
  • apps/web/app/admin/members/_components/sidepanel/Header.tsx (1 hunks)
  • apps/web/app/admin/members/_components/sidepanel/index.tsx (1 hunks)
  • apps/web/app/admin/teams/_hooks/useTeamsMutations.ts (2 hunks)
  • apps/web/app/settings/_components/modals/ManageTeamModal.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/app/settings/_components/modals/ManageTeamModal.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: preview
🔇 Additional comments (1)
apps/web/app/admin/members/_components/sidepanel/index.tsx (1)

28-28: 불필요한 래퍼 div 제거는 좋은 개선입니다!

컴포넌트 구조가 단순화되어 DOM 계층이 깔끔해졌습니다.

Copy link
Collaborator

@miraclee1226 miraclee1226 left a comment

Choose a reason for hiding this comment

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

고생많았슴둥👍

@bokeeeey bokeeeey merged commit 8a1f5a7 into develop Jan 8, 2025
2 checks passed
@bokeeeey bokeeeey deleted the 185-fix-members-페이지-css-수정-및-teams페이지-에러-수정 branch January 8, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] members 페이지 css 수정 및 teams페이지 에러 수정

3 participants