-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 인사이트 페이지 ui 및 코드 정리 (#129) #134
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ac954d6
design: 피드백 박스 ui 수정 (#129)
gyogyo05 031ded0
Merge branch 'develop' of https://github.com/TTORANG/Web into feat/pd…
gyogyo05 e5e3a6c
refactor: 인사이트 페이지 컴포넌트 구조 분리 및 404에러 재요청 방지 (#129)
gyogyo05 ec2136e
refactor: 인사이트 페이지 구조 단순화 및 유틸 명칭 정리 (#129)
gyogyo05 0746683
fix: 이탈 슬라이드/영상 구간 빈 데이터 메시지 처리 (#129)
gyogyo05 72c1394
fix: 영상 없을때 영상이탈 구간 박스 숨김처리 (#129)
gyogyo05 f7ae4c2
fix: 404 재요청 중단 로직 원복 (#129)
gyogyo05 e1a3aaf
Merge branch 'develop' into feat/pd-ins-ui-129
gyogyo05 22882e7
fix: 빌드 오류 수정 (#129)
gyogyo05 fddb03a
fix: 빌드 오류 재수정 (#129)
gyogyo05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // src/components/insight/RecentCommentsSection.tsx | ||
| import type { ReadRecentCommentListResponseDto } from '@/api/dto/analytics.dto'; | ||
| import { RecentCommentItem } from '@/components/insight'; | ||
| import { formatVideoTimestamp } from '@/utils/format'; | ||
|
|
||
| const thumbBase = 'bg-gray-100 rounded-lg aspect-video'; | ||
|
|
||
| export function RecentCommentsSection({ | ||
| hasVideo, | ||
| recentCommentsData, | ||
| }: { | ||
| hasVideo: boolean; | ||
| recentCommentsData?: ReadRecentCommentListResponseDto; | ||
| }) { | ||
| return ( | ||
| <div className="flex w-full flex-col gap-4"> | ||
| <div className="relative"> | ||
| <div | ||
| className={`flex flex-col gap-2 ${!hasVideo ? 'blur-sm pointer-events-none select-none' : ''}`} | ||
| > | ||
| <h3 className="text-body-l-bold text-gray-800">최근 댓글 피드백</h3> | ||
|
|
||
| {recentCommentsData?.comments && recentCommentsData.comments.length > 0 ? ( | ||
| recentCommentsData.comments.map((comment) => ( | ||
| <RecentCommentItem | ||
| key={comment.commentId} | ||
| user={comment.user.name} | ||
| slideLabel={`슬라이드 ${comment.slide.slideNum}`} | ||
| time={formatVideoTimestamp(comment.timestampMs / 1000)} | ||
| text={comment.content} | ||
| thumbUrl={comment.slide.imageUrl} | ||
| thumbFallbackClassName={thumbBase} | ||
| /> | ||
| )) | ||
| ) : ( | ||
| <div className="py-4 text-center text-gray-400 text-body-s"> | ||
| 아직 등록된 댓글이 없습니다. | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| {!hasVideo && ( | ||
| <div className="absolute inset-0 z-10 flex items-center justify-center text-center pointer-events-auto"> | ||
| <div className="px-6 py-5"> | ||
| <p className="text-body-l-bold text-gray-800"> | ||
| 영상을 녹화하면 더 자세한 분석을 받을 수 있어요 | ||
| </p> | ||
| <ul className="mt-3 mx-auto w-fit text-left text-body-m text-gray-800"> | ||
| <li>• 시청 구간별 이탈률 분석</li> | ||
| <li>• 영상 잔존율 그래프</li> | ||
| <li>• 타임라인 기반 댓글 피드백</li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // src/pages/insight/charts/RetentionChartCard.tsx | ||
| import { | ||
| Area, | ||
| AreaChart, | ||
| CartesianGrid, | ||
| ResponsiveContainer, | ||
| Tooltip, | ||
| XAxis, | ||
| YAxis, | ||
| } from 'recharts'; | ||
|
|
||
| import type { ChartDataPoint } from '../types'; | ||
| import { RetentionChartTooltip } from './RetentionChartTooltip'; | ||
|
|
||
| interface Props { | ||
| title: string; | ||
| data: ChartDataPoint[]; | ||
| isVideo: boolean; | ||
| } | ||
|
|
||
| export function RetentionChartCard({ title, data, isVideo }: Props) { | ||
| return ( | ||
| <div className="flex w-full flex-col gap-6 rounded-lg border border-gray-200 bg-white px-5 pb-8 pt-4"> | ||
| <h3 className="text-body-l-bold text-gray-800">{title}</h3> | ||
|
|
||
| <div className="h-100 w-full px-6"> | ||
| {data.length > 0 ? ( | ||
| <ResponsiveContainer width="100%" height="100%"> | ||
| <AreaChart data={data} margin={{ top: 10, right: 10, left: -20, bottom: 0 }}> | ||
| <defs> | ||
| <linearGradient | ||
| id={`colorRate-${isVideo ? 'video' : 'slide'}`} | ||
| x1="0" | ||
| y1="0" | ||
| x2="0" | ||
| y2="1" | ||
| > | ||
| <stop offset="5%" stopColor="var(--color-main)" stopOpacity={0.2} /> | ||
| <stop offset="95%" stopColor="var(--color-main)" stopOpacity={0} /> | ||
| </linearGradient> | ||
| </defs> | ||
|
|
||
| <CartesianGrid | ||
| strokeDasharray="3 3" | ||
| vertical={false} | ||
| stroke="var(--color-gray-400)" | ||
| /> | ||
|
|
||
| <XAxis | ||
| dataKey="label" | ||
| axisLine={false} | ||
| tickLine={false} | ||
| tick={{ fontSize: 12, fill: 'var(--color-gray-600)', fontWeight: 600 }} | ||
| dy={10} | ||
| interval={isVideo ? 'preserveStartEnd' : 0} | ||
| minTickGap={30} | ||
| /> | ||
|
|
||
| <YAxis | ||
| domain={[0, 100]} | ||
| axisLine={false} | ||
| tickLine={false} | ||
| tick={{ fontSize: 12, fill: 'var(--color-gray-600)' }} | ||
| ticks={[0, 25, 50, 75, 100]} | ||
| unit="%" | ||
| /> | ||
|
|
||
| <Tooltip | ||
| content={(props) => <RetentionChartTooltip {...props} hasVideo={isVideo} />} | ||
| cursor={{ stroke: 'var(--color-error)', strokeDasharray: '4 4', strokeWidth: 1 }} | ||
| /> | ||
|
|
||
| <Area | ||
| type="monotone" | ||
| dataKey="value" | ||
| stroke="var(--color-main)" | ||
| strokeWidth={2} | ||
| fillOpacity={1} | ||
| fill={`url(#colorRate-${isVideo ? 'video' : 'slide'})`} | ||
| dot={ | ||
| !isVideo | ||
| ? { r: 4, fill: '#fff', stroke: 'var(--color-main)', strokeWidth: 2 } | ||
| : false | ||
| } | ||
| activeDot={{ r: 5, fill: 'var(--color-error)', stroke: '#fff', strokeWidth: 2 }} | ||
| /> | ||
| </AreaChart> | ||
| </ResponsiveContainer> | ||
| ) : ( | ||
| <div className="flex h-full w-full flex-col items-center justify-center gap-2 text-gray-400"> | ||
| <p>데이터를 분석 중이거나 결과가 없습니다.</p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // src/pages/insight/charts/RetentionChartTooltip.tsx | ||
| import type { NameType, ValueType } from 'recharts/types/component/DefaultTooltipContent'; | ||
| import type { TooltipContentProps } from 'recharts/types/component/Tooltip'; | ||
|
|
||
| import type { ChartDataPoint } from '../types'; | ||
|
|
||
| export function RetentionChartTooltip({ | ||
| active, | ||
| payload, | ||
| label, | ||
| hasVideo, | ||
| }: TooltipContentProps<ValueType, NameType> & { hasVideo: boolean }) { | ||
| if (active && payload && payload.length) { | ||
| const data = payload[0].payload as ChartDataPoint; | ||
| return ( | ||
| <div className="rounded-lg border border-gray-100 bg-white p-3 shadow-lg"> | ||
| <p className="mb-1 text-xs font-semibold text-gray-500"> | ||
| {hasVideo ? `재생 시간: ${label}` : `${data.tooltipTitle}`} | ||
| </p> | ||
| <div className="flex items-end gap-2"> | ||
| <p className="text-sm font-bold text-indigo-600">잔존율 {data.value}%</p> | ||
| <span className="text-xs text-gray-400">({data.sessionCount}명)</span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| return null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // src/components/insight/types.ts | ||
| import type { ReadRecentCommentListResponseDto } from '@/api/dto/analytics.dto'; | ||
| import type { DropOffSlide, DropOffTime, SummaryStat } from '@/types/insight'; | ||
| import type { ReactionType } from '@/types/script'; | ||
| import type { SlideListItem } from '@/types/slide'; | ||
|
|
||
| // 기존 공용 타입 재사용 | ||
|
|
||
| export interface ChartDataPoint { | ||
| label: string; | ||
| value: number; | ||
| tooltipTitle: string; | ||
| sessionCount: number; | ||
| originalTime?: number; | ||
| } | ||
|
|
||
| export type InsightTopSlide = { | ||
| slideId: string; | ||
| slide?: SlideListItem; | ||
| slideIndex: number; | ||
| title: string; | ||
| commentCount: number; | ||
| feedbackCount: number; | ||
| }; | ||
|
|
||
| export type InsightModel = { | ||
| projectIdStr: string; | ||
| projectIdNum: number; | ||
|
|
||
| hasVideo: boolean; | ||
|
|
||
| summaryStats: SummaryStat[]; | ||
|
|
||
| dropOffSlides: DropOffSlide[]; | ||
| dropOffTimes: DropOffTime[]; | ||
|
|
||
| retentionTitle: string; | ||
| retentionData: ChartDataPoint[]; | ||
| retentionIsVideo: boolean; | ||
|
|
||
| topSlides: InsightTopSlide[]; | ||
| topSlideReactionSummaries?: Array<Record<ReactionType, number>>; | ||
| getThumb: (slideIndex: number) => string | undefined; | ||
|
|
||
| recentCommentsData: ReadRecentCommentListResponseDto | undefined; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.