라이브 상세 페이지 추가
This commit is contained in:
83
SodaLive/Sources/Live/Now/All/LiveNowAllView.swift
Normal file
83
SodaLive/Sources/Live/Now/All/LiveNowAllView.swift
Normal file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// LiveNowAllView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/14.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import RefreshableScrollView
|
||||
|
||||
struct LiveNowAllView: View {
|
||||
|
||||
@StateObject var viewModel = LiveViewModel()
|
||||
@StateObject var liveAllViewModel = LiveAllViewModel()
|
||||
|
||||
let onClickParticipant: (Int) -> Void
|
||||
|
||||
var body: some View {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
GeometryReader { proxy in
|
||||
VStack(spacing: 0) {
|
||||
DetailNavigationBar(title: "지금 라이브 중 전체보기")
|
||||
|
||||
RefreshableScrollView(
|
||||
refreshing: $viewModel.isRefresh,
|
||||
action: {
|
||||
viewModel.getLiveNowList()
|
||||
},
|
||||
content: {
|
||||
VStack(spacing: 0) {
|
||||
ForEach(0..<viewModel.liveNowItems.count, id: \.self) { index in
|
||||
let item = viewModel.liveNowItems[index]
|
||||
|
||||
LiveNowAllItemView(item: item)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
self.liveAllViewModel.selectedRoomId = item.roomId
|
||||
withAnimation {
|
||||
self.liveAllViewModel.isShowLiveDetail = true
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if index == viewModel.liveNowItems.count - 1 {
|
||||
viewModel.getLiveNowList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if proxy.safeAreaInsets.bottom > 0 {
|
||||
Rectangle()
|
||||
.foregroundColor(Color.black.opacity(0))
|
||||
.frame(width: screenSize().width, height: 15.3)
|
||||
}
|
||||
}
|
||||
.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
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.getLiveNowList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user