콘텐츠 댓글 - 수정/삭제 추가
This commit is contained in:
@@ -10,12 +10,16 @@ import Kingfisher
|
||||
|
||||
struct AudioContentListReplyView: View {
|
||||
|
||||
let creatorId: Int
|
||||
let audioContentId: Int
|
||||
let parentComment: GetAudioContentCommentListItem
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
|
||||
@StateObject var viewModel = AudioContentListReplyViewModel()
|
||||
|
||||
@State private var commentId: Int = 0
|
||||
@State private var isShowDeletePopup: Bool = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
VStack(spacing: 0) {
|
||||
@@ -87,7 +91,15 @@ struct AudioContentListReplyView: View {
|
||||
.padding(.bottom, 13.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
AudioContentCommentItemView(comment: parentComment, isReplyComment: true)
|
||||
AudioContentCommentItemView(
|
||||
isDisabledNavigationLink: .constant(false),
|
||||
contentCreatorId: creatorId,
|
||||
commentItem: parentComment,
|
||||
isReplyComment: true,
|
||||
isShowPopupMenuButton: false,
|
||||
modifyComment: { _, _ in },
|
||||
onClickDelete: { _ in }
|
||||
)
|
||||
.padding(.horizontal, 26.7)
|
||||
.padding(.bottom, 13.3)
|
||||
|
||||
@@ -95,7 +107,21 @@ struct AudioContentListReplyView: View {
|
||||
LazyVStack(spacing: 13.3) {
|
||||
ForEach(0..<viewModel.commentList.count, id: \.self) { index in
|
||||
let comment = viewModel.commentList[index]
|
||||
AudioContentCommentItemView(comment: comment, isReplyComment: true)
|
||||
AudioContentCommentItemView(
|
||||
isDisabledNavigationLink: .constant(false),
|
||||
contentCreatorId: creatorId,
|
||||
commentItem: comment,
|
||||
isReplyComment: true,
|
||||
isShowPopupMenuButton: true,
|
||||
modifyComment: { commentId, comment in
|
||||
hideKeyboard()
|
||||
viewModel.modifyComment(commentId: commentId, audioContentId: audioContentId, comment: comment)
|
||||
},
|
||||
onClickDelete: {
|
||||
commentId = $0
|
||||
isShowDeletePopup = true
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 40)
|
||||
.onAppear {
|
||||
if index == viewModel.commentList.count - 1 {
|
||||
@@ -108,6 +134,28 @@ struct AudioContentListReplyView: View {
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarBackButtonHidden()
|
||||
|
||||
if isShowDeletePopup && commentId > 0 {
|
||||
SodaDialog(
|
||||
title: "댓글 삭제",
|
||||
desc: "삭제하시겠습니까?",
|
||||
confirmButtonTitle: "삭제",
|
||||
confirmButtonAction: {
|
||||
viewModel.modifyComment(commentId: commentId, audioContentId: audioContentId, isActive: false)
|
||||
commentId = 0
|
||||
isShowDeletePopup = false
|
||||
},
|
||||
cancelButtonTitle: "취소",
|
||||
cancelButtonAction: {
|
||||
commentId = 0
|
||||
isShowDeletePopup = false
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
LoadingView()
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.audioContentId = audioContentId
|
||||
|
Reference in New Issue
Block a user