라이브 정보 수정

- 메뉴판 수정 기능 추가
This commit is contained in:
Yu Sung
2024-03-08 20:40:29 +09:00
parent b6411c3ccb
commit 70460f5c8a
6 changed files with 242 additions and 114 deletions

View File

@@ -18,7 +18,7 @@ struct LiveRoomInfoEditDialog: View {
let placeholder = "라이브 공지를 입력하세요"
let viewModel: LiveRoomViewModel
@StateObject var viewModel: LiveRoomViewModel
let isLoading: Bool
let coverImageUrl: String?
@@ -39,7 +39,7 @@ struct LiveRoomInfoEditDialog: View {
self._isShowing = isShowing
self._isShowPhotoPicker = isShowPhotoPicker
self.viewModel = viewModel
self._viewModel = StateObject(wrappedValue: viewModel)
self.isLoading = isLoading
self.title = currentTitle
@@ -53,112 +53,123 @@ struct LiveRoomInfoEditDialog: View {
var body: some View {
ZStack {
GeometryReader { proxy in
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 0) {
Text("라이브 수정")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
Image("ic_close_white")
.onTapGesture {
isShowing = false
}
}
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 0) {
Text("라이브 수정")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color.grayee)
HStack {
Spacer()
ZStack {
if let coverImage = coverImage {
Image(uiImage: coverImage)
.resizable()
.scaledToFill()
.frame(width: 80, height: 116.8, alignment: .top)
.clipped()
.cornerRadius(10)
} else if let coverImageUrl = coverImageUrl {
KFImage(URL(string: coverImageUrl))
.resizable()
.scaledToFill()
.frame(width: 80, height: 116.8, alignment: .top)
.clipped()
.cornerRadius(10)
} else {
Image("ic_logo")
.resizable()
.scaledToFit()
.frame(width: 80, height: 116.8)
.background(Color(hex: "3e3358"))
.cornerRadius(10)
}
Image("ic_camera")
.padding(10)
.background(Color(hex: "9970ff"))
.cornerRadius(30)
.offset(x: 40, y: 40)
}
.frame(alignment: .bottomTrailing)
.padding(.top, 13.3)
Spacer()
Image("ic_close_white")
.onTapGesture {
isShowPhotoPicker = true
isShowing = false
}
}
HStack {
Spacer()
ZStack {
if let coverImage = coverImage {
Image(uiImage: coverImage)
.resizable()
.scaledToFill()
.frame(width: 80, height: 116.8, alignment: .top)
.clipped()
.cornerRadius(10)
} else if let coverImageUrl = coverImageUrl {
KFImage(URL(string: coverImageUrl))
.resizable()
.scaledToFill()
.frame(width: 80, height: 116.8, alignment: .top)
.clipped()
.cornerRadius(10)
} else {
Image("ic_logo")
.resizable()
.scaledToFit()
.frame(width: 80, height: 116.8)
.background(Color.bg)
.cornerRadius(10)
}
Spacer()
Image("ic_camera")
.padding(10)
.background(Color.button)
.cornerRadius(30)
.offset(x: 40, y: 40)
}
TitleInputView()
.padding(.top, 40)
ContentInputView()
.padding(.top, 33.3)
HStack(spacing: 13.3) {
Text("취소")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "9970ff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff").opacity(0.2))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
)
.onTapGesture {
isShowing = false
}
Text("수정하기")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff"))
.cornerRadius(10)
.onTapGesture {
confirmAction(
title,
notice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? notice : ""
)
isShowing = false
}
.frame(alignment: .bottomTrailing)
.padding(.top, 13.3)
.onTapGesture {
isShowPhotoPicker = true
}
.padding(.top, 45)
Spacer()
}
.padding(13.3)
.frame(width: proxy.size.width, height: proxy.size.height)
.onTapGesture { hideKeyboard() }
TitleInputView()
.padding(.top, 40)
ContentInputView()
.padding(.top, 33.3)
LiveRoomMenuSelectView(
menu: $viewModel.menu,
isActivate: $viewModel.isActivateMenu,
menuCount: viewModel.menuList.count,
selectedMenu: viewModel.selectedMenu,
selectMenu: { viewModel.selectMenuPreset(selectedMenuPreset: $0) }
)
.padding(.top, 33.3)
HStack(spacing: 13.3) {
Text("취소")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color.button)
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color.button.opacity(0.2))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color.button)
)
.onTapGesture {
isShowing = false
}
Text("수정하기")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color.button)
.cornerRadius(10)
.onTapGesture {
confirmAction(
title,
notice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? notice : ""
)
isShowing = false
}
}
.padding(.top, 45)
Spacer()
}
.padding(13.3)
.onTapGesture { hideKeyboard() }
.onAppear {
viewModel.getAllMenuPreset {
self.isShowing = false
}
}
.background(Color(hex: "222222").edgesIgnoringSafeArea(.all))
}
.background(Color(hex: "222222").edgesIgnoringSafeArea(.all))
if viewModel.isShowPopup {
LiveRoomDialogView(
@@ -193,15 +204,15 @@ struct LiveRoomInfoEditDialog: View {
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.accentColor(Color(hex: "3bb9f1"))
.foregroundColor(Color.grayee)
.accentColor(Color.button)
.keyboardType(.default)
.padding(.top, 12)
.padding(.horizontal, 6.7)
Rectangle()
.frame(height: 1)
.foregroundColor(Color(hex: "909090").opacity(0.7))
.foregroundColor(Color.gray90.opacity(0.7))
.padding(.top, 8.3)
}
}
@@ -212,16 +223,16 @@ struct LiveRoomInfoEditDialog: View {
HStack(spacing: 0) {
Text("공지")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
Spacer()
Text("\(notice.count)")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "ff5c49")) +
.foregroundColor(Color.mainRed) +
Text(" / 1000자")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777"))
.foregroundColor(Color.gray77)
}
TextViewWrapper(