Skip to content

[1단계 - 장바구니] 클레어(안은소) 미션 제출합니다. #364

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 57 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5484192
chore: 의존성 제거
woowa-euijinkk May 27, 2025
fcdc511
docs: PR template
woowa-euijinkk May 29, 2025
9c5d27a
docs: README.md에 기능 요구 사항 작성
eunsoA May 27, 2025
6f79598
docs: README.md에 컴포넌트 분리 이미지 추가
eunsoA May 27, 2025
08e1787
chore: package 에서 안쓰는 의존성 정리
eunsoA May 27, 2025
3ab362c
style: reset.css 설정
eunsoA May 27, 2025
38e8120
chore: 절대 경로 설정
eunsoA May 27, 2025
4993921
feat: 아이콘 파일 추가
eunsoA May 27, 2025
9f0cbff
chore: components 경로 수정
eunsoA May 27, 2025
e4e4aa4
feat: MobileLayout 추가
eunsoA May 27, 2025
3f5a046
feat: Header 컴포넌트 추가
eunsoA May 27, 2025
f639d9f
style: Header 시맨틱 태그 수정
eunsoA May 27, 2025
28cff9f
feat: EmptyCartContainer 컴포넌트 추가
eunsoA May 27, 2025
3eb7d93
fix: 사용하지 않는 아이콘 삭제
eunsoA May 27, 2025
9c8256d
feat: CartItemQuantityButton 컴포넌트 추가
eunsoA May 27, 2025
d92c7bd
feat: CheckBox 컴포넌트 추가
eunsoA May 27, 2025
6e8415a
feat: default-item 아이콘 추가
eunsoA May 27, 2025
4ad0ca4
feat: CartItem 컴포넌트 추가
eunsoA May 27, 2025
2d74ea1
feat: HTTPClient 및 장바구니 관련 API 추가
eunsoA May 28, 2025
3bc245e
feat: useFetchData 및 useMutation 훅 추가
eunsoA May 28, 2025
973192d
feat: CartPage 및 관련 컴포넌트 추가
eunsoA May 28, 2025
50b6068
docs: 요구사항 진행도 체크
eunsoA May 28, 2025
7cc3ef1
refactor: interface에서 type으로 타입 정의 수정
eunsoA May 28, 2025
d8c7cfd
feat: 장바구니 아이템 수량 업데이트 및 제거 기능 추가
eunsoA May 28, 2025
ee4eb57
feat: 장바구니 체크박스 스타일 수정
eunsoA May 28, 2025
aad1127
feat: 장바구니 전체 선택 기능 추가
eunsoA May 28, 2025
6476bda
feat: CartPage에서 CartContent 컴포넌트 분리
eunsoA May 28, 2025
6ab781d
feat: CartItem 체크 버튼 기능 구현
eunsoA May 28, 2025
3a1b79f
feat: info 아이콘 파일 추가
eunsoA May 28, 2025
3c90284
feat: PriceContainer 컴포넌트 추가
eunsoA May 28, 2025
1ef08cc
feat: CartContainer에 PriceContainer 추가 및 스크롤 스타일 수정
eunsoA May 28, 2025
c019a82
feat: 장바구니 아이템 관리 훅(useCartItem) 추가
eunsoA May 29, 2025
116421d
refactor: 폴더 구조 변경
eunsoA May 29, 2025
7461a99
chore: package에 react-router-dom 의존성 추가
eunsoA May 29, 2025
9035fce
feat: BackButton 컴포넌트 추가
eunsoA May 29, 2025
38d5ca1
feat: OrderSuccessPage 추가
eunsoA May 29, 2025
fa247f1
feat: routes 경로 설정
eunsoA May 29, 2025
4d2a3a3
style: Header 스타일 수정 (padding 수정)
eunsoA May 29, 2025
b1713f2
feat: 리액트 라우터 설정
eunsoA May 29, 2025
b4198f3
feat: OrderSuccessPage로 이동시 location.state 설정 추가
eunsoA May 29, 2025
5b22328
chore: 사용하지 않는 jest관련 의존성 삭제 및 vitest 추가
eunsoA May 29, 2025
2929d08
test: CartContent 테스트 추가
eunsoA May 29, 2025
d86d2c8
test: PriceContainer 테스트 추가
eunsoA May 29, 2025
6cc7566
test: OrderSuccessPage 테스트 추가
eunsoA May 29, 2025
f08475f
fix: orderPrice update 로직 수정
eunsoA May 29, 2025
c0b51b0
docs: 기능 요구 사항, 폴더 구조, 컴포넌트 분리 추가
eunsoA May 29, 2025
b6b4dc8
refactor: type으로 통일되어있던 타입 정의를 일부 interface로 변경
eunsoA Jun 3, 2025
88dfaee
refactor: 주문할 장바구니 상품 목록의 id를 orderIdList로 수정
eunsoA Jun 3, 2025
d08a760
refactor: 주문 상품 결제 금액 계산 로직 분리
eunsoA Jun 3, 2025
c814464
fix: 로딩상태로 화면 깜빡임 문제 해결 (조건부 로딩 화면 처리)
eunsoA Jun 3, 2025
25f6336
feat: 로딩 화면을 위한 LoadingContainer 컴포넌트 및 스타일 추가
eunsoA Jun 3, 2025
9da7e57
feat: 에러 메시지를 표시하는 ErrorContainer 컴포넌트 및 스타일 추가
eunsoA Jun 3, 2025
c15f537
feat: CartContent 컴포넌트에서 로딩 및 에러 상태를 LoadingContainer와 ErrorContainer…
eunsoA Jun 3, 2025
1430c1c
style: CartPage에서 스크롤 범위 변경
eunsoA Jun 3, 2025
2b04ab1
refactor: 관심사 분리를 위한 cart 상태 관리 구조 개선
eunsoA Jun 4, 2025
59fb48a
feat: 장바구니 아이템 수정에 낙관적 업데이트 적용
eunsoA Jun 4, 2025
b273ff0
feat: 페이지 내비게이션 로직을 usePageNavigation 훅으로 분리 및 개선
eunsoA Jun 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## 📦 장바구니 미션

이번 미션을 통해 다음과 같은 학습 경험들을 쌓는 것을 목표로 합니다.

### 1단계

- 클라이언트 상태를 효과적으로 모델링하고 관리할 수 있다.
- Jest, React Testing Library(RTL)를 활용하여 주요 기능에 대한 테스트를 작성할 수 있다.

## 🕵️ 셀프 리뷰(Self-Review)

### 제출 전 체크 리스트

- [ ] 기능 요구 사항을 모두 구현했고, 정상적으로 동작하는지 확인했나요?
- [ ] RTL 테스트 케이스를 모두 작성했나요?
- [ ] 배포한 데모 페이지에 정상적으로 접근할 수 있나요?

- 배포 링크 기입: **\_\_**

- [ ] 리뷰어가 장바구니 추가를 쉽게 할 수 있도록 Curl 명령어를 전달해주세요. (토큰을 채워주세요)

```
curl -X 'POST' \
'http://techcourse-lv2-alb-974870821.ap-northeast-2.elb.amazonaws.com/cart-items' \
-H 'accept: */*' \
-H 'Authorization: Basic <토큰>' \
-H 'Content-Type: application/json' \
-d '{
"productId": 1,
"quantity": 1
}'
```

### 리뷰 요청 & 논의하고 싶은 내용

### 1) 상태 설계 의도

### 2) 이번 단계에서 가장 많이 고민했던 문제와 해결 과정에서 배운 점

### 3) 이번 리뷰를 통해 논의하고 싶은 부분

---

## ✅ 리뷰어 체크 포인트

<!-- 리뷰어가 이 PR을 검토할 때 중점적으로 확인할 사항입니다.
코드의 완성도뿐만 아니라, 리뷰이가 구현 과정에서 어떤 고민과 결정을 하며 학습했는지도 함께 고려해 주세요. -->

### 1. 클라이언트 상태관리

- 원본상태/파생상태를 적절히 구분하여 선언하였나요?
- React state 를 불필요하게 선언한 부분은 없나요?
- 상태 관리 로직의 책임이 적절히 응집/분리되었나요? (ex. reducer, hook, Context)

### 2. MSW/Test

- 주요 기능을 적절히 정의하였나요?
- 주요 기능/예외에 대한 테스트가 충분히 이루어졌나요?
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
# react-shopping-cart

## 🔽 기능 요구 사항

- [x] /cart-items API를 호출하여 장바구니 상품 데이터를 불러온다.
- [x] 불러온 데이터를 기반으로 클라이언트 상태를 구성하고 관리한다.
- [x] 개별 상품의 선택 여부, 결제 금액, 배송비 등의 상태를 관리한다.
- [x] 상품 선택에 따른 결제 금액, 배송비 등의 동적인 변경 사항을 처리한다.
- [x] 진입 시, 전체 선택 되어 있는 것이 디폴트이다.
- [x] 상품 선택/해제 시 결제 금액을 동적으로 변경한다.
- [x] 결제 금액이 10만원 이상일 경우 배송비는 무료이다.
- [x] 장바구니 상품의 수량을 변경할 수 있다.
- [x] 장바구니에 담긴 상품을 제거할 수 있다.

## 🔽 컴포넌트 분리
### CartPage

![image](https://github.com/user-attachments/assets/a025ef21-ee4b-4155-a22e-5b50e4784348)

### OrderSuccessPage
![image](https://github.com/user-attachments/assets/63fd77da-38fc-4eaf-b283-941ab69f2e1d)

## 🔽 폴더 구조

```
react-shopping-cart
├─ src
│ ├─ apis 👈 api
│ │ ├─ cartItems
│ │ │ ├─ cartItem.type.ts
│ │ │ ├─ deleteCartItem.ts
│ │ │ ├─ getCartItems.ts
│ │ │ └─ updateCartItemQuantity.ts
│ │ └─ httpClient.ts
│ ├─ pages 👈 페이지별
│ │ ├─ cart
│ │ │ ├─ CartContent
│ │ │ │ ├─ CartList
│ │ │ │ │ ├─ CartItem
│ │ │ │ │ │ └─ Button
│ │ │ │ │ │ ├─ Quantity
│ │ │ │ │ │ └─ Remove
│ │ │ │ ├─ EmptyCartContainer
│ │ │ │ └─ PriceContainer
│ │ │ └─ hooks
│ │ │ └─ useCartItem.ts
│ │ └─ order
│ ├─ shared 👈 프로젝트 공용 로직
│ │ ├─ components
│ │ │ ├─ BackButton
│ │ │ ├─ CheckBox
│ │ │ ├─ Header
│ │ │ └─ MobileLayout
│ │ ├─ config
│ │ │ └─ routes.ts
│ │ └─ hooks
│ │ ├─ useFetchData.ts
│ │ └─ useMutation.ts
```

11 changes: 0 additions & 11 deletions jest.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion jest.setup.ts

This file was deleted.

Loading