Skip to content

feat: 7주차 미션_레몬#50

Open
Lemon0610 wants to merge 6 commits into
mainfrom
lemon-7
Open

feat: 7주차 미션_레몬#50
Lemon0610 wants to merge 6 commits into
mainfrom
lemon-7

Conversation

@Lemon0610
Copy link
Copy Markdown
Collaborator

@Lemon0610 Lemon0610 commented May 12, 2026

📌 PR 제목

🔗 관련 이슈

Closes #49

✨ 변경 사항

  • Compose Migration
  • 기본 UI 구축
  • Navigation 연동

🔍 테스트

  • 테스트 완료
  • 에러 없음

📸 스크린샷 (선택)

구매하기 장바구니
화면 캡처 2026-05-13 042205 화면 캡처 2026-05-13 042222 화면 캡처 2026-05-13 042252

🚨 추가 이슈

@Lemon0610 Lemon0610 self-assigned this May 12, 2026
@@ -0,0 +1,120 @@
package com.example.week7
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 xml을 다 지우지 못하고 코드를 짰는데, 다시 compose이용해서 다시 짜볼게요

Comment on lines +15 to +22
@Composable
fun BuyScreen() {
var selectedTabIndex by remember { mutableIntStateOf(0) }
val tabs = listOf(
stringResource(R.string.all),
stringResource(R.string.Shirts),
stringResource(R.string.Shoes)
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose...ㅎㅎ 전 너무 어려운거 같아요 대단해요

Copy link
Copy Markdown
Collaborator

@jeongkyueun jeongkyueun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컴포즈 마이그레이션 잘 하시고 미션 잘 수행하신 거 같아요!! 고생 많으셨습니다~!!

Copy link
Copy Markdown
Collaborator

@kimdoyeon1234 kimdoyeon1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!
BuyGraph를 Nested Navigation으로 구성하고 hierarchy로 선택 상태를 처리한 부분 너무 좋았습니다!! Type-safe Navigation도 올바르게 적용하셨고요

한 가지 꼭 짚고 싶은 부분은 ShoppingCartScreen이 NavController를 직접 파라미터로 받고 있는 점입니다!
Compose에서 Navigation의 핵심 원칙은 "Data Flows Down, Events Flow Up"이에요!
값(데이터)은 파라미터로 내려오고, 화면 전환 같은 이벤트는 람다로 올라가야 해요!

// 현재
fun ShoppingCartScreen(navController: NavController)
->
fun ShoppingCartScreen(onNavigateToBuy: () -> Unit)

NavController는 NavHost가 있는 최상위 레벨에서만 다루고, 하위 Composable은 람다만 받도록 수정해주세요!
추가로 MainView()를 별도 파일로 분리하면 MainActivity가 진입점 역할만 하게 되어 구조가 더 깔끔해질 거예요 :)

Comment on lines +22 to +23
fun ShoppingCartScreen(navController: NavController) {
Box(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavController를 Composable에 직접 주입하고 있어요!
Composable은 이벤트를 람다로 올려보내는 게 올바른 패턴이에요

// 현재
fun ShoppingCartScreen(navController: NavController)

// 바꾸면 좋을 코드!
fun ShoppingCartScreen(onNavigateToBuy: () -> Unit)

NavController는 NavHost가 있는 상위 레벨에서만 다루고, 하위 Composable은 람다만 받도록 수정하면은 좋을거 같습니다!

Comment on lines +17 to +18
var selectedTabIndex by remember { mutableIntStateOf(0) }
val tabs = listOf(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedTabIndex 상태가 BuyScreen 내부에 고립되어 있어요
지금 구조에서는 큰 문제가 없어 보이지만, 탭 상태를 외부에서 제어하거나 저장해야 할 때 한계가 생겨요!
State Hoisting 패턴을 연습 삼아 적용해보면 좋을 것 같습니다!

fun BuyScreen(
    selectedTabIndex: Int,
    onTabSelected: (Int) -> Unit
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavController 생성과 NavHost 구성, BottomBar까지 모두 MainActivity에 몰려있어요! MainScreen.kt(또는 MainView.kt)를 별도 파일로 분리하면 MainActivity는 진입점 역할만 하게 되어 훨씬 깔끔해져요 :)

@Lemon0610 Lemon0610 added the enhancement New feature or request label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 7주차 미션_레몬

5 participants