커뮤니티 게시물 신고 UI 추가

This commit is contained in:
Yu Sung 2023-12-16 03:24:07 +09:00
parent e2e64fa4e6
commit d393bb8f8b
2 changed files with 103 additions and 0 deletions

View File

@ -11,6 +11,8 @@ struct CreatorCommunityAllView: View {
let creatorId: Int
@State var isShowingReportView = false
var body: some View {
BaseView {
VStack(spacing: 0) {
@ -26,6 +28,11 @@ struct CreatorCommunityAllView: View {
.padding(.vertical, 5.3)
}
}
if isShowingReportView {
CreatorCommunityReportView(isShowing: $isShowingReportView) { _ in
}
}
}
}
}

View File

@ -0,0 +1,96 @@
//
// CreatorCommunityReportView.swift
// SodaLive
//
// Created by klaus on 2023/12/16.
//
import SwiftUI
struct CreatorCommunityReportView: View {
@Binding var isShowing: Bool
let confirmAction: (String) -> Void
@State private var selectedIndex: Int? = nil
let reasons = [
"원치 않는 상업성 콘텐츠 또는 스팸",
"포르노 또는 음란물",
"아동 학대",
"증오심 표현 또는 노골적인 폭력",
"테러 조장",
"괴롭힘 또는 폭력",
"자살 또는 자해",
"잘못된 정보"
]
var body: some View {
ZStack {
Color.black
.opacity(0.7)
.ignoresSafeArea()
.onTapGesture { isShowing = false }
VStack(spacing: 13.3) {
Text("게시물 신고")
.font(.custom(Font.medium.rawValue, size: 16.7))
.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)
.font(.custom(Font.medium.rawValue, size: 14))
.foregroundColor(Color(hex: "909090"))
Spacer()
}
.onTapGesture {
selectedIndex = index
}
}
}
.padding(.vertical, 3.3)
HStack(spacing: 26.7) {
Spacer()
Text("취소")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff"))
.onTapGesture {
isShowing = false
}
Text("신고")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff"))
.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)
}
}
}
struct CreatorCommunityReportView_Previews: PreviewProvider {
static var previews: some View {
CreatorCommunityReportView(
isShowing: .constant(false),
confirmAction: { _ in }
)
}
}