Skip to content

feat: 7주차 미션_묵은지#51

Open
mookeunji05 wants to merge 21 commits into
mainfrom
mookeunji-7
Open

feat: 7주차 미션_묵은지#51
mookeunji05 wants to merge 21 commits into
mainfrom
mookeunji-7

Conversation

@mookeunji05
Copy link
Copy Markdown
Collaborator

@mookeunji05 mookeunji05 commented May 13, 2026

📌 PR 제목

🔗 관련 이슈

Closes #이슈번호

✨ 변경 사항

  • 기능1 추가
  • UI 수정
  • 버그 수정

🔍 테스트

  • 테스트 완료
  • 에러 없음

📸 스크린샷 (선택)

1 2

🚨 추가 이슈

@mookeunji05 mookeunji05 changed the title 7주차 미션 feat: 7주차 미션_묵은지 May 13, 2026
}
}
@Composable
fun HomeScreen() {
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.

페이지별 코틀린 파일을 분리해도 될 것 같기도요?

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.

수고하셨습니다!
CartScreen에서 onOrderClick을 람다로 받아서 Events Flow Up 패턴을 올바르게 적용한 점 좋았어요

다만 이번 미션의 핵심인 Type-safe Navigation이 아직 적용되지 않았어요!
현재는 문자열(selectedTab)로 탭을 관리하고 when으로 화면을 분기하는 방식인데,
NavController + NavHost + @serializable sealed interface 조합으로 바꿔주세요!

// 현재
var selectedTab by remember { mutableStateOf("홈") }
when (selectedTab) { "홈" -> HomeScreen() ... }

->

@Serializable sealed interface Screen {
    @Serializable data object Home : Screen
    ...
}
NavHost(navController, startDestination = Screen.Home) {
    composable<Screen.Home> { HomeScreen() }
    ...
}

그리고 현재 MainActivity.kt 하나에 MainScreen, HomeScreen, StoreScreen, CartScreen이 모두 들어가 있어요!
화면마다 파일을 분리해주세요 :)

MainActivity.kt ← MainActivity만
MainScreen.kt ← MainScreen()
ui/home/HomeScreen.kt
ui/store/StoreScreen.kt
ui/cart/CartScreen.kt

추가로 StoreScreen 내부의 selectedCategory 상태도 State Hoisting으로 끌어올리면 더 좋을 것 같아요 :)
전반적인 Compose 문법은 잘 지키고 계시니 파일 분리와 Navigation 구조만 잡아주시면 완성도가 훨씬 올라갈 거예요! 화이팅 !

Comment on lines +30 to +33
@Composable
fun MainScreen() {
var selectedTab by remember { mutableStateOf("홈") }

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.

이번 미션의 핵심인 Type-safe Navigation이 적용되지 않았어요!
현재는 문자열로 탭을 관리하고 when으로 화면을 분기하는 방식인데, NavController + NavHost 구조로 바꿔주세요! 꼭..

@serializable sealed interface Screen {
@serializable data object Home : Screen
@serializable data object Purchase : Screen
...
}

Comment on lines +37 to +38
val items = listOf("홈", "구매하기", "위시리스트", "장바구니", "프로필")
val icons = 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.

탭 목록이 문자열로 하드코딩되어 있어요!
Screen sealed interface + BottomNavItem 데이터 클래스로 타입 안전하게 관리해주세요

Comment on lines +89 to +91
fun StoreScreen() {
var selectedCategory by remember { mutableStateOf("전체") }
val categories = listOf("전체", "Tops & Shirts", "Sale")
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.

카테고리 선택 상태가 StoreScreen 내부에 고립되어 있어요.
State Hoisting 패턴을 적용해서 상태를 상위로 끌어올려보는 것도 좋을거 같습니다!

fun StoreScreen(
selectedCategory: String,
onCategorySelected: (String) -> Unit
)

Scaffold(
bottomBar = {
NavigationBar {
val items = 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.

문자열 대신 데이터 클래스를 사용하여 관리하는 게 좋을 거 같습니다 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants