fix(creator): 팬Talk 액션 팝업을 정리한다

This commit is contained in:
Yu Sung
2026-07-07 15:44:45 +09:00
parent 75aa99768e
commit f2d589eca2
8 changed files with 170 additions and 78 deletions

View File

@@ -3608,6 +3608,14 @@ If you block this user, the following features will be restricted.
pick(ko: "수정", en: "Edit", ja: "編集")
}
static var editAction: String {
pick(ko: "수정하기", en: "Edit", ja: "編集する")
}
static var deleteAction: String {
pick(ko: "삭제하기", en: "Delete", ja: "削除する")
}
static var report: String {
pick(ko: "신고", en: "Report", ja: "通報")
}

View File

@@ -156,6 +156,10 @@ struct CreatorChannelView: View {
authConfirmDialog
}
if viewModel.selectedTab == .fanTalk && fanTalkViewModel.isShowDeleteDialog {
fanTalkDeleteDialog
}
if isShowChannelDonationDialog {
LiveRoomDonationDialogView(
isShowing: $isShowChannelDonationDialog,
@@ -338,6 +342,30 @@ struct CreatorChannelView: View {
)
}
private var fanTalkDeleteDialog: some View {
SodaV2ActionModal(
title: I18n.MemberChannel.cheersDeleteTitle,
message: I18n.Common.confirmDeleteQuestion,
button1: SodaV2ActionModalButton(
label: I18n.Common.delete,
action: {
fanTalkViewModel.isShowDeleteDialog = false
fanTalkViewModel.deleteSelectedFanTalk(creatorId: creatorId)
}
),
button2: SodaV2ActionModalButton(
label: I18n.Common.cancel,
action: dismissFanTalkDeleteDialog
),
onDimmedTap: dismissFanTalkDeleteDialog
)
}
private func dismissFanTalkDeleteDialog() {
fanTalkViewModel.isShowDeleteDialog = false
fanTalkViewModel.selectedFanTalkId = 0
}
private var authView: some View {
BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
.onConfirm { _ in true }

View File

@@ -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
)
}
}

View File

@@ -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"
}

View File

@@ -7,33 +7,13 @@ struct CreatorChannelReplyDetailActionPopup: View {
let onTapDelete: () -> Void
var body: some View {
VStack(alignment: .leading, spacing: 0) {
if canEdit {
actionButton(title: I18n.Explorer.edit, action: onTapEdit)
}
if canDelete {
actionButton(title: I18n.Common.delete, action: onTapDelete)
}
}
.background(Color.gray900)
.cornerRadius(14)
.overlay(
RoundedRectangle(cornerRadius: 14, style: .continuous)
.stroke(Color.gray700, lineWidth: 1)
CreatorChannelActionPopup(
canEdit: canEdit,
canDelete: canDelete,
onTapEdit: onTapEdit,
onTapDelete: onTapDelete,
editTitle: I18n.Explorer.editAction,
deleteTitle: I18n.Explorer.deleteAction
)
}
private func actionButton(title: String, action: @escaping () -> Void) -> some View {
Button(action: action) {
Text(title)
.appFont(size: 14, weight: .medium)
.foregroundColor(.white)
.lineLimit(1)
.frame(minWidth: 80, alignment: .leading)
.padding(.horizontal, SodaSpacing.s12)
.padding(.vertical, SodaSpacing.s8)
}
.buttonStyle(.plain)
}
}

View File

@@ -45,17 +45,18 @@ struct CreatorChannelReplyDetailView: View {
}
if viewModel.isShowDeleteDialog {
SodaDialog(
SodaV2ActionModal(
title: I18n.Common.commentDeleteTitle,
desc: I18n.Common.confirmDeleteQuestion,
confirmButtonTitle: I18n.Common.delete,
confirmButtonAction: viewModel.confirmDelete,
cancelButtonTitle: I18n.Common.cancel,
cancelButtonAction: {
viewModel.isShowDeleteDialog = false
viewModel.deletingItem = nil
},
textAlignment: .center
message: I18n.Common.confirmDeleteQuestion,
button1: SodaV2ActionModalButton(
label: I18n.Common.delete,
action: viewModel.confirmDelete
),
button2: SodaV2ActionModalButton(
label: I18n.Common.cancel,
action: dismissDeleteDialog
),
onDimmedTap: dismissDeleteDialog
)
}
}
@@ -65,4 +66,9 @@ struct CreatorChannelReplyDetailView: View {
}
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1)
}
private func dismissDeleteDialog() {
viewModel.isShowDeleteDialog = false
viewModel.deletingItem = nil
}
}