Skip to content
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

[Feat] 업로드 예약 > 상세페이지 구현 및 부가 수정 #120

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

minseong0324
Copy link
Contributor

@minseong0324 minseong0324 commented Feb 10, 2025

관련 이슈

close: #119

변경 사항

업로드 예약 > 상세페이지를 구현 완료 했어요.

그리고 업로드 예약 페이지에서 불필요했던 로직 제거 및 자잘한 개선을 진행했어요.

image

레퍼런스

Summary by CodeRabbit

  • 새로운 기능

    • 일정 상세 정보 페이지와 컴포넌트가 추가되어 게시물 상세 내용을 확인할 수 있습니다.
    • 게시물 업로드 준비 개수를 UI에 쉽게 확인할 수 있도록 개선했습니다.
    • 새로운 제목을 표시할 수 있는 옵션이 추가되었습니다.
  • 리팩토링

    • 게시물 주제 접근 방식을 명확하게 하여 오류 발생 가능성을 재정의했습니다.
    • 편집 화면의 안내 문구를 업데이트하여 사용자 경험을 향상시켰습니다.
    • 테이블 동작과 라우팅 관련 기능을 단순화했습니다.
  • 유지보수

    • 여러 타입 정의를 업데이트하여 모듈 간 재사용성을 높였습니다.
    • 새로운 스타일 상수를 도입해 UI 레이아웃을 더 유연하게 구성했습니다.

Copy link

coderabbitai bot commented Feb 10, 2025

Walkthrough

이 PR은 업로드 예약 상세페이지 구현과 관련된 UI 및 코드 로직 수정을 포함합니다. Edit.tsx 파일에서 안전성 검사 없이 데이터 접근 방식을 변경하고, EditContent.tsx의 placeholder 문구를 수정하였습니다. 또한, Schedule 관련 컴포넌트에서 props 구조 변경 및 불필요한 로직 제거, 새로운 drag-and-drop 방식 적용 등이 이루어졌으며, 새로운 상세페이지 컴포넌트와 스타일, 타입 정의가 추가되었습니다. 마지막으로, 일부 타입들을 외부에서 사용할 수 있도록 업데이트하였습니다.

Changes

Files Change Summary
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/Edit.tsx Optional chaining 제거로 posts.data.postGroup.topic에 대해 안전 검사 없이 접근
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/_components/EditContent/EditContent.tsx TextField의 placeholder 텍스트를 "AI에게 요청하여 수정 중인 글 모두 업그레이드하기"로 수정
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx TitleWithDescriptionrightTitle 프로퍼티 추가, ScheduleTable 호출 시 params 제거, posts ready count 추가 표시
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/ScheduleTable/ScheduleTable.tsx Props에서 params 삭제, 내부 로직(handleModify, handleDeletePost) 제거 및 클릭 핸들러로 routing 변경
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/TitleWithDescription/*.tsx, *.css.ts TitleWithDescriptionrightTitle 추가 및 렌더링 로직 변경, 새로운 CSS 상수 titleWrapperStyle 추가
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/* 새로운 상세페이지 컴포넌트(ScheduleDetail.tsx), 상세페이지 라우팅(page.tsx), 관련 스타일(pageStyle.css.ts) 및 타입(type.ts) 추가
apps/web/src/types/post.ts 기존 local type들을 export 처리하여 외부 모듈에서 사용 가능하도록 변경 (PostPurpose, PostReference, PostLength)

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ScheduleDetailPage
    participant API
    participant Toast

    User->>ScheduleDetailPage: 상세페이지 요청 (id 포함)
    ScheduleDetailPage->>API: getAllPostsQuery 호출 (agentId, postGroupId, 토큰 포함)
    API-->>ScheduleDetailPage: posts 데이터 반환
    alt Post 존재함
        ScheduleDetailPage->>User: 상세정보 및 이미지 렌더링
    else Post 미존재
        ScheduleDetailPage->>Toast: 에러 메시지 전송
        ScheduleDetailPage-->>User: 에러 상태 렌더링
    end
Loading

Assessment against linked issues

Objective (이슈 #119) Addressed Explanation
업로드 예약 > 상세페이지 구현
불필요 로직 제거 및 자잘한 수정 관련 props 및 메서드 제거 등이 반영됨
결과 수정 페이지 TextField placeholder 수정 EditContent의 placeholder 텍스트가 수정됨

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • kongnayeon

Poem

나는 작은 토끼, 코드 숲을 달리네,
줄마다 담긴 변화에 귀가 쫑긋,
안정성을 위해 도약하는 발걸음,
UI와 타입, 모두 정갈하게 다듬었네,
당근 한 입과 함께 축하의 점프!
새로운 코드의 봄, 모두 함께 즐기세!
🥕🐇

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/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx

Oops! Something went wrong! :(

ESLint: 9.17.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@repo/eslint-config' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c210fdd and 2108011.

📒 Files selected for processing (1)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx

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.

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

🔭 Outside diff range comments (1)
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/Edit.tsx (1)

31-33: 배열 메서드 사용 시 안전성 검사가 필요합니다.

posts.data.posts가 undefined일 경우 some 메서드 호출 시 에러가 발생할 수 있습니다.

다음과 같이 안전성 검사를 추가하는 것을 추천드립니다:

-  const hasReadyToUploadPosts = posts.data.posts.some(
+  const hasReadyToUploadPosts = posts?.data?.posts?.some(
     (post) => post.status === POST_STATUS.READY_TO_UPLOAD
   );
🧹 Nitpick comments (2)
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/pageStyle.css.ts (1)

4-51: 스타일 정의가 깔끔하나, 반응형 디자인 개선이 필요합니다.

현재 스타일 정의는 잘 구성되어 있으나, 다양한 화면 크기에 대한 대응이 부족합니다. 미디어 쿼리를 추가하여 모바일 환경에서의 사용성을 개선하는 것이 좋겠습니다.

다음과 같이 미디어 쿼리를 추가하는 것을 제안드립니다:

 export const contentWrapperStyle = style({
   maxWidth: '768px',
   position: 'relative',
   display: 'flex',
   flexDirection: 'column',
   padding: `0 ${vars.space[16]}`,
+  '@media': {
+    'screen and (max-width: 480px)': {
+      padding: `0 ${vars.space[8]}`,
+    }
+  }
 });
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/ScheduleDetail.tsx (1)

73-79: 이미지 처리 방식 개선이 필요합니다.

  1. 고정된 이미지 크기는 이미지의 원본 비율을 왜곡시킬 수 있습니다.
  2. 대체 텍스트가 더 구체적일 필요가 있습니다.

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

  <Image
    src={image.url}
-   alt={`업로드 예정인 이미지 ${image.id}`}
+   alt={`${currentPost.summary}의 ${image.id}번째 이미지`}
    width={185.5}
    height={240}
+   style={{ objectFit: 'contain' }}
    className={style.imageStyle}
  />

또한 이미지 크기를 반응형으로 처리하는 것을 고려해보세요.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6adea35 and c210fdd.

📒 Files selected for processing (11)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/Edit.tsx (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/_components/EditContent/EditContent.tsx (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx (2 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/ScheduleTable/ScheduleTable.tsx (2 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/TitleWithDescription/TitleWithDescription.css.ts (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/TitleWithDescription/TitleWithDescription.tsx (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/ScheduleDetail.tsx (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/page.tsx (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/pageStyle.css.ts (1 hunks)
  • apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/type.ts (1 hunks)
  • apps/web/src/types/post.ts (1 hunks)
🔇 Additional comments (11)
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/type.ts (1)

3-7: 타입 정의가 명확하고 적절합니다!

EditPageProps를 확장하여 id 파라미터를 추가한 것이 페이지 라우팅 구조에 잘 맞습니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/page.tsx (1)

7-20: 서버 컴포넌트 구현이 잘 되어있습니다!

서버 사이드 토큰 처리와 데이터 페칭 로직이 적절하게 구현되어 있습니다. ServerFetchBoundary를 사용한 것이 좋은 패턴입니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/detail/[id]/ScheduleDetail.tsx (2)

1-12: 컴포넌트 선언과 임포트가 잘 구성되어 있습니다!

필요한 의존성들이 명확하게 임포트되어 있고, 클라이언트 컴포넌트 지시자가 올바르게 배치되어 있습니다.


13-19: params 유효성 검사가 필요합니다.

쿼리 파라미터를 사용하기 전에 agentId와 postGroupId의 유효성을 검사하는 것이 좋습니다. 잘못된 파라미터로 인한 오류를 방지할 수 있습니다.

다음과 같이 검사 로직을 추가하는 것을 고려해보세요:

+ if (!params.agentId || !params.postGroupId) {
+   toast.error('잘못된 접근입니다.');
+   router.push('/');
+   return;
+ }
  const { data: posts } = useGetAllPostsQuery({
    agentId: params.agentId,
    postGroupId: params.postGroupId,
  });
apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/TitleWithDescription/TitleWithDescription.css.ts (1)

11-15: 새로운 스타일 구현이 적절합니다!

디자인 시스템의 spacing 변수를 일관되게 사용하고, flex 레이아웃을 적절하게 활용하였습니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/TitleWithDescription/TitleWithDescription.tsx (2)

4-8: 타입 정의가 명확합니다!

rightTitle을 옵셔널 프롭으로 추가한 것이 적절합니다.


17-26: UI 구현이 깔끔합니다!

타이틀 레이아웃과 조건부 렌더링이 잘 구현되었습니다. 폰트 스타일도 일관성 있게 적용되었습니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/_components/ScheduleTable/ScheduleTable.tsx (1)

10-12: Props 단순화가 잘 되었습니다!

불필요한 props를 제거하여 컴포넌트의 재사용성이 향상되었습니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/schedule/Schedule.tsx (2)

109-109: 업로드 예약 일정 제목에 게시물 수 표시 추가가 잘 되었습니다!

사용자가 업로드할 준비가 된 게시물의 수를 한눈에 파악할 수 있도록 하는 UI 개선이 잘 이루어졌습니다.


130-130: ScheduleTable 컴포넌트의 params prop 제거 검증 필요

params prop이 제거되었습니다. 이 변경이 ScheduleTable 컴포넌트의 기능에 영향을 미치지 않는지 확인이 필요합니다.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# ScheduleTable 컴포넌트에서 params 사용 여부 확인
ast-grep --pattern 'const ScheduleTable = ({ $_ }) => {
  $$$
  params
  $$$
}'

Length of output: 81


ScheduleTable 컴포넌트의 params prop 사용 검증 결과

추가 확인 결과, ScheduleTable 컴포넌트 내부에서 params prop에 대한 참조를 찾을 수 없었습니다. 따라서 props에서 params가 제거된 변경 사항이 기능에 영향을 미치지 않을 것으로 판단됩니다.

apps/web/src/app/(prompt)/edit/[agentId]/[postGroupId]/_components/EditContent/EditContent.tsx (1)

178-178: placeholder 텍스트가 더 명확하게 개선되었습니다!

"AI에게 요청하여 수정 중인 글 모두 업그레이드하기"로 변경함으로써, 해당 액션이 현재 수정 중인 모든 글에 적용된다는 것을 사용자가 더 명확하게 이해할 수 있게 되었습니다.

@@ -22,23 +22,24 @@ export const POST_PURPOSE = {
MARKETING: 'MARKETING',
} as const;

type PostPurpose = (typeof POST_PURPOSE)[keyof typeof POST_PURPOSE];
export type PostPurpose = (typeof POST_PURPOSE)[keyof typeof POST_PURPOSE];
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

중복된 타입 정의를 통합할 필요가 있습니다.

PurposePostPurpose, ReferencePostReference 등 유사한 타입이 중복 정의되어 있습니다. 타입 정의를 통합하여 코드의 일관성을 높이는 것이 좋겠습니다.

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

-export type Purpose = 'INFORMATION' | 'OPINION' | 'HUMOR' | 'MARKETING';
-export type Reference = 'NONE' | 'NEWS' | 'IMAGE';

// PostPurpose와 PostReference 타입을 재사용
+export type Purpose = PostPurpose;
+export type Reference = PostReference;

Also applies to: 33-34, 42-42, 63-65

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.

[Feature] 업로드 예약 > 상세페이지 구현 및 부가 수정
1 participant