-
Notifications
You must be signed in to change notification settings - Fork 0
1:1 스터디 리뷰 통계·후기 목록 추가 및 그룹 스터디 수정 스키마 분리 #441
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
Changes from all commits
a63799c
0c13265
d5fa80e
5f4a2fc
dadd65c
640d91b
3034336
6ef96a6
95bf182
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import type { GroupStudyReviewStatistics } from '@/types/api/group-study-review.types'; | ||
|
|
||
| interface ReviewStatisticsProps { | ||
| id: number; | ||
| content: string; | ||
| count: number; | ||
| } | ||
|
|
||
| export function buildEvaluationStatistics( | ||
| positiveKeywords: ReviewStatisticsProps[], | ||
| negativeKeywords: ReviewStatisticsProps[], | ||
| ): GroupStudyReviewStatistics { | ||
| const filterAndMap = (keywords: ReviewStatisticsProps[]) => | ||
| keywords | ||
| .filter((keyword) => keyword.count > 0) | ||
| .map((keyword) => ({ | ||
| id: keyword.id, | ||
| label: keyword.content, | ||
| count: keyword.count, | ||
| })); | ||
|
|
||
| return { | ||
| goodItems: filterAndMap(positiveKeywords), | ||
| disappointedItems: filterAndMap(negativeKeywords), | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,81 @@ | ||
| 'use client'; | ||
|
|
||
| import { | ||
| useMyNegativeKeywordsQuery, | ||
| useMyReviewsInfinityQuery, | ||
| useUserPositiveKeywordsQuery, | ||
| } from '@/hooks/queries/use-review-query'; | ||
|
|
||
| import { buildEvaluationStatistics } from './_utils'; | ||
| import CompletedStudyReviewPage from '../_components/completed-study-review-page'; | ||
| import StudyReviewTabNav from '../_components/study-review-tab-nav'; | ||
| import OneToOneReviewCard from './_components/one-to-one-review-card'; | ||
| import EvaluationSection from '../group/[groupStudyId]/_components/evaluation-section'; | ||
|
|
||
| export default function OneToOneReviewPage() { | ||
| const { data: positiveData } = useUserPositiveKeywordsQuery({}); | ||
| const { data: negativeData } = useMyNegativeKeywordsQuery({}); | ||
| const { | ||
| data: reviewData, | ||
| fetchNextPage, | ||
| hasNextPage, | ||
| } = useMyReviewsInfinityQuery(); | ||
|
|
||
| const statistics = buildEvaluationStatistics( | ||
| positiveData?.keywords ?? [], | ||
| negativeData?.keywords ?? [], | ||
| ); | ||
|
|
||
| const reviews = reviewData?.reviews ?? []; | ||
| const totalCount = reviewData?.totalCount ?? 0; | ||
|
Comment on lines
+16
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 초기/실패 상태가 빈 데이터로 오인됩니다. Line 16-30에서 새로 추가한 세 쿼리 결과를 바로 As per coding guidelines 'For recoverable failures in UI: use inline error display first, Toast as secondary. Never use browser alert(). Use useToastStore for Toast display in React components and getState() outside React.' 🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <CompletedStudyReviewPage | ||
| basePath="/my-study-review/one-to-one" | ||
| studyType="ONE_ON_ONE_STUDY" | ||
| studyTypeName="1:1스터디" | ||
| /> | ||
| <div className="flex flex-col gap-400"> | ||
| <StudyReviewTabNav /> | ||
|
|
||
| <EvaluationSection statistics={statistics} /> | ||
|
|
||
| <section className="flex flex-col gap-200"> | ||
| <div className="flex items-center gap-100"> | ||
| <h2 className="font-designer-20b text-text-default">후기</h2> | ||
| <span className="font-designer-20b text-text-default"> | ||
| {totalCount} | ||
| </span> | ||
| </div> | ||
| <span className="font-designer-14r text-text-subtle"> | ||
| 모든 후기는 나에게만 보여요. | ||
| </span> | ||
|
|
||
| {reviews.length > 0 ? ( | ||
| <ul className="flex flex-col"> | ||
| {reviews.map((review) => ( | ||
| <OneToOneReviewCard key={review.id} review={review} /> | ||
| ))} | ||
| </ul> | ||
| ) : ( | ||
| <div className="text-text-subtle font-designer-14r flex h-200 items-center justify-center text-center"> | ||
| 아직까지 받은 후기가 없습니다. | ||
| </div> | ||
| )} | ||
|
|
||
| {hasNextPage && ( | ||
| <button | ||
| type="button" | ||
| className="font-designer-14m text-text-subtle hover:bg-background-accent-gray-default rounded-50 flex w-full cursor-pointer items-center justify-center py-200" | ||
| onClick={() => fetchNextPage()} | ||
| > | ||
| 더보기 | ||
| </button> | ||
| )} | ||
| </section> | ||
|
|
||
| <CompletedStudyReviewPage | ||
| basePath="/my-study-review/one-to-one" | ||
| studyType="ONE_ON_ONE_STUDY" | ||
| studyTypeName="1:1스터디" | ||
| hideTabNav | ||
| hideEmptyMessage | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 50397
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 879
🏁 Script executed:
# use-review-query.ts 전체 내용 확인 wc -l src/hooks/queries/use-review-query.tsRepository: code-zero-to-one/study-platform-client
Length of output: 123
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 3193
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 9623
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 3165
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 5589
🏁 Script executed:
Repository: code-zero-to-one/study-platform-client
Length of output: 1125
세 쿼리가 모든 스터디 타입의 데이터를 함께 조회하고 있습니다.
이 페이지는 1:1 리뷰만 표시해야 하지만, 호출하는 세 쿼리(
useUserPositiveKeywordsQuery,useMyNegativeKeywordsQuery,useMyReviewsInfinityQuery)는 모두studyType파라미터가 없습니다. API 함수, 타입 정의, 엔드포인트 모두에서 1:1 필터링이 불가능하므로, 긍정 키워드, 부정 키워드, 후기 데이터가 그룹 스터디 리뷰와 함께 섞여 조회됩니다.CompletedStudyReviewPage컴포넌트처럼studyType="ONE_ON_ONE_STUDY"필터를 세 쿼리에도 추가해야 합니다.🤖 Prompt for AI Agents