Files
sodalive-ios/SodaLive/Sources/Content/Detail/AudioContentReportDialogView.swift

97 lines
3.7 KiB
Swift

//
// AudioContentReportDialogView.swift
// SodaLive
//
// Created by klaus on 2023/08/13.
//
import SwiftUI
struct AudioContentReportDialogView: View {
@Binding var isShowing: Bool
let confirmAction: (String) -> Void
@State private var selectedIndex: Int? = nil
let reasons = I18n.ContentDetail.ReportDialog.reasons
var body: some View {
ZStack {
Color.black
.opacity(0.7)
.ignoresSafeArea()
.onTapGesture { isShowing = false }
VStack(spacing: 13.3) {
Text(I18n.ContentDetail.ReportDialog.title)
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
VStack(spacing: 13.3) {
ForEach(0..<reasons.count, id: \.self) { index in
let reason = reasons[index]
HStack(spacing: 8) {
Image(selectedIndex == index ? "btn_radio_select_selected" : "btn_radio_select_normal")
.resizable()
.frame(width: 20, height: 20)
Text(reason)
.appFont(size: 14, weight: .medium)
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
}
.onTapGesture {
selectedIndex = index
}
}
}
.padding(13.3)
.background(Color(hex: "303030"))
.cornerRadius(6.7)
.padding(.vertical, 21.3)
Text(I18n.ContentDetail.ReportDialog.notice)
.appFont(size: 13.3, weight: .medium)
.foregroundColor(Color(hex: "dd4500"))
.multilineTextAlignment(.center)
HStack(spacing: 12) {
Text(I18n.Common.cancel)
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color(hex: "9970ff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 100) / 2)
.overlay(
RoundedRectangle(cornerRadius: CGFloat(10))
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
)
.onTapGesture {
isShowing = false
}
Text(I18n.ContentDetail.ReportDialog.reportAction)
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 100) / 2)
.background(Color(hex: "9970ff"))
.cornerRadius(10)
.onTapGesture {
if let selectedIndex = selectedIndex {
isShowing = false
confirmAction(reasons[selectedIndex])
}
}
}
.padding(.top, 13.3)
}
.padding(24)
.frame(width: screenSize().width - 33.3)
.background(Color(hex: "222222"))
.cornerRadius(13.3)
}
}
}