diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/button/NavigateToPostButton.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/button/NavigateToPostButton.kt new file mode 100644 index 00000000..2d06bcc4 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/button/NavigateToPostButton.kt @@ -0,0 +1,44 @@ +package com.sopt.withsuhyeon.core.component.button + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +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.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import com.sopt.withsuhyeon.R +import com.sopt.withsuhyeon.core.util.modifier.noRippleClickable +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography + +@Composable +fun NavigateToPostButton( + modifier: Modifier = Modifier, + onClick: () -> Unit +) { + Box( + modifier = modifier + .width(76.dp) + .background( + color = colors.Purple50, + shape = RoundedCornerShape(size = 8.dp) + ) + .padding(vertical = 9.dp) + .noRippleClickable(onClick), + contentAlignment = Alignment.Center + ) + { + Text( + text = stringResource(R.string.navigate_to_post_button_title), + color = colors.Purple500, + textAlign = TextAlign.Center, + style = typography.caption01_B + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/card/ChatRoomInfoCardItem.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/card/ChatRoomInfoCardItem.kt new file mode 100644 index 00000000..fd501752 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/card/ChatRoomInfoCardItem.kt @@ -0,0 +1,76 @@ +package com.sopt.withsuhyeon.core.component.card + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.sopt.withsuhyeon.core.component.button.NavigateToPostButton +import com.sopt.withsuhyeon.core.util.price.toDecimalFormat +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography + +@Composable +fun ChatRoomInfoCardItem( + region: String, + postTitle: String, + price: Int, + modifier: Modifier = Modifier +) { + Column( + modifier = modifier + .fillMaxWidth() + .background(colors.White) + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + Column( + verticalArrangement = Arrangement.spacedBy(4.dp), + modifier = Modifier.weight(1f) + ) { + Text( + text = region, + style = typography.caption01_B, + color = colors.Grey400 + ) + Text( + text = postTitle, + style = typography.body03_B, + color = colors.Grey950 + ) + Text( + text = "${price.toDecimalFormat()}원", + style = typography.body03_B, + color = colors.Grey950 + ) + } + NavigateToPostButton {} + } + HorizontalDivider( + thickness = 1.dp, + color = colors.Grey100 + ) + } +} + +@Preview +@Composable +private fun ChatRoomInfoCardItemPreview() { + WithSuhyeonTheme { + ChatRoomInfoCardItem("강남/역삼/삼성", "강남역에서 수현이 되어주실 분!", 20000) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatBubble.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatBubble.kt new file mode 100644 index 00000000..22478201 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatBubble.kt @@ -0,0 +1,106 @@ +package com.sopt.withsuhyeon.core.component.chat + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn +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.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography + +@Composable +fun ChatBubble( + message: String, + time: String, + isSentByOwner: Boolean, + modifier: Modifier = Modifier +) { + Row( + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp), + verticalAlignment = Alignment.Bottom, + horizontalArrangement = if (isSentByOwner) Arrangement.End else Arrangement.Start + ) { + if (!isSentByOwner) { + Box( + modifier = Modifier + .size(36.dp) + .background(colors.Grey200, shape = CircleShape) + ) + Spacer(modifier = Modifier.width(8.dp)) + } + + if (!isSentByOwner) { + Box( + modifier = Modifier + .background( + color = colors.Grey50, + shape = RoundedCornerShape(16.dp) + ) + .padding(horizontal = 12.dp, vertical = 8.dp) + .widthIn(max = 230.dp) + ) { + Text( + text = message, + style = typography.body03_R, + color = colors.Black, + modifier = modifier.align(Alignment.BottomStart) + ) + } + + Text( + text = time, + style = typography.caption02_R, + color = colors.Grey400, + modifier = Modifier.padding(start = 6.dp) + ) + } else { + Text( + text = time, + style = typography.caption02_R, + color = colors.Grey400, + modifier = Modifier.padding(end = 6.dp) + ) + + Box( + modifier = Modifier + .background( + color = colors.Purple400, + shape = RoundedCornerShape(16.dp) + ) + .padding(horizontal = 12.dp, vertical = 8.dp) + .widthIn(max = 260.dp) + ) { + Text( + text = message, + style = typography.body03_R, + color = colors.White + ) + } + } + } +} + +@Preview +@Composable +private fun ChatBubblePreview() { + WithSuhyeonTheme { + ChatBubble("안녕안녕", "오후 04:01", false) + ChatBubble("안녕안녕", "오후 04:01", true) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatRoomDateInfoItem.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatRoomDateInfoItem.kt new file mode 100644 index 00000000..c1e39b79 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/chat/ChatRoomDateInfoItem.kt @@ -0,0 +1,43 @@ +package com.sopt.withsuhyeon.core.component.chat + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography + +@Composable +fun ChatRoomDateInfoItem( + date: String, + modifier: Modifier = Modifier +) { + Row( + modifier = modifier + .fillMaxWidth() + .background(colors.White) + .padding(vertical = 16.dp), + horizontalArrangement = Arrangement.Center + ) { + Text( + text = date, + style = typography.caption01_SB, + color = colors.Grey500 + ) + } +} + +@Preview +@Composable +private fun Preview() { + WithSuhyeonTheme { + ChatRoomDateInfoItem("2025년 1월 2일") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/list/TotalChatRoomList.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/list/TotalChatRoomList.kt index 9a2d5931..b752c223 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/core/component/list/TotalChatRoomList.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/list/TotalChatRoomList.kt @@ -11,6 +11,7 @@ import com.sopt.withsuhyeon.domain.entity.ChatRoomModel @Composable fun TotalChatRoomList( chatRooms: List, + onChatRoomListItemClick: () -> Unit, modifier: Modifier = Modifier ) { LazyColumn( @@ -22,7 +23,8 @@ fun TotalChatRoomList( partnerName = chatRoom.partnerName, recentChat = chatRoom.recentChat, recentChatDateTime = chatRoom.recentChatDateTime, - unreadChatCount = chatRoom.unreadChatCount + unreadChatCount = chatRoom.unreadChatCount, + onChatRoomListItemClick = onChatRoomListItemClick ) } } diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/listitem/ChatRoomListItem.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/listitem/ChatRoomListItem.kt index b8a3762a..8eada68c 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/core/component/listitem/ChatRoomListItem.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/listitem/ChatRoomListItem.kt @@ -19,13 +19,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import com.sopt.withsuhyeon.R import com.sopt.withsuhyeon.core.component.chip.SmallChip import com.sopt.withsuhyeon.core.type.SmallChipType -import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme +import com.sopt.withsuhyeon.core.util.modifier.noRippleClickable import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography @@ -36,12 +35,14 @@ fun ChatRoomListItem( recentChat: String, recentChatDateTime: String, unreadChatCount: String, + onChatRoomListItemClick: () -> Unit, modifier: Modifier = Modifier ) { Column( modifier = Modifier .fillMaxWidth() .background(colors.White) + .noRippleClickable { onChatRoomListItemClick() } ) { Row( modifier = Modifier @@ -103,12 +104,4 @@ fun ChatRoomListItem( color = colors.Grey100 ) } -} - -@Preview (showBackground = true) -@Composable -private fun ChatRoomListItemPreview() { - WithSuhyeonTheme { - ChatRoomListItem("https://via.placeholder.com/150", "작심이", "나는야 작심이 작심이 작심이 작심이 작심이 작심이", "1월 1일", "+99") - } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/component/textfield/ChatRoomTextFieldRow.kt b/app/src/main/java/com/sopt/withsuhyeon/core/component/textfield/ChatRoomTextFieldRow.kt new file mode 100644 index 00000000..64b9acb4 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/core/component/textfield/ChatRoomTextFieldRow.kt @@ -0,0 +1,96 @@ +package com.sopt.withsuhyeon.core.component.textfield + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.sopt.withsuhyeon.R +import com.sopt.withsuhyeon.core.util.modifier.noRippleClickable +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors +import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.typography + +@Composable +fun ChatRoomTextFieldRow( + text: String, + onTextChange: (String) -> Unit, + onSendClick: () -> Unit, + modifier: Modifier = Modifier +) { + val isMessageTextFieldNotEmpty = text.isNotBlank() + // val focusRequester = remember { FocusRequester()} + + Row( + modifier = modifier + .fillMaxWidth() + .background(colors.White) + // .focusRequester(focusRequester) + .padding(horizontal = 16.dp, vertical = 8.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + TextField( + value = text, + onValueChange = onTextChange, + placeholder = { + Text( + text = stringResource(R.string.chatroom_textfield_hint), + style = typography.body03_R, + color = colors.Grey400 + ) + }, + colors = TextFieldDefaults.colors( + focusedContainerColor = Color.Transparent, + unfocusedContainerColor = Color.Transparent, + focusedIndicatorColor = Color.Transparent, + unfocusedIndicatorColor = Color.Transparent, + focusedTextColor = colors.Grey900, + unfocusedTextColor = colors.Grey900 + ), + modifier = Modifier + .weight(1f) + .heightIn(min = 40.dp) + .background( + color = colors.Grey50, + shape = RoundedCornerShape(24.dp) + ), + maxLines = 5, + textStyle = typography.body03_SB + ) + + Box( + modifier = Modifier + .size(40.dp) + .background( + color = if (isMessageTextFieldNotEmpty) colors.Purple50 else colors.Grey50, + shape = RoundedCornerShape(20.dp) + ) + .noRippleClickable(onClick = onSendClick), + contentAlignment = Alignment.Center + ) { + Icon( + painter = painterResource(R.drawable.ic_send), + contentDescription = stringResource(R.string.message_textfield_send_button_description), + tint = if (isMessageTextFieldNotEmpty) colors.Purple500 else colors.Grey300 + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/core/navigation/RouteModel.kt b/app/src/main/java/com/sopt/withsuhyeon/core/navigation/RouteModel.kt index cb87d652..d54bfa8a 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/core/navigation/RouteModel.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/core/navigation/RouteModel.kt @@ -29,6 +29,8 @@ sealed interface Route { data object PostProfileImage : Route @Serializable data object SelectLocation : Route + @Serializable + data object ChatRoom : Route } sealed interface MainTabRoute : Route { diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatRoomScreen.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatRoomScreen.kt new file mode 100644 index 00000000..7782da66 --- /dev/null +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatRoomScreen.kt @@ -0,0 +1,161 @@ + package com.sopt.withsuhyeon.feature.chat + + import androidx.compose.foundation.background + import androidx.compose.foundation.layout.Box + import androidx.compose.foundation.layout.Column + import androidx.compose.foundation.layout.PaddingValues + import androidx.compose.foundation.layout.fillMaxSize + import androidx.compose.foundation.layout.fillMaxWidth + import androidx.compose.foundation.layout.imePadding + import androidx.compose.foundation.layout.padding + import androidx.compose.foundation.lazy.LazyColumn + import androidx.compose.foundation.lazy.items + import androidx.compose.foundation.lazy.rememberLazyListState + import androidx.compose.runtime.Composable + import androidx.compose.runtime.LaunchedEffect + import androidx.compose.runtime.mutableStateListOf + import androidx.compose.runtime.mutableStateOf + import androidx.compose.runtime.remember + import androidx.compose.ui.Alignment + import androidx.compose.ui.Modifier + import androidx.compose.ui.res.painterResource + import androidx.compose.ui.tooling.preview.Preview + import androidx.compose.ui.unit.dp + import androidx.hilt.navigation.compose.hiltViewModel + import com.sopt.withsuhyeon.R + import com.sopt.withsuhyeon.core.component.card.ChatRoomInfoCardItem + import com.sopt.withsuhyeon.core.component.chat.ChatBubble + import com.sopt.withsuhyeon.core.component.textfield.ChatRoomTextFieldRow + import com.sopt.withsuhyeon.core.component.topbar.SubTopNavBar + import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme + import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors + import java.time.LocalTime + import java.time.format.DateTimeFormatter + import java.util.Locale + + @Composable + fun ChatRoomRoute( + padding: PaddingValues + ) { + ChatRoomScreen( + padding = padding + ) + } + + @Composable + private fun ChatRoomScreen( + padding: PaddingValues, + modifier: Modifier = Modifier, + viewModel: ChatViewModel = hiltViewModel() + ) { + val messages = remember { + mutableStateListOf( + Triple("안녕하세요", true, "오후 12:00"), + Triple("반갑습니다", false, "오후 12:01"), + Triple("안녕히계세요", true, "오후 12:02") + ) + } + val (inputText, setInputText) = remember { mutableStateOf("") } + + val lazyListState = rememberLazyListState() + + LaunchedEffect(messages.size) { + if (messages.isNotEmpty()) { + lazyListState.animateScrollToItem(messages.size - 1) + } + } + + fun getCurrentTime(): String { + val now = LocalTime.now() + val formatter = DateTimeFormatter.ofPattern("a hh:mm", Locale("ko", "KR")) + return now.format(formatter).replace("AM", "오전").replace("PM", "오후") + } + Box( + modifier = modifier + .fillMaxSize() + .background(colors.White) + .padding(padding) + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .background(colors.White) + .align(Alignment.TopCenter) + ) { + SubTopNavBar( + text = "작심이", + btnIcon = painterResource(R.drawable.ic_close), + isTextVisible = true, + isBtnVisible = false, + onCloseBtnClicked = {} + ) + ChatRoomInfoCardItem( + region = "강남/역삼/삼성", + postTitle = "강남역에서 수현이 되어주실 분!", + price = 20000 + ) + } + + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = 140.dp) + ) { + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .weight(1f), + state = lazyListState, + contentPadding = PaddingValues(vertical = 8.dp) + ) { + items(messages) { (message, isSentByOwner, time) -> + ChatBubble( + message = message, + time = time, + isSentByOwner = isSentByOwner + ) + } + } + ChatRoomTextFieldRow( + text = inputText, + onTextChange = setInputText, + onSendClick = { + if (inputText.isNotBlank()) { + val currentTime = getCurrentTime() + messages.add(Triple(inputText, true, currentTime)) + setInputText("") + } + }, + modifier = Modifier.fillMaxWidth().imePadding() + ) + } + } + } + + @Preview + @Composable + private fun ChatRoomScreenPreview() { + WithSuhyeonTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(colors.White) + ) { + ChatBubble( + message = "지금은 몇시일까요 지금은 몇시일까요 지금은 몇시일까요 지금은 몇시일까요 지금은 몇시일까요", + time = "오후 04:01", + isSentByOwner = false + ) + ChatBubble( + message = "시러요", + time = "오후 04:01", + isSentByOwner = true + ) + ChatBubble( + message = "히히", + time = "오후 08:40", + isSentByOwner = false + ) + } + } + } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatScreen.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatScreen.kt index e7189472..c72c392e 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatScreen.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/ChatScreen.kt @@ -24,15 +24,20 @@ import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme.colors @Composable fun ChatRoute( padding: PaddingValues, + navigateToChatRoom: () -> Unit, viewModel: ChatViewModel = hiltViewModel() ) { ChatScreen( - padding = padding + padding = padding, + onChatRoomListItemClick = { + navigateToChatRoom() + } ) } @Composable private fun ChatScreen( padding: PaddingValues, + onChatRoomListItemClick: () -> Unit, viewModel: ChatViewModel = hiltViewModel() ) { val sampleChatRooms by viewModel.chatRooms.collectAsState() @@ -53,7 +58,10 @@ private fun ChatScreen( .fillMaxWidth() .fillMaxHeight() ) { - TotalChatRoomList(chatRooms = sampleChatRooms) + TotalChatRoomList( + chatRooms = sampleChatRooms, + onChatRoomListItemClick = onChatRoomListItemClick + ) } } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/chat/navigation/ChatNavigation.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/navigation/ChatNavigation.kt index 1db9ba74..2eb308c4 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/chat/navigation/ChatNavigation.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/chat/navigation/ChatNavigation.kt @@ -6,16 +6,31 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.sopt.withsuhyeon.core.navigation.MainTabRoute +import com.sopt.withsuhyeon.core.navigation.Route +import com.sopt.withsuhyeon.feature.chat.ChatRoomRoute import com.sopt.withsuhyeon.feature.chat.ChatRoute fun NavController.navigateToChat(navOptions: NavOptions) { navigate(MainTabRoute.Chat, navOptions) } +fun NavController.navigateToChatRoom() { + navigate(Route.ChatRoom) +} + fun NavGraphBuilder.chatNavGraph( - padding: PaddingValues + padding: PaddingValues, + onNavigateToChatRoom: () -> Unit ) { composable { - ChatRoute(padding) + ChatRoute( + padding = padding, + navigateToChatRoom = onNavigateToChatRoom + ) + } + composable { + ChatRoomRoute( + padding = padding + ) } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/home/HomeScreen.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/home/HomeScreen.kt index a30d3679..90fa8eef 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/home/HomeScreen.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/home/HomeScreen.kt @@ -17,7 +17,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel -import com.sopt.withsuhyeon.core.component.bottomsheet.GalleryCategoryBottomSheet import com.sopt.withsuhyeon.core.util.modifier.noRippleClickable import com.sopt.withsuhyeon.ui.theme.Purple100 @@ -45,12 +44,6 @@ private fun HomeScreen( ) var isBottomSheetVisible by remember { mutableStateOf(false) } - var selectedCategories by remember { mutableStateOf(listOf()) } - val categories = listOf( - "학교", "카페", "회식", "엠티", "자취방", "도서관", - "수영장/빠지", "바다/계곡", "스키장", "찜질방", "캠핑/글램핑", - "파티룸", "절/교회 수련회", "해외여행", "공항", "기타" - ) Box( modifier = Modifier @@ -64,26 +57,5 @@ private fun HomeScreen( text = "카테고리 바텀 시트" ) } - -// if (isBottomSheetVisible) { -// GalleryCategoryBottomSheet( -// isVisible = isBottomSheetVisible, -// categories = categories, -// selectedCategories = selectedCategories, -// onCategoryChipClick = { category -> -// selectedCategories = if (selectedCategories.contains(category)) { -// selectedCategories - category -// } else { -// selectedCategories + category -// } -// }, -// onConfirmClick = { -// isBottomSheetVisible = false -// }, -// onDismiss = { -// isBottomSheetVisible = false -// } -// ) -// } } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainActivity.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainActivity.kt index 8b97a11c..2940e864 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainActivity.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainActivity.kt @@ -6,6 +6,7 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.core.view.WindowCompat import com.sopt.withsuhyeon.ui.theme.WithSuhyeonTheme import dagger.hilt.android.AndroidEntryPoint diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainNavigator.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainNavigator.kt index 84e4db40..a0435703 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainNavigator.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainNavigator.kt @@ -13,6 +13,7 @@ import androidx.navigation.navOptions import com.sopt.withsuhyeon.core.navigation.MainTabRoute import com.sopt.withsuhyeon.core.navigation.Route import com.sopt.withsuhyeon.feature.chat.navigation.navigateToChat +import com.sopt.withsuhyeon.feature.chat.navigation.navigateToChatRoom import com.sopt.withsuhyeon.feature.findsuhyeon.navigation.navigateToFindSuhyeon import com.sopt.withsuhyeon.feature.findsuhyeon.navigation.navigateToFindSuhyeonPost import com.sopt.withsuhyeon.feature.findsuhyeon.navigation.navigateToFindSuhyeonUpload @@ -37,7 +38,7 @@ class MainNavigator( @Composable get() = navController .currentBackStackEntryAsState().value?.destination - val startDestination = MainTabRoute.FindSuhyeon + val startDestination = Route.TermsOfUse val currentTab: MainTab? @SuppressLint("RestrictedApi") @Composable get() = MainTab.find { tab -> @@ -101,6 +102,10 @@ class MainNavigator( navController.navigateToGalleryPostDetail() } + fun navigateToChatRoom() { + navController.navigateToChatRoom() + } + fun navigateToFindSuhyeon(navOptions: NavOptions? = null) { navController.navigateToHome( navOptions ?: navOptions { diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainScreen.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainScreen.kt index 83f522e9..2e9fa8e3 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainScreen.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/main/MainScreen.kt @@ -56,7 +56,6 @@ private fun MainScreenContent( ) }, - contentWindowInsets = WindowInsets(0, 0, 0, 0), bottomBar = { MainBottomBar( modifier = Modifier.background(colors.White) diff --git a/app/src/main/java/com/sopt/withsuhyeon/feature/main/component/MainNavHost.kt b/app/src/main/java/com/sopt/withsuhyeon/feature/main/component/MainNavHost.kt index 295f83ab..08b0534e 100644 --- a/app/src/main/java/com/sopt/withsuhyeon/feature/main/component/MainNavHost.kt +++ b/app/src/main/java/com/sopt/withsuhyeon/feature/main/component/MainNavHost.kt @@ -50,6 +50,7 @@ fun MainNavHost( ) chatNavGraph( padding = padding, + onNavigateToChatRoom = navigator::navigateToChatRoom ) myPageNavGraph( padding = padding, diff --git a/app/src/main/res/drawable/ic_btn_send.xml b/app/src/main/res/drawable/ic_btn_send.xml new file mode 100644 index 00000000..6dee818c --- /dev/null +++ b/app/src/main/res/drawable/ic_btn_send.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_send.xml b/app/src/main/res/drawable/ic_send.xml new file mode 100644 index 00000000..3b60f1bb --- /dev/null +++ b/app/src/main/res/drawable/ic_send.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d9ec18f..4456ed2a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -133,6 +133,9 @@ 채팅 + 메시지를 입력해주세요 + 게시물 보기 + Send Button 수현이랑\n서비스 이용약관