feat(series-all): 시리즈 전체보기 UI 수정
- 기존 3단 구성에서 2단 구성으로 변경 - NavigationBar 제목에 OOO님의 시리즈 전체보기로 변경
This commit is contained in:
@@ -128,7 +128,7 @@ enum AppStep {
|
|||||||
|
|
||||||
case seriesDetail(seriesId: Int)
|
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)
|
case seriesContentAll(seriesId: Int, seriesTitle: String)
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,46 @@ import SwiftUI
|
|||||||
struct SeriesListAllView: View {
|
struct SeriesListAllView: View {
|
||||||
|
|
||||||
@ObservedObject var viewModel = SeriesListAllViewModel()
|
@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 {
|
var body: some View {
|
||||||
|
NavigationView {
|
||||||
BaseView(isLoading: $viewModel.isLoading) {
|
BaseView(isLoading: $viewModel.isLoading) {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
DetailNavigationBar(title: "시리즈 전체보기")
|
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) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
LazyVGrid(columns: columns, spacing: 33.3) {
|
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
|
ForEach(0..<viewModel.seriesList.count, id: \.self) { index in
|
||||||
let item = viewModel.seriesList[index]
|
let item = viewModel.seriesList[index]
|
||||||
SeriesListItemView(itemWidth: (screenSize().width - 40) / 3, item: item)
|
NavigationLink {
|
||||||
|
SeriesDetailView(seriesId: item.seriesId)
|
||||||
|
} label: {
|
||||||
|
SeriesListItemView(itemWidth: width, item: item)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
|
||||||
AppState.shared
|
|
||||||
.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
|
|
||||||
}
|
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if index == viewModel.seriesList.count - 1 {
|
if index == viewModel.seriesList.count - 1 {
|
||||||
viewModel.getSeriesList()
|
viewModel.getSeriesList()
|
||||||
@@ -36,20 +57,18 @@ struct SeriesListAllView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(13.3)
|
}
|
||||||
|
.padding(horizontalPadding)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
columns = [
|
viewModel.creatorId = creatorId ?? 0
|
||||||
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()
|
viewModel.getSeriesList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ struct ContentView: View {
|
|||||||
case .contentAllByTheme(let themeId):
|
case .contentAllByTheme(let themeId):
|
||||||
ContentAllByThemeView(themeId: themeId)
|
ContentAllByThemeView(themeId: themeId)
|
||||||
|
|
||||||
case .seriesAll(let creatorId):
|
case .seriesAll(let creatorId, let creatorNickname, let isOriginal):
|
||||||
SeriesListAllView(creatorId: creatorId)
|
SeriesListAllView(creatorId: creatorId, creatorNickname: creatorNickname, isOriginal: isOriginal)
|
||||||
|
|
||||||
case .seriesDetail(let seriesId):
|
case .seriesDetail(let seriesId):
|
||||||
SeriesDetailView(seriesId: seriesId)
|
SeriesDetailView(seriesId: seriesId)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import SwiftUI
|
|||||||
|
|
||||||
struct UserProfileSeriesView: View {
|
struct UserProfileSeriesView: View {
|
||||||
let creatorId: Int
|
let creatorId: Int
|
||||||
|
let creatorNickname: String
|
||||||
let items: [SeriesListItem]
|
let items: [SeriesListItem]
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -25,7 +26,7 @@ struct UserProfileSeriesView: View {
|
|||||||
.foregroundColor(Color(hex: "78909C"))
|
.foregroundColor(Color(hex: "78909C"))
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
AppState.shared
|
AppState.shared
|
||||||
.setAppStep(step: .seriesAll(creatorId: creatorId))
|
.setAppStep(step: .seriesAll(creatorId: creatorId, creatorNickname: creatorNickname))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24)
|
.padding(.horizontal, 24)
|
||||||
@@ -46,6 +47,7 @@ struct UserProfileSeriesView: View {
|
|||||||
#Preview {
|
#Preview {
|
||||||
UserProfileSeriesView(
|
UserProfileSeriesView(
|
||||||
creatorId: 1,
|
creatorId: 1,
|
||||||
|
creatorNickname: "",
|
||||||
items: [
|
items: [
|
||||||
SeriesListItem(
|
SeriesListItem(
|
||||||
seriesId: 1,
|
seriesId: 1,
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ struct UserProfileView: View {
|
|||||||
if !creatorProfile.seriesList.isEmpty {
|
if !creatorProfile.seriesList.isEmpty {
|
||||||
UserProfileSeriesView(
|
UserProfileSeriesView(
|
||||||
creatorId: creatorProfile.creator.creatorId,
|
creatorId: creatorProfile.creator.creatorId,
|
||||||
|
creatorNickname: creatorProfile.creator.nickname,
|
||||||
items: creatorProfile.seriesList
|
items: creatorProfile.seriesList
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user