fix(creator): 팬Talk 액션 팝업을 정리한다
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorChannelFanTalkActionPopup: View {
|
||||
let isMine: Bool
|
||||
let isOwnCreatorChannel: Bool
|
||||
struct CreatorChannelActionPopup: View {
|
||||
let canEdit: Bool
|
||||
let canDelete: Bool
|
||||
let onTapEdit: () -> Void
|
||||
let onTapDelete: () -> Void
|
||||
var editTitle = I18n.Explorer.editAction
|
||||
var deleteTitle = I18n.Explorer.deleteAction
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if isMine {
|
||||
actionButton(title: "수정하기", action: onTapEdit)
|
||||
if canEdit {
|
||||
actionButton(title: editTitle, action: onTapEdit)
|
||||
}
|
||||
|
||||
if isMine || isOwnCreatorChannel {
|
||||
actionButton(title: "삭제하기", action: onTapDelete)
|
||||
if canDelete {
|
||||
actionButton(title: deleteTitle, action: onTapDelete)
|
||||
}
|
||||
}
|
||||
.background(Color.gray900)
|
||||
@@ -37,3 +39,19 @@ struct CreatorChannelFanTalkActionPopup: View {
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelFanTalkActionPopup: View {
|
||||
let isMine: Bool
|
||||
let isOwnCreatorChannel: Bool
|
||||
let onTapEdit: () -> Void
|
||||
let onTapDelete: () -> Void
|
||||
|
||||
var body: some View {
|
||||
CreatorChannelActionPopup(
|
||||
canEdit: isMine,
|
||||
canDelete: isMine || isOwnCreatorChannel,
|
||||
onTapEdit: onTapEdit,
|
||||
onTapDelete: onTapDelete
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ struct CreatorChannelFanTalkTabView: View {
|
||||
}
|
||||
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1)
|
||||
.overlay(reportDialog)
|
||||
.overlay(deleteDialog)
|
||||
}
|
||||
|
||||
private var content: some View {
|
||||
@@ -100,9 +99,9 @@ struct CreatorChannelFanTalkTabView: View {
|
||||
let itemFrame = fanTalkItemFrames[fanTalk.fanTalkId] {
|
||||
let isMine = fanTalk.writerId == UserDefaults.int(forKey: .userId)
|
||||
|
||||
CreatorChannelFanTalkActionPopup(
|
||||
isMine: isMine,
|
||||
isOwnCreatorChannel: isOwnCreatorChannel,
|
||||
CreatorChannelActionPopup(
|
||||
canEdit: isMine,
|
||||
canDelete: isMine || isOwnCreatorChannel,
|
||||
onTapEdit: {
|
||||
actionPopupFanTalk = nil
|
||||
onTapEdit(fanTalk)
|
||||
@@ -110,7 +109,9 @@ struct CreatorChannelFanTalkTabView: View {
|
||||
onTapDelete: {
|
||||
actionPopupFanTalk = nil
|
||||
viewModel.presentDeleteDialog(fanTalkId: fanTalk.fanTalkId)
|
||||
}
|
||||
},
|
||||
editTitle: I18n.Explorer.editAction,
|
||||
deleteTitle: I18n.Explorer.deleteAction
|
||||
)
|
||||
.padding(.top, itemFrame.minY + 44)
|
||||
.padding(.trailing, SodaSpacing.s14)
|
||||
@@ -134,26 +135,6 @@ struct CreatorChannelFanTalkTabView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var deleteDialog: some View {
|
||||
if viewModel.isShowDeleteDialog {
|
||||
SodaDialog(
|
||||
title: I18n.MemberChannel.cheersDeleteTitle,
|
||||
desc: I18n.Common.confirmDeleteQuestion,
|
||||
confirmButtonTitle: I18n.Common.delete,
|
||||
confirmButtonAction: {
|
||||
viewModel.isShowDeleteDialog = false
|
||||
viewModel.deleteSelectedFanTalk(creatorId: creatorId)
|
||||
},
|
||||
cancelButtonTitle: I18n.Common.cancel,
|
||||
cancelButtonAction: {
|
||||
viewModel.isShowDeleteDialog = false
|
||||
viewModel.selectedFanTalkId = 0
|
||||
},
|
||||
textAlignment: .center
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private static let coordinateSpaceName = "CreatorChannelFanTalkTabView"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user