fix(main): 현재 라이브 전체보기를 보정한다

This commit is contained in:
Yu Sung
2026-08-03 15:37:27 +09:00
parent 498debbfc7
commit dc99bdf9c9
10 changed files with 172 additions and 160 deletions

View File

@@ -13,7 +13,6 @@ import BootpayUI
struct LiveNowAllView: View {
@StateObject var viewModel = LiveViewModel()
@StateObject var liveAllViewModel = LiveAllViewModel()
@StateObject var mypageViewModel = MyPageViewModel()
let spacing: CGFloat = 16
@@ -25,15 +24,6 @@ struct LiveNowAllView: View {
@State private var isShowAuthConfirmView = false
@State private var pendingAction: (() -> Void)? = nil
@State private var payload = Payload()
var columns: [GridItem] {
[
GridItem(.flexible(), spacing: spacing, alignment: .top),
GridItem(.flexible(), spacing: spacing, alignment: .top)
]
}
let onClickParticipant: (Int) -> Void
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
@@ -50,13 +40,13 @@ struct LiveNowAllView: View {
viewModel.getLiveNowList()
},
content: {
let itemWidth = (proxy.size.width - (spacing * 3)) / 2
let itemWidth = proxy.size.width - (spacing * 2)
LazyVGrid(columns: columns, spacing: spacing) {
LazyVStack(spacing: spacing) {
ForEach(0..<viewModel.liveNowItems.count, id: \.self) { index in
let item = viewModel.liveNowItems[index]
LiveNowItemView(item: item, itemWidth: itemWidth)
LiveNowAllItemView(item: item, itemWidth: itemWidth)
.contentShape(Rectangle())
.onTapGesture {
handleLiveNowItemTap(
@@ -85,24 +75,6 @@ struct LiveNowAllView: View {
.edgesIgnoringSafeArea(.bottom)
}
if liveAllViewModel.isShowLiveDetail {
LiveDetailView(
roomId: liveAllViewModel.selectedRoomId,
onClickParticipant: {
AppState.shared.isShowPlayer = false
onClickParticipant(liveAllViewModel.selectedRoomId)
},
onClickReservation: {},
onClickStart: {},
onClickCancel: {},
onClickClose: {
withAnimation {
liveAllViewModel.isShowLiveDetail = false
}
}
)
}
if isShowAuthConfirmView {
SodaDialog(
title: I18n.Main.Auth.dialogTitle,
@@ -120,6 +92,28 @@ struct LiveNowAllView: View {
textAlignment: .center
)
}
if viewModel.isShowPaymentDialog {
LivePaymentDialog(
title: viewModel.paymentDialogTitle,
desc: viewModel.paymentDialogDesc,
desc2: viewModel.paymentDialogDesc2,
confirmButtonTitle: viewModel.paymentDialogConfirmTitle,
confirmButtonAction: viewModel.paymentDialogConfirmAction,
cancelButtonTitle: viewModel.paymentDialogCancelTitle,
cancelButtonAction: viewModel.hidePopup,
startDateTime: viewModel.liveStartDate,
nowDateTime: viewModel.nowDate
)
}
if viewModel.isShowPasswordDialog {
LiveRoomPasswordDialog(
isShowing: $viewModel.isShowPasswordDialog,
can: viewModel.secretOrPasswordDialogCan,
confirmAction: viewModel.passwordDialogConfirmAction
)
}
}
}
.onAppear {
@@ -160,6 +154,7 @@ struct LiveNowAllView: View {
isShowAuthView = false
}
}
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2)
}
private func handleLiveNowItemTap(roomId: Int, isAdult: Bool) {
@@ -191,13 +186,11 @@ struct LiveNowAllView: View {
}
}
openLiveDetail(roomId: roomId)
enterLiveRoom(roomId: roomId)
}
private func openLiveDetail(roomId: Int) {
liveAllViewModel.selectedRoomId = roomId
withAnimation {
liveAllViewModel.isShowLiveDetail = true
}
private func enterLiveRoom(roomId: Int) {
AppState.shared.isShowPlayer = false
viewModel.enterLiveRoom(roomId: roomId)
}
}