-
Notifications
You must be signed in to change notification settings - Fork 0
[FE] 대시보드 카드 편집 API 연동 및 에러 fallback 처리 #304
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
61 commits
Select commit
Hold shift + click to select a range
5b56183
feat: EditCardContext에 대시보드 카드 드래그앤드랍 상태 관리 추가
lwjmcn f709a51
chore: import 경로 단축
lwjmcn 8f126d8
feat: EditCardContext에 픽셀 좌표 계산을 위한 gridRef 추가
lwjmcn bf00cc2
refactor: 카드 상태 2차원 그리드 대신 카드 배열 기준으로 리팩터링
lwjmcn fa99942
feat: 그리드 셀 크기 계산을 위한 useGridCellSize 추가
lwjmcn 3e281f5
feat: MiniViewActiveCard의 props 수정 (posX, posY -> colNo, rowNo)
lwjmcn ae9de0d
feat: 카드편집 뷰 카드 클릭 시 추가 이벤트 동작 및 클릭 이벤트 전파 방지
lwjmcn 6b3a8d2
fix: parameter row,col 순서 변경 버그
lwjmcn d2103e0
feat: 드래그 앤 드롭 카드 기능 추가 및 카드 밀어내기 재귀 알고리즘 구현
lwjmcn fc3937f
feat: 카드 편집 및 미니 뷰에 드래그 앤 드롭 핸들러 연결 및 ghost 컴포넌트 추가
lwjmcn 966d071
fix: 이미지 드래그 막기
lwjmcn e862450
fix: 이미 추가된 카드 드래그 시도 시 텍스트가 선택되는 문제
lwjmcn c17a05f
feat: dragOver 이벤트 핸들러에 스로틀링 추가
lwjmcn 8077dfb
chore: 메트릭 이름 오타 수정
lwjmcn ca7e601
style: 메트릭 이름 줄바꿈 스타일링
lwjmcn bb21461
style: 드래그앤드랍 고스트 스타일링
lwjmcn 57ae2c6
feat: 대시보드 목록 및 카드 레이아웃 조회 API 및 타입 정의 추가
lwjmcn 28ec3f3
feat: 대시보드 목록 및 카드 조회를 위한 query option 정의
lwjmcn b9bff7a
feat: 대시보드 이름 수정 요청 API 및 타입 정의 추가
lwjmcn 2042839
feat: 대시보드 삭제 API 및 타입 정의 추가
lwjmcn 5048799
feat: 대시보드 탭 추가 API 및 타입 정의 추가
lwjmcn cf01d26
feat: 대시보드 카드 레이아웃 업데이트 API 및 타입 정의 추가
lwjmcn 97548f8
chore: dto, query 타입 배럴 파일 추가
lwjmcn 75fda4c
refactor: 대시보드 타입 dto에서 일반 타입으로 분리
lwjmcn 897835e
feat: 대시보드 API 배럴 파일 추가 및 함수명 변경
lwjmcn 09bbc71
feat: 대시보드 query option명 변경
lwjmcn 1c160e8
feat: 대시보드 context에서 서버 상태 삭제 및 대시보드 목록 query 패치
lwjmcn c04c223
feat: 대시보드 탭 및 카드 목록 조회 API 연동
lwjmcn 994befe
feat: 대시보드 페이지에 FetchBoundary 추가
lwjmcn 93c29f0
fix: import 경로 단축
lwjmcn 918f7aa
style: fallback이 전체 화면의 중앙에 뜨도록 스타일 변경
lwjmcn c15a7bd
feat: 대시보드 탭 추가/삭제/편집 mutation 기능 추가
lwjmcn f89ac3f
feat: shadcn skeleton 컴포넌트 추가
lwjmcn bd00d83
feat: 대시보드 메인 카드 레이아웃 suspense 추가
lwjmcn 3b53f05
feat: 기본 대시보드 isDefault 값으로 초기화
lwjmcn d66369d
style: 불필요한 스타일 삭제
lwjmcn c2faa0a
chore: 불필요한 undefined 처리 삭제
lwjmcn 59036be
fix: Promise.all에 undefined가 아닌 resolve 전달
lwjmcn d9b7fc1
fix: options에 잘못된 key 사용
lwjmcn 2f90800
refactor: Array -> []로 코드 스타일 통일
lwjmcn b757428
chore: import 경로 단축
lwjmcn 3b89bc4
Merge branch 'feature/#54-fe-dashboard-edit-draggable' of https://git…
lwjmcn 83d3d79
feat: error fallback에서 에러 메시지 띄우기
lwjmcn 4b6a1e8
feat: 대시보드 카드 목록 조회 및 url 오류 방어 로직 추가
lwjmcn df30d59
chore: key에서 불필요한 params 삭제
lwjmcn b4bf1c0
feat: URL에 따른 현재 대시보드 id 컨텍스트에 추가
lwjmcn 8facd4d
feat: 카드 목록 저장 기능 뮤테이션으로 구현
lwjmcn 4e8a8fd
feat: 홈 대시보드에서 카드 편집 비활성화
lwjmcn 94cd315
feat: error fallback 공통 컴포넌트로 분리
lwjmcn 8cdbf4f
feat: 잘못된 대시보드 접근 시 나가기 버튼 노출
lwjmcn 6355759
feat: local storage에 현재 대시보드 id 저장
lwjmcn 17a96ae
feat: 현재 대시보드 정보 local storage에 저장 기능 및 storage 키 상수로 분리
lwjmcn a40d86d
Merge branch 'develop' into feature/#50-dashboard-edit-api
lwjmcn 52c2938
style: 미니 뷰 크기 변경 및 empty 뷰 outline으로 숨김
lwjmcn 676bbfb
Merge branch 'develop' into feature/#50-dashboard-edit-api
lwjmcn 2e2bab2
fix: merge conflict 해결
lwjmcn d707552
fix: local storage 에러 시 error boundary 대신 콘솔 로그로민 표시
lwjmcn 40d7027
fix: onClick 비활성화 시 onClick 핸들러 undefined 처리
lwjmcn d9b2416
refactor: tabs를 매번 find 하는 대신 currentDashboard 객체를 정의
lwjmcn 50ecdaa
refactor: 매직 넘버 교체
lwjmcn 9535789
refactor: 불필요한 useErrrorBoundary 제거
lwjmcn 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
32 changes: 29 additions & 3 deletions
32
frontend/src/components/dashboard/dashboard-edit/CardEditView.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
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
21 changes: 16 additions & 5 deletions
21
frontend/src/components/dashboard/dashboard-edit/DashboardEditLayout.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 |
|---|---|---|
| @@ -1,14 +1,25 @@ | ||
| import { ErrorBoundary } from 'react-error-boundary'; | ||
|
|
||
| import { FetchBoundary } from '@/components/shared'; | ||
|
|
||
| import { CardEditView } from './CardEditView'; | ||
| import { EditCardProvider } from './EditCardProvider'; | ||
| import { EditErrorFallback } from './EditErrorFallback'; | ||
| import { MiniView } from './MiniView'; | ||
|
|
||
| export const DashboardEditLayout = () => { | ||
| return ( | ||
| <div className="flex size-full"> | ||
| <EditCardProvider> | ||
| <MiniView /> | ||
| <CardEditView /> | ||
| </EditCardProvider> | ||
| <div className="flex size-full overflow-y-hidden"> | ||
| <FetchBoundary> | ||
| <ErrorBoundary | ||
| fallbackRender={(props) => <EditErrorFallback {...props} />} | ||
| > | ||
| <EditCardProvider> | ||
| <MiniView /> | ||
| <CardEditView /> | ||
| </EditCardProvider> | ||
| </ErrorBoundary> | ||
| </FetchBoundary> | ||
| </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
16 changes: 16 additions & 0 deletions
16
frontend/src/components/dashboard/dashboard-edit/EditErrorFallback.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,16 @@ | ||
| import type { FallbackProps } from 'react-error-boundary'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
|
|
||
| import { ErrorFallback } from '@/components/shared'; | ||
|
|
||
| export const EditErrorFallback = (props: FallbackProps) => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| return ( | ||
| <ErrorFallback | ||
| buttonText="나가기" | ||
| onClickButton={() => navigate(-1)} | ||
| {...props} | ||
| /> | ||
| ); | ||
| }; |
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
3 changes: 2 additions & 1 deletion
3
frontend/src/components/dashboard/dashboard-main/DashboardMainSuspense.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
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
39 changes: 39 additions & 0 deletions
39
frontend/src/components/shared/error-fallback/ErrorFallback.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,39 @@ | ||
| import { type FallbackProps } from 'react-error-boundary'; | ||
|
|
||
| import { Button } from '@/components/shared/shadcn-ui'; | ||
|
|
||
| interface ErrorFallbackProps extends FallbackProps { | ||
| errorMessage?: string; | ||
| buttonText?: string; | ||
| onClickButton?: () => void; | ||
| } | ||
| export const ErrorFallback = ({ | ||
| error, | ||
| errorMessage, | ||
| buttonText = '다시 시도', | ||
| onClickButton, | ||
| resetErrorBoundary, | ||
| }: ErrorFallbackProps) => { | ||
|
Collaborator
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. p5] 기존 코드에서 에러 메시지랑, 버튼 클릭 헨들러를 props로 추가로 받으셨네요! 범용성이 더 좋아진 것 같습니다 굳굳굳! |
||
| const handleClick = () => { | ||
| resetErrorBoundary(); // 에러 바운더리의 에러상태 초기화 -> 이걸 해야 에러 바운더리가 다시 자식 컴포넌트를 렌더링 시도함 | ||
| onClickButton?.(); | ||
| }; | ||
|
|
||
| const message = | ||
| error instanceof Error ? error.message : '오류가 발생했습니다.'; | ||
|
|
||
lwjmcn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return ( | ||
| <div className="flex h-full w-full flex-col items-center justify-center gap-3"> | ||
| <p className="body-medium-medium text-center"> | ||
| {errorMessage ?? message} | ||
| </p> | ||
|
|
||
| <Button | ||
| className="rounded-200 body-medium-medium bg-brand-main text-grey-50 px-4 py-3" | ||
| onClick={handleClick} | ||
| > | ||
| {buttonText} | ||
| </Button> | ||
| </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 @@ | ||
| export { ErrorFallback } from './ErrorFallback'; |
25 changes: 0 additions & 25 deletions
25
frontend/src/components/shared/fetch-boundary/ErrorFallback.tsx
This file was deleted.
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.