Skip to content

Commit

Permalink
Merge pull request #53 from SOPT-all/48#-allcategory-fix-qa
Browse files Browse the repository at this point in the history
[FIX/#48] QA기반 오류 해결
  • Loading branch information
jangsjw authored Nov 29, 2024
2 parents 4746cf8 + 81874d1 commit deb53f9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.viewmodel.compose.viewModel
import com.sopt.shinmungo.core.designsystem.theme.ShinMunGoTheme
import com.sopt.shinmungo.presentation.allcategory.component.AllCategoryComponent
Expand All @@ -26,6 +25,7 @@ import com.sopt.shinmungo.presentation.allcategory.viewmodel.AllCategoryViewMode
@Composable
fun AllCategoryScreen(
onNavigateBack: () -> Unit,
onNavigateToReport: () -> Unit,
modifier: Modifier = Modifier,
viewModel: AllCategoryViewModel = viewModel()
) {
Expand All @@ -40,6 +40,7 @@ fun AllCategoryScreen(
modifier = modifier
) {
AllCategoryTopBar(onNavigateBack = onNavigateBack)
Spacer(modifier = Modifier.height(19.dp))
if (categories.value.isEmpty()) {
Box(
modifier = Modifier
Expand Down Expand Up @@ -69,20 +70,11 @@ fun AllCategoryScreen(
isExpanded = expandedStates.value[index],
reportableItems = reportableItems,
onClick = { viewModel.toggleCategoryExpanded(index) },
onNavigateToReport = onNavigateToReport
)
}
}
}
}
}


@Preview(showBackground = true)
@Composable
fun PreviewReportCategoryScreen() {
ShinMunGoTheme {
AllCategoryScreen(
onNavigateBack = { /* 뒤로가기 로직 */ },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ fun AllCategoryComponent(
category: AllCategoryEntity,
isExpanded: Boolean,
reportableItems: List<String>,
onClick: () -> Unit
onClick: () -> Unit,
onNavigateToReport: () -> Unit
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -80,7 +81,11 @@ fun AllCategoryComponent(
textColor = ShinMunGoTheme.color.gray1,
backgroundColor = ShinMunGoTheme.color.primary,
roundedCornerShape = RoundedCornerShape(4.dp),
onButtonClick = { /* 신고하기 로직 */ },
onButtonClick = {
if (category.title == "불법 주정차") {
onNavigateToReport()
}
},
modifier = Modifier
.padding(horizontal = 20.dp, vertical = 8.dp)
)
Expand Down Expand Up @@ -168,24 +173,28 @@ fun PreviewAllCategoryComponent() {
) {
AllCategoryComponent(
category = AllCategoryEntity(
title = "안전",
description = "가로등 점검사항, 도로/시설물 파손 및 고장 등.",
reportableItems = listOf("가로등 고장", "도로 표지판 손상", "건물 외벽 위험 요소")
title = "불법 주정차",
description = "불법 주정차 관련 신고 항목",
reportableItems = listOf("소화전", "교차로 모퉁이", "횡단보도", "버스 정류소")
),
isExpanded = false,
reportableItems = listOf("가로등 고장", "도로 표지판 손상", "건물 외벽 위험 요소"),
onClick = {}
isExpanded = true,
reportableItems = listOf("소화전", "교차로 모퉁이", "횡단보도", "버스 정류소"),
onClick = { println("불법 주정차 클릭") },
onNavigateToReport = { println("ReportScreen으로 이동") }
)
AllCategoryComponent(
category = AllCategoryEntity(
title = "생활불편",
description = "쓰레기 무단투기, 불법 광고물 등.",
reportableItems = listOf("무단 투기 쓰레기", "불법 광고물 게시", "공공장소 방치물")
title = "안전",
description = "안전 관련 신고 항목",
reportableItems = listOf("가로등 고장", "도로 표지판 손상", "건물 외벽 위험 요소")
),
isExpanded = true,
reportableItems = listOf("무단 투기 쓰레기", "불법 광고물 게시", "공공장소 방치물"),
onClick = {}
isExpanded = false,
reportableItems = listOf("가로등 고장", "도로 표지판 손상", "건물 외벽 위험 요소"),
onClick = { println("안전 카테고리 클릭") },
onNavigateToReport = { println("ReportScreen으로 이동") }
)
}
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package com.sopt.shinmungo.presentation.allcategory.component

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sopt.shinmungo.R
import com.sopt.shinmungo.core.designsystem.component.topbar.CommonTopBar
import com.sopt.shinmungo.core.designsystem.theme.ShinMunGoTheme
Expand All @@ -23,7 +21,7 @@ fun AllCategoryTopBar(
CommonTopBar(
title = stringResource(id = R.string.all_category_title),
onLeftContent = {
IconButton(onClick = onNavigateBack, modifier = Modifier.padding(start = 8.dp)) {
IconButton(onClick = onNavigateBack) {
Icon(
painter = painterResource(id = R.drawable.ic_arrow_left_line_white_24),
contentDescription = stringResource(id = R.string.back_button_description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.sopt.shinmungo.core.navigation.MainTabRoute
import com.sopt.shinmungo.presentation.allcategory.AllCategoryScreen
import com.sopt.shinmungo.presentation.report.navigation.navigateToReport
import kotlinx.serialization.Serializable

fun NavHostController.navigateToAllCategory(navOptions: NavOptions? = null) =
Expand All @@ -22,10 +23,12 @@ fun NavGraphBuilder.allCategoryScreen(
composable<AllCategory> {
AllCategoryScreen(
onNavigateBack = navController::navigateUp,
onNavigateToReport = { navController.navigateToReport() }, // ReportScreen으로 이동
modifier = modifier
)
}
}


@Serializable
data object AllCategory: MainTabRoute

0 comments on commit deb53f9

Please sign in to comment.