룰렛 설정

- 확률 총합 추가
This commit is contained in:
Yu Sung
2024-05-16 14:21:54 +09:00
parent 6bf5fcde7f
commit fd2230dbe1
3 changed files with 56 additions and 21 deletions

View File

@@ -64,7 +64,7 @@ struct RouletteSettingsView: View {
HStack(spacing: 0) {
Text("룰렛을 활성화 하시겠습니까?")
.font(.custom(Font.bold.rawValue, size: 16))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
Spacer()
@@ -80,7 +80,7 @@ struct RouletteSettingsView: View {
VStack(alignment: .leading, spacing: 13.3) {
Text("룰렛 금액 설정")
.font(.custom(Font.bold.rawValue, size: 16))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
HStack(spacing: 8) {
TextField("룰렛 금액을 입력해 주세요 (최소 5캔)", text: Binding(
@@ -94,19 +94,19 @@ struct RouletteSettingsView: View {
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
.keyboardType(.numberPad)
.padding(.horizontal, 13.3)
.padding(.vertical, 16.7)
.frame(maxWidth: .infinity)
.background(Color(hex: "222222"))
.background(Color.gray22)
.cornerRadius(6.7)
Spacer()
Text("")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
}
}
.padding(.top, 26.7)
@@ -114,12 +114,12 @@ struct RouletteSettingsView: View {
VStack(alignment: .leading, spacing: 21.3) {
Text("룰렛 옵션 설정")
.font(.custom(Font.bold.rawValue, size: 16))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
HStack(spacing: 0) {
Text("※ 룰렛 옵션은 최소 2개,\n최대 10개까지 설정할 수 있습니다.")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "ff5c49"))
.foregroundColor(Color.mainRed)
Spacer()
@@ -129,12 +129,26 @@ struct RouletteSettingsView: View {
}
.padding(.top, 26.7)
HStack(spacing: 0) {
Text("옵션 확률 합계")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color.grayee)
Spacer()
Text("( \(String(format: "%.2f", viewModel.totalPercentage))% )")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color.grayee)
}
.padding(.top, 21.3)
LazyVStack(spacing: 21.3) {
ForEach(viewModel.options.indices, id: \.self) { index in
RouletteSettingsOptionView(
option: viewModel.options[index],
index: index,
onClickDelete: { viewModel.deleteOption(index: index) }
onClickDelete: { viewModel.deleteOption(index: index) },
calculateTotalPercentage: { viewModel.calculateTotalPercentage() }
)
}
}
@@ -149,13 +163,13 @@ struct RouletteSettingsView: View {
HStack(spacing: 13.3) {
Text("미리보기")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "3bb9f1"))
.foregroundColor(Color.button)
.padding(.vertical, 16)
.frame(maxWidth: .infinity)
.overlay(
RoundedRectangle(cornerRadius: 10)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "3bb9f1"))
.foregroundColor(Color.button)
)
.onTapGesture {
viewModel.onClickPreview()
@@ -166,7 +180,7 @@ struct RouletteSettingsView: View {
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(maxWidth: .infinity)
.background(Color(hex: "3bb9f1"))
.background(Color.button)
.cornerRadius(10)
.onTapGesture {
viewModel.createOrUpdateRoulette {
@@ -176,12 +190,12 @@ struct RouletteSettingsView: View {
}
}
.padding(13.3)
.background(Color(hex: "222222"))
.background(Color.gray22)
.cornerRadius(16.7, corners: [.topLeft, .topRight])
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.foregroundColor(Color.gray22)
.frame(width: screenSize().width, height: 15.3)
}
}
@@ -206,7 +220,7 @@ struct RouletteSettingsView: View {
.padding(.vertical, 13.3)
.frame(width: geo.size.width - 66.7, alignment: .center)
.font(.custom(Font.medium.rawValue, size: 12))
.background(Color(hex: "9970ff"))
.background(Color.button)
.foregroundColor(Color.white)
.multilineTextAlignment(.center)
.cornerRadius(20)