diff --git a/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift b/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift index e0d6a2f..eeefe0f 100644 --- a/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift +++ b/Sources/AllInApp/AllIn/Components/ChoiceFinalAnswerCell.swift @@ -16,11 +16,17 @@ struct ChoiceFinalAnswerCell: View { var rawColor = AllInColors.blueAccentColor var body: some View { - HStack{ - Spacer() - Text(answer.response) - .textStyle(weight: .bold, color: selected ? AllInColors.whiteColor :rawColor, size: 40).padding(.vertical, 10) - Spacer() + ZStack{ + HStack{ + Spacer() + Text(answer.response) + .textStyle(weight: .bold, color: selected ? AllInColors.whiteColor :rawColor, size: 40).padding(.vertical, 10) + Spacer() + } + HStack{ + Spacer() + OddCapsule(backgroundColor: selected ? AllInColors.whiteColor : AllInColors.purpleAccentColor, foregroundColor: selected ? AllInColors.purpleAccentColor : AllInColors.whiteColor ,odd: answer.odds ).padding(.trailing,20).scaleEffect(0.9) + } }.background(selected ? AllInColors.purpleAccentColor : AllInColors.whiteColor).cornerRadius(17) } } diff --git a/Sources/AllInApp/AllIn/Components/OddCapsule.swift b/Sources/AllInApp/AllIn/Components/OddCapsule.swift new file mode 100644 index 0000000..f4dc9bb --- /dev/null +++ b/Sources/AllInApp/AllIn/Components/OddCapsule.swift @@ -0,0 +1,33 @@ +// +// OddCapsule.swift +// AllIn +// +// Created by Lucas Delanier on 03/02/2024. +// + +import Foundation +import SwiftUI + +struct OddCapsule: View { + var backgroundColor: Color = AllInColors.purpleAccentColor + var foregroundColor: Color = AllInColors.whiteColor + var odd: Float = 0.0 + var body: some View { + HStack(alignment: .center) { + Text("x\(odd.description)") + .fontWeight(.bold) + .foregroundColor(foregroundColor) + } + .padding(.horizontal, 10) + .padding(.vertical,5) + .background(backgroundColor) + .cornerRadius(9999) + + } +} + +struct OddCapsule_Previews: PreviewProvider { + static var previews: some View { + AllcoinsCounter() + } +} diff --git a/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift b/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift index c726682..02b0eca 100644 --- a/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift +++ b/Sources/AllInApp/AllIn/Views/BetEndingValidationView.swift @@ -49,11 +49,29 @@ struct BetEndingValidation: View { VStack(spacing: 14){ ForEach(bet.answers, id: \.self) { answer in ChoiceFinalAnswerCell(selected : answer.response == selectedAnswer, answer: answer).onTapGesture { - selectedAnswer = answer.response + if(selectedAnswer == answer.response){ + selectedAnswer = nil + } + else { + selectedAnswer = answer.response + } } } } Spacer() + selectedAnswer != nil ? Button { + dismiss() + } label: { + Text("Valider") + .font(.system(size: 23)) + .foregroundColor(AllInColors.whiteColor) + .fontWeight(.bold) + .frame(maxWidth: .infinity) + .padding(.vertical, 3) + } + .buttonStyle(.borderedProminent) + .tint(AllInColors.purpleAccentColor) + : nil } .padding([.all],20) } diff --git a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj index d1ae95a..def970a 100644 --- a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj +++ b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 123590B82B5541BA00F7AEBD /* ParticipateButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123590B72B5541BA00F7AEBD /* ParticipateButton.swift */; }; 1244EF602B4EC31E00374ABF /* HistoricBetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1244EF5F2B4EC31E00374ABF /* HistoricBetView.swift */; }; 1244EF622B4EC67000374ABF /* ReviewCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1244EF612B4EC67000374ABF /* ReviewCard.swift */; }; + 129D051D2B6E7FF0003D3E08 /* OddCapsule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 129D051C2B6E7FF0003D3E08 /* OddCapsule.swift */; }; 12C370482B5A5EE500CD9F0F /* BetLineLoading.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12C370472B5A5EE500CD9F0F /* BetLineLoading.swift */; }; 12C3704A2B5D5BD000CD9F0F /* ParticiationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12C370492B5D5BD000CD9F0F /* ParticiationCell.swift */; }; EC0193782B25BF16005D81E6 /* AllcoinsCapsule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC0193772B25BF16005D81E6 /* AllcoinsCapsule.swift */; }; @@ -117,6 +118,7 @@ 123590B72B5541BA00F7AEBD /* ParticipateButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateButton.swift; sourceTree = ""; }; 1244EF5F2B4EC31E00374ABF /* HistoricBetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoricBetView.swift; sourceTree = ""; }; 1244EF612B4EC67000374ABF /* ReviewCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewCard.swift; sourceTree = ""; }; + 129D051C2B6E7FF0003D3E08 /* OddCapsule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OddCapsule.swift; sourceTree = ""; }; 12C370472B5A5EE500CD9F0F /* BetLineLoading.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetLineLoading.swift; sourceTree = ""; }; 12C370492B5D5BD000CD9F0F /* ParticiationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticiationCell.swift; sourceTree = ""; }; EC0193772B25BF16005D81E6 /* AllcoinsCapsule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllcoinsCapsule.swift; sourceTree = ""; }; @@ -344,6 +346,7 @@ 12C370472B5A5EE500CD9F0F /* BetLineLoading.swift */, 12C370492B5D5BD000CD9F0F /* ParticiationCell.swift */, 123225DA2B67E41400D30BB3 /* ChoiceFinalAnswerCell.swift */, + 129D051C2B6E7FF0003D3E08 /* OddCapsule.swift */, ); path = Components; sourceTree = ""; @@ -544,6 +547,7 @@ EC6B96D82B24BF2100FC1C58 /* Menu.swift in Sources */, EC650A4E2B278EDB003AFCAD /* TrendingBetCard.swift in Sources */, 123225DB2B67E41400D30BB3 /* ChoiceFinalAnswerCell.swift in Sources */, + 129D051D2B6E7FF0003D3E08 /* OddCapsule.swift in Sources */, 123225D92B67B46100D30BB3 /* BetEndingValidationView.swift in Sources */, EC0193782B25BF16005D81E6 /* AllcoinsCapsule.swift in Sources */, EC650A4A2B25DD58003AFCAD /* FriendsView.swift in Sources */,