Skip to content

Feature: 세팅 페이지 구현 #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 22, 2024
Merged

Feature: 세팅 페이지 구현 #100

merged 21 commits into from
Nov 22, 2024

Conversation

guesung
Copy link
Owner

@guesung guesung commented Nov 22, 2024

Summary by CodeRabbit

릴리스 노트

  • 새 기능

    • 새로운 상수 SUPABASE_SCHEMA_MEMO 추가.
    • 언어 선택을 위한 Setting 컴포넌트 및 SettingHeader 컴포넌트 추가.
    • 메모 복원 기능을 지원하는 handleDeleteMemo 업데이트.
    • useLanguage 훅 추가로 언어 상태 관리 기능 향상.
  • 변경 사항

    • URL_CHROME_STORE의 URL을 더 읽기 쉬운 형식으로 업데이트.
    • 여러 컴포넌트에서 하드코딩된 URL을 상수로 대체하여 유지 관리 용이성 향상.
    • memo 스키마를 상수로 변경하여 유연성 증가.
    • 다양한 경로를 중앙 집중화하여 코드 유지 관리 개선.
  • 버그 수정

    • 메모 삭제 후 UI 업데이트를 보장하는 쿼리 무효화 로직 추가.

Copy link

coderabbitai bot commented Nov 22, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

이 풀 리퀘스트에서는 여러 파일에 대한 변경 사항이 포함되어 있습니다. 새로운 상수 SUPABASE_SCHEMA_MEMO가 추가되었고, URL 상수가 업데이트되었습니다. 또한, 여러 컴포넌트와 훅에서 기능이 개선되었으며, 새로운 레이아웃 및 설정 관련 컴포넌트가 추가되었습니다. 이 외에도 다수의 파일에서 경로 관리와 관련된 상수들이 중앙 집중화되었습니다.

Changes

파일 경로 변경 요약
packages/shared/src/constants/Supabase.ts 새로운 상수 SUPABASE_SCHEMA_MEMO 추가
packages/shared/src/constants/Url.ts URL_CHROME_STORE 상수의 URL을 더 읽기 쉬운 형식으로 업데이트
packages/shared/src/hooks/supabase/useMemoPostMutation.ts newMemosData 변수의 연결 순서 변경
packages/shared/src/utils/Supabase.ts 여러 함수에서 하드코딩된 테이블 이름을 SUPABASE_SCHEMA_MEMO 상수로 변경, 새로운 checkUserLogin 함수 추가
packages/web/package.json @radix-ui/react-label 의존성 추가
packages/web/src/app/[lng]/layout.tsx 여러 import 재조정 및 ReactQueryDevtools 추가
packages/web/src/app/[lng]/memos/components/Header/RefreshButton.tsx import 재조정
packages/web/src/app/[lng]/memos/components/Header/index.tsx 하드코딩된 URL을 PATHS.memos로 변경
packages/web/src/app/[lng]/memos/components/MemoSidebar/index.tsx 하드코딩된 URL을 PATHS 상수로 변경
packages/web/src/app/[lng]/memos/components/MemoSidebarTrigger/index.tsx 서버 컴포넌트로 변경 및 언어 매개변수 추가
packages/web/src/app/[lng]/memos/components/MemoView/MemoOption.tsx 새로운 훅 추가 및 삭제 메모 복원 기능 개선
packages/web/src/app/[lng]/memos/layout.tsx 새로운 레이아웃 컴포넌트 추가
packages/web/src/app/[lng]/memos/page.tsx 복잡한 렌더링 로직 단순화
packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx 언어 선택을 위한 새로운 컴포넌트 추가
packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx 새로운 설정 헤더 컴포넌트 추가
packages/web/src/app/i18n/locales/en/translation.json 영어 번역 업데이트
packages/web/src/app/i18n/locales/ko/translation.json 한국어 번역에 새로운 섹션 추가
packages/web/src/app/i18n/server.js import 경로에서 .js 확장자 제거
packages/web/src/app/i18n/settings.ts languages 상수에 as const 추가
packages/web/src/app/i18n/type.ts Language 타입 별칭 추가
packages/web/src/components/Footer.tsx 하드코딩된 URL을 URL_CHROME_STORE 상수로 변경
packages/web/src/components/ui/label.tsx 새로운 Label 컴포넌트 추가
packages/web/src/constants/Page.ts NEED_AUTH_PAGES 상수를 포함한 파일 삭제
packages/web/src/constants/Path.ts 새로운 PATHSNEED_AUTH_PAGES 상수 추가
packages/web/src/constants/index.ts Page 모듈 대신 Path 모듈로 변경
packages/web/src/hooks/index.ts useLanguage 훅 추가
packages/web/src/hooks/useLanguage.ts 언어 상태를 관리하는 새로운 훅 추가
packages/web/src/hooks/useMemoDeleteMutation.ts useMutation 훅의 타입 매개변수 명시
packages/web/src/middleware.ts 리다이렉트 URL 구성 로직 업데이트
packages/web/src/utils/middleware.ts 하드코딩된 로그인 경로를 PATHS 상수로 변경
packages/web/src/utils/supabase.client.ts 데이터베이스 구성에서 하드코딩된 스키마를 SUPABASE_SCHEMA_MEMO 상수로 변경
packages/web/src/utils/supabase.server.ts 여러 리다이렉트 경로를 PATHS 상수로 변경
packages/shared/src/utils/extension/Supabase.ts 사용자 인증 확인 로직을 checkUserLogin 함수로 변경
packages/web/src/app/[lng]/login/page.tsx 로그인 상태 확인 로직을 checkUserLogin으로 변경
packages/web/src/app/[lng]/memos/components/MemoSidebar/SidebarGroupCategory.tsx useSearchParamsRouter 훅을 useRouter 훅으로 변경
packages/web/src/app/[lng]/page.tsx 리다이렉트 경로를 PATHS.memos로 변경
packages/web/src/app/auth/callback-email/route.ts 리다이렉트 URL을 PATHS.memos로 변경
packages/web/src/app/auth/callback/route.ts 리다이렉트 URL을 PATHS.memos로 변경
packages/web/src/utils/index.ts isStringArray 모듈의 추가 export 추가
packages/web/src/utils/isStringArray.ts 문자열 배열을 확인하는 유틸리티 함수 추가

Possibly related PRs

  • Feature: 세팅 페이지 구현 #100: 이 PR에서는 새로운 상수 SUPABASE_SCHEMA_MEMO가 추가되었으며, 이는 메인 PR의 SUPABASE_SCHEMA_MEMO 추가와 관련이 있습니다.

🐰 새로운 상수가 추가되고, URL이 바뀌고, 기능이 개선되니,
우리의 코드도 더 깔끔해지고, 관리도 쉬워지니!
Rabbit의 기쁨이 가득 차,
더 나은 세상으로 나아가자! 🌟
모두 함께 손잡고,
새로운 길을 향해 뛰어가자! 🐇✨

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 (1.23.1)

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.

packages/web/src/app/[lng]/login/page.tsx

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/packages/web/.eslintrc.json".

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


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 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.

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

🧹 Outside diff range and nitpick comments (23)
packages/web/src/app/[lng]/memos/setting/page.tsx (1)

5-5: 의미론적 HTML 요소 사용 및 접근성 개선이 필요합니다

의미 없는 div 대신 main 또는 section과 같은 의미론적 HTML 요소를 사용하고, 적절한 ARIA 속성을 추가하는 것이 좋습니다.

다음과 같이 수정해주세요:

-    <div>
+    <main aria-label="설정">
packages/web/src/constants/Path.ts (2)

1-10: 타입 안전성 개선이 필요합니다

경로 상수의 타입 안전성을 높이기 위해 as const 어서션과 함께 타입 정의를 추가하는 것이 좋습니다.

+type PathsType = {
+  readonly root: '/'
+  readonly error: '/error'
+  readonly login: '/login'
+  readonly memos: '/memos'
+  readonly memosWish: '/memos?wish=true'
+  readonly memosSetting: '/memos/setting'
+  readonly callbackAuth: '/auth/callback'
+  readonly callbackEmail: '/auth/callback-email'
+}

-export const PATHS = {
+export const PATHS: PathsType = {
   root: '/',
   error: '/error',
   login: '/login',
   memos: '/memos',
   memosWish: '/memos?wish=true',
   memosSetting: '/memos/setting',
-  allbackoAuth: '/auth/callback',
+  callbackAuth: '/auth/callback',
   callbackEmail: '/auth/callback-email'
-};
+} as const;

12-12: 인증이 필요한 페이지 배열의 타입 안전성 개선이 필요합니다

NEED_AUTH_PAGES 배열의 타입을 명시적으로 정의하여 타입 안전성을 높이는 것이 좋습니다.

-export const NEED_AUTH_PAGES = [PATHS.memos, PATHS.memosSetting];
+export const NEED_AUTH_PAGES: readonly (keyof typeof PATHS)[] = ['memos', 'memosSetting'] as const;
packages/web/src/app/i18n/settings.ts (1)

2-2: as const 어서션 추가는 좋은 개선사항입니다!

as const 어서션을 추가함으로써 다음과 같은 이점이 있습니다:

  • 언어 배열이 읽기 전용으로 변경되어 실수로 수정되는 것을 방지합니다
  • 타입스크립트가 더 정확한 타입 추론을 할 수 있게 됩니다
  • Language 타입과 함께 사용하여 타입 안정성이 향상됩니다

추가로 고려해볼 사항:

  • 향후 지원 언어가 추가될 경우를 대비하여 언어 코드에 대한 문서화를 추가하는 것이 좋을 것 같습니다
  • 각 언어 코드가 실제 유효한 ISO 639-1 코드인지 확인하는 유효성 검사를 추가하는 것을 고려해보세요
packages/web/src/components/Footer.tsx (1)

10-12: 접근성 개선을 위한 제안

Chrome Extension 링크의 구현은 잘 되었습니다만, 접근성 향상을 위해 약간의 개선을 제안드립니다.

다음과 같이 aria-label을 추가하는 것을 고려해보세요:

-        <Link className="link link-hover" href={URL_CHROME_STORE}>
+        <Link className="link link-hover" href={URL_CHROME_STORE} aria-label="Chrome 웹 스토어에서 확장 프로그램 설치하기">
           Chrome Extension
         </Link>
packages/web/src/app/[lng]/memos/page.tsx (1)

12-15: 로딩 상태 관리를 위한 Suspense 경계 추가를 고려해보세요.

HydrationBoundaryWrapper 내부의 컴포넌트들에 대한 로딩 상태 처리가 없습니다. Suspense를 사용하여 더 나은 사용자 경험을 제공할 수 있습니다.

다음과 같이 Suspense를 추가해보세요:

+ import { Suspense } from 'react';

return (
  <HydrationBoundaryWrapper queryKey={QUERY_KEY.memos()} queryFn={() => getMemo(supabaseClient)}>
+   <Suspense fallback={<div>메모를 불러오는 중...</div>}>
      <MemoView lng={lng} />
+   </Suspense>
+   <Suspense fallback={null}>
      <MemoDialog lng={lng} />
+   </Suspense>
  </HydrationBoundaryWrapper>
);
packages/web/src/components/ui/label.tsx (2)

9-11: 스타일 변형 옵션 추가를 고려해보세요.

현재 기본 스타일만 정의되어 있습니다. 다양한 사용 사례를 지원하기 위해 크기나 색상 등의 변형을 추가하면 좋을 것 같습니다.

예시 구현:

 const labelVariants = cva(
   "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
+  {
+    variants: {
+      size: {
+        default: "text-sm",
+        large: "text-base",
+        small: "text-xs"
+      },
+      variant: {
+        default: "text-gray-900",
+        secondary: "text-gray-500"
+      }
+    },
+    defaultVariants: {
+      size: "default",
+      variant: "default"
+    }
+  }
 )

13-24: 접근성 관련 문서화가 필요합니다.

컴포넌트 구현은 잘 되어있지만, 접근성 관련 사용법에 대한 JSDoc 문서화를 추가하면 좋을 것 같습니다.

다음과 같은 문서화를 추가해보세요:

+/**
+ * 접근성이 고려된 레이블 컴포넌트입니다.
+ * @example
+ * <Label htmlFor="email">이메일</Label>
+ * <input id="email" type="email" />
+ *
+ * @note
+ * - 항상 폼 요소와 함께 사용하고 htmlFor 속성을 지정해주세요.
+ * - 시각적으로 숨겨야 하는 경우 className으로 sr-only를 사용하세요.
+ */
 const Label = React.forwardRef<
packages/web/src/app/[lng]/memos/components/MemoSidebarTrigger/index.tsx (2)

9-9: 인터페이스에 문서화를 추가하면 좋겠습니다.

다른 개발자들의 이해를 돕기 위해 MemoSidebarTriggerProps 인터페이스에 JSDoc 문서를 추가하는 것이 좋겠습니다.

다음과 같이 문서화를 추가해보세요:

+/**
+ * MemoSidebarTrigger 컴포넌트의 속성을 정의합니다.
+ * @extends LanguageType - 현재 설정된 언어 정보를 포함합니다.
+ */
interface MemoSidebarTriggerProps extends LanguageType {}

22-23: 키보드 단축키 표시를 플랫폼별로 최적화하면 좋겠습니다.

현재 Control/Command + B로 표시된 단축키를 사용자의 운영체제에 따라 동적으로 표시하는 것이 좋겠습니다.

다음과 같이 개선해보세요:

-<p>Control/Command + B</p>
+<p>{
+  typeof window !== 'undefined' && navigator.platform.toLowerCase().includes('mac')
+    ? '⌘ + B'
+    : 'Ctrl + B'
+}</p>
packages/web/src/app/i18n/locales/ko/translation.json (1)

34-34: 사용자 친화적인 표현으로 개선을 제안드립니다.

"사이드바 토글" 대신 "사이드바 열기/닫기"로 변경하면 일반 사용자가 더 이해하기 쉬울 것 같습니다.

- "sideBar": "사이드바 토글"
+ "sideBar": "사이드바 열기/닫기"
packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (1)

1-27: 테스트 코드 작성이 필요합니다

컴포넌트의 안정성을 보장하기 위해 다음 사항들에 대한 테스트 코드 작성이 필요합니다:

  1. 언어 변경 기능
  2. 초기 언어 값 렌더링
  3. 접근성 검증

테스트 코드 작성을 도와드릴까요?

packages/web/src/hooks/useLanguage.ts (1)

6-7: 상수 이름과 철자를 수정해주세요.

다음과 같은 개선사항이 있습니다:

  • REGEXR_PATHNAME_LANGAUGE에 철자 오류가 있습니다 ('LANGUAGE'로 수정 필요)
  • 상수 이름에서 REGEXR보다는 REGEX가 더 일반적인 표현입니다

다음과 같이 수정을 제안합니다:

-const REGEXR_PATHNAME_WITHOUT_LANGUAGE = /^\/\w+(.+)/;
-const REGEXR_PATHNAME_LANGAUGE = /^\/(\w+)\/.+/;
+const REGEX_PATHNAME_WITHOUT_LANGUAGE = /^\/\w+(.+)/;
+const REGEX_PATHNAME_LANGUAGE = /^\/(\w+)\/.+/;
packages/web/src/app/[lng]/memos/components/Header/RefreshButton.tsx (1)

Line range hint 21-23: 가이드 상태 관리 개선 제안

현재 로컬 스토리지를 직접 조작하는 방식은 상태 관리의 일관성을 해칠 수 있습니다. 커스텀 훅으로 분리하는 것을 고려해보세요.

다음과 같은 구현을 제안드립니다:

// useGuideState.ts
export const useGuideState = () => {
  const setGuideSeen = () => {
    window.localStorage.setItem(IS_USER_SEEN_GUIDE, 'true');
  };

  const isGuideSeen = () => {
    return window.localStorage.getItem(IS_USER_SEEN_GUIDE) === 'true';
  };

  return { setGuideSeen, isGuideSeen };
};

// RefreshButton 컴포넌트에서:
const { setGuideSeen } = useGuideState();

const handleRefreshClick = async () => {
  driverObj.moveNext();
  setGuideSeen();
  // ... 나머지 로직
};
packages/web/src/app/i18n/locales/en/translation.json (1)

33-34: 툴팁 텍스트의 일관성 개선이 필요합니다.

다른 메시지들과의 일관성을 위해 다음과 같이 수정하는 것이 좋겠습니다:

   "tooltip": {
-    "sideBar": "toggle the sidebar"
+    "sideBar": "Toggle the Sidebar."
   }

변경 사유:

  • 문장의 첫 글자를 대문자로 시작
  • "Sidebar"를 대문자로 표기
  • 문장 끝에 마침표 추가
packages/web/src/app/[lng]/layout.tsx (2)

5-5: import 구문 재정렬 검토 필요

import 구문이 일관성 있게 정렬되어 있지 않습니다. 다음과 같은 순서로 정렬하는 것이 좋습니다:

  1. 외부 라이브러리
  2. Next.js 관련
  3. React 관련
  4. 내부 모듈
  5. 스타일 관련

다음과 같이 수정하는 것을 제안합니다:

import '@extension/ui/dist/global.css';
import { Header, QueryProvider, ThemeProvider } from '@src/components';
import { Toaster } from '@src/components/ui/toaster';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { dir } from 'i18next';
import type { Metadata } from 'next';
-import localFont from 'next/font/local';
import { PropsWithChildren } from 'react';
+import localFont from 'next/font/local';
import './globals.css';

Also applies to: 7-7


Line range hint 1-51: 성능 최적화 제안

전반적인 레이아웃 구조는 잘 구성되어 있으나, 몇 가지 성능 최적화를 제안드립니다:

  1. ThemeProvider와 QueryProvider를 별도의 클라이언트 컴포넌트로 분리
  2. 메타데이터를 동적으로 생성하도록 개선

다음과 같은 구조로 분리하는 것을 제안합니다:

// providers.tsx
'use client';

export function Providers({ children }: PropsWithChildren) {
  return (
    <ThemeProvider attribute="class" defaultTheme="system">
      <QueryProvider>
        {children}
        {process.env.NODE_ENV === 'development' && (
          <ReactQueryDevtools initialIsOpen={false} />
        )}
      </QueryProvider>
    </ThemeProvider>
  );
}

그리고 layout.tsx에서:

-<ThemeProvider attribute="class" defaultTheme="system">
-  <QueryProvider>
-    <Header lng={lng} />
-    {children}
-    <ReactQueryDevtools initialIsOpen={false} />
-  </QueryProvider>
-</ThemeProvider>
+<Providers>
+  <Header lng={lng} />
+  {children}
+</Providers>
packages/web/src/middleware.ts (1)

Line range hint 15-18: 인증 경로 처리 로직 개선 제안

현재 인증 경로 확인 로직이 문자열 포함 여부로만 처리되고 있습니다. 더 견고한 구현을 위해 다음 사항들을 고려해보세요:

  1. 정확한 경로 매칭을 위한 패턴 사용
  2. 허용된 경로 목록 중앙화
  3. 에러 처리 추가
+const EXCLUDED_PATHS = {
+  AUTH: '/auth',
+  NEXT: '/_next',
+} as const;
+
+function isExcludedPath(pathname: string): boolean {
+  return Object.values(EXCLUDED_PATHS).some(path => pathname.startsWith(path));
+}
+
 if (
   !languages.some(language => request.nextUrl.pathname.startsWith(`/${language}`)) &&
-  !request.nextUrl.pathname.startsWith('/_next') &&
-  !request.nextUrl.pathname.includes('/auth')
+  !isExcludedPath(request.nextUrl.pathname)
 ) {
packages/web/src/utils/middleware.ts (1)

Line range hint 1-45: 전반적인 미들웨어 구현이 견고해 보입니다.

인증이 필요한 페이지에 대한 접근 제어와 세션 관리가 잘 구현되어 있습니다. 다만, 다음 사항들을 고려해보시면 좋겠습니다:

  1. 리다이렉션 시 현재 URL을 state로 저장하여 로그인 후 원래 페이지로 돌아갈 수 있도록 하는 기능
  2. 에러 발생 시 사용자 친화적인 에러 처리
packages/web/src/app/[lng]/memos/layout.tsx (2)

24-38: 데이터 페칭 시의 로딩 상태와 에러 처리를 개선하면 좋겠습니다.

현재 구현에 다음 기능들을 추가하면 사용자 경험이 개선될 것 같습니다:

  1. 카테고리 데이터 로딩 중 상태 표시
  2. 데이터 페칭 실패 시 에러 처리

다음과 같은 개선을 제안드립니다:

 <SidebarProvider defaultOpen={defaultOpen}>
-  <HydrationBoundaryWrapper queryKey={QUERY_KEY.category()} queryFn={() => getCategory(supabaseClient)}>
+  <HydrationBoundaryWrapper 
+    queryKey={QUERY_KEY.category()} 
+    queryFn={() => getCategory(supabaseClient)}
+    LoadingComponent={<div>카테고리 로딩 중...</div>}
+    ErrorComponent={({ error }) => (
+      <div>카테고리를 불러오는 중 오류가 발생했습니다: {error.message}</div>
+    )}
+  >
     <MemoSidebar lng={lng} />
     <MemoSidebarTrigger lng={lng} />
   </HydrationBoundaryWrapper>

1-38: 아키텍처 관점에서의 제안사항

현재 구현은 잘 되어있지만, 다음과 같은 아키텍처적 개선을 고려해보시면 좋겠습니다:

  1. 인증 로직을 별도의 미들웨어나 HOC로 분리하여 재사용성 향상
  2. 사이드바 상태 관리를 전역 상태 관리 도구(예: Zustand)로 마이그레이션하여 쿠키 의존성 감소
  3. 에러 바운더리 컴포넌트 추가로 애플리케이션 안정성 향상
packages/web/src/utils/supabase.server.ts (1)

51-53: 에러 처리 개선을 제안드립니다

현재 구현은 정상적으로 작동하지만, 사용자 경험 향상을 위해 에러 메시지를 함께 전달하는 것이 좋을 것 같습니다.

다음과 같은 개선을 고려해보세요:

-  if (error) redirect(PATHS.error);
+  if (error) {
+    const errorMessage = encodeURIComponent(error.message);
+    redirect(`${PATHS.error}?message=${errorMessage}`);
+  }
packages/web/src/app/[lng]/memos/components/MemoView/MemoOption.tsx (1)

22-40: import 구문 최적화 제안

import 구문들이 잘 구성되어 있지만, 관련된 import들을 그룹화하면 코드 가독성이 더욱 향상될 것 같습니다.

다음과 같이 수정하는 것을 제안드립니다:

- import {
-   useCategoryQuery,
-   useMemoPatchMutation,
-   useMemoPostMutation,
-   useMemoQuery,
-   useSearchParamsRouter,
- } from '@extension/shared/hooks';
- import { useMemoDeleteMutation } from '@src/hooks';
+ // Query/Mutation hooks
+ import {
+   useCategoryQuery,
+   useMemoPatchMutation,
+   useMemoPostMutation,
+   useMemoQuery,
+   useSearchParamsRouter,
+   useMemoDeleteMutation,
+ } from '@extension/shared/hooks';

- import { useRouter, useSearchParams } from 'next/navigation';
- import { PATHS } from '@src/constants';
- import { ToastAction } from '@src/components/ui/toast';
- import { useQueryClient } from '@tanstack/react-query';
- import { QUERY_KEY } from '@extension/shared/constants';
+ // Navigation & Constants
+ import { useRouter, useSearchParams } from 'next/navigation';
+ import { PATHS } from '@src/constants';
+ import { QUERY_KEY } from '@extension/shared/constants';
+ 
+ // UI Components
+ import { ToastAction } from '@src/components/ui/toast';
+ 
+ // Query Client
+ import { useQueryClient } from '@tanstack/react-query';
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 27e72a5 and 738e947.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (35)
  • packages/shared/src/constants/Supabase.ts (1 hunks)
  • packages/shared/src/constants/Url.ts (1 hunks)
  • packages/shared/src/hooks/supabase/useMemoPostMutation.ts (1 hunks)
  • packages/shared/src/utils/Supabase.ts (1 hunks)
  • packages/web/package.json (1 hunks)
  • packages/web/src/app/[lng]/layout.tsx (2 hunks)
  • packages/web/src/app/[lng]/memos/components/Header/RefreshButton.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/components/Header/index.tsx (2 hunks)
  • packages/web/src/app/[lng]/memos/components/MemoSidebar/index.tsx (2 hunks)
  • packages/web/src/app/[lng]/memos/components/MemoSidebarTrigger/index.tsx (2 hunks)
  • packages/web/src/app/[lng]/memos/components/MemoView/MemoOption.tsx (3 hunks)
  • packages/web/src/app/[lng]/memos/layout.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/page.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/component/index.ts (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/page.tsx (1 hunks)
  • packages/web/src/app/[lng]/setting/page.tsx (0 hunks)
  • packages/web/src/app/i18n/locales/en/translation.json (2 hunks)
  • packages/web/src/app/i18n/locales/ko/translation.json (1 hunks)
  • packages/web/src/app/i18n/server.js (1 hunks)
  • packages/web/src/app/i18n/settings.ts (1 hunks)
  • packages/web/src/app/i18n/type.ts (1 hunks)
  • packages/web/src/components/Footer.tsx (2 hunks)
  • packages/web/src/components/ui/label.tsx (1 hunks)
  • packages/web/src/constants/Page.ts (0 hunks)
  • packages/web/src/constants/Path.ts (1 hunks)
  • packages/web/src/constants/index.ts (1 hunks)
  • packages/web/src/hooks/index.ts (1 hunks)
  • packages/web/src/hooks/useLanguage.ts (1 hunks)
  • packages/web/src/hooks/useMemoDeleteMutation.ts (2 hunks)
  • packages/web/src/middleware.ts (2 hunks)
  • packages/web/src/utils/middleware.ts (2 hunks)
  • packages/web/src/utils/supabase.client.ts (2 hunks)
  • packages/web/src/utils/supabase.server.ts (4 hunks)
💤 Files with no reviewable changes (2)
  • packages/web/src/app/[lng]/setting/page.tsx
  • packages/web/src/constants/Page.ts
✅ Files skipped from review due to trivial changes (5)
  • packages/shared/src/constants/Supabase.ts
  • packages/shared/src/constants/Url.ts
  • packages/web/src/app/[lng]/memos/setting/component/index.ts
  • packages/web/src/app/i18n/server.js
  • packages/web/src/constants/index.ts
🔇 Additional comments (33)
packages/web/src/hooks/index.ts (1)

2-2: 내보내기 구문이 올바르게 추가되었습니다.

barrel 파일에 useLanguage 훅의 내보내기가 적절하게 추가되었습니다. 기존 내보내기 스타일과 일관성이 유지되어 있습니다.

훅 파일의 존재 여부를 확인하기 위해 다음 스크립트를 실행합니다:

✅ Verification successful

useLanguage 훅이 정상적으로 구현되어 있습니다

useLanguage 훅이 다음과 같이 올바르게 구현되어 있음을 확인했습니다:

  • URL 경로에서 언어 코드를 추출하여 상태 관리
  • 언어 변경 시 라우팅 처리 기능 제공
  • 타입 안전성이 보장된 구현
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: useLanguage 훅 파일의 존재 여부 확인

# useLanguage.ts 파일 검색
fd "useLanguage.ts" packages/web/src/hooks

Length of output: 80


Script:

#!/bin/bash
# Description: useLanguage 훅의 구현 확인

# useLanguage.ts 파일의 내용 확인
cat packages/web/src/hooks/useLanguage.ts

Length of output: 1020

packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx (1)

1-7: 컴포넌트 구현이 깔끔합니다

서버 컴포넌트로 적절히 구현되었으며, UI 구성이 간단명료합니다. Label 컴포넌트의 재사용과 스타일링도 잘 되어있습니다.

packages/web/src/app/i18n/type.ts (2)

3-3: 타입 별칭이 잘 정의되었습니다!

Language 타입 별칭을 통해 지원되는 언어들을 중앙에서 관리할 수 있게 되었습니다.


6-6: 타입 안전성이 향상되었습니다.

LanguageTypelng 속성이 새로운 Language 타입을 사용하도록 변경되어 타입 안전성이 개선되었습니다.

languages 배열의 타입 단언을 확인하기 위해 다음 스크립트를 실행합니다:

✅ Verification successful

타입 안전성이 향상되었음을 확인했습니다

Language 타입이 languages 배열의 요소 타입으로 정의되어 있고, languages 배열이 as const로 선언되어 있어 타입 안전성이 보장됩니다. 이는 LanguageTypelng 속성이 정확히 허용된 언어 값만 받을 수 있음을 의미합니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: settings.ts 파일에서 languages 배열의 타입 단언을 확인합니다.

# languages 배열이 'as const'로 선언되었는지 확인
ast-grep --pattern 'languages = $_ as const'

Length of output: 46


Script:

#!/bin/bash
# Language 타입과 languages 배열의 정의를 찾습니다
rg -A 5 "type Language" packages/web/src/app/i18n/
rg "languages\s*=" packages/web/src/app/i18n/

Length of output: 625

packages/web/src/components/Footer.tsx (1)

1-1: 상수 중앙화 구현이 잘 되었습니다!

URL 상수를 공유 상수 파일로 분리하여 중앙 집중화한 것은 매우 좋은 접근 방식입니다. 이는 유지보수성을 향상시키고 URL 관리를 더욱 효율적으로 만들어줍니다.

packages/web/src/app/[lng]/memos/page.tsx (1)

1-6: 불필요한 import문이 잘 정리되었습니다!

사이드바와 인증 관련 기능이 제거되면서 import문이 깔끔하게 정리되었고, 메모 기능에 필요한 것들만 남아있어 코드의 가독성이 향상되었습니다.

packages/web/src/components/ui/label.tsx (2)

1-8: 코드 구조가 깔끔하고 적절합니다!

필요한 의존성들이 잘 정리되어 있으며, 'use client' 지시문의 위치도 적절합니다.


26-26: 내보내기가 올바르게 구현되었습니다!

명확한 named export를 사용하여 컴포넌트를 내보내고 있습니다.

packages/web/src/utils/supabase.client.ts (1)

1-1: 상수 가져오기 변경이 적절합니다!

공유 상수를 사용하여 스키마 이름을 중앙 집중화하는 것은 좋은 접근 방식입니다.

packages/web/src/app/[lng]/memos/components/MemoSidebarTrigger/index.tsx (2)

1-8: 서버 컴포넌트 설정이 적절합니다!

i18n을 위한 서버 컴포넌트 설정과 필요한 의존성들이 올바르게 구성되어 있습니다.


11-12: 번역 구현이 잘 되어있습니다!

비동기 컴포넌트와 번역 기능이 올바르게 구현되어 있습니다.

packages/web/src/app/i18n/locales/ko/translation.json (1)

33-34: 툴팁 섹션이 적절하게 추가되었습니다.

새로운 툴팁 섹션의 구조와 위치가 적절합니다.

packages/web/src/hooks/useMemoDeleteMutation.ts (2)

16-16: 구현이 개선되었습니다

삭제된 메모 데이터를 반환하도록 수정된 것은 좋은 변경사항입니다. 이를 통해 삭제 작업 후 추가적인 처리가 필요한 경우에 유용하게 활용할 수 있습니다.


Line range hint 19-26: 타입 안정성이 향상되었습니다

useMutation에 명시적인 타입 파라미터를 추가한 것은 좋은 개선사항입니다:

  • MemoSupabaseResponse: 성공 응답 타입
  • Error: 에러 타입
  • number: 입력 파라미터(메모 ID) 타입

이를 통해 타입 안정성이 향상되고 코드의 의도가 더 명확해졌습니다.

packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (1)

1-7: 🛠️ Refactor suggestion

타입 안정성 개선이 필요합니다

Language 타입이 명시적으로 사용되지 않고 있습니다. 컴포넌트의 타입 안정성을 높이기 위해 다음과 같은 개선이 필요합니다.

'use client';

import { Language } from '@src/app/i18n/type';
import { Label } from '@src/components/ui/label';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@src/components/ui/select';
-import { useLanguage } from '@src/hooks';
+import type { useLanguage } from '@src/hooks';
+
+type SettingProps = {
+  className?: string;
+};

Likely invalid or redundant comment.

packages/web/src/hooks/useLanguage.ts (1)

9-14: 훅 초기화가 올바르게 구현되었습니다.

상태 관리와 라우터 설정이 타입 안전성을 유지하면서 잘 구현되었습니다.

packages/web/src/app/[lng]/memos/components/Header/RefreshButton.tsx (2)

5-6: 가져오기 구문이 잘 정리되었습니다!

i18n 관련 가져오기 구문들이 논리적으로 잘 그룹화되어 있습니다.


Line range hint 24-26: 쿼리 무효화 처리 검증 필요

쿼리 무효화 후 사용자 피드백이 잘 구현되어 있습니다. 다만, 쿼리 실패 시의 에러 처리가 누락되어 있습니다.

다음과 같은 에러 처리를 추가하는 것을 추천드립니다:

const handleRefreshClick = async () => {
  try {
    driverObj.moveNext();
    setGuideSeen();
    await queryClient.invalidateQueries({ queryKey: QUERY_KEY.memos() });
    toast({ title: t('toastMessage.refresh') });
  } catch (error) {
    toast({ 
      title: t('toastMessage.error'),
      variant: 'destructive'
    });
  }
};
packages/web/src/app/i18n/locales/en/translation.json (1)

22-22: 문법적으로 더 자연스러운 표현으로 변경되었습니다.

카테고리 변경 텍스트가 영어 문법에 맞게 개선되었습니다.

packages/web/src/app/[lng]/layout.tsx (1)

Line range hint 37-37: RTL/LTR 지원 추가 확인 필요

dir(lng) 함수를 통해 RTL/LTR 지원이 추가되었습니다. 이는 아랍어나 히브리어와 같은 RTL 언어 지원을 위한 좋은 개선사항입니다.

현재 지원되는 언어 목록과 RTL 지원이 필요한 언어가 있는지 확인이 필요합니다:

packages/web/src/middleware.ts (1)

19-19: URL 검색 매개변수 처리 개선 👍

리다이렉션 시 request.nextUrl.search를 포함하여 쿼리 파라미터를 보존하는 것은 좋은 개선사항입니다. 사용자 컨텍스트를 유지하면서 더 나은 사용자 경험을 제공할 수 있습니다.

packages/web/src/utils/middleware.ts (1)

1-1: 경로 상수 가져오기 추가에 대해 긍정적입니다.

하드코딩된 문자열을 제거하고 중앙 집중화된 경로 상수를 사용하는 것은 좋은 접근 방식입니다.

packages/shared/src/hooks/supabase/useMemoPostMutation.ts (2)

Line range hint 1-35: 에러 처리와 타입 안전성이 잘 구현되어 있습니다.

  • NoMemosError를 통한 명확한 에러 처리
  • TypeScript 타입 정의를 통한 타입 안전성 확보
  • React Query의 올바른 사용

28-28: 배열 연결 순서 변경이 사용자 경험에 미치는 영향을 확인해주세요.

배열 연결 순서가 변경되어 새로운 메모가 목록의 시작 부분에 추가되도록 수정되었습니다. 이는 사용자 인터페이스에서 메모의 표시 순서에 영향을 미칠 수 있습니다.

다음 스크립트를 실행하여 메모 목록 컴포넌트에서 이 순서가 올바르게 처리되는지 확인하세요:

✅ Verification successful

배열 연결 순서 변경은 적절한 수정입니다.

메모는 이미 Supabase 쿼리에서 created_at 기준으로 내림차순 정렬되어 있으며, 새 메모를 배열 앞쪽에 추가하는 것이 이 정렬 순서와 일치합니다. 메모 그리드 컴포넌트는 정렬된 순서대로 메모를 표시하므로, 이 변경은 사용자 경험을 개선하는데 도움이 됩니다.

  • packages/shared/src/utils/Supabase.ts: 메모가 created_at 기준 내림차순으로 정렬됨
  • MemoGrid 컴포넌트: 받은 메모 배열 순서대로 표시
  • MemoForm: 새 메모 작성 시 즉시 목록 상단에 표시됨
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 메모 목록 컴포넌트에서 정렬 로직 확인
rg -A 10 "memo.*sort|memo.*order" --type ts --type tsx

Length of output: 84


Script:

#!/bin/bash
# 메모 관련 컴포넌트와 로직 검색
rg -A 10 "memo.*sort|memo.*order" --type typescript

# 메모 목록 관련 컴포넌트 파일 검색
fd -e ts -e tsx . packages/shared/src/components | xargs rg -l "memo"

# useMemoPostMutation 사용 위치 검색
rg "useMemoPostMutation" --type typescript -A 5

Length of output: 2943


Script:

#!/bin/bash
# 메모 컴포넌트에서 정렬 관련 코드 검색
rg -t ts -t tsx "memo.*sort|memo.*order" packages/web/src/app/\[lng\]/memos/components/

# MemoView 컴포넌트 내용 확인
cat packages/web/src/app/\[lng\]/memos/components/MemoView/index.tsx

# useMemoPostMutation이 사용되는 컴포넌트 검색
rg -t ts -t tsx "useMemoPostMutation" packages/web/src/app/

Length of output: 1320


Script:

#!/bin/bash
# 사이드 패널의 메모 작성 컴포넌트 확인
cat pages/side-panel/src/components/MemoForm.tsx

# 메모 그리드 컴포넌트 확인
cat packages/web/src/app/\[lng\]/memos/components/MemoView/MemoGrid.tsx

# 메모 정렬 관련 코드 검색 (확장된 패턴)
rg -g "*.{ts,tsx}" "(sort.*memo|order.*memo|memo.*sort|memo.*order)"

Length of output: 6252

packages/web/package.json (1)

17-17: Radix UI 라벨 컴포넌트 의존성 추가 검토

새로운 @radix-ui/react-label 의존성 추가가 기존 Radix UI 컴포넌트들과 일관성이 있어 적절해 보입니다. 다만, 다른 Radix UI 패키지들과의 버전 호환성을 확인하시는 것이 좋겠습니다.

다음 스크립트를 실행하여 Radix UI 패키지들 간의 버전 호환성을 확인하세요:

✅ Verification successful

Radix UI 패키지 버전 호환성 확인 완료

@radix-ui/react-label v2.1.0 추가는 기존 Radix UI 패키지들과 호환됩니다. 현재 프로젝트에서 사용 중인 다른 Radix UI 컴포넌트들도 대부분 v1.x ~ v2.x 버전대를 사용하고 있으며, 특히 react-dropdown-menu(v2.1.2)와 react-select(v2.1.2)와 같은 v2.x 컴포넌트들과 잘 호환될 것으로 예상됩니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Radix UI 패키지들의 버전 호환성 확인

# 모든 Radix UI 패키지의 현재 버전 출력
echo "설치된 Radix UI 패키지 버전:"
jq '.dependencies | with_entries(select(.key | startswith("@radix-ui")))' package.json

# npm registry에서 최신 버전 정보 확인
echo "\n최신 안정 버전 (@radix-ui/react-label):"
curl -s https://registry.npmjs.org/@radix-ui/react-label/latest | jq '.version'

Length of output: 311


Script:

#!/bin/bash
# Check package.json in the web directory specifically
echo "packages/web/package.json의 Radix UI 패키지 버전:"
cat packages/web/package.json | jq '.dependencies | with_entries(select(.key | startswith("@radix-ui")))'

# Find all package.json files and check for Radix UI dependencies
echo "\n전체 프로젝트의 Radix UI 패키지 사용현황:"
fd package.json --type f --exec sh -c 'echo "=== {} ==="; cat {} | jq -c ".dependencies | with_entries(select(.key | startswith(\"@radix-ui\"))) // {}"'

Length of output: 13491

packages/web/src/app/[lng]/memos/layout.tsx (1)

1-13: 코드가 깔끔하고 잘 구성되어 있습니다!

임포트문이 잘 구성되어 있고, LayoutProps 인터페이스가 적절하게 정의되어 있습니다.

packages/shared/src/utils/Supabase.ts (1)

19-19: 데이터 반환 동작이 일관성 있게 개선되었습니다.

다른 데이터 조작 함수들(insert, update, upsert)과 마찬가지로 .select()를 추가하여 삭제된 레코드를 반환하도록 수정한 것이 좋습니다.

프론트엔드에서의 사용 방식 변경이 필요한지 확인하겠습니다:

✅ Verification successful

.select() 추가는 기존 타입 시스템과 완벽하게 호환됩니다.

프론트엔드 코드 분석 결과, deleteMemo 함수는 이미 MemoSupabaseResponse 타입을 반환하도록 설계되어 있으며, 모든 mutation 훅에서 동일한 응답 타입을 사용하고 있습니다. .select()를 추가해도 기존 코드에 영향을 주지 않습니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: deleteMemo 함수의 사용 패턴을 확인합니다.

# deleteMemo 함수 호출 부분 검색
rg -A 3 "deleteMemo\(" 

Length of output: 331


Script:

#!/bin/bash
# Check the implementation of useMemoDeleteMutation to see how it handles the response
cat packages/web/src/hooks/useMemoDeleteMutation.ts

# Also check for any type definitions related to MemoSupabaseResponse
rg "MemoSupabaseResponse" -A 3

Length of output: 7399

packages/web/src/app/[lng]/memos/components/MemoSidebar/index.tsx (2)

21-21: 하드코딩된 URL을 상수로 대체한 것은 좋은 개선입니다.

URL을 PATHS 상수로 중앙 집중화한 것은 유지보수성을 향상시키는 좋은 리팩토링입니다. 향후 URL 구조가 변경되더라도 한 곳에서만 수정하면 되므로 관리가 용이해집니다.

Also applies to: 26-26, 31-31


Line range hint 1-1: 'use server' 지시문의 필요성을 검토해주세요.

이 컴포넌트가 서버 액션을 사용하지 않는 것으로 보입니다. 불필요한 'use server' 지시문은 제거하는 것이 좋습니다.

다음 스크립트로 서버 액션 사용 여부를 확인해보겠습니다:

packages/web/src/utils/supabase.server.ts (2)

3-3: 상수 관리 개선이 잘 이루어졌습니다!

경로 상수를 중앙 집중화하여 관리하는 방식으로 변경한 것이 코드 유지보수성을 향상시킵니다.


64-64: 세션 정리 검증이 필요합니다

로그아웃 시 모든 세션 데이터가 정상적으로 정리되는지 확인이 필요합니다.

✅ Verification successful

Let me verify if there are any other session-related data that needs to be cleaned up.


세션 정리가 올바르게 구현되어 있습니다

로그아웃 시 다음과 같은 세션 정리가 모두 적절하게 처리되고 있습니다:

  • Supabase auth 세션 종료 (signOut())
  • 액세스 토큰 쿠키 삭제
  • 리프레시 토큰 쿠키 삭제

추가적인 세션 데이터나 인증 관련 저장소가 발견되지 않았으므로 현재 구현이 안전합니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 세션 관련 데이터 정리 로직 확인

# 세션 관련 쿠키 및 로컬 스토리지 정리 코드 검색
rg -A 5 "signOut|clearSession|removeItem.*token" 

Length of output: 495


Script:

#!/bin/bash
# Check for any other session or auth related storage/cleanup
rg -A 5 "session|auth.*clear|clear.*auth|storage.*clear|clear.*storage"

# Check for any other cookie keys being used
rg "COOKIE_KEY_"

Length of output: 5270

packages/web/src/app/[lng]/memos/components/Header/index.tsx (1)

17-17: 경로 상수 가져오기 추가에 대해 승인합니다.

하드코딩된 경로를 중앙 집중화된 상수로 관리하는 것은 좋은 접근 방식입니다.

packages/web/src/app/[lng]/memos/components/MemoView/MemoOption.tsx (1)

125-125: Select 컴포넌트의 기본값 설정 검토 필요

현재 Select 컴포넌트의 기본값이 빈 문자열로 설정되어 있어, 사용자에게 혼란을 줄 수 있습니다.

현재 카테고리 값을 기본값으로 설정하는 것이 더 적절해 보입니다:

✅ Verification successful

Select 컴포넌트의 빈 문자열 기본값은 의도된 설계입니다

코드 분석 결과, Select 컴포넌트의 빈 문자열 기본값은 다음과 같은 이유로 적절합니다:

  1. Select 컴포넌트는 placeholder를 통해 option.changeCategory 번역 텍스트를 표시하여 사용자에게 카테고리 변경 동작을 명확히 안내합니다.
  2. 빈 문자열 기본값은 사용자가 새로운 카테고리를 선택하기 전까지 현재 카테고리를 유지하면서, 변경 의도를 명확히 표현할 수 있게 합니다.
  3. handleCategoryChange 함수는 사용자가 실제로 카테고리를 선택했을 때만 동작하여 안전한 상태 관리가 가능합니다.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 메모의 현재 카테고리 ID를 기본값으로 사용하는지 확인

# Test: Select 컴포넌트에서 현재 메모의 카테고리를 기본값으로 사용하는 패턴 검색
rg "defaultValue={(\w+\.category_id|String\(\w+\.category_id\))}" 

Length of output: 224


Script:

#!/bin/bash
# Let's check the MemoOption component implementation to understand the context better
rg -A 10 "const MemoOption" packages/web/src/app/\[lng\]/memos/components/MemoView/MemoOption.tsx

# Also check how category is being handled
rg -B 5 -A 5 "handleCategoryChange" packages/web/src/app/\[lng\]/memos/components/MemoView/MemoOption.tsx

# Check if there's any category prop being passed
rg -B 5 "MemoOption.*Props" packages/web/src/app/\[lng\]/memos/components/MemoView/MemoOption.tsx

Length of output: 1458


Script:

#!/bin/bash
# Let's check if there's any memo data being fetched that might contain category information
rg -B 5 -A 10 "const.*memo.*=" packages/web/src/app/\[lng\]/memos/components/MemoView/MemoOption.tsx

# Also check for any category-related queries or data fetching
rg -B 3 -A 3 "useQuery.*category" packages/web/src/app/\[lng\]/memos/components/MemoView/MemoOption.tsx

Length of output: 208

import { Label } from '@src/components/ui/label';

export default async function SettingHeader() {
return <Label className="flex justify-center py-10 text-xl">설정</Label>;
Copy link

@coderabbitai coderabbitai bot Nov 22, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

하드코딩된 텍스트를 i18n으로 대체해주세요

다국어 지원을 위해 하드코딩된 "설정" 텍스트를 i18n 번역 시스템을 통해 처리하는 것이 좋습니다. 현재 구현은 한국어만 지원하고 있습니다.

다음과 같이 수정하는 것을 제안드립니다:

-  return <Label className="flex justify-center py-10 text-xl">설정</Label>;
+  return <Label className="flex justify-center py-10 text-xl">{t('settings')}</Label>;

추가로 번역 키를 사용하기 위해 상단에 다음 import를 추가해주세요:

import { useTranslation } from '@/app/i18n';

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

@​guesung 수정해주셔서 감사합니다!

(^‿^)/


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Comment on lines 65 to 69
<SidebarFooter>
<Link href={PATHS.memosSetting} className="mb-2 ml-2 cursor-pointer">
<SettingsIcon size={16} />
</Link>
</SidebarFooter> */}
</SidebarFooter>
Copy link

@coderabbitai coderabbitai bot Nov 22, 2024

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

설정 페이지 링크의 접근성 개선이 필요합니다.

설정 아이콘만으로는 스크린 리더 사용자가 이 링크의 목적을 이해하기 어려울 수 있습니다.

다음과 같이 접근성을 개선하는 것을 추천드립니다:

-        <Link href={PATHS.memosSetting} className="mb-2 ml-2 cursor-pointer">
+        <Link 
+          href={PATHS.memosSetting} 
+          className="mb-2 ml-2 cursor-pointer"
+          aria-label="설정"
+        >
           <SettingsIcon size={16} />
         </Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<SidebarFooter>
<Link href={PATHS.memosSetting} className="mb-2 ml-2 cursor-pointer">
<SettingsIcon size={16} />
</Link>
</SidebarFooter> */}
</SidebarFooter>
<SidebarFooter>
<Link
href={PATHS.memosSetting}
className="mb-2 ml-2 cursor-pointer"
aria-label="설정"
>
<SettingsIcon size={16} />
</Link>
</SidebarFooter>

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

@ guesung, 수정 사항을 반영해주셔서 감사합니다!


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

@@ -28,7 +29,7 @@ async function HeaderLeft({ lng }: LanguageType) {
const { t } = await useTranslation(lng);

return (
<Link href="/memos">
<Link href={PATHS.memos}>
Copy link

@coderabbitai coderabbitai bot Nov 22, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

경로 관리 패턴 검토 결과

검증 결과, 몇몇 파일에서 여전히 하드코딩된 '/memos' 경로가 사용되고 있습니다:

  • auth/callback/route.ts
  • [lng]/page.tsx
  • auth/callback-email/route.ts
  • [lng]/login/page.tsx

이러한 파일들에서도 PATHS.memos 상수를 사용하도록 변경하는 것이 일관성 있는 경로 관리를 위해 권장됩니다.

🔗 Analysis chain

하드코딩된 경로를 PATHS 상수로 교체한 것을 승인합니다.

경로 관리를 중앙화하여 유지보수성이 향상되었습니다. 다만, 다른 컴포넌트에서도 동일한 방식으로 경로가 관리되고 있는지 확인이 필요합니다.

다른 컴포넌트에서의 경로 사용 패턴을 확인하기 위한 스크립트입니다:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 설명: 하드코딩된 '/memos' 문자열 사용 여부 확인

# '/memos'를 직접 사용하는 다른 컴포넌트 검색
rg -t tsx -t ts "'/memos'" --glob '!**/constants/**'

Length of output: 88


Script:

#!/bin/bash
# 하드코딩된 '/memos' 문자열 검색 (확장자 수정)
rg "'/memos'" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -t tsx -t ts --glob '!**/constants/**'

# PATHS 상수 사용 패턴 확인
rg "PATHS\.memos" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' -t tsx -t ts

# Link 컴포넌트의 href 속성 사용 패턴 확인
ast-grep --pattern 'Link $$$href={$_}$$$'

Length of output: 1250

Copy link

Choose a reason for hiding this comment

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

@guesung, 수정 사항을 확인했습니다. 감사합니다!


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

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 and nitpick comments (3)
packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx (1)

7-12: 컴포넌트 구조가 잘 설계되었습니다

  • LanguageType을 확장하여 타입 안전성이 보장됩니다
  • 이전 리뷰에서 지적된 하드코딩된 텍스트 이슈가 i18n으로 적절하게 해결되었습니다
  • className을 통한 스타일링이 일관되게 적용되어 있습니다

다만, 한 가지 제안사항이 있습니다:

Label 컴포넌트에 semantic HTML을 위해 'heading' 역할을 부여하는 것이 좋을 것 같습니다:

-  return <Label className="flex justify-center py-10 text-xl">{t('setting.header')}</Label>;
+  return <Label asChild><h1 className="flex justify-center py-10 text-xl">{t('setting.header')}</h1></Label>;
packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (2)

24-25: 언어 텍스트의 국제화가 필요합니다

언어 선택 옵션의 텍스트를 번역 시스템을 통해 관리하는 것이 좋습니다.

-            <SelectItem value="ko">한글</SelectItem>
-            <SelectItem value="en">English</SelectItem>
+            <SelectItem value="ko">{t('languages.korean')}</SelectItem>
+            <SelectItem value="en">{t('languages.english')}</SelectItem>

16-29: 컴포넌트의 재사용성 개선이 필요합니다

현재 구현은 section 태그에 하드코딩된 className을 사용하고 있습니다. 컴포넌트의 재사용성을 높이기 위해 className을 props로 받아 처리하는 것이 좋습니다.

-    <section className="grid gap-6">
+    <section className={cn("grid gap-6", className)}>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 24a6d1f and 5712d12.

📒 Files selected for processing (5)
  • packages/web/src/app/[lng]/memos/layout.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx (1 hunks)
  • packages/web/src/app/[lng]/memos/setting/page.tsx (1 hunks)
  • packages/web/src/app/i18n/locales/ko/translation.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/web/src/app/[lng]/memos/layout.tsx
  • packages/web/src/app/[lng]/memos/setting/page.tsx
  • packages/web/src/app/i18n/locales/ko/translation.json
🔇 Additional comments (3)
packages/web/src/app/[lng]/memos/setting/component/SettingHeader/index.tsx (1)

1-5: 서버 컴포넌트 구현이 올바르게 되었습니다

'use server' 지시문과 필요한 의존성들이 적절하게 import 되어 있습니다. 서버 사이드 번역을 위해 올바른 useTranslation 훅을 사용하고 있습니다.

packages/web/src/app/[lng]/memos/setting/component/Setting/index.tsx (2)

1-9: 코드가 깔끔하고 잘 구성되어 있습니다!

import 문과 인터페이스 정의가 명확하게 되어있습니다.


11-13: ⚠️ Potential issue

setLanauageRouter에 오타가 있습니다

setLanauageRoutersetLanguageRouter로 수정해야 합니다. 이는 런타임 에러를 방지하기 위해 필수적입니다.

-  const { language, setLanauageRouter } = useLanguage();
+  const { language, setLanguageRouter } = useLanguage();

@guesung guesung merged commit f32b597 into master Nov 22, 2024
7 checks passed
@guesung guesung deleted the feature/setting branch November 22, 2024 04:09
Copy link

설정

This was referenced Nov 28, 2024
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.

1 participant