diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/domain/entity/BabsangListEntity.kt b/app/src/main/java/com/hackathon/alddeul_babsang/domain/entity/BabsangListEntity.kt new file mode 100644 index 0000000..8a09967 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/domain/entity/BabsangListEntity.kt @@ -0,0 +1,11 @@ +package com.hackathon.alddeul_babsang.domain.entity + +data class BabsangListEntity( + val id: Long, + val avatar: String? = null, + val name: String, + val codeName: String, + val address: String, + val phone: String, + val favorite: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavGraph.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavGraph.kt index 8d1efdb..f6b6ee9 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavGraph.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavGraph.kt @@ -2,12 +2,17 @@ package com.hackathon.alddeul_babsang.presentation.profile.navigation import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable +import com.hackathon.alddeul_babsang.presentation.profile.screen.ProfileLikeListRoute import com.hackathon.alddeul_babsang.presentation.profile.screen.ProfileRoute + fun NavGraphBuilder.profileNavGraph( navigator: ProfileNavigator ) { composable(route = "profile") { ProfileRoute(navigator = navigator) } + composable(route = "profileLikeList") { + ProfileLikeListRoute(navigator = navigator) + } } \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavigator.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavigator.kt index 856376d..04ea985 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavigator.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/navigation/ProfileNavigator.kt @@ -5,4 +5,21 @@ import androidx.navigation.NavController class ProfileNavigator( val navController: NavController ) { + + fun navigateDetail(id: Long) { + navController.navigate("detail?id=$id") + } + + fun navigateBack() { + navController.popBackStack() + } + + fun navigateLogin() { + navController.navigate("login") { + popUpTo("profile") { inclusive = true } + launchSingleTop = true + } + + } + } \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListItem.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListItem.kt new file mode 100644 index 0000000..b63e9f2 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListItem.kt @@ -0,0 +1,201 @@ +package com.hackathon.alddeul_babsang.presentation.profile.screen + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +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.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.body2Regular +import com.hackathon.alddeul_babsang.core_ui.theme.body4Regular +import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold +import com.hackathon.alddeul_babsang.domain.entity.BabsangListEntity +import com.hackathon.alddeul_babsang.presentation.profile.navigation.ProfileNavigator + +@Composable +fun LikeItem( + navigator: ProfileNavigator, + data: BabsangListEntity +) { + + var isFavorite by remember { mutableStateOf(data.favorite ?: false) } + + // 클릭할 때마다 favorite 값 토글 + val heartIconId = if (isFavorite) { + R.drawable.ic_heart_red + } else { + R.drawable.ic_heart_white + } + + + Column( + modifier = Modifier + .fillMaxWidth() + .border( + width = 1.dp, + color = Orange700, + shape = RoundedCornerShape(14.dp) + ) + .height(240.dp) + .clickable(onClick = { + navigator.navigateDetail(data.id) + }) + ) { + Box( + modifier = Modifier + .fillMaxWidth() + .height(140.dp) + .clip(RoundedCornerShape(topStart = 14.dp, topEnd = 14.dp)) + ) { + // AsyncImage 로드 + LoadImageWithPlaceholder(data.codeName, data.avatar) + + Image( + painter = painterResource(heartIconId), + contentDescription = null, + modifier = Modifier + .padding(end = 10.dp, top = 10.dp) + .align(Alignment.TopEnd) // Box 내에서 오른쪽 끝으로 배치 + .clickable { + // 클릭 시 좋아요 상태를 토글 + isFavorite = !isFavorite + } + ) + } + + Spacer(modifier = Modifier.height(15.dp)) + + Row { + Text( + text = data.name, + style = head4Bold, + color = Orange900, + modifier = Modifier.padding(start = 20.dp) + ) + + Spacer(modifier = Modifier.width(15.dp)) + + Text( + text = data.codeName, + style = body2Regular, + color = Orange800, + modifier = Modifier + .align(Alignment.Bottom) + .padding(bottom = 3.dp) + ) + } + + Spacer(modifier = Modifier.height(12.dp)) + + Text( + text = data.address, + style = body4Regular, + color = Gray300, + modifier = Modifier.padding(start = 20.dp) + ) + + Spacer(modifier = Modifier.height(7.dp)) + + Text( + text = data.phone, + style = body4Regular, + color = Gray300, + modifier = Modifier.padding(start = 20.dp) + ) + } +} + +@Composable +fun LoadImageWithPlaceholder(codeName: String, imageUrl: String?) { + val imageId = when (codeName) { + "경양식/일식" -> R.drawable.ic_japanese_food + "한식" -> R.drawable.ic_korean_food + "중식" -> R.drawable.ic_chinese_food + else -> R.drawable.ic_etc_food + } + + + Box( + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight() + .background(color = Orange700) // 배경색 설정 + ) { + if (imageUrl.isNullOrEmpty()) { + // imageUrl이 null이나 empty일 경우 대체 이미지 표시 + Image( + painter = painterResource(id = imageId), // 대체 이미지 + contentDescription = null, + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight() + .padding(vertical = 15.dp) + ) + } else { + // imageUrl이 null이 아니면 AsyncImage로 비동기 이미지 로드 + AsyncImage( + model = imageUrl, + contentDescription = null, + placeholder = painterResource(id = imageId), + contentScale = ContentScale.Crop, // 이미지 비율 유지, 크기 확대 또는 자르기 + modifier = Modifier + .fillMaxWidth() // 가로는 꽉 차게 + .fillMaxHeight() // 세로도 꽉 차게 + .clip(RoundedCornerShape(topStart = 14.dp, topEnd = 14.dp)) + + ) + + } + } +} + +@Preview(showBackground = true) +@Composable +fun LikeItemPreview() { + val navController = rememberNavController() + val navigator = ProfileNavigator(navController) + + AlddeulBabsangTheme { + LikeItem( + navigator = navigator, + data = BabsangListEntity( + id = 1, + avatar = null, + name = "송이네 밥상", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 11", + phone = "02-210-0220", + favorite = true + ) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListViewModel.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListViewModel.kt new file mode 100644 index 0000000..30e668c --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/BabsangListViewModel.kt @@ -0,0 +1,61 @@ +package com.hackathon.alddeul_babsang.presentation.profile.screen + + +import androidx.lifecycle.ViewModel +import com.hackathon.alddeul_babsang.domain.entity.BabsangListEntity +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class BabsangListViewModel @Inject constructor() : ViewModel() { + + + val mockLikeList = listOf( + BabsangListEntity( + id = 1, + avatar = null, + name = "송이네 밥상", + codeName = "기타외식업", + address = "서울특별시 용산구 청파동 81", + phone = "02-210-0120", + favorite = true + ), + BabsangListEntity( + id = 2, + avatar = null, + name = "송이네 일식", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 11", + phone = "02-210-0220", + favorite = true + ), + BabsangListEntity( + id = 3, + avatar = null, + name = "송이네 한식", + codeName = "한식", + address = "서울특별시 용산구 청파동 31", + phone = "02-223-0220", + favorite = true + ), + BabsangListEntity( + id = 4, + avatar = null, + name = "송이네 중식", + codeName = "중식", + address = "서울특별시 용산구 청파동 31", + phone = "02-223-0220", + favorite = true + ), + BabsangListEntity( + id = 4, + avatar = "https://avatars.githubusercontent.com/u/166610834?s=400&u=568eacc2e4696d563a4fd732c148edba2196e4f6&v=4", + name = "송이네 밥상", + codeName = "중식", + address = "서울특별시 용산구 청파동 31", + phone = "02-223-0220", + favorite = true + ) + + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileLikeListScreen.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileLikeListScreen.kt new file mode 100644 index 0000000..a3929af --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileLikeListScreen.kt @@ -0,0 +1,161 @@ +package com.hackathon.alddeul_babsang.presentation.profile.screen + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +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.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.Icon +import androidx.compose.material3.IconButton +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.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +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.White +import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold +import com.hackathon.alddeul_babsang.core_ui.theme.head6Semi +import com.hackathon.alddeul_babsang.domain.entity.BabsangListEntity +import com.hackathon.alddeul_babsang.presentation.profile.navigation.ProfileNavigator + +@Composable +fun ProfileLikeListRoute( + navigator: ProfileNavigator +) { + + val systemUiController = rememberSystemUiController() + + SideEffect { + systemUiController.setStatusBarColor( + color = White + ) + } + + val babsangListViewModel: BabsangListViewModel = hiltViewModel() + ProfileLikeListScreen( + navigator = navigator, // navController 대신 navigator 전달 + onBackClick = { navigator.navigateBack() }, + babsangListViewModel = babsangListViewModel + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ProfileLikeListScreen( + navigator: ProfileNavigator, + onBackClick: () -> Unit = {}, + babsangListViewModel: BabsangListViewModel +) { + + val scrollState = rememberScrollState() + + Scaffold( + topBar = { + CenterAlignedTopAppBar( + modifier = Modifier.background(White), + title = { + Text( + text = stringResource(R.string.tv_profilelikelist_title), + style = head4Bold, + color = Gray900 + ) + }, + navigationIcon = { + IconButton(onClick = { onBackClick() }) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_back), + contentDescription = null + ) + } + }, + colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + containerColor = White + ) + ) + } + ) { innerPadding -> + Column( + modifier = Modifier + .padding(innerPadding) + .fillMaxSize() + .padding(horizontal = 20.dp, vertical = 16.dp) + .verticalScroll(scrollState), + ) { + + Spacer(modifier = Modifier.height(8.dp)) + + Text( + text = buildAnnotatedString { + withStyle(style = SpanStyle(color = Orange800)) { + append("좋아요 히스토리") + } + append("를 바탕으로\n") + withStyle(style = SpanStyle(color = Orange800)) { + append("밥상을 추천") + } + append("해드려요") + }, + style = head6Semi + + ) + + Spacer(modifier = Modifier.height(12.dp)) + + Column( + verticalArrangement = Arrangement.spacedBy(16.dp), + horizontalAlignment = Alignment.CenterHorizontally + ) { + for (item in babsangListViewModel.mockLikeList) { + LikeItem( + navigator = navigator, + data = item + ) + } + } + + } + } + + +} + +@Preview +@Composable +fun ProfileLikeListScreenPreview() { + val babsangListViewModel: BabsangListViewModel = hiltViewModel() + val navController = rememberNavController() + val navigator = ProfileNavigator(navController) + + AlddeulBabsangTheme { + ProfileLikeListScreen( + navigator = navigator, + onBackClick = { }, + babsangListViewModel = babsangListViewModel + ) + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreen.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreen.kt index 0315bee..bc08ce4 100644 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreen.kt +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreen.kt @@ -1,28 +1,359 @@ package com.hackathon.alddeul_babsang.presentation.profile.screen +import android.content.Context +import android.content.Intent +import android.net.Uri +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +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 androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController +import coil.compose.AsyncImage +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.Gray300 +import com.hackathon.alddeul_babsang.core_ui.theme.Gray500 +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.body2Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold +import com.hackathon.alddeul_babsang.core_ui.theme.head5Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head6Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head7Bold +import com.hackathon.alddeul_babsang.core_ui.theme.head7Semi import com.hackathon.alddeul_babsang.presentation.profile.navigation.ProfileNavigator + @Composable fun ProfileRoute( navigator: ProfileNavigator ) { - ProfileScreen() + val systemUiController = rememberSystemUiController() + + SideEffect { + systemUiController.setStatusBarColor( + color = White + ) + } + + ProfileScreen( + navController = navigator.navController, + onBackClick = { navigator.navigateLogin() } + ) } @Composable -fun ProfileScreen() { +fun ProfileScreen( + navController: NavController, + onBackClick: () -> Unit = {}, +) { + val context = LocalContext.current + var showBottomSheet by remember { mutableStateOf(false) } + var bottomSheetKeyword by remember { mutableStateOf("") } + Column( - modifier = Modifier.fillMaxSize(), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + modifier = Modifier + .fillMaxSize() + .background(Color.White), + + ) { + Row( + modifier = Modifier + .padding(top = 60.dp) + .fillMaxWidth() + ) { + Spacer(modifier = Modifier.width(30.dp)) + AsyncImage( + modifier = Modifier + .size(107.dp) + .clip(CircleShape) + .border(5.dp, Color(0xFFFAB935), CircleShape), + model = "", + contentDescription = null, + contentScale = ContentScale.Crop + ) + + Spacer(modifier = Modifier.width(30.dp)) + + Column { + Spacer(modifier = Modifier.height(25.dp)) + Text(stringResource(R.string.tv_profile_nickname), style = head4Bold) + Spacer(modifier = Modifier.height(10.dp)) + Row { + Text( + stringResource(R.string.tv_profile_likelist), + style = head7Semi, + color = Gray300 + ) + Spacer(modifier = Modifier.width(10.dp)) + + Image( + painter = painterResource(id = R.drawable.ic_back), + contentDescription = null, + colorFilter = ColorFilter.tint(Gray300), + modifier = Modifier + .graphicsLayer(scaleX = -1f) // 좌우 반전 + .clickable(onClick = { + navController.navigate("profileLikeList") + }) + ) + } + } + + } + Spacer(modifier = Modifier.height(80.dp)) + + Column( + modifier = Modifier + .height(240.dp) + .padding(horizontal = 30.dp) + ) { + Text( + stringResource(R.string.tv_profile_userservice), style = head6Semi, modifier = Modifier + .fillMaxWidth() + .height(30.dp) + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservice1), + onClick = { + navigateToWebsite( + context = context, + "https://flowery-alloy-47e.notion.site/1336b8d0ab7b8019a7a9da0d80ff285b" + ) + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservice2), + onClick = { + navigateToWebsite( + context = context, + "https://flowery-alloy-47e.notion.site/1336b8d0ab7b80949a59fe847a7e94d8" + ) + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservice3), + onClick = {} + ) + + Spacer(modifier = Modifier.height(30.dp)) + + HorizontalDivider( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 10.dp) + ) + + } + + Spacer(modifier = Modifier.height(30.dp)) + + Column( + modifier = Modifier + .height(220.dp) + .padding(horizontal = 30.dp) + ) { + Text( + stringResource(R.string.tv_profile_userservice4), style = head6Semi, modifier = Modifier + + .fillMaxWidth() + .height(30.dp) + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservice5), + onClick = {} + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservicelogout), + onClick = { + bottomSheetKeyword = "로그아웃" + showBottomSheet = true + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + ProfileScreenItem( + text = stringResource(R.string.tv_profile_userservicedelete), + onClick = { + bottomSheetKeyword = "회원 탈퇴" + showBottomSheet = true + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + + } + if (showBottomSheet) { + BottomSheetContent( + keyword = bottomSheetKeyword, + onDismiss = { + showBottomSheet = false + }, + onConfirm = { + //백엔드로 쿼리 전달 + onBackClick() + + showBottomSheet = false + } + ) + } + } +} + + +fun navigateToWebsite(context: Context, url: String) { + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + context.startActivity(intent) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BottomSheetContent( + keyword: String, + onDismiss: () -> Unit, + onConfirm: () -> Unit +) { + val sheetState = rememberModalBottomSheetState() + var tv1 = "" + var tv2 = "" + if (keyword == "로그아웃") { + tv1 = stringResource(R.string.tv_profile_asklogout) + tv2 = stringResource(R.string.tv_profile_asklogout2) + } + + if (keyword == "회원 탈퇴") { + tv1 = stringResource(R.string.tv_profile_askdelete) + tv2 = stringResource(R.string.tv_profile_askdelete2) + } + + ModalBottomSheet( + sheetState = sheetState, + onDismissRequest = { onDismiss() }, + containerColor = White, ) { - Text(text = "프로필") + Column( + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text( + text = tv1, + style = head5Semi, + modifier = Modifier.padding(bottom = 2.dp) + ) + Spacer(modifier = Modifier.height(20.dp)) + + Text( + text = tv2, + style = body2Semi, + modifier = Modifier.padding(bottom = 2.dp) + ) + Spacer(modifier = Modifier.height(41.dp)) + + Row( + modifier = Modifier + .fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Button( + modifier = Modifier.weight(1f), + colors = ButtonDefaults.buttonColors( + containerColor = Gray500, + ), + shape = RoundedCornerShape(40.dp), + contentPadding = PaddingValues(vertical = 19.dp), + onClick = { + onDismiss() + } + ) { + Text( + text = stringResource(R.string.btn_profile_cancel), + color = White, + style = head7Bold + ) + } + + Spacer(modifier = Modifier.width(8.dp)) + + Button( + modifier = Modifier.weight(1f), + colors = ButtonDefaults.buttonColors( + containerColor = Orange900, + ), + shape = RoundedCornerShape(40.dp), + contentPadding = PaddingValues(vertical = 19.dp), + onClick = { onConfirm() } + ) { + Text( + text = keyword, + color = White, + style = head7Bold + ) + } + Spacer(modifier = Modifier.width(8.dp)) + } + } } -} \ No newline at end of file +} + + +@Preview +@Composable +fun ProfileScreenPreview() { + AlddeulBabsangTheme { + ProfileScreen( + navController = rememberNavController() + ) + } +} diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreenItem.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreenItem.kt new file mode 100644 index 0000000..0fa90f0 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileScreenItem.kt @@ -0,0 +1,72 @@ +package com.hackathon.alddeul_babsang.presentation.profile.screen + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.hackathon.alddeul_babsang.R +import com.hackathon.alddeul_babsang.core_ui.theme.Gray300 +import com.hackathon.alddeul_babsang.core_ui.theme.Gray400 +import com.hackathon.alddeul_babsang.core_ui.theme.body1Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head5Semi +import com.hackathon.alddeul_babsang.core_ui.theme.head7Semi + + +@Composable +fun ProfileScreenItem( + text: String, + onClick: () -> Unit +) { + Box( + modifier = Modifier + .fillMaxWidth() + .height(40.dp) + .clickable { onClick() } + .padding(vertical = 8.dp) + ) { + Text( + modifier = Modifier + .align(Alignment.CenterStart) + , + text = text, + color = Gray400, + style = head7Semi + ) + IconButton( + modifier = Modifier + .align(Alignment.CenterEnd) + .graphicsLayer(scaleX = -1f), + onClick = { onClick() } + ) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_back), + contentDescription = null, + tint = Gray300 + ) + } + } +} + +@Preview +@Composable +fun ProfileScreenItemPreview() { + ProfileScreenItem( + text = "개인정보 수정", + onClick = {} + ) +} \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d18f31..c12c1f4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,4 +69,23 @@ %1$s/10자 닉네임은 10자 이하로 입력해주세요. + + 좋아요 목록 + 회원 탈퇴 하시겠습니까? + 회원 탈퇴 시 회원 정보가 초기화 됩니다 + 취소 + 회원 탈퇴 + 로그아웃 시 로그인 화면으로 이동합니다 + 로그아웃 하시겠습니까? + 좋아요 목록 + 닉네임 + 이용안내 + 서비스 이용약관 + 개인정보 처리방침 + 버전 정보 + 기타 + 고객센터 + 로그아웃 + 회원 탈퇴 + \ No newline at end of file