feat(series-all): 시리즈 전체보기 UI 수정

- 기존 3단 구성에서 2단 구성으로 변경
- NavigationBar 제목에 OOO님의 시리즈 전체보기로 변경
This commit is contained in:
Yu Sung
2025-11-14 17:55:23 +09:00
parent c4a7742514
commit ed48efd58d
5 changed files with 58 additions and 36 deletions

View File

@@ -10,44 +10,63 @@ import SwiftUI
struct SeriesListAllView: View {
@ObservedObject var viewModel = SeriesListAllViewModel()
@State var columns: [GridItem] = []
let creatorId: Int
var creatorId: Int? = nil
var creatorNickname: String? = nil
var isOriginal = false
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) {
DetailNavigationBar(title: "시리즈 전체보기")
ScrollView(.vertical, showsIndicators: false) {
LazyVGrid(columns: columns, spacing: 33.3) {
ForEach(0..<viewModel.seriesList.count, id: \.self) { index in
let item = viewModel.seriesList[index]
SeriesListItemView(itemWidth: (screenSize().width - 40) / 3, item: item)
.contentShape(Rectangle())
.onTapGesture {
AppState.shared
.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
}
.onAppear {
if index == viewModel.seriesList.count - 1 {
viewModel.getSeriesList()
}
}
}
NavigationView {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) {
if isOriginal {
DetailNavigationBar(title: "오직 보이스온에서만")
} else {
DetailNavigationBar(title: "\(creatorNickname ?? "") 님의 시리즈 전체보기")
}
let horizontalPadding: CGFloat = 24
let gridSpacing: CGFloat = 16
let width = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
ScrollView(.vertical, showsIndicators: false) {
LazyVGrid(
columns: Array(
repeating: GridItem(
.flexible(),
spacing: gridSpacing,
alignment: .topLeading
),
count: 2
),
alignment: .leading,
spacing: gridSpacing
) {
ForEach(0..<viewModel.seriesList.count, id: \.self) { index in
let item = viewModel.seriesList[index]
NavigationLink {
SeriesDetailView(seriesId: item.seriesId)
} label: {
SeriesListItemView(itemWidth: width, item: item)
.contentShape(Rectangle())
.onAppear {
if index == viewModel.seriesList.count - 1 {
viewModel.getSeriesList()
}
}
}
}
}
.padding(horizontalPadding)
}
.padding(13.3)
}
}
}
.onAppear {
columns = [
GridItem(.fixed((screenSize().width - 40) / 3), alignment: .top),
GridItem(.fixed((screenSize().width - 40) / 3), alignment: .top),
GridItem(.fixed((screenSize().width - 40) / 3), alignment: .top)
]
viewModel.creatorId = creatorId
viewModel.getSeriesList()
.onAppear {
viewModel.creatorId = creatorId ?? 0
viewModel.getSeriesList()
}
}
}
}