80 lines
3.2 KiB
Swift
80 lines
3.2 KiB
Swift
import SwiftUI
|
|
|
|
struct ChannelDonationAllView: View {
|
|
let creatorId: Int
|
|
|
|
@StateObject private var viewModel = ChannelDonationViewModel()
|
|
|
|
var body: some View {
|
|
BaseView(isLoading: $viewModel.isLoading) {
|
|
VStack(spacing: 0) {
|
|
DetailNavigationBar(title: I18n.MemberChannel.channelDonationAllTitle)
|
|
|
|
HStack(alignment: .center, spacing: 0) {
|
|
Text(I18n.MemberChannel.totalLabel)
|
|
.appFont(size: 14.7, weight: .medium)
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
|
|
Text("\(viewModel.totalCount)")
|
|
.appFont(size: 12, weight: .medium)
|
|
.foregroundColor(Color(hex: "80d8ff"))
|
|
.padding(.leading, 6.7)
|
|
|
|
Text(I18n.MemberChannel.countUnit)
|
|
.appFont(size: 12, weight: .medium)
|
|
.foregroundColor(Color(hex: "777777"))
|
|
|
|
Spacer()
|
|
}
|
|
.padding(.top, 13.3)
|
|
.padding(.horizontal, 13.3)
|
|
|
|
Rectangle()
|
|
.frame(width: screenSize().width - 26.7, height: 1)
|
|
.foregroundColor(Color(hex: "595959"))
|
|
.padding(.top, 6.7)
|
|
|
|
ScrollView(.vertical, showsIndicators: false) {
|
|
if viewModel.donationItems.isEmpty {
|
|
Text(I18n.MemberChannel.channelDonationEmpty)
|
|
.appFont(size: 16, weight: .regular)
|
|
.foregroundColor(Color(hex: "CFD8DC"))
|
|
.padding(.top, 40)
|
|
} else {
|
|
LazyVStack(spacing: 12) {
|
|
ForEach(0..<viewModel.donationItems.count, id: \.self) { index in
|
|
let item = viewModel.donationItems[index]
|
|
ChannelDonationItemView(
|
|
item: item,
|
|
previewLimit: 30,
|
|
isShowFullMessageOnTap: true
|
|
)
|
|
}
|
|
}
|
|
.padding(.vertical, 16.7)
|
|
.padding(.horizontal, 13.3)
|
|
}
|
|
}
|
|
}
|
|
.onAppear {
|
|
viewModel.setCreatorId(creatorId)
|
|
}
|
|
.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)
|
|
.appFont(size: 12, weight: .medium)
|
|
.background(Color.button)
|
|
.foregroundColor(Color.white)
|
|
.multilineTextAlignment(.leading)
|
|
.cornerRadius(20)
|
|
.padding(.bottom, 66.7)
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|