diff --git a/SodaLive/Sources/Content/Main/ContentMainRankingView.swift b/SodaLive/Sources/Content/Main/ContentMainRankingView.swift new file mode 100644 index 0000000..254be0d --- /dev/null +++ b/SodaLive/Sources/Content/Main/ContentMainRankingView.swift @@ -0,0 +1,140 @@ +// +// ContentMainRankingView.swift +// SodaLive +// +// Created by klaus on 2023/10/15. +// + +import SwiftUI +import Kingfisher + +struct ContentMainRankingView: View { + + let item: GetAudioContentRanking + + let rows = [ + GridItem(.fixed(60), alignment: .leading), + GridItem(.fixed(60), alignment: .leading), + GridItem(.fixed(60), alignment: .leading) + ] + + var body: some View { + VStack(spacing: 0) { + HStack(spacing: 0) { + Text("인기 콘텐츠") + .font(.custom(Font.bold.rawValue, size: 18.3)) + .foregroundColor(Color(hex: "eeeeee")) + + Spacer() + + Image("ic_forward") + .onTapGesture {} + } + + VStack(spacing: 8) { + Text("\(item.startDate) ~ \(item.endDate)") + .font(.custom(Font.bold.rawValue, size: 14.7)) + .foregroundColor(Color(hex: "eeeeee")) + + Text("※ 인기 콘텐츠의 순위는 매주 업데이트됩니다.") + .font(.custom(Font.light.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "bbbbbb")) + } + .padding(.vertical, 8) + .frame(width: screenSize().width - 26.7) + .background(Color(hex: "222222")) + .padding(.top, 13.3) + + ScrollView(.horizontal, showsIndicators: false) { + LazyHGrid(rows: rows, spacing: 13.3) { + ForEach(0.. 0 { ContentMainCurationView(items: viewModel.curationList) .padding(.top, 40) diff --git a/SodaLive/Sources/Content/Main/ContentMainViewModel.swift b/SodaLive/Sources/Content/Main/ContentMainViewModel.swift index 06480e1..98d4d2e 100644 --- a/SodaLive/Sources/Content/Main/ContentMainViewModel.swift +++ b/SodaLive/Sources/Content/Main/ContentMainViewModel.swift @@ -24,6 +24,7 @@ final class ContentMainViewModel: ObservableObject { @Published var orderList = [GetAudioContentMainItem]() @Published var themeList = [String]() @Published var curationList = [GetAudioContentCurationResponse]() + @Published var contentRanking: GetAudioContentRanking? = nil @Published var selectedTheme = "전체" { didSet { @@ -64,6 +65,7 @@ final class ContentMainViewModel: ObservableObject { self.bannerList.append(contentsOf: data.bannerList) self.orderList.append(contentsOf: data.orderList) self.curationList.append(contentsOf: data.curationList) + self.contentRanking = data.contentRanking self.themeList.append("전체") self.themeList.append(contentsOf: data.themeList) diff --git a/SodaLive/Sources/Content/Main/GetAudioContentMainResponse.swift b/SodaLive/Sources/Content/Main/GetAudioContentMainResponse.swift index 6c1692d..2a3da3f 100644 --- a/SodaLive/Sources/Content/Main/GetAudioContentMainResponse.swift +++ b/SodaLive/Sources/Content/Main/GetAudioContentMainResponse.swift @@ -14,6 +14,24 @@ struct GetAudioContentMainResponse: Decodable { let themeList: [String] let newContentList: [GetAudioContentMainItem] let curationList: [GetAudioContentCurationResponse] + let contentRanking: GetAudioContentRanking +} + +struct GetAudioContentRanking: Decodable { + let startDate: String + let endDate: String + let items: [GetAudioContentRankingItem] +} + +struct GetAudioContentRankingItem: Decodable { + let contentId: Int + let title: String + let coverImageUrl: String + let themeStr: String + let price: Int + let duration: String + let creatorId: Int + let creatorNickname: String } struct GetNewContentUploadCreator: Decodable {