콘텐츠 등록 화면 텍스트와 버튼을 I18n 기반 번역 문자열로 교체 룰렛 설정과 미션 메뉴 버튼 라벨을 다국어 문자열로 통일 신규 텍스트를 String Catalog에 추가하여 네비게이션 타이틀 번역
107 lines
3.7 KiB
Swift
107 lines
3.7 KiB
Swift
//
|
|
// MenuSettingsView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 10/7/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MenuSettingsView: View {
|
|
|
|
@StateObject var viewModel = MenuSettingsViewModel()
|
|
|
|
@Binding var isShowing: Bool
|
|
|
|
var body: some View {
|
|
BaseView(isLoading: $viewModel.isLoading) {
|
|
VStack(spacing: 13.3) {
|
|
DetailNavigationBar(title: "메뉴 설정") {
|
|
isShowing = false
|
|
}
|
|
|
|
HStack(spacing: 13.3) {
|
|
SelectedButtonView(
|
|
title: I18n.MissionMenu.menu1,
|
|
isActive: true,
|
|
isSelected: viewModel.selectedMenu == .MENU_1
|
|
)
|
|
.onTapGesture {
|
|
viewModel.selectMenuPreset(selectedMenuPreset: .MENU_1)
|
|
}
|
|
|
|
SelectedButtonView(
|
|
title: I18n.MissionMenu.menu2,
|
|
isActive: viewModel.menuList.count > 0,
|
|
isSelected: viewModel.selectedMenu == .MENU_2
|
|
)
|
|
.onTapGesture {
|
|
viewModel.selectMenuPreset(selectedMenuPreset: .MENU_2)
|
|
}
|
|
|
|
SelectedButtonView(
|
|
title: I18n.MissionMenu.menu3,
|
|
isActive: viewModel.menuList.count > 1,
|
|
isSelected: viewModel.selectedMenu == .MENU_3
|
|
)
|
|
.onTapGesture {
|
|
viewModel.selectMenuPreset(selectedMenuPreset: .MENU_3)
|
|
}
|
|
}
|
|
.padding(.horizontal, 13.3)
|
|
|
|
TextViewWrapper(
|
|
text: $viewModel.menu,
|
|
placeholder: "메뉴판을 작성해주세요.",
|
|
textColorHex: "eeeeee",
|
|
backgroundColorHex: "303030"
|
|
)
|
|
.frame(height: 300)
|
|
.cornerRadius(6.7)
|
|
.padding(.horizontal, 13.3)
|
|
|
|
Text("저장하기")
|
|
.font(.custom(Font.bold.rawValue, size: 18.3))
|
|
.foregroundColor(.white)
|
|
.padding(.vertical, 16)
|
|
.frame(maxWidth: .infinity)
|
|
.background(Color.button)
|
|
.cornerRadius(10)
|
|
.padding(.horizontal, 13.3)
|
|
.clipShape(Rectangle())
|
|
.onTapGesture { viewModel.saveMenu() }
|
|
|
|
Spacer()
|
|
}
|
|
.edgesIgnoringSafeArea(.bottom)
|
|
.onAppear {
|
|
viewModel.getAllMenuPreset {
|
|
self.isShowing = false
|
|
}
|
|
}
|
|
.onTapGesture {
|
|
hideKeyboard()
|
|
}
|
|
.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)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.background(Color.button)
|
|
.foregroundColor(Color.white)
|
|
.multilineTextAlignment(.leading)
|
|
.cornerRadius(20)
|
|
.padding(.bottom, 66.7)
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
MenuSettingsView(isShowing: .constant(true))
|
|
}
|