Files
sodalive-ios/SodaLive/Sources/Live/Now/SectionLiveNowView.swift
Yu Sung b985af4497 성인 라이브 입장에 본인인증 흐름 추가
라이브 지금 항목 탭을 상위에서 처리 가능하도록 노출
2026-02-02 11:48:12 +09:00

105 lines
3.5 KiB
Swift

//
// SectionLiveNowView.swift
// SodaLive
//
// Created by klaus on 2023/08/09.
//
import SwiftUI
struct SectionLiveNowView: View {
let items: [GetRoomListResponse]
let onClickParticipant: (Int) -> Void
let onTapItem: (GetRoomListResponse) -> Void
let onTapCreateLive: () -> Void
let onClickRefresh: () -> Void
var body: some View {
LazyVStack(spacing: 13.3) {
HStack(spacing: 0) {
Text("지금 라이브중")
.appFont(size: 24, weight: .bold)
.foregroundColor(.white)
Spacer()
if items.count > 0 {
Text("전체보기")
.appFont(size: 14, weight: .regular)
.foregroundColor(Color(hex: "78909C"))
.onTapGesture { AppState.shared.setAppStep(step: .liveNowAll(onClickParticipant: onClickParticipant)) }
}
}
.padding(.horizontal, 24)
.frame(maxWidth: .infinity)
if items.count > 0 {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(alignment: .top, spacing: 16) {
ForEach(items, id: \.self) { item in
LiveNowItemView(item: item, itemWidth: nil)
.contentShape(Rectangle())
.onTapGesture {
onTapItem(item)
}
}
}
.padding(.horizontal, 24)
}
} else {
VStack(spacing: 0) {
Image("ic_no_item")
.resizable()
.frame(width: 60, height: 60)
Text("마이페이지에서 본인인증을 하거나\n라이브를 예약하고 참여해보세요.")
.appFont(size: 13, weight: .medium)
.foregroundColor(Color(hex: "bbbbbb"))
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.lineSpacing(8)
.padding(.vertical, 8)
}
.padding(.vertical, 16.7)
.frame(maxWidth: .infinity)
.background(Color(hex: "13181b"))
.padding(.horizontal, 24)
.cornerRadius(4.7)
}
HStack(spacing: 8) {
Image("ic_refresh")
Text("새로고침")
.appFont(size: 14.7, weight: .medium)
.foregroundColor(Color.grayd2)
}
.padding(.vertical, 11)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
.overlay(
RoundedRectangle(cornerRadius: 26.7)
.stroke(Color.gray90, lineWidth: 1)
)
.padding(.horizontal, 24)
.onTapGesture {
onClickRefresh()
}
}
}
}
struct SectionLiveNowView_Previews: PreviewProvider {
static var previews: some View {
SectionLiveNowView(
items: [],
onClickParticipant: { _ in },
onTapItem: { _ in },
onTapCreateLive: {},
onClickRefresh: {}
)
}
}