Files
sodalive-ios/SodaLive/Sources/Content/Main/V2/Series/Completed/CompletedSeriesView.swift

73 lines
2.4 KiB
Swift

//
// CompletedSeriesView.swift
// SodaLive
//
// Created by klaus on 2/22/25.
//
import SwiftUI
struct CompletedSeriesView: View {
@StateObject var viewModel = CompletedSeriesViewModel()
private let columns = [
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible())
]
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 13.3) {
DetailNavigationBar(title: "완결 시리즈")
HStack(alignment: .center, spacing: 0) {
Text("전체")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(.graye2)
Text("\(viewModel.totalCount)")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(.mainRed)
.padding(.leading, 6.7)
Text("")
.appFont(size: 13.3, weight: .medium)
.foregroundColor(.graye2)
Spacer()
}
.padding(.horizontal, 13.3)
ScrollView(.vertical, showsIndicators: false) {
LazyVGrid(columns: columns, spacing: 13.3) {
ForEach(0..<viewModel.rankCompleteSeriesList.count, id: \.self) { index in
let item = viewModel.rankCompleteSeriesList[index]
SeriesListItemView(
itemWidth: (screenSize().width - (13.3 * 4)) / 3,
item: item
)
.onAppear {
if index == viewModel.rankCompleteSeriesList.count - 1 {
viewModel.getCompletedSeries()
}
}
}
}
.padding(.horizontal, 13.3)
}
}
}
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2)
.onAppear {
viewModel.getCompletedSeries()
}
}
}
#Preview {
CompletedSeriesView()
}