parent
75b9c76987
commit
ffbdbbaa06
|
@ -121,4 +121,8 @@ enum AppStep {
|
|||
case canCoupon
|
||||
|
||||
case contentAllByTheme(themeId: Int)
|
||||
|
||||
case seriesDetail(seriesId: Int)
|
||||
|
||||
case seriesAll(creatorId: Int)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// GetSeriesListResponse.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 4/29/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct GetSeriesListResponse: Decodable {
|
||||
let totalCount: Int
|
||||
let items: [SeriesListItem]
|
||||
}
|
||||
|
||||
struct SeriesListItem: Decodable {
|
||||
let seriesId: Int
|
||||
let title: String
|
||||
let coverImage: String
|
||||
let publishedDaysOfWeek: String
|
||||
let isComplete: Bool
|
||||
let creator: SeriesListItemCreator
|
||||
let numberOfContent: Int
|
||||
let isNew: Bool
|
||||
let isPopular: Bool
|
||||
}
|
||||
|
||||
struct SeriesListItemCreator: Decodable {
|
||||
let creatorId: Int
|
||||
let nickname: String
|
||||
let profileImage: String
|
||||
}
|
|
@ -17,6 +17,7 @@ struct GetCreatorProfileResponse: Decodable {
|
|||
let communityPostList: [GetCommunityPostListResponse]
|
||||
let cheers: GetCheersResponse
|
||||
let activitySummary: GetCreatorActivitySummary
|
||||
let seriesList: [SeriesListItem]
|
||||
let isBlock: Bool
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
//
|
||||
// UserProfileSeriesView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 4/29/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct UserProfileSeriesView: View {
|
||||
let creatorId: Int
|
||||
let items: [SeriesListItem]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 13.3) {
|
||||
HStack(spacing: 0) {
|
||||
Text("시리즈")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color.grayee)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("전체보기")
|
||||
.font(.custom(Font.light.rawValue, size: 11.3))
|
||||
.foregroundColor(Color.grayee)
|
||||
.onTapGesture {}
|
||||
}
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
ForEach(0..<items.count, id: \.self) {
|
||||
SeriesListBigItemView(item: items[$0])
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(step: .seriesAll(creatorId: creatorId))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
UserProfileSeriesView(
|
||||
creatorId: 1,
|
||||
items: [
|
||||
SeriesListItem(
|
||||
seriesId: 1,
|
||||
title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
|
||||
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
publishedDaysOfWeek: "매주 수, 토요일",
|
||||
isComplete: true,
|
||||
creator: SeriesListItemCreator(
|
||||
creatorId: 1,
|
||||
nickname: "creator",
|
||||
profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
|
||||
),
|
||||
numberOfContent: 10,
|
||||
isNew: true,
|
||||
isPopular: true
|
||||
),
|
||||
SeriesListItem(
|
||||
seriesId: 1,
|
||||
title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
|
||||
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
publishedDaysOfWeek: "매주 수, 토요일",
|
||||
isComplete: true,
|
||||
creator: SeriesListItemCreator(
|
||||
creatorId: 1,
|
||||
nickname: "creator",
|
||||
profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
|
||||
),
|
||||
numberOfContent: 10,
|
||||
isNew: true,
|
||||
isPopular: true
|
||||
)
|
||||
])
|
||||
}
|
|
@ -107,6 +107,15 @@ struct UserProfileView: View {
|
|||
}
|
||||
}
|
||||
|
||||
if !creatorProfile.seriesList.isEmpty {
|
||||
UserProfileSeriesView(
|
||||
creatorId: creatorProfile.creator.creatorId,
|
||||
items: creatorProfile.seriesList
|
||||
)
|
||||
.padding(.top, 26.7)
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
if creatorProfile.contentList.count > 0 ||
|
||||
userId == UserDefaults.int(forKey: .userId)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// SeriesItemBadgeView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 4/29/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SeriesItemBadgeView: View {
|
||||
|
||||
let title: String
|
||||
let backgroundColor: Color
|
||||
|
||||
var body: some View {
|
||||
Text(title)
|
||||
.font(.custom(Font.medium.rawValue, size: 10.3))
|
||||
.foregroundColor(.white)
|
||||
.padding(.vertical, 3.7)
|
||||
.padding(.horizontal, 5.3)
|
||||
.background(backgroundColor)
|
||||
.cornerRadius(13.3)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview("신작") {
|
||||
SeriesItemBadgeView(title: "신작", backgroundColor: .button)
|
||||
}
|
||||
|
||||
#Preview("완결") {
|
||||
SeriesItemBadgeView(title: "완결", backgroundColor: Color(hex: "002abd"))
|
||||
}
|
||||
|
||||
#Preview("인기") {
|
||||
SeriesItemBadgeView(title: "인기", backgroundColor: Color(hex: "ec6033"))
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
//
|
||||
// SeriesListBigItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 4/29/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
import Kingfisher
|
||||
|
||||
struct SeriesListBigItemView: View {
|
||||
|
||||
let item: SeriesListItem
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
ZStack {
|
||||
KFImage(URL(string: item.coverImage))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 116.7, height: 165, alignment: .center)
|
||||
.cornerRadius(5)
|
||||
.clipped()
|
||||
|
||||
LinearGradient(
|
||||
colors: [Color.black.opacity(0.1), Color.black.opacity(0.8)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
)
|
||||
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(spacing: 3.3) {
|
||||
if !item.isComplete && item.isNew {
|
||||
SeriesItemBadgeView(title: "신작", backgroundColor: .button)
|
||||
}
|
||||
|
||||
if item.isComplete {
|
||||
SeriesItemBadgeView(title: "완결", backgroundColor: Color(hex: "002abd"))
|
||||
}
|
||||
|
||||
if item.isPopular {
|
||||
SeriesItemBadgeView(title: "인기", backgroundColor: Color(hex: "ec6033"))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
SeriesItemBadgeView(title: "총 \(item.numberOfContent)화", backgroundColor: Color.gray33.opacity(0.7))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: 116.7, height: 165, alignment: .center)
|
||||
|
||||
Text(item.title)
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color.grayee)
|
||||
.lineLimit(2)
|
||||
|
||||
HStack(spacing: 3) {
|
||||
KFImage(URL(string: item.creator.profileImage))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 16, height: 16, alignment: .center)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(item.creator.nickname)
|
||||
.font(.custom(Font.medium.rawValue, size: 10))
|
||||
.foregroundColor(Color.gray77)
|
||||
}
|
||||
|
||||
Text(item.publishedDaysOfWeek)
|
||||
.font(.custom(Font.medium.rawValue, size: 11))
|
||||
.foregroundColor(Color.gray77)
|
||||
}
|
||||
.frame(width: 116.7)
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SeriesListBigItemView(
|
||||
item: SeriesListItem(
|
||||
seriesId: 1,
|
||||
title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
|
||||
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
publishedDaysOfWeek: "매주 수, 토요일",
|
||||
isComplete: true,
|
||||
creator: SeriesListItemCreator(
|
||||
creatorId: 1,
|
||||
nickname: "creator",
|
||||
profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
|
||||
),
|
||||
numberOfContent: 10,
|
||||
isNew: true,
|
||||
isPopular: true
|
||||
)
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue