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

@@ -14,117 +14,92 @@ struct LiveNowAllItemView: View {
let itemWidth: CGFloat
var body: some View {
VStack(alignment: .leading, spacing: 8) {
ZStack {
KFImage(URL(string: item.coverImageUrl))
.cancelOnDisappear(true)
.downsampling(
size: CGSize(
width: itemWidth,
height: itemWidth * 144 / 102
)
)
.resizable()
.scaledToFill()
.frame(width: itemWidth, height: itemWidth * 144 / 102, alignment: .center)
.cornerRadius(4.7)
.clipped()
LinearGradient(
colors: [Color.black.opacity(0.1), Color.black.opacity(0.8)],
startPoint: .top,
endPoint: .bottom
)
VStack(alignment: .trailing, spacing: 0) {
HStack(spacing: 0) {
HStack(spacing: 1) {
if item.price > 0 {
Image("ic_can_white")
}
Text(item.price > 0 ? "\(item.price)" : I18n.CreateContent.free)
.appFont(size: 12, weight: .medium)
.foregroundColor(Color.white)
}
.padding(.horizontal, 7.3)
.padding(.vertical, 4)
.background(item.price > 0 ? Color.mainRed3 : Color.gray11)
.cornerRadius(13.3)
Spacer()
if item.isPrivateRoom {
Image("ic_lock")
.resizable()
.frame(width: 20, height: 20)
.padding(2.7)
.background(Color.gray33.opacity(0.7))
.clipShape(Circle())
}
}
.padding(.horizontal, 3.3)
.padding(.top, 3.3)
Spacer()
if item.numberOfPeople - item.numberOfParticipate < 3 {
HStack(spacing: 0) {
Spacer()
HStack(spacing: 2) {
Text(I18n.LiveNow.remaining)
.appFont(size: 12, weight: .medium)
.foregroundColor(Color.grayee)
Text("\(item.numberOfPeople - item.numberOfParticipate)")
.appFont(size: 12, weight: .medium)
.foregroundColor(Color.button)
}
.padding(.horizontal, 4)
.padding(.vertical, 3)
.background(Color.gray33.opacity(0.7))
.cornerRadius(13.3)
}
.padding(.horizontal, 3.3)
.padding(.bottom, 3.3)
}
HStack(alignment: .center, spacing: 14) {
KFImage(URL(string: item.creatorProfileImage))
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: 75, height: 75))
.resizable()
.scaledToFill()
.frame(width: 75, height: 75)
.clipShape(Circle())
VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 8) {
liveTag
Text(startTimeText)
.appFont(size: 14, weight: .regular)
.foregroundColor(Color.gray500)
}
Text(item.title)
.appFont(size: 18, weight: .bold)
.foregroundColor(.white)
.lineLimit(1)
.truncationMode(.tail)
Text(item.creatorNickname)
.appFont(size: 14, weight: .regular)
.foregroundColor(Color.gray500)
.lineLimit(1)
.truncationMode(.tail)
}
.frame(width: itemWidth, height: itemWidth * 144 / 102)
Text("\(item.title)")
.appFont(size: 12, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
.lineLimit(2)
.fixedSize(horizontal: false, vertical: true)
if item.tags.count > 0 {
Text("\(item.tags.map { "#\($0)" }.joined(separator: " "))")
.appFont(size: 11, weight: .medium)
.foregroundColor(Color.button)
}
HStack(spacing: 5.3) {
KFImage(URL(string: item.creatorProfileImage))
.cancelOnDisappear(true)
.downsampling(
size: CGSize(
width: 21.3,
height: 21.3
)
)
.resizable()
.scaledToFill()
.frame(width: 21.3, height: 21.3, alignment: .center)
.clipShape(Circle())
Text("\(item.creatorNickname)")
.appFont(size: 10, weight: .medium)
.foregroundColor(Color.gray77)
}
.frame(maxWidth: .infinity, alignment: .leading)
priceView
}
.frame(width: itemWidth)
.frame(width: itemWidth, height: 99)
}
private var liveTag: some View {
HStack(spacing: 4) {
Circle()
.fill(Color.red400)
.frame(width: 8, height: 8)
Text("LIVE")
.appFont(size: 12, weight: .regular)
.foregroundColor(.white)
}
.padding(.horizontal, 4)
.padding(.vertical, 2)
.frame(height: 18)
.background(Color.black)
.clipShape(Capsule())
}
@ViewBuilder
private var priceView: some View {
if item.price > 0 {
HStack(spacing: 2) {
Image("ic_bar_cash")
.resizable()
.scaledToFit()
.frame(width: 18, height: 18)
Text("\(item.price)")
.appFont(size: 14, weight: .regular)
.foregroundColor(.white)
.lineLimit(1)
}
.padding(.trailing, 7)
.frame(width: 60, alignment: .trailing)
} else {
Text(I18n.CreateContent.free)
.appFont(size: 14, weight: .regular)
.foregroundColor(.white)
.lineLimit(1)
.padding(.trailing, 7)
.frame(width: 60, alignment: .trailing)
}
}
private var startTimeText: String {
guard let date = DateParser.parse(item.beginDateTimeUtc) else {
return item.beginDateTimeUtc
}
return date.convertDateFormat(dateFormat: "HH:mm")
}
}

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

View File

@@ -11,7 +11,6 @@ struct SectionLiveNowView: View {
let items: [GetRoomListResponse]
let onClickParticipant: (Int) -> Void
let onTapItem: (GetRoomListResponse) -> Void
let onTapCreateLive: () -> Void
let onClickRefresh: () -> Void
@@ -29,7 +28,7 @@ struct SectionLiveNowView: View {
Text(I18n.Common.viewAll)
.appFont(size: 14, weight: .regular)
.foregroundColor(Color(hex: "78909C"))
.onTapGesture { AppState.shared.setAppStep(step: .liveNowAll(onClickParticipant: onClickParticipant)) }
.onTapGesture { AppState.shared.setAppStep(step: .liveNowAll) }
}
}
.padding(.horizontal, 24)
@@ -95,7 +94,6 @@ struct SectionLiveNowView_Previews: PreviewProvider {
static var previews: some View {
SectionLiveNowView(
items: [],
onClickParticipant: { _ in },
onTapItem: { _ in },
onTapCreateLive: {},
onClickRefresh: {}