diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/SignUpLoginTextfield.kt b/app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/SignUpLoginTextfield.kt deleted file mode 100644 index 6bf6db0..0000000 --- a/app/src/main/java/com/hackathon/alddeul_babsang/core_ui/component/SignUpLoginTextfield.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.hackathon.alddeul_babsang.core_ui.component - -import androidx.compose.material3.Text -import androidx.compose.material3.TextField -import androidx.compose.material3.TextFieldDefaults -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import com.hackathon.alddeul_babsang.core_ui.theme.* - -@Composable -fun SignUpLoginTextField( - value: String, - onValueChange: (String) -> Unit, - placeholderText: String -) { - TextField( - value = value, - onValueChange = onValueChange, - placeholder = { - Text( - text = placeholderText, - style = head4Bold, - color = Gray300, - ) - }, - colors = TextFieldDefaults.colors( - focusedContainerColor = Color.White, // 포커스된 상태에서 배경색을 흰색으로 설정 - unfocusedContainerColor = Color.White, // 비포커스 상태에서 배경색을 흰색으로 설정 - cursorColor = Color.Black, - focusedIndicatorColor = Orange900, - unfocusedIndicatorColor = Gray300 - ) - ) -} diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/main/screen/LikeListScreen.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/main/screen/LikeListScreen.kt deleted file mode 100644 index b49bbb5..0000000 --- a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/main/screen/LikeListScreen.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.hackathon.alddeul_babsang.presentation.main.screen - -class LikeListScreen { -} \ 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..92ee9c7 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,7 +2,10 @@ 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 +import com.hackathon.alddeul_babsang.presentation.report.navigation.ReportNavigator +import com.hackathon.alddeul_babsang.presentation.report.screen.ReportWriteRoute fun NavGraphBuilder.profileNavGraph( navigator: ProfileNavigator @@ -10,4 +13,12 @@ fun NavGraphBuilder.profileNavGraph( composable(route = "profile") { ProfileRoute(navigator = navigator) } +} + +fun NavGraphBuilder.profileLikeListNavGraph( + navigator: ProfileNavigator +) { + 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..b5e2bb2 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,12 @@ import androidx.navigation.NavController class ProfileNavigator( val navController: NavController ) { + + fun profileLikeList() { + navController.navigate("profileLikeList") + } + + fun navigateBack() { + navController.popBackStack() + } } \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeItem.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeItem.kt new file mode 100644 index 0000000..1f11653 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeItem.kt @@ -0,0 +1,183 @@ +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.layout.Arrangement.Bottom +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.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +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.graphics.vector.ImageVector +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +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.Font_B04 +import com.hackathon.alddeul_babsang.core_ui.theme.Gray200 +import com.hackathon.alddeul_babsang.core_ui.theme.Gray300 +import com.hackathon.alddeul_babsang.core_ui.theme.Gray600 +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.body3Semi +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.BabsangDetailEntity +import com.hackathon.alddeul_babsang.domain.entity.ReviewEntity +import com.hackathon.alddeul_babsang.presentation.detail.screen.DetailViewModel +import kotlin.math.round + +@Composable +fun LikeItem( + data: BabsangDetailEntity +) { + Column( + modifier = Modifier + .width(350.dp) + .border( + width = 1.dp, + color = Orange700, + shape = RoundedCornerShape(14.dp) + ) + .height(240.dp) + ) { + Box( + modifier = Modifier + .fillMaxWidth() + .height(140.dp) + .clip(RoundedCornerShape(topStart = 14.dp, topEnd = 14.dp)) + ) { + // AsyncImage 로드를 위한 함수 호출 + LoadImageWithPlaceholder(data.codeName, data.avatar) + + // 아이콘을 이미지 위에 오버레이 + Image( + painter = painterResource(id = R.drawable.ic_heart_white), + contentDescription = null, + modifier = Modifier + .padding(end = 10.dp, top = 10.dp) + .align(Alignment.TopEnd) // Box 내에서 오른쪽 끝으로 배치 + ) + } + + 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?) { + var imageId =R.drawable.ic_korean_food + if (codeName =="경양식/일식"){ + imageId=R.drawable.ic_japanese_food + } + else if (codeName =="한식"){ + imageId=R.drawable.ic_korean_food + } + else if (codeName =="중식"){ + imageId=R.drawable.ic_chinese_food + } + else { + imageId=R.drawable.ic_etc_food + } + + + Box( + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight() + .background(color= Orange700) // 배경색 설정 + ) { + AsyncImage( + model = imageUrl, + contentDescription = null, + placeholder = painterResource(id = imageId), // codeName에 따라 다른 placeholder 제공 + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight() + .padding(vertical = 15.dp) + ) + } +} + +@Preview(showBackground = true) +@Composable +fun ReviewItemPreview() { + val LikeListViewModel: LikeListViewModel = hiltViewModel() + AlddeulBabsangTheme { + LikeItem( + data = BabsangDetailEntity( + id = 1, + avatar = "", + name = "송이네 밥상", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 11", + phone = "02-210-0220", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = LikeListViewModel.mockReviews + ) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeListViewModel.kt b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeListViewModel.kt new file mode 100644 index 0000000..ea0d590 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/LikeListViewModel.kt @@ -0,0 +1,88 @@ +package com.hackathon.alddeul_babsang.presentation.profile.screen + + +import androidx.lifecycle.ViewModel +import com.hackathon.alddeul_babsang.domain.entity.BabsangDetailEntity +import com.hackathon.alddeul_babsang.domain.entity.MenuEntity +import com.hackathon.alddeul_babsang.domain.entity.ReviewEntity +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class LikeListViewModel @Inject constructor() : ViewModel() { + val mockMenuList = listOf( + MenuEntity("김치찌개", 8000), + MenuEntity("된장찌개", 9000), + ) + + val mockReviews = listOf( + ReviewEntity( + id = 1, + avatar = "https://avatars.githubusercontent.com/u/12345678?v=4", + nickname = "김개발", + createdAt = "24.03.12", + star = 4.56, + content = "맛있어요!" + ), + ReviewEntity( + id = 2, + avatar = "https://avatars.githubusercontent.com/u/12345678?v=4", + nickname = "김디자인", + createdAt = "24.03.12", + star = 3.28, + content = "그저 그랬어요 블라블라블라!" + ), + ReviewEntity( + id = 3, + avatar = "https://avatars.githubusercontent.com/u/12345678?v=4", + nickname = "김마케팅", + createdAt = "24.03.12", + star = 2.49, + content = "위생이 별로에요!" + ), + + ) + + val mockLikeList = listOf( + BabsangDetailEntity( + id = 1, + name = "송이네 밥상", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 1211", + phone = "02-295-0220", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = mockReviews + ), + BabsangDetailEntity( + id = 2, + name = "송이네 밥상2", + codeName = "한식", + address = "서울특별시 용산구 청파동 911", + phone = "02-230-0220", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = mockReviews + ), + BabsangDetailEntity( + id = 3, + name = "송이네 밥상3", + codeName = "중식", + address = "서울특별시 용산구 청파동 321", + phone = "02-210-2097", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = mockReviews + ), + BabsangDetailEntity( + id = 4, + name = "송이네 밥상4", + codeName = "기타외식업", + address = "서울특별시 용산구 청파동 14", + phone = "02-210-0270", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = mockReviews + ) + ) +} \ 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..d6cf882 --- /dev/null +++ b/app/src/main/java/com/hackathon/alddeul_babsang/presentation/profile/screen/ProfileLikeListScreen.kt @@ -0,0 +1,163 @@ +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.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 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.BabsangDetailEntity +import com.hackathon.alddeul_babsang.presentation.profile.navigation.ProfileNavigator + +@Composable +fun ProfileLikeListRoute( + navigator: ProfileNavigator +) { + val LikeListViewModel: LikeListViewModel = hiltViewModel() + ProfileLikeListScreen( + data = BabsangDetailEntity( + id = 1, + name = "송이네 밥상", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 11", + phone = "02-210-0220", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = LikeListViewModel.mockReviews + ), + onBackClick = { navigator.navigateBack() }, + LikeListViewModel = LikeListViewModel + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun ProfileLikeListScreen( + data: BabsangDetailEntity, + onBackClick: () -> Unit = {}, + LikeListViewModel: LikeListViewModel +) { + + 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 LikeListViewModel.mockLikeList) { + LikeItem( + data = item + ) + } + } + + } + } + + +} + +@Preview +@Composable +fun ProfileLikeListScreenPreview() { + val LikeListViewModel: LikeListViewModel = hiltViewModel() + AlddeulBabsangTheme { + ProfileLikeListScreen( + data = BabsangDetailEntity( + id = 1, + avatar = "", + name = "송이네 밥상", + codeName = "경양식/일식", + address = "서울특별시 용산구 청파동 11", + phone = "02-210-0220", + rating = 4.3, + menu = "김치찌개: 8000, 된장찌개 9000", + review = LikeListViewModel.mockReviews + ), + onBackClick = { }, + LikeListViewModel = LikeListViewModel + + ) + } +} \ 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 ed74c51..c183bb6 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 @@ -3,13 +3,13 @@ package com.hackathon.alddeul_babsang.presentation.profile.screen import android.content.Context import android.content.Intent import android.net.Uri -import androidx.compose.foundation.BorderStroke 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 @@ -18,31 +18,30 @@ 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.lazy.LazyColumn -import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.ArrowForward -import androidx.compose.material.icons.filled.ArrowBack -import androidx.compose.material.icons.filled.ArrowForward -import androidx.compose.material3.Divider +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon +import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState 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.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.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavController @@ -50,18 +49,10 @@ 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.Gray200 -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.Gray500 -import com.hackathon.alddeul_babsang.core_ui.theme.Orange700 -import com.hackathon.alddeul_babsang.core_ui.theme.head4Bold -import com.hackathon.alddeul_babsang.core_ui.theme.head6Semi -import com.hackathon.alddeul_babsang.core_ui.theme.head7Semi +import com.hackathon.alddeul_babsang.core_ui.theme.* import com.hackathon.alddeul_babsang.presentation.profile.navigation.ProfileNavigator - @Composable fun ProfileRoute( navigator: ProfileNavigator @@ -73,18 +64,24 @@ fun ProfileRoute( @Composable fun ProfileScreen( - navController: NavController, + navController: NavController ) { val context = LocalContext.current + var showBottomSheet by remember { mutableStateOf(false) } + var bottomSheetKeyword by remember { mutableStateOf("") } + var bottomSheetQuery by remember { mutableStateOf("") } Column( modifier = Modifier .fillMaxSize() .background(Color.White), - ) { - Row(modifier = Modifier.padding(top=60.dp) - .fillMaxWidth()){ + ) { + Row( + modifier = Modifier + .padding(top = 60.dp) + .fillMaxWidth() + ) { Spacer(modifier = Modifier.width(30.dp)) AsyncImage( modifier = Modifier @@ -102,8 +99,12 @@ fun ProfileScreen( Spacer(modifier = Modifier.height(25.dp)) Text("닉네임", style = head4Bold) Spacer(modifier = Modifier.height(10.dp)) - Row(){ - Text(stringResource(R.string.tv_profile_likelist), style = head7Semi, color=Gray300) + Row { + Text( + stringResource(R.string.tv_profile_likelist), + style = head7Semi, + color = Gray300 + ) Spacer(modifier = Modifier.width(10.dp)) Image( @@ -112,9 +113,9 @@ fun ProfileScreen( colorFilter = ColorFilter.tint(Gray300), modifier = Modifier .graphicsLayer(scaleX = -1f) // 좌우 반전 - //.clickable(onClick={ - //navController.navigate("signUp2") - //}) + .clickable(onClick={ + navController.navigate("profileLikeList") + }) ) } } @@ -125,11 +126,13 @@ fun ProfileScreen( Column( modifier = Modifier .height(200.dp) - ){ - Text("이용안내",style= head6Semi, modifier = Modifier - .padding(start=30.dp) - .fillMaxWidth() - .height(30.dp)) + ) { + Text( + "이용안내", style = head6Semi, modifier = Modifier + .padding(start = 30.dp) + .fillMaxWidth() + .height(30.dp) + ) Spacer(modifier = Modifier.height(20.dp)) ProfileScreenItem( @@ -174,11 +177,13 @@ fun ProfileScreen( Column( modifier = Modifier .height(200.dp) - ){ - Text("기타",style= head6Semi, modifier = Modifier - .padding(start=30.dp) - .fillMaxWidth() - .height(30.dp)) + ) { + Text( + "기타", style = head6Semi, modifier = Modifier + .padding(start = 30.dp) + .fillMaxWidth() + .height(30.dp) + ) Spacer(modifier = Modifier.height(20.dp)) ProfileScreenItem( @@ -189,23 +194,43 @@ fun ProfileScreen( Spacer(modifier = Modifier.height(20.dp)) ProfileScreenItem( text = "로그아웃", - onClick = {} + onClick = { + bottomSheetKeyword = "로그아웃" + bottomSheetQuery = "logout_query" // 여기에 실제 쿼리문을 넣을 수 있음 + showBottomSheet = true + } ) Spacer(modifier = Modifier.height(20.dp)) ProfileScreenItem( text = "회원 탈퇴", - onClick = {} + onClick = { + bottomSheetKeyword = "회원 탈퇴" + bottomSheetQuery = "logout_query" // 여기에 실제 쿼리문을 넣을 수 있음 + showBottomSheet = true + } ) Spacer(modifier = Modifier.height(20.dp)) } - - - - - + if (showBottomSheet) { + BottomSheetContent( + keyword = bottomSheetKeyword, + onDismiss = { + showBottomSheet = false + }, + onConfirm = { + //백엔드로 쿼리 전달 + navController.navigate("login"){ + popUpTo("profile") { inclusive = true } + launchSingleTop = true + } + + showBottomSheet = false + } + ) + } } } @@ -215,6 +240,96 @@ fun navigateToWebsite(context: Context, url: String) { 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, + ) { + Column( + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text( + text = tv1, + color = Gray500, + style = head5Semi, + modifier = Modifier.padding(bottom = 2.dp) + ) + Spacer(modifier = Modifier.height(20.dp)) + + Text( + text = tv2, + color = Gray500, + 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 + ) + } + } + } + } +} @Preview diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4ae979..fd2180a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,5 +69,12 @@ %1$s/10자 닉네임은 10자 이하로 입력해주세요. 좋아요 목록 + 회원 탈퇴 하시겠습니까? + 회원 탈퇴 시 회원 정보가 초기화 됩니다 + 취소 + 회원 탈퇴 + 로그아웃 시 로그인 화면으로 이동합니다 + 로그아웃 하시겠습니까? + 좋아요 목록 \ No newline at end of file