재생목록 상세 페이지 추가
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
//
|
||||
// ContentPlaylistDetailView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 12/9/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct ContentPlaylistDetailView: View {
|
||||
@StateObject var viewModel = ContentPlaylistDetailViewModel()
|
||||
|
||||
let playlistId: Int
|
||||
@Binding var isShowing: Bool
|
||||
@Binding var reloadData: Bool
|
||||
|
||||
var body: some View {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
VStack(spacing: 21.3) {
|
||||
HStack(spacing: 5.3) {
|
||||
Image("ic_back")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(8)
|
||||
.onTapGesture {
|
||||
isShowing = false
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("ic_edit_white")
|
||||
.padding(8)
|
||||
.onTapGesture {
|
||||
}
|
||||
|
||||
Image("ic_seemore_vertical_white")
|
||||
.padding(8)
|
||||
.onTapGesture {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
.frame(height: 50)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.black)
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
if let response = viewModel.response {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(alignment: .top, spacing: 13.3) {
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
HStack(spacing: 0) {
|
||||
KFImage(URL(string: response.playlistCoverImageList[0]))
|
||||
.cancelOnDisappear(true)
|
||||
.downsampling(size: CGSize(width: 80, height: 80))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.clipped()
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
|
||||
if response.playlistCoverImageList.count > 2 {
|
||||
KFImage(URL(string: response.playlistCoverImageList[1]))
|
||||
.cancelOnDisappear(true)
|
||||
.downsampling(size: CGSize(width: 80, height: 80))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.clipped()
|
||||
.frame(maxWidth: 40, maxHeight: 40)
|
||||
}
|
||||
}
|
||||
|
||||
HStack(spacing: 0) {
|
||||
if response.playlistCoverImageList.count > 2 {
|
||||
KFImage(URL(string: response.playlistCoverImageList[2]))
|
||||
.cancelOnDisappear(true)
|
||||
.downsampling(size: CGSize(width: 80, height: 80))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.clipped()
|
||||
.frame(maxWidth: 40, maxHeight: 40)
|
||||
}
|
||||
|
||||
if response.playlistCoverImageList.count > 3 {
|
||||
KFImage(URL(string: response.playlistCoverImageList[3]))
|
||||
.cancelOnDisappear(true)
|
||||
.downsampling(size: CGSize(width: 80, height: 80))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.clipped()
|
||||
.frame(maxWidth: 40, maxHeight: 40)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: 80, height: 80)
|
||||
.background(Color.graybb)
|
||||
.cornerRadius(4)
|
||||
|
||||
VStack(spacing: 6.7) {
|
||||
Text(response.title)
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color.grayd2)
|
||||
.lineLimit(2)
|
||||
.truncationMode(.tail)
|
||||
|
||||
Text(response.desc.prefix(100))
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color.gray90)
|
||||
.truncationMode(.tail)
|
||||
}
|
||||
}
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Text("만든 날짜 \(response.createdDate)")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.gray90)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("\(response.contentCount)개")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.grayee)
|
||||
}
|
||||
.padding(.top, 13.3)
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
HStack(spacing: 5.3) {
|
||||
Image("ic_playlist_play")
|
||||
|
||||
Text("Play")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.white)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 11)
|
||||
.background(Color.button)
|
||||
.cornerRadius(5.3)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
}
|
||||
|
||||
HStack(spacing: 5.3) {
|
||||
Image("ic_playlist_shuffle")
|
||||
|
||||
Text("Shuffle")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.white)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 11)
|
||||
.background(Color.button)
|
||||
.cornerRadius(5.3)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
}
|
||||
}
|
||||
.padding(.top, 18)
|
||||
|
||||
LazyVStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(0..<response.contentList.count, id: \.self) {
|
||||
PlaylistContentItemView(item: response.contentList[$0])
|
||||
}
|
||||
}
|
||||
.padding(.top, 18)
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(viewModel.errorMessage)
|
||||
.padding(.vertical, 13.3)
|
||||
.frame(width: screenSize().width - 66.7, alignment: .center)
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.background(Color.button)
|
||||
.foregroundColor(Color.white)
|
||||
.multilineTextAlignment(.leading)
|
||||
.cornerRadius(20)
|
||||
.padding(.bottom, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.playlistId = playlistId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentPlaylistDetailView(
|
||||
playlistId: 1,
|
||||
isShowing: .constant(true),
|
||||
reloadData: .constant(false)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user