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

@@ -128,7 +128,7 @@ enum AppStep {
case seriesDetail(seriesId: Int)
case seriesAll(creatorId: Int)
case seriesAll(creatorId: Int? = nil, creatorNickname: String? = nil, isOriginal: Bool = false)
case seriesContentAll(seriesId: Int, seriesTitle: String)

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()
}
}
}
}

View File

@@ -193,8 +193,8 @@ struct ContentView: View {
case .contentAllByTheme(let themeId):
ContentAllByThemeView(themeId: themeId)
case .seriesAll(let creatorId):
SeriesListAllView(creatorId: creatorId)
case .seriesAll(let creatorId, let creatorNickname, let isOriginal):
SeriesListAllView(creatorId: creatorId, creatorNickname: creatorNickname, isOriginal: isOriginal)
case .seriesDetail(let seriesId):
SeriesDetailView(seriesId: seriesId)

View File

@@ -9,6 +9,7 @@ import SwiftUI
struct UserProfileSeriesView: View {
let creatorId: Int
let creatorNickname: String
let items: [SeriesListItem]
var body: some View {
@@ -25,7 +26,7 @@ struct UserProfileSeriesView: View {
.foregroundColor(Color(hex: "78909C"))
.onTapGesture {
AppState.shared
.setAppStep(step: .seriesAll(creatorId: creatorId))
.setAppStep(step: .seriesAll(creatorId: creatorId, creatorNickname: creatorNickname))
}
}
.padding(.horizontal, 24)
@@ -46,6 +47,7 @@ struct UserProfileSeriesView: View {
#Preview {
UserProfileSeriesView(
creatorId: 1,
creatorNickname: "",
items: [
SeriesListItem(
seriesId: 1,

View File

@@ -328,6 +328,7 @@ struct UserProfileView: View {
if !creatorProfile.seriesList.isEmpty {
UserProfileSeriesView(
creatorId: creatorProfile.creator.creatorId,
creatorNickname: creatorProfile.creator.nickname,
items: creatorProfile.seriesList
)
}