From 441f0d162b735d6c833f5823933624901f038d89 Mon Sep 17 00:00:00 2001 From: seoyeonsw Date: Thu, 7 Nov 2024 15:56:16 +0900 Subject: [PATCH] =?UTF-8?q?#16=20=EC=B0=A9=ED=95=9C=EB=B0=A5=EC=83=81=20&?= =?UTF-8?q?=20=EC=98=88=EB=B9=84=EC=B0=A9=ED=95=9C=20=EB=B0=A5=EC=83=81=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../babsang/screen/BabsangRecommendItem.kt | 20 ++- .../screen/BabsangRecommendViewModel.kt | 16 +- .../babsang/screen/BabsangScreen.kt | 151 ++++++++++++++++-- .../report/screen/ReportScreen.kt | 77 +++++---- app/src/main/res/values/strings.xml | 22 +++ 5 files changed, 231 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendItem.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendItem.kt index 2c880d3..b1e74a6 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendItem.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendItem.kt @@ -35,11 +35,14 @@ import androidx.navigation.compose.rememberNavController import coil.compose.AsyncImage import com.hackathon.alddeul_babsang.R import com.hackathon.alddeul_babsang.core_ui.theme.AlddeulBabsangTheme +import com.hackathon.alddeul_babsang.core_ui.theme.Blue import com.hackathon.alddeul_babsang.core_ui.theme.Gray300 import com.hackathon.alddeul_babsang.core_ui.theme.Orange700 import com.hackathon.alddeul_babsang.core_ui.theme.Orange800 import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 +import com.hackathon.alddeul_babsang.core_ui.theme.Pink import com.hackathon.alddeul_babsang.core_ui.theme.White +import com.hackathon.alddeul_babsang.core_ui.theme.Yellow import com.hackathon.alddeul_babsang.core_ui.theme.body2Regular import com.hackathon.alddeul_babsang.core_ui.theme.body4Regular import com.hackathon.alddeul_babsang.core_ui.theme.body7Semi @@ -57,11 +60,6 @@ fun BabsangRecommendItem( Column( modifier = Modifier - .border( - width = 1.dp, - color = Orange700, - shape = RoundedCornerShape(14.dp) - ) .width(170.dp) .height(192.dp) .clickable(onClick = { @@ -88,6 +86,7 @@ fun BabsangRecommendItem( .height(17.dp) .clip(RoundedCornerShape(50.dp)) .background(White), + contentAlignment = Alignment.Center ){ Text(data.address, textAlign = TextAlign.Center, style = body7Semi) @@ -151,10 +150,10 @@ fun ReplaceImage(codeName: String, imageUrl: String?) { } val backgroundColor = when (codeName) { - "경양식/일식" -> Orange700 - "한식" -> Color(0xFAB935) - "중식" -> Color(0xFAB935) - else -> Color(0xFAB935) + "경양식/일식" -> Yellow + "한식" -> Orange700 + "중식" -> Pink + else -> Blue } @@ -162,7 +161,7 @@ fun ReplaceImage(codeName: String, imageUrl: String?) { modifier = Modifier .fillMaxWidth() .fillMaxHeight() - .background(color = Orange700) // 배경색 설정 + .background(color = backgroundColor) // 배경색 설정 ) { if (imageUrl.isNullOrEmpty()) { // imageUrl이 null이나 empty일 경우 대체 이미지 표시 @@ -175,7 +174,6 @@ fun ReplaceImage(codeName: String, imageUrl: String?) { .padding(horizontal = 15.dp) .padding(bottom = 80.dp) .padding(top = 15.dp) - .background(color = backgroundColor) ) } else { // imageUrl이 null이 아니면 AsyncImage로 비동기 이미지 로드 diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendViewModel.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendViewModel.kt index a677f9f..df54691 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendViewModel.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangRecommendViewModel.kt @@ -13,7 +13,7 @@ class BabsangRecommendViewModel @Inject constructor() : ViewModel() { val mockBabsangRecommendList = listOf( BabsangRecommendEntity( id = 1, - avatar = null, + avatar = "https://avatars.githubusercontent.com/u/166610834?s=400&u=568eacc2e4696d563a4fd732c148edba2196e4f6&v=4", name = "송이네 밥상", codeName = "경양식/일식", address = "용산구", @@ -32,6 +32,20 @@ class BabsangRecommendViewModel @Inject constructor() : ViewModel() { codeName = "한식", address = "양천구", ), + BabsangRecommendEntity( + id = 3, + avatar = null, + name = "송이네 한식", + codeName = "중식", + address = "양천구", + ), + BabsangRecommendEntity( + id = 1, + avatar = null, + name = "송이네 밥상", + codeName = "경양식/일식", + address = "용산구", + ), ) diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangScreen.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangScreen.kt index 97ebf3b..e647d92 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangScreen.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/babsang/screen/BabsangScreen.kt @@ -1,38 +1,169 @@ package com.hackathon.alddeul_babsang.presentation.babsang.screen +import androidx.compose.foundation.background +import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.CenterAlignedTopAppBar +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Scaffold import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.navigation.compose.rememberNavController +import com.google.accompanist.systemuicontroller.rememberSystemUiController +import com.hackathon.alddeul_babsang.R import com.hackathon.alddeul_babsang.core_ui.theme.AlddeulBabsangTheme +import com.hackathon.alddeul_babsang.core_ui.theme.Gray900 +import com.hackathon.alddeul_babsang.core_ui.theme.Orange800 +import com.hackathon.alddeul_babsang.core_ui.theme.Orange900 +import com.hackathon.alddeul_babsang.core_ui.theme.White +import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold +import com.hackathon.alddeul_babsang.core_ui.theme.head6Bold +import com.hackathon.alddeul_babsang.core_ui.theme.head6Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head7Bold import com.hackathon.alddeul_babsang.presentation.babsang.navigation.BabsangNavigator +import com.hackathon.alddeul_babsang.presentation.profile.screen.BabsangListViewModel @Composable fun BabsangRoute( navigator: BabsangNavigator ) { - BabsangScreen() + val babsangListViewModel: BabsangListViewModel = hiltViewModel() + val babsangRecommendViewModel: BabsangRecommendViewModel = hiltViewModel() + val systemUiController = rememberSystemUiController() + + SideEffect { + systemUiController.setStatusBarColor( + color = White + ) + } + + BabsangScreen( + navigator = navigator, // navController 대신 navigator 전달 + babsangListViewModel = babsangListViewModel, + babsangRecommendViewModel = babsangRecommendViewModel + ) } +@OptIn(ExperimentalMaterial3Api::class) @Composable -fun BabsangScreen() { - Column( - modifier = Modifier.fillMaxSize(), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally - ) { - Text(text = "착한 밥상") - } +fun BabsangScreen( + navigator: BabsangNavigator, + babsangListViewModel: BabsangListViewModel, + babsangRecommendViewModel: BabsangRecommendViewModel +) { + val scrollState = rememberScrollState() + val rowScrollState = rememberScrollState() + Scaffold( + topBar = { + CenterAlignedTopAppBar( + modifier = Modifier.background(White), + title = { + Text( + text = stringResource(R.string.tv_babsang_title), + style = head4Bold, + color = Gray900 + ) + }, + colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + containerColor = White + ) + ) + } + ) { innerPadding -> + Column( + modifier = Modifier + .padding(innerPadding) + .fillMaxSize() + .background(color = White) + .padding(horizontal = 20.dp, vertical = 25.dp) + .verticalScroll(scrollState), + + ) { + Text( + text = buildAnnotatedString { + withStyle(style = SpanStyle(color = Orange800)) { + append("알뜰 밥상") + } + append("이 ") + withStyle(style = SpanStyle(color = Orange800)) { + append("추천") + } + append("하는 밥상") + }, + style = head6Semi + ) + + Spacer(modifier = Modifier.height(10.dp)) + Row( + horizontalArrangement = Arrangement.spacedBy(16.dp), + modifier = Modifier + .horizontalScroll(rowScrollState) + ) { + for (item in babsangRecommendViewModel.mockBabsangRecommendList) { + BabsangRecommendItem( + navigator = navigator, + data = item + ) + } + } + + + Spacer(modifier = Modifier.height(30.dp)) + + Text("착한 밥상 리스트", style = head6Semi) + + Spacer(modifier = Modifier.height(15.dp)) + + Column( + verticalArrangement = Arrangement.spacedBy(16.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + for (item in babsangListViewModel.mockLikeList) { + BabsangListItem( + navigator = navigator, + data = item + ) + } + } + }} + + + + } @Preview(showBackground = true) @Composable fun BabsangScreenPreview() { + val babsangListViewModel: BabsangListViewModel = hiltViewModel() + val babsangRecommendViewModel: BabsangRecommendViewModel = hiltViewModel() + val navController = rememberNavController() + val navigator = BabsangNavigator(navController) + AlddeulBabsangTheme { - BabsangScreen() + BabsangScreen( + navigator = navigator, + babsangListViewModel = babsangListViewModel, + babsangRecommendViewModel = babsangRecommendViewModel + ) } } diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/report/screen/ReportScreen.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/report/screen/ReportScreen.kt index c3eb4fa..dfd69fe 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/report/screen/ReportScreen.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/report/screen/ReportScreen.kt @@ -2,15 +2,18 @@ package com.hackathon.alddeul_babsang.presentation.report.screen import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect @@ -66,44 +69,52 @@ fun ReportScreen( val scrollState = rememberScrollState() - Column( - modifier = Modifier - .fillMaxSize() - .background(color = White) - .padding(horizontal = 20.dp, vertical = 25.dp) - .verticalScroll(scrollState), - - ) { - Text("직접 제보받은", style = head7Bold, color = Gray900) - Text("착한 밥상 후보 리스트", style = head6Bold, color = Orange900) - Spacer(modifier = Modifier.height(10.dp)) - Text("제보와 후기로 쌓아 보아요", style = head7Bold, color = Gray900) - - Spacer(modifier = Modifier.height(30.dp)) - + Box{ Column( - verticalArrangement = Arrangement.spacedBy(16.dp), - horizontalAlignment = Alignment.CenterHorizontally - ) { - for (item in babsangListViewModel.mockLikeList) { - BabsangItem( - navigator = navigator, - data = item - ) + modifier = Modifier + .fillMaxSize() + .background(color = White) + .padding(horizontal = 20.dp, vertical = 25.dp) + .verticalScroll(scrollState), + + ) { + Text("직접 제보받은", style = head7Bold, color = Gray900) + Text("착한 밥상 후보 리스트", style = head6Bold, color = Orange900) + Spacer(modifier = Modifier.height(10.dp)) + Text("제보와 후기로 쌓아 보아요", style = head7Bold, color = Gray900) + + Spacer(modifier = Modifier.height(30.dp)) + + Column( + verticalArrangement = Arrangement.spacedBy(16.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + for (item in babsangListViewModel.mockLikeList) { + BabsangItem( + navigator = navigator, + data = item + ) + } } - } - - - - - - - - Button(onClick = { onReportWriteClick() }) { - Text(text = "제보하러 가기") } + Button( + onClick = { onReportWriteClick() }, + modifier = Modifier + .width(170.dp) + .height(70.dp) + .offset(y = -20.dp, x=-10.dp) + .align(Alignment.BottomEnd), + colors = ButtonDefaults.buttonColors( + containerColor = Blue, // 버튼 배경색 + contentColor = White // 버튼 텍스트 색상 + ) + ) { + Text(text = "제보하러 가기", style= head7Bold) // 텍스트 색상은 흰색으로 설정 + } + } + } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d18f31..7ca54e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,4 +69,26 @@ %1$s/10자 닉네임은 10자 이하로 입력해주세요. + + 좋아요 목록 + 회원 탈퇴 하시겠습니까? + 회원 탈퇴 시 회원 정보가 초기화 됩니다 + 취소 + 회원 탈퇴 + 로그아웃 시 로그인 화면으로 이동합니다 + 로그아웃 하시겠습니까? + 좋아요 목록 + 닉네임 + 이용안내 + 서비스 이용약관 + 개인정보 처리방침 + 버전 정보 + 기타 + 고객센터 + 로그아웃 + 회원 탈퇴 + + + 착한 밥상 + \ No newline at end of file