라이브 메인 페이지
This commit is contained in:
123
SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift
Normal file
123
SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift
Normal file
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// LiveReservationItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct LiveReservationItemView: View {
|
||||
|
||||
let item: GetRoomListResponse
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 13.3) {
|
||||
HStack(spacing: 20) {
|
||||
ZStack(alignment: .topLeading) {
|
||||
KFImage(URL(string: item.coverImageUrl))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 80, height: 116, alignment: .top)
|
||||
.cornerRadius(4.7)
|
||||
.clipped()
|
||||
|
||||
if item.isAdult {
|
||||
Text("19")
|
||||
.font(.custom(Font.bold.rawValue, size: 11.3))
|
||||
.foregroundColor(Color.white)
|
||||
.padding(4)
|
||||
.background(Color(hex: "e53621"))
|
||||
.cornerRadius(20)
|
||||
.padding(.top, 3.3)
|
||||
.padding(.leading, 3.3)
|
||||
}
|
||||
}
|
||||
|
||||
HStack(alignment: .top, spacing: 0) {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text(item.beginDateTime)
|
||||
.font(.custom(Font.medium.rawValue, size: 9.3))
|
||||
.foregroundColor(Color(hex: "ffd300"))
|
||||
|
||||
Text(item.managerNickname)
|
||||
.font(.custom(Font.medium.rawValue, size: 11.3))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.padding(.top, 10)
|
||||
|
||||
Text(item.title)
|
||||
.font(.custom(Font.medium.rawValue, size: 15.3))
|
||||
.foregroundColor(Color(hex: "e2e2e2"))
|
||||
.padding(.top, 4.3)
|
||||
|
||||
Spacer()
|
||||
|
||||
if item.isReservation {
|
||||
Text("예약완료")
|
||||
.font(.custom(Font.medium.rawValue, size: 11.3))
|
||||
.foregroundColor(Color(hex: "d2d2d2"))
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 4)
|
||||
.background(Color(hex: "533d89"))
|
||||
.cornerRadius(10)
|
||||
} else {
|
||||
if item.price > 0 {
|
||||
Text("\(item.price)코인")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(
|
||||
Color(hex: "e2e2e2")
|
||||
.opacity(0.5)
|
||||
)
|
||||
|
||||
} else {
|
||||
Text("무료")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(
|
||||
Color(hex: "e2e2e2")
|
||||
.opacity(0.5)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
if item.isPrivateRoom {
|
||||
Image("ic_lock")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 6.7)
|
||||
}
|
||||
|
||||
Divider()
|
||||
.frame(height: 1)
|
||||
.background(Color(hex: "909090").opacity(0.5))
|
||||
}
|
||||
.frame(width: screenSize().width - 26.7, height: 130, alignment: .center)
|
||||
}
|
||||
}
|
||||
|
||||
struct LiveReservationItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LiveReservationItemView(item: GetRoomListResponse(
|
||||
roomId: 99,
|
||||
title: "test",
|
||||
content: "testtest",
|
||||
beginDateTime: "2022.05.23 Mon 03:00 PM",
|
||||
numberOfParticipate: 0,
|
||||
numberOfPeople: 5,
|
||||
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
isAdult: false,
|
||||
price: 0,
|
||||
tags: ["팬미팅", "힐링"],
|
||||
channelName: nil,
|
||||
managerNickname: "user8",
|
||||
managerId: 19,
|
||||
isReservation: false,
|
||||
isPrivateRoom: true
|
||||
))
|
||||
}
|
||||
}
|
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// MyLiveReservationItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct MyLiveReservationItemView: View {
|
||||
|
||||
let item: GetRoomListResponse
|
||||
let index: Int
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
if index == 0 {
|
||||
HStack(spacing: 8) {
|
||||
Image("ic_mic_colored")
|
||||
|
||||
Text("내가 개설한 라이브")
|
||||
.font(.custom(Font.bold.rawValue, size: 16))
|
||||
.foregroundColor(Color(hex: "9970ff"))
|
||||
}
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 13.3) {
|
||||
HStack(alignment: .top, spacing: 20) {
|
||||
ZStack(alignment: .topLeading) {
|
||||
KFImage(URL(string: item.coverImageUrl))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 80, height: 116, alignment: .top)
|
||||
.cornerRadius(4.7)
|
||||
.clipped()
|
||||
|
||||
if item.isAdult {
|
||||
Text("19")
|
||||
.font(.custom(Font.bold.rawValue, size: 11.3))
|
||||
.foregroundColor(Color.white)
|
||||
.padding(4)
|
||||
.background(Color(hex: "e53621"))
|
||||
.cornerRadius(20)
|
||||
.padding(.top, 3.3)
|
||||
.padding(.leading, 3.3)
|
||||
}
|
||||
}
|
||||
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text(item.beginDateTime)
|
||||
.font(.custom(Font.medium.rawValue, size: 9.3))
|
||||
.foregroundColor(Color(hex: "ffd300"))
|
||||
|
||||
Text(item.managerNickname)
|
||||
.font(.custom(Font.medium.rawValue, size: 11.3))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.padding(.top, 10)
|
||||
|
||||
Text(item.title)
|
||||
.font(.custom(Font.medium.rawValue, size: 15.3))
|
||||
.foregroundColor(Color(hex: "e2e2e2"))
|
||||
.padding(.top, 4.3)
|
||||
}
|
||||
}.frame(height: 116)
|
||||
|
||||
Spacer()
|
||||
|
||||
if item.isPrivateRoom {
|
||||
Image("ic_lock")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
.padding(.trailing, 13.3)
|
||||
.padding(.top, 13.3)
|
||||
}
|
||||
}
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.stroke(Color(hex: "9970ff"), lineWidth: 1)
|
||||
)
|
||||
|
||||
Divider()
|
||||
.frame(height: 1)
|
||||
.background(Color(hex: "909090").opacity(0.5))
|
||||
}.frame(width: screenSize().width - 26.7)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MyLiveReservationItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MyLiveReservationItemView(
|
||||
item: GetRoomListResponse(
|
||||
roomId: 99,
|
||||
title: "test",
|
||||
content: "testtest",
|
||||
beginDateTime: "2022.05.23 Mon 03:00 PM",
|
||||
numberOfParticipate: 0,
|
||||
numberOfPeople: 5,
|
||||
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
||||
isAdult: false,
|
||||
price: 0,
|
||||
tags: ["팬미팅", "힐링"],
|
||||
channelName: nil,
|
||||
managerNickname: "user8",
|
||||
managerId: 19,
|
||||
isReservation: false,
|
||||
isPrivateRoom: true
|
||||
),
|
||||
index: 0
|
||||
)
|
||||
}
|
||||
}
|
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// SectionLiveReservationView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SectionLiveReservationView: View {
|
||||
|
||||
let items: [GetRoomListResponse]
|
||||
|
||||
let onClickCancel: () -> Void
|
||||
let onClickStart: (Int) -> Void
|
||||
let onClickReservation: (Int) -> Void
|
||||
let onTapCreateLive: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 13.3) {
|
||||
HStack(spacing: 0) {
|
||||
Text("지금 ")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Text("예약중")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "9970ff"))
|
||||
|
||||
Spacer()
|
||||
|
||||
if items.count > 0 {
|
||||
Text("전체보기")
|
||||
.font(.custom(Font.light.rawValue, size: 11.3))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.onTapGesture {}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
.frame(width: screenSize().width)
|
||||
|
||||
if items.count > 0 {
|
||||
VStack(spacing: 13.3) {
|
||||
ForEach(0..<items.count, id: \.self) { index in
|
||||
let item = items[index]
|
||||
|
||||
if item.managerId == UserDefaults.int(forKey: .userId) {
|
||||
MyLiveReservationItemView(item: item, index: index)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {}
|
||||
} else {
|
||||
LiveReservationItemView(item: item)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
.frame(width: screenSize().width)
|
||||
.padding(.top, 28.3)
|
||||
} else {
|
||||
VStack(spacing: 0) {
|
||||
Image("ic_no_item")
|
||||
.resizable()
|
||||
.frame(width: 60, height: 60)
|
||||
|
||||
Text("지금 예약중인 라이브가 없습니다.\n직접 라이브를 만들어 보세요!")
|
||||
.font(.custom(Font.medium.rawValue, size: 10.7))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.top, 8)
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Image("ic_plus_no_bg")
|
||||
.resizable()
|
||||
.frame(width: 33.3, height: 33.3, alignment: .center)
|
||||
|
||||
Text("라이브 만들기")
|
||||
.font(.custom(Font.bold.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.white)
|
||||
}
|
||||
.frame(width: 200, height: 33.3, alignment: .center)
|
||||
.background(Color(hex: "9970ff"))
|
||||
.cornerRadius(4.7)
|
||||
.padding(.top, 10.7)
|
||||
.onTapGesture { onTapCreateLive() }
|
||||
}
|
||||
.padding(.vertical, 16.7)
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.background(Color(hex: "2b2635"))
|
||||
.cornerRadius(4.7)
|
||||
.padding(.top, 28.3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SectionLiveReservationView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SectionLiveReservationView(
|
||||
items: [],
|
||||
onClickCancel: {},
|
||||
onClickStart: { _ in },
|
||||
onClickReservation: { _ in },
|
||||
onTapCreateLive: {}
|
||||
)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user