From 3de6c5d804b973e204a49d850ec32a35e7d66f1d Mon Sep 17 00:00:00 2001 From: JU YONGHAN Date: Thu, 15 Aug 2024 22:57:43 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20ui=20=EB=B3=80=EA=B2=BD=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whyranoid/data/model/post/PostResponse.kt | 3 ++ .../com/whyranoid/domain/model/post/Post.kt | 1 + .../domain/model/post/PostPreview.kt | 1 + .../component/community/PostContentItem.kt | 5 +-- .../presentation/screens/CommunityScreen.kt | 1 + .../screens/mypage/MyPageScreen.kt | 42 ++++++++++++------- .../main/res/drawable/ic_comment_button.xml | 11 +++++ .../drawable/ic_comment_outlined_button.xml | 5 --- 8 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 presentation/src/main/res/drawable/ic_comment_button.xml delete mode 100644 presentation/src/main/res/drawable/ic_comment_outlined_button.xml diff --git a/data/src/main/java/com/whyranoid/data/model/post/PostResponse.kt b/data/src/main/java/com/whyranoid/data/model/post/PostResponse.kt index 659f6ba1..50927a3c 100644 --- a/data/src/main/java/com/whyranoid/data/model/post/PostResponse.kt +++ b/data/src/main/java/com/whyranoid/data/model/post/PostResponse.kt @@ -18,6 +18,7 @@ data class PostResponse( @SerializedName("date") val date: String, @SerializedName("colorMode") val colorMode: Long, @SerializedName("historyContent") val historyContent: String, + @SerializedName("commentCount") val commentCount: Long, ) { fun toPostPreview(): PostPreview { val destructedHistoryContent = historyContent.split('_') @@ -33,6 +34,7 @@ data class PostResponse( timeText = destructedHistoryContent[3], paceText = destructedHistoryContent[4], address = destructedHistoryContent[1], + commentCount = commentCount, ) } @@ -52,6 +54,7 @@ data class PostResponse( timeText = destructedHistoryContent[3], paceText = destructedHistoryContent[4], address = destructedHistoryContent[1], + commentCount = commentCount, ) } diff --git a/domain/src/main/java/com/whyranoid/domain/model/post/Post.kt b/domain/src/main/java/com/whyranoid/domain/model/post/Post.kt index 1c4bc3cf..e7e6b2e8 100644 --- a/domain/src/main/java/com/whyranoid/domain/model/post/Post.kt +++ b/domain/src/main/java/com/whyranoid/domain/model/post/Post.kt @@ -18,6 +18,7 @@ data class Post( val timeText: String = "", val paceText: String = "", val address: String = "", + val commentCount: Long = 0, ) : Serializable { companion object { val DUMMY = diff --git a/domain/src/main/java/com/whyranoid/domain/model/post/PostPreview.kt b/domain/src/main/java/com/whyranoid/domain/model/post/PostPreview.kt index 6d07116a..0f7737af 100644 --- a/domain/src/main/java/com/whyranoid/domain/model/post/PostPreview.kt +++ b/domain/src/main/java/com/whyranoid/domain/model/post/PostPreview.kt @@ -14,6 +14,7 @@ data class PostPreview( val timeText: String = "", val paceText: String = "", val address: String = "", + val commentCount: Long = 0, ) { companion object { val DUMMY_LIST = listOf( diff --git a/presentation/src/main/java/com/whyranoid/presentation/component/community/PostContentItem.kt b/presentation/src/main/java/com/whyranoid/presentation/component/community/PostContentItem.kt index 1f67275c..b47ec6ba 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/component/community/PostContentItem.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/component/community/PostContentItem.kt @@ -78,14 +78,13 @@ fun PostContentItem( Icon( modifier = Modifier - .graphicsLayer(scaleX = -1f) .size(28.dp) .clip(CircleShape) .clickable { onCommentClicked(post) } .padding(3.dp), - painter = painterResource(id = R.drawable.ic_comment_outlined_button), + painter = painterResource(id = R.drawable.ic_comment_button), contentDescription = "댓글 버튼", tint = WalkieColor.GrayBorder ) @@ -94,7 +93,7 @@ fun PostContentItem( Text( modifier = Modifier.align(Alignment.CenterVertically), - text = "?", // todo replace real count + text = post.commentCount.toString(), style = WalkieTypography.Body1_Normal, color = WalkieColor.GrayBorder ) diff --git a/presentation/src/main/java/com/whyranoid/presentation/screens/CommunityScreen.kt b/presentation/src/main/java/com/whyranoid/presentation/screens/CommunityScreen.kt index feecb169..21876937 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/screens/CommunityScreen.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/screens/CommunityScreen.kt @@ -61,6 +61,7 @@ fun CommunityScreen(navController: NavController) { modifier = Modifier .clickable { + navController.navigate(Screen.AddPostScreen.route) }, imageVector = Icons.Filled.Add, contentDescription = "추가 버튼", diff --git a/presentation/src/main/java/com/whyranoid/presentation/screens/mypage/MyPageScreen.kt b/presentation/src/main/java/com/whyranoid/presentation/screens/mypage/MyPageScreen.kt index 4ad14fb2..858693ca 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/screens/mypage/MyPageScreen.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/screens/mypage/MyPageScreen.kt @@ -20,8 +20,10 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material.Scaffold import androidx.compose.material.Tab import androidx.compose.material.TabRow @@ -377,17 +379,25 @@ fun UserPageContent( verticalAlignment = Alignment.Top, ) { pagerNum -> when (pagerNum) { - 0 -> state.userPostPreviewsState.getDataOrNull()?.let { postPreviews -> - PostPage( - nickname == null, - postPreviews, - onPostPreviewClicked, - onPostCreateClicked, - ) + 0 -> { + Column( + modifier = Modifier.verticalScroll(rememberScrollState()) + ) { + state.userPostPreviewsState.getDataOrNull()?.let { postPreviews -> + PostPage( + nickname == null, + postPreviews, + onPostPreviewClicked, + onPostCreateClicked, + ) + } + } } 1 -> { - Column { + Column( + modifier = Modifier.verticalScroll(rememberScrollState()) + ) { HistoryPage(onDayClicked = onDateClicked) state.calendarPreviewsState.getDataOrNull() ?.let { postPreviews -> @@ -407,12 +417,16 @@ fun UserPageContent( 2 -> { val itemList = state.challengingPreviewsState.getDataOrNull() if (itemList != null) { - ChallengePage( - itemList, - onChallengePreviewClicked, - goChallengeMainScreen, - nickname == null - ) + Column( + modifier = Modifier.verticalScroll(rememberScrollState()) + ) { + ChallengePage( + itemList, + onChallengePreviewClicked, + goChallengeMainScreen, + nickname == null + ) + } } else { Box(Modifier.fillMaxSize()) { CircularProgressIndicator(Modifier.align(Alignment.Center)) diff --git a/presentation/src/main/res/drawable/ic_comment_button.xml b/presentation/src/main/res/drawable/ic_comment_button.xml new file mode 100644 index 00000000..e2b757c5 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_comment_button.xml @@ -0,0 +1,11 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_comment_outlined_button.xml b/presentation/src/main/res/drawable/ic_comment_outlined_button.xml deleted file mode 100644 index 91d5a017..00000000 --- a/presentation/src/main/res/drawable/ic_comment_outlined_button.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - -