feat: 메인 홈 - 라이브 중
- 터치 액션 추가
This commit is contained in:
@@ -11,6 +11,7 @@ import Kingfisher
|
||||
struct HomeLiveItemView: View {
|
||||
|
||||
let item: GetRoomListResponse
|
||||
let onClickItem: (Int) -> Void
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 16) {
|
||||
@@ -65,6 +66,8 @@ struct HomeLiveItemView: View {
|
||||
lineWidth: 1
|
||||
)
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { onClickItem(item.roomId) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,5 +91,5 @@ struct HomeLiveItemView: View {
|
||||
isReservation: false,
|
||||
isPrivateRoom: false
|
||||
)
|
||||
)
|
||||
) { _ in }
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import SwiftUI
|
||||
|
||||
struct HomeTabView: View {
|
||||
@StateObject var viewModel = HomeTabViewModel()
|
||||
@StateObject var liveViewModel = LiveViewModel()
|
||||
|
||||
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||
@AppStorage("role") private var role: String = UserDefaults.string(forKey: UserDefaultsKey.role)
|
||||
|
||||
@@ -50,8 +52,25 @@ struct HomeTabView: View {
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 16) {
|
||||
ForEach(0..<viewModel.liveList.count, id: \.self) {
|
||||
HomeLiveItemView(item: viewModel.liveList[$0])
|
||||
ForEach(0..<viewModel.liveList.count, id: \.self) { index in
|
||||
HomeLiveItemView(item: viewModel.liveList[index]) { roomId in
|
||||
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
AppState.shared.setAppStep(
|
||||
step: .liveDetail(
|
||||
roomId: roomId,
|
||||
onClickParticipant: {
|
||||
AppState.shared.isShowPlayer = false
|
||||
liveViewModel.enterLiveRoom(roomId: roomId)
|
||||
},
|
||||
onClickReservation: {},
|
||||
onClickStart: {},
|
||||
onClickCancel: {}
|
||||
)
|
||||
)
|
||||
} else {
|
||||
AppState.shared.setAppStep(step: .login)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
|
||||
Reference in New Issue
Block a user