Skip to content

Commit 29c3ed7

Browse files
committed
[refactor]: 내 기록은 pin할 수 있도록 수정 (#50)
1 parent d4107eb commit 29c3ed7

4 files changed

Lines changed: 46 additions & 3 deletions

File tree

app/src/main/java/com/texthip/thip/ui/group/note/component/TextCommentCard.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ fun TextCommentCard(
2929
modifier: Modifier = Modifier,
3030
data: GroupNoteRecord,
3131
onCommentClick: () -> Unit = {},
32-
onLongPress: () -> Unit = {}
32+
onLongPress: () -> Unit = {},
33+
onPinClick: () -> Unit = {}
3334
) {
3435
var isLiked by remember { mutableStateOf(data.isLiked) }
3536
val isLocked = data.isLocked
37+
val isWriter = data.isWriter
3638

3739
Column(
3840
modifier = modifier
@@ -65,12 +67,16 @@ fun TextCommentCard(
6567
isLiked = isLiked,
6668
likeCount = data.likeCount,
6769
commentCount = data.commentCount,
70+
isPinVisible = isWriter,
6871
onLikeClick = {
6972
if (!isLocked) isLiked = !isLiked
7073
},
7174
onCommentClick = {
7275
if (!isLocked) onCommentClick()
7376
},
77+
onPinClick = {
78+
if (!isLocked) onPinClick()
79+
}
7480
)
7581
}
7682
}

app/src/main/java/com/texthip/thip/ui/group/note/component/VoteCommentCard.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ fun VoteCommentCard(
3131
modifier: Modifier = Modifier,
3232
data: GroupNoteVote,
3333
onCommentClick: () -> Unit = {},
34-
onLongPress: () -> Unit = {}
34+
onLongPress: () -> Unit = {},
35+
onPinClick: () -> Unit = {}
3536
) {
3637
var isLiked by remember { mutableStateOf(data.isLiked) }
3738
var selected by remember { mutableStateOf<Int?>(null) }
3839
var voteItems by remember { mutableStateOf(data.voteItems) }
3940
val hasVoted = voteItems.any { it.isVoted }
4041

4142
val isLocked = data.isLocked
43+
val isWriter = data.isWriter
4244

4345
Column(
4446
modifier = modifier
@@ -91,12 +93,16 @@ fun VoteCommentCard(
9193
isLiked = isLiked,
9294
likeCount = data.likeCount,
9395
commentCount = data.commentCount,
96+
isPinVisible = isWriter,
9497
onLikeClick = {
9598
if (!isLocked) isLiked = !isLiked
9699
},
97100
onCommentClick = {
98101
if (!isLocked) onCommentClick()
99102
},
103+
onPinClick = {
104+
if (!isLocked) onPinClick()
105+
}
100106
)
101107
}
102108
}

app/src/main/java/com/texthip/thip/ui/group/note/screen/GroupNoteScreen.kt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import com.texthip.thip.ui.common.buttons.ExpandableFloatingButton
3838
import com.texthip.thip.ui.common.buttons.FabMenuItem
3939
import com.texthip.thip.ui.common.buttons.FilterButton
4040
import com.texthip.thip.ui.common.header.HeaderMenuBarTab
41+
import com.texthip.thip.ui.common.modal.DialogPopup
4142
import com.texthip.thip.ui.common.modal.ToastWithDate
4243
import com.texthip.thip.ui.common.topappbar.DefaultTopAppBar
4344
import com.texthip.thip.ui.group.note.component.CommentBottomSheet
@@ -80,6 +81,8 @@ fun GroupNoteScreen() {
8081

8182
var isMenuBottomSheetVisible by rememberSaveable { mutableStateOf(false) }
8283

84+
var isPinDialogVisible by remember { mutableStateOf(false) }
85+
8386
var showToast by remember { mutableStateOf(false) }
8487

8588
// 토스트 3초
@@ -91,7 +94,7 @@ fun GroupNoteScreen() {
9194
}
9295

9396
Box(
94-
if (isCommentBottomSheetVisible || isMenuBottomSheetVisible) {
97+
if (isCommentBottomSheetVisible || isMenuBottomSheetVisible || isPinDialogVisible) {
9598
Modifier
9699
.fillMaxSize()
97100
.blur(5.dp)
@@ -206,6 +209,9 @@ fun GroupNoteScreen() {
206209
onLongPress = {
207210
selectedItemForMenu = item
208211
isMenuBottomSheetVisible = true
212+
},
213+
onPinClick = {
214+
isPinDialogVisible = true
209215
}
210216
)
211217

@@ -219,6 +225,9 @@ fun GroupNoteScreen() {
219225
onLongPress = {
220226
selectedItemForMenu = item
221227
isMenuBottomSheetVisible = true
228+
},
229+
onPinClick = {
230+
isPinDialogVisible = true
222231
}
223232
)
224233
}
@@ -330,6 +339,26 @@ fun GroupNoteScreen() {
330339
}
331340
)
332341
}
342+
343+
if (isPinDialogVisible) {
344+
Box(
345+
modifier = Modifier
346+
.fillMaxSize(),
347+
contentAlignment = Alignment.Center
348+
) {
349+
DialogPopup(
350+
title = stringResource(R.string.pin_modal_title),
351+
description = stringResource(R.string.pin_modal_content),
352+
onConfirm = {
353+
// 핀하기 로직
354+
isPinDialogVisible = false
355+
},
356+
onCancel = {
357+
isPinDialogVisible = false
358+
}
359+
)
360+
}
361+
}
333362
}
334363

335364
@Preview

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@
203203
<string name="no_my_record_subtext">나의 첫번째 기록을 남겨보세요</string>
204204
<string name="no_comments_yet">아직 댓글이 없어요.</string>
205205
<string name="no_comment_subtext">첫번째 댓글을 남겨보세요</string>
206+
<string name="pin_modal_title">이 기록을 피드에 핀할까요?</string>
207+
<string name="pin_modal_content">핀하면 내 피드에 글을 옮길 수 있어요.</string>
206208

207209
<!-- alarm -->
208210
<string name="alarm_feed">피드</string>

0 commit comments

Comments
 (0)