응원글 전체보기 - 응원글 삭제기능 추가

This commit is contained in:
Yu Sung
2023-09-09 00:38:55 +09:00
parent 948b1fd2b3
commit 1f992a11dc
5 changed files with 39 additions and 71 deletions

View File

@@ -14,6 +14,7 @@ struct UserProfileFanTalkAllView: View {
@StateObject var viewModel = UserProfileFanTalkViewModel()
@State private var cheersContent: String = ""
@State private var cheersId: Int = 0
var body: some View {
GeometryReader { proxy in
@@ -86,13 +87,16 @@ struct UserProfileFanTalkAllView: View {
viewModel.writeCheersReply(parentCheersId: cheer.cheersId, creatorId: userId, cheersReplyContent: cheersReplyContent)
},
modifyCheer: { cheersId, cheersReplyContent in
viewModel.modifyCheers(cheersId: cheersId, creatorId: userId, cheersReplyContent: cheersReplyContent)
viewModel.modifyCheers(cheersId: cheersId, creatorId: userId, cheersContent: cheersReplyContent)
},
reportPopup: { cheersId in
viewModel.reportCheersId = cheersId
viewModel.isShowCheersReportMenu = true
viewModel.isShowCheersReportView = true
},
onClickDelete: { _ in }
onClickDelete: { cheersId in
self.cheersId = cheersId
viewModel.isShowCheersDeleteView = true
}
)
.onAppear {
if index == viewModel.cheersList.count - 1 {
@@ -142,22 +146,6 @@ struct UserProfileFanTalkAllView: View {
}
ZStack {
if viewModel.isShowCheersReportMenu {
VStack(spacing: 0) {
CheersReportMenuView(
isShowing: $viewModel.isShowCheersReportMenu,
onClickReport: { viewModel.isShowCheersReportView = true }
)
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.frame(width: proxy.size.width, height: 15.3)
}
}
.ignoresSafeArea()
}
if viewModel.isShowCheersReportView {
CheersReportDialogView(
isShowing: $viewModel.isShowCheersReportView,
@@ -166,6 +154,23 @@ struct UserProfileFanTalkAllView: View {
}
)
}
if viewModel.isShowCheersDeleteView {
if viewModel.isShowCheersDeleteView {
SodaDialog(
title: "응원글 삭제",
desc: "삭제하시겠습니까?",
confirmButtonTitle: "삭제",
confirmButtonAction: {
viewModel.modifyCheers(cheersId: cheersId, creatorId: userId, isActive: false)
viewModel.isShowCheersDeleteView = false
self.cheersId = 0
},
cancelButtonTitle: "취소",
cancelButtonAction: { viewModel.isShowCheersDeleteView = false }
)
}
}
}
}
}