|
|
|
@ -45,6 +45,8 @@ struct EditScoreView: View { |
|
|
|
|
|
|
|
|
|
|
|
@ObservedObject var matchDescriptor: MatchDescriptor |
|
|
|
@ObservedObject var matchDescriptor: MatchDescriptor |
|
|
|
@Environment(\.dismiss) private var dismiss |
|
|
|
@Environment(\.dismiss) private var dismiss |
|
|
|
|
|
|
|
@State private var showSetInputView: Bool = true |
|
|
|
|
|
|
|
@State private var showTieBreakInputView: Bool = false |
|
|
|
|
|
|
|
|
|
|
|
let colorTeamOne: Color = .mint |
|
|
|
let colorTeamOne: Color = .mint |
|
|
|
let colorTeamTwo: Color = .cyan |
|
|
|
let colorTeamTwo: Color = .cyan |
|
|
|
@ -81,7 +83,7 @@ struct EditScoreView: View { |
|
|
|
.bold() |
|
|
|
.bold() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.listRowView(isActive: true, color: colorTeamOne, hideColorVariation: true) |
|
|
|
.listRowView(isActive: teamOneSetupIsActive, color: .master, hideColorVariation: false) |
|
|
|
HStack { |
|
|
|
HStack { |
|
|
|
Spacer() |
|
|
|
Spacer() |
|
|
|
VStack(alignment: .trailing) { |
|
|
|
VStack(alignment: .trailing) { |
|
|
|
@ -92,7 +94,7 @@ struct EditScoreView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.listRowView(isActive: true, color: colorTeamTwo, hideColorVariation: true, alignment: .trailing) |
|
|
|
.listRowView(isActive: teamTwoSetupIsActive, color: .master, hideColorVariation: false, alignment: .trailing) |
|
|
|
} footer: { |
|
|
|
} footer: { |
|
|
|
HStack { |
|
|
|
HStack { |
|
|
|
Menu { |
|
|
|
Menu { |
|
|
|
@ -120,7 +122,7 @@ struct EditScoreView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ForEach($matchDescriptor.setDescriptors) { $setDescriptor in |
|
|
|
ForEach($matchDescriptor.setDescriptors) { $setDescriptor in |
|
|
|
SetInputView(setDescriptor: $setDescriptor) |
|
|
|
SetInputView(setDescriptor: $setDescriptor, showSetInputView: $showSetInputView, showTieBreakInputView: $showTieBreakInputView) |
|
|
|
.onChange(of: setDescriptor.hasEnded) { |
|
|
|
.onChange(of: setDescriptor.hasEnded) { |
|
|
|
if setDescriptor.hasEnded { |
|
|
|
if setDescriptor.hasEnded { |
|
|
|
if matchDescriptor.hasEnded == false { |
|
|
|
if matchDescriptor.hasEnded == false { |
|
|
|
@ -131,7 +133,7 @@ struct EditScoreView: View { |
|
|
|
matchDescriptor.setDescriptors = Array(matchDescriptor.setDescriptors[0...index]) |
|
|
|
matchDescriptor.setDescriptors = Array(matchDescriptor.setDescriptors[0...index]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.tint(getColor()) |
|
|
|
.tint(.master) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if matchDescriptor.hasEnded { |
|
|
|
if matchDescriptor.hasEnded { |
|
|
|
@ -180,6 +182,10 @@ struct EditScoreView: View { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var teamOneSetupIsActive: Bool { |
|
|
|
var teamOneSetupIsActive: Bool { |
|
|
|
|
|
|
|
if matchDescriptor.hasEnded && showSetInputView == false && showTieBreakInputView == false { |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
guard let setDescriptor = matchDescriptor.setDescriptors.last else { |
|
|
|
guard let setDescriptor = matchDescriptor.setDescriptors.last else { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
@ -197,6 +203,9 @@ struct EditScoreView: View { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var teamTwoSetupIsActive: Bool { |
|
|
|
var teamTwoSetupIsActive: Bool { |
|
|
|
|
|
|
|
if matchDescriptor.hasEnded && showSetInputView == false && showTieBreakInputView == false { |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
guard let setDescriptor = matchDescriptor.setDescriptors.last else { |
|
|
|
guard let setDescriptor = matchDescriptor.setDescriptors.last else { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|