diff --git a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/CommentSection.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSection.kt similarity index 98% rename from feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/CommentSection.kt rename to core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSection.kt index c885fcb9..42395ea2 100644 --- a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/CommentSection.kt +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSection.kt @@ -1,4 +1,4 @@ -package com.withpeace.withpeace.feature.postdetail +package com.withpeace.withpeace.core.ui.comment import androidx.compose.foundation.Image import androidx.compose.foundation.clickable @@ -41,10 +41,12 @@ import com.skydoves.landscapist.glide.GlideImage import com.withpeace.withpeace.core.designsystem.theme.PretendardFont import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme import com.withpeace.withpeace.core.ui.DateUiModel +import com.withpeace.withpeace.core.ui.R import com.withpeace.withpeace.core.ui.R.drawable import com.withpeace.withpeace.core.ui.post.CommentUiModel import com.withpeace.withpeace.core.ui.post.CommentUserUiModel import com.withpeace.withpeace.core.ui.post.ReportTypeUiModel +import com.withpeace.withpeace.core.ui.report.PostDetailReportBottomSheet import com.withpeace.withpeace.core.ui.toRelativeString import java.time.LocalDateTime diff --git a/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSize.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSize.kt new file mode 100644 index 00000000..5396554a --- /dev/null +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/CommentSize.kt @@ -0,0 +1,33 @@ +package com.withpeace.withpeace.core.ui.comment + +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +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.painterResource +import androidx.compose.ui.unit.dp +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.ui.R + +@Composable +fun CommentSize( + commentSize: Int, +) { + Row( + modifier = Modifier.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_chat), + contentDescription = "댓글 개수", + modifier = Modifier.padding(end = 4.dp), + ) + Text( + text = "$commentSize", + style = WithpeaceTheme.typography.caption, + ) + } +} \ No newline at end of file diff --git a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/RegisterCommentSection.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/RegisterCommentSection.kt similarity index 98% rename from feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/RegisterCommentSection.kt rename to core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/RegisterCommentSection.kt index 3963a17e..1a3a632c 100644 --- a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/RegisterCommentSection.kt +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/comment/RegisterCommentSection.kt @@ -1,4 +1,4 @@ -package com.withpeace.withpeace.feature.postdetail +package com.withpeace.withpeace.core.ui.comment import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource @@ -27,6 +27,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.ui.R @Composable fun RegisterCommentSection( diff --git a/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/PostDetailReportBottomSheet.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/PostDetailReportBottomSheet.kt new file mode 100644 index 00000000..7470aecb --- /dev/null +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/PostDetailReportBottomSheet.kt @@ -0,0 +1,62 @@ +package com.withpeace.withpeace.core.ui.report + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +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.ui.Modifier +import androidx.compose.ui.graphics.RectangleShape +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.designsystem.ui.WithPeaceBackButtonTopAppBar +import com.withpeace.withpeace.core.ui.post.ReportTypeUiModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun PostDetailReportBottomSheet( + isPostReport: Boolean, + id: Long, + onDismissRequest: () -> Unit, + onClickReportType: (id: Long, ReportTypeUiModel) -> Unit, +) { + val bottomSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) + ModalBottomSheet( + contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, + containerColor = WithpeaceTheme.colors.SystemWhite, + onDismissRequest = onDismissRequest, + sheetState = bottomSheetState, + shape = RectangleShape, + ) { + Column( + modifier = Modifier.fillMaxSize(), + ) { + WithPeaceBackButtonTopAppBar( + onClickBackButton = onDismissRequest, + title = { + Text(text = "신고하는 이유를 선택해주세요", style = WithpeaceTheme.typography.title1) + }, + ) + HorizontalDivider(Modifier.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding)) + Column( + modifier = Modifier + .fillMaxWidth(), + ) { + ReportTypeUiModel.entries.forEach { reportTypeUiModel -> + ReportTypeItem( + isPostReport = isPostReport, + id = id, + reportTypeUiModel = reportTypeUiModel, + onClickReportType = onClickReportType, + onDismissRequest = onDismissRequest, + ) + } + } + } + } +} \ No newline at end of file diff --git a/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportDialog.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportDialog.kt new file mode 100644 index 00000000..52bf2d05 --- /dev/null +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportDialog.kt @@ -0,0 +1,82 @@ +package com.withpeace.withpeace.core.ui.report + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +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.unit.dp +import androidx.compose.ui.window.Dialog +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.ui.R + +@Composable +fun ReportDialog( + title: String, + onClickReportButton: () -> Unit, + onDismissRequest: () -> Unit, +) { + Dialog(onDismissRequest = onDismissRequest) { + Column( + modifier = Modifier + .background( + WithpeaceTheme.colors.SystemWhite, + RoundedCornerShape(10.dp), + ) + .wrapContentSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + modifier = Modifier.padding(top = 24.dp, bottom = 16.dp), + text = title, + style = WithpeaceTheme.typography.title2, + ) + Row { + Button( + modifier = Modifier + .padding(start = 16.dp, end = 4.dp) + .weight(1f), + onClick = { onDismissRequest() }, + shape = RoundedCornerShape(10.dp), + border = BorderStroke(width = 1.dp, color = WithpeaceTheme.colors.MainPurple), + colors = ButtonDefaults.buttonColors(containerColor = WithpeaceTheme.colors.SystemWhite), + ) { + Text( + text = stringResource(R.string.delete_cancel), + style = WithpeaceTheme.typography.caption, + color = WithpeaceTheme.colors.MainPurple, + ) + } + Button( + modifier = Modifier + .padding(start = 4.dp, end = 16.dp) + .weight(1f), + onClick = { + onClickReportButton() + onDismissRequest() + }, + shape = RoundedCornerShape(10.dp), + colors = ButtonDefaults.buttonColors(containerColor = WithpeaceTheme.colors.MainPurple), + ) { + Text( + text = "신고하기", + style = WithpeaceTheme.typography.caption, + color = WithpeaceTheme.colors.SystemWhite, + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + } + } +} \ No newline at end of file diff --git a/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportTypeItem.kt b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportTypeItem.kt new file mode 100644 index 00000000..8f96d63f --- /dev/null +++ b/core/ui/src/main/java/com/withpeace/withpeace/core/ui/report/ReportTypeItem.kt @@ -0,0 +1,53 @@ +package com.withpeace.withpeace.core.ui.report + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.ui.post.ReportTypeUiModel + +@Composable +fun ReportTypeItem( + modifier: Modifier = Modifier, + isPostReport: Boolean, + id: Long, + reportTypeUiModel: ReportTypeUiModel, + onClickReportType: (id: Long, ReportTypeUiModel) -> Unit, + onDismissRequest: () -> Unit, +) { + var showReportDialog by rememberSaveable { + mutableStateOf(false) + } + val title = if (isPostReport) reportTypeUiModel.postTitle else reportTypeUiModel.commentTitle + Column( + modifier = modifier.clickable { + showReportDialog = true + }.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), + ) { + Text( + text = title, + style = WithpeaceTheme.typography.body, + modifier = Modifier.padding(start = 4.dp, top = 16.dp, bottom = 16.dp), + ) + HorizontalDivider() + } + if (showReportDialog) { + ReportDialog( + title = title, + onClickReportButton = { + onClickReportType(id, reportTypeUiModel) + onDismissRequest() + }, + onDismissRequest = { showReportDialog = false }, + ) + } +} \ No newline at end of file diff --git a/core/ui/src/main/res/drawable/ic_chat.xml b/core/ui/src/main/res/drawable/ic_chat.xml new file mode 100644 index 00000000..a2caa1c4 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_chat.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/ui/src/main/res/drawable/ic_complain.xml b/core/ui/src/main/res/drawable/ic_complain.xml new file mode 100644 index 00000000..4022176f --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_complain.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/ui/src/main/res/drawable/ic_delete.xml b/core/ui/src/main/res/drawable/ic_delete.xml new file mode 100644 index 00000000..048edcc9 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_delete.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/ui/src/main/res/drawable/ic_edit.xml b/core/ui/src/main/res/drawable/ic_edit.xml new file mode 100644 index 00000000..a45e6ab1 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_edit.xml @@ -0,0 +1,13 @@ + + + diff --git a/core/ui/src/main/res/drawable/ic_hide.xml b/core/ui/src/main/res/drawable/ic_hide.xml new file mode 100644 index 00000000..9ff27923 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_hide.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/ui/src/main/res/drawable/ic_more.xml b/core/ui/src/main/res/drawable/ic_more.xml new file mode 100644 index 00000000..eab1c085 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_more.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/core/ui/src/main/res/drawable/ic_send.xml b/core/ui/src/main/res/drawable/ic_send.xml new file mode 100644 index 00000000..314e3002 --- /dev/null +++ b/core/ui/src/main/res/drawable/ic_send.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index 7b910434..c935fcff 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -40,4 +40,24 @@ 정책분야 전체 해제 검색하기 + + + 수정하기 아이콘 + 수정하기 + 삭제하기 아이콘 + 삭제하기 + 신고하기 아이콘 + 신고하기 + 사용자 글 안보기 아이콘 + 이 사용자의 글 보지 않기 + 네트워크 상태를 확인해주세요 + 게시글이 존재하지 않습니다. + 취소하기 + 게시글을 삭제할까요? + 게시글을 삭제하면 모든 데이터가\n삭제되고 다시 볼 수 없어요. + 기본 유저 이미지 + 사진을 불러올 수 없어요 + 댓글 더보기 + 댓글 작성 아이콘 + 댓글을 입력해주세요 diff --git a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostDetailScreen.kt b/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostDetailScreen.kt index 714a3c78..645b9a2b 100644 --- a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostDetailScreen.kt +++ b/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostDetailScreen.kt @@ -52,6 +52,8 @@ import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme import com.withpeace.withpeace.core.designsystem.ui.KeyboardAware import com.withpeace.withpeace.core.designsystem.ui.WithPeaceBackButtonTopAppBar import com.withpeace.withpeace.core.ui.DateUiModel +import com.withpeace.withpeace.core.ui.comment.CommentSection +import com.withpeace.withpeace.core.ui.comment.RegisterCommentSection import com.withpeace.withpeace.core.ui.post.CommentUiModel import com.withpeace.withpeace.core.ui.post.CommentUserUiModel import com.withpeace.withpeace.core.ui.post.PostDetailUiModel @@ -525,9 +527,11 @@ fun ReportTypeItem( } val title = if (isPostReport) reportTypeUiModel.postTitle else reportTypeUiModel.commentTitle Column( - modifier = modifier.clickable { - showReportDialog = true - }.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), + modifier = modifier + .clickable { + showReportDialog = true + } + .padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), ) { Text( text = title, diff --git a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostSection.kt b/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostSection.kt index d573d089..fcab8350 100644 --- a/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostSection.kt +++ b/feature/postdetail/src/main/java/com/withpeace/withpeace/feature/postdetail/PostSection.kt @@ -33,10 +33,10 @@ import com.skydoves.landscapist.glide.GlideImage import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme import com.withpeace.withpeace.core.ui.DateUiModel import com.withpeace.withpeace.core.ui.R +import com.withpeace.withpeace.core.ui.comment.CommentSize import com.withpeace.withpeace.core.ui.post.PostTopicUiModel import com.withpeace.withpeace.core.ui.post.PostUserUiModel import com.withpeace.withpeace.core.ui.toRelativeString -import com.withpeace.withpeace.feature.postdetail.R.drawable import com.withpeace.withpeace.feature.postdetail.R.string fun LazyListScope.PostSection( @@ -217,23 +217,3 @@ fun PostUserProfile( } } } - -@Composable -fun CommentSize( - commentSize: Int, -) { - Row( - modifier = Modifier.padding(horizontal = WithpeaceTheme.padding.BasicHorizontalPadding), - verticalAlignment = Alignment.CenterVertically, - ) { - Icon( - painter = painterResource(id = drawable.ic_chat), - contentDescription = "댓글 개수", - modifier = Modifier.padding(end = 4.dp), - ) - Text( - text = "$commentSize", - style = WithpeaceTheme.typography.caption, - ) - } -}