-
Notifications
You must be signed in to change notification settings - Fork 4
[FE] [FEAT] Report Myself 컴포넌트 구현 #401
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 47 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
082caef
feat: myself 컴포넌트 초기 구현
1jiwoo27 31a820b
chore: import 문 절대 경로로 변경
1jiwoo27 e4b8f67
feat: report page 구조 초기 구현
1jiwoo27 75511e4
feat: 분석 페이지 레이아웃 스타일 반영
1jiwoo27 dcc3e2d
refactor: ReportLegend 컴포넌트 분리
1jiwoo27 ff81d41
feat: 사용량 안내 subtext 추가
1jiwoo27 df1dd2d
feat: ReportLegend line variant 추가
1jiwoo27 90dd331
chore: legend border-radius 10px로 변경
1jiwoo27 331b6ba
feat: line chart svg로 초기 구현
1jiwoo27 78f4ea8
chore: 그래프에 필요한 data props로 전달
1jiwoo27 38008d0
refactor: VerticalGrid 다른 그래프에서도 사용할 수 있도록 리팩터링
1jiwoo27 8d2bcb6
chore: import문 절대경로로 변경
1jiwoo27 89f7e23
feat: accountbook 데이터 없을 시, mockdata 불러오기
1jiwoo27 c4034c9
Merge branch 'develop' of https://github.com/softeerbootcamp-7th/Team…
1jiwoo27 b5aa568
chore: store 불러오는 불필요한 코드 삭제
1jiwoo27 6b41d4c
feat: buildPath 함수 차트 파일에 추가
1jiwoo27 5db8653
chore: prettier 스크립트 실행
1jiwoo27 e60d61d
feat: verticalGrid 추가
1jiwoo27 10cd834
chore: verticalGrid 컴포넌트에 className props 추가
1jiwoo27 409a292
chore: 그래프와 그리드에 relative 속성 추가
1jiwoo27 64ff6d3
feat: 그래프와 그리드 크기 조정
1jiwoo27 ac7c971
refactor: VerticalGrid에 positions props 추가하여 일정하지 않은 라벨에서도 사용 가능하도록 변경
1jiwoo27 bf6cdfa
chore: label 깨지지 않도록 whitespace-nowrap 속성 추가
1jiwoo27 824ff97
refactor: props 정리 및 불필요한 계산 로직 삭제
1jiwoo27 12cf18f
feat: mockdata 구조 변경 및 데이터 적용
1jiwoo27 e9b9d19
feat: 애니메이션 스타일 css 파일로 분리
1jiwoo27 ee696bf
feat: prevPath fill 속성 추가 (커스텀 스타일 적용)
1jiwoo27 a32b9ca
chore: 그래프 height 변경
1jiwoo27 8c8a147
feat: 필요한 count props 추가
1jiwoo27 09e3d48
chore: animation 변수명 변경
1jiwoo27 ca39e9c
chore: 라벨 mockData 정보로 변경
1jiwoo27 e70ad3a
Merge branch 'develop' of https://github.com/softeerbootcamp-7th/Team…
1jiwoo27 15477cf
refactor: buildPath 파일 분리
1jiwoo27 85670da
chore: prev 대신 last로 통일
1jiwoo27 215475e
chore: props 관련 주석 추가
1jiwoo27 da36349
chore: Legend_Color key 값 변경
1jiwoo27 070a690
chore: 필요없는 변수 삭제
1jiwoo27 2033a4e
refactor: buildPath 함수 내 반복되는 로직 분리
1jiwoo27 a73063b
chore: 컴포넌트명 변경
1jiwoo27 7f73bae
chore: 바뀐 컴포넌트명에 따라 import 문 수정
1jiwoo27 0f96f3d
style: pl 추가로 가운데 정렬
1jiwoo27 9086b7b
chore: 필요한 currencyCode만 불러오도록 조건문 작성
1jiwoo27 c884faa
Merge branch 'develop' of https://github.com/softeerbootcamp-7th/WEB-…
1jiwoo27 fffb25d
refactor: 반복되는 ChartItem 타입 분리 및 props에 적용
1jiwoo27 56e3486
fix: 자동 저장 시 줄바꿈되면서 변경사항으로 인식되는 문제로, .gitattributes에 routeTree 파일 추가
1jiwoo27 5938d74
refactor: 라벨도 gridPositions 기준으로 순회하도록 변경 (라벨이 없으면 렌더링하지 않게 처리)
1jiwoo27 f310b78
chore: 함수 호출 부분 상수화
1jiwoo27 f844887
chore: props 타입 keyof typeof로 통일
1jiwoo27 aa5fd36
feat: mockdata 구조 변경
1jiwoo27 1e9d060
refactor: month 단위로 props 구조 재정리
1jiwoo27 bc6537f
chore: 불필요한 주석 삭제
1jiwoo27 038896c
chore: className props에서 제거
1jiwoo27 eb30dcc
chore: 타입 단언 제거 및 countryCode null 가드 추가
1jiwoo27 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # 자동 생성되는 라우트 트리 파일의 줄바꿈을 LF로 고정 | ||
| src/routeTree.gen.ts text eol=lf |
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,30 @@ | ||
| import clsx from 'clsx'; | ||
|
|
||
| const LEGEND_COLOR = { | ||
| primary: 'bg-primary-normal', | ||
| secondary: 'bg-cool-neutral-90', | ||
| } as const; | ||
|
|
||
| const SHAPE_STYLE = { | ||
| box: 'size-2.5', | ||
| line: 'w-6.25 h-1 rounded-modal-10', | ||
| } as const; | ||
|
|
||
| interface ReportLegendProps { | ||
| color: keyof typeof LEGEND_COLOR; | ||
| label: string; | ||
| variant?: 'box' | 'line'; | ||
| } | ||
|
|
||
| const ReportLegend = ({ color, label, variant = 'box' }: ReportLegendProps) => { | ||
| return ( | ||
| <div className="flex items-center gap-1.5"> | ||
| <div className={clsx(SHAPE_STYLE[variant], LEGEND_COLOR[color])} /> | ||
| <span className="label1-normal-regular text-label-alternative"> | ||
| {label} | ||
| </span> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ReportLegend; | ||
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,67 @@ | ||
| import { clsx } from 'clsx'; | ||
|
|
||
| interface VerticalGridProps { | ||
| steps?: number; | ||
| labels: (number | string)[]; | ||
| positions?: number[]; // 커스텀 위치 배열 | ||
| className?: string; | ||
1jiwoo27 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| const VerticalGrid = ({ | ||
| steps, | ||
| labels, | ||
| positions, | ||
| className, | ||
| }: VerticalGridProps) => { | ||
| const gridPositions = | ||
| positions || | ||
| (steps !== undefined | ||
| ? Array.from({ length: steps + 1 }, (_, i) => (i / steps) * 100) | ||
| : []); | ||
|
|
||
| if (gridPositions.length === 0) return null; | ||
|
|
||
| return ( | ||
| <div | ||
| className={clsx( | ||
| 'pointer-events-none absolute inset-0 flex h-full flex-col gap-4 pr-5', | ||
| className, | ||
| )} | ||
| > | ||
| <div className="relative flex-1"> | ||
| {gridPositions.map((position, i) => ( | ||
| <div | ||
| key={i} | ||
| className="border-line-normal-normal absolute top-0 h-full border-l border-dashed" | ||
| style={{ | ||
| left: `${position}%`, | ||
| }} | ||
| /> | ||
| ))} | ||
| </div> | ||
| <div className="relative"> | ||
| {gridPositions.map((position, i) => { | ||
| const label = labels[i]; | ||
| if (label === undefined || label === null) return null; | ||
|
|
||
| return ( | ||
| <div | ||
| key={i} | ||
| className="text-label-assistive absolute text-xs whitespace-nowrap" | ||
| style={{ | ||
| left: `${position}%`, | ||
| transform: 'translateX(-50%)', | ||
| }} | ||
| > | ||
| {typeof label === 'number' | ||
| ? Math.round(label).toLocaleString() | ||
| : label} | ||
| </div> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default VerticalGrid; | ||
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
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
47 changes: 0 additions & 47 deletions
47
frontend/src/components/report-page/category/VerticalGrid.tsx
This file was deleted.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
frontend/src/components/report-page/monthly/ReportMonthly.tsx
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,17 @@ | ||
| import ReportContainer from '@/components/report-page/layout/ReportContainer'; | ||
| import ReportContent from '@/components/report-page/layout/ReportContent'; | ||
|
|
||
| const ReportMonthly = () => { | ||
| return ( | ||
| <ReportContainer title="월별 지출 비교"> | ||
| <ReportContent className="h-62 w-109 gap-7 py-8.75 pl-7"> | ||
| <h3 className="heading1-bold text-label-normal"> | ||
| 나랑 같은 국가의 교환학생보다 <br /> | ||
| <span className="text-primary-strong">234달러 덜</span> 썼어요 | ||
| </h3> | ||
| </ReportContent> | ||
| </ReportContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default ReportMonthly; |
71 changes: 71 additions & 0 deletions
71
frontend/src/components/report-page/myself/ReportLineChart.tsx
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,71 @@ | ||
| import { | ||
| buildAreaPath, | ||
| buildLinePath, | ||
| } from '@/components/report-page/myself/buildPath'; | ||
| import { type ChartItem } from '@/components/report-page/reportType'; | ||
|
|
||
| interface ReportLineChartProps { | ||
| thisMonth: ChartItem[]; | ||
| lastMonth: ChartItem[]; | ||
| thisMonthCount: number; | ||
| lastMonthCount: number; | ||
| maxValue: number; | ||
| width?: number; | ||
| height?: number; | ||
| } | ||
|
|
||
| const ReportLineChart = ({ | ||
| thisMonthCount, | ||
| lastMonthCount, | ||
| thisMonth, | ||
| lastMonth, | ||
| maxValue, | ||
| width = 348, | ||
| height = 140, | ||
| }: ReportLineChartProps) => { | ||
| const maxDay = Math.max(thisMonthCount, lastMonthCount); | ||
|
|
||
| const thisPath = buildLinePath(thisMonth, width, height, maxValue, maxDay); | ||
| const lastLinePath = buildLinePath(lastMonth, width, height, maxValue, maxDay); | ||
| const lastAreaPath = buildAreaPath( | ||
| lastMonth, | ||
| width, | ||
| height, | ||
| maxValue, | ||
| maxDay, | ||
| ); | ||
|
|
||
| const thisMonthWidth = (thisMonth.length / maxDay) * width; | ||
|
|
||
| return ( | ||
| <svg width={width} height={height}> | ||
| <defs> | ||
| <clipPath id="thisMonthClip"> | ||
| <rect x="0" y="0" width={thisMonthWidth} height={height} /> | ||
| </clipPath> | ||
| <linearGradient id="graphGradient" x1="0%" y1="0%" x2="0%" y2="100%"> | ||
| <stop offset="0%" stopColor="rgba(194, 196, 200, 0.50)" /> | ||
| <stop offset="100%" stopColor="rgba(255, 255, 255, 0.50)" /> | ||
| </linearGradient> | ||
| </defs> | ||
| <path d={lastAreaPath} fill="url(#graphGradient)" stroke="none" /> | ||
| <path | ||
| d={lastLinePath} | ||
| fill="none" | ||
| stroke="#C2C4C8" | ||
| strokeWidth={2.5} | ||
| /> | ||
| <path | ||
| d={thisPath} | ||
| fill="none" | ||
| stroke="#44A3B6" | ||
| strokeWidth={2.5} | ||
| strokeDasharray="1000" | ||
| className="animate-draw-path" | ||
| clipPath="url(#thisMonthClip)" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; | ||
|
|
||
| export default ReportLineChart; |
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.