diff --git a/Sources/AllInApp/AllIn/AppState.swift b/Sources/AllInApp/AllIn/AppState.swift index d2d6693..ca9d3f4 100644 --- a/Sources/AllInApp/AllIn/AppState.swift +++ b/Sources/AllInApp/AllIn/AppState.swift @@ -12,7 +12,7 @@ class AppStateContainer: ObservableObject { static let shared = AppStateContainer() let loggedState: LoggedState = LoggedState() var onlineStatus: OnlineStatus = OnlineStatus() - var user: User? + @Published var user: User? @AppStorage("authenticationRefresh") var authenticationRefresh: String? } diff --git a/Sources/AllInApp/AllIn/Components/AllcoinsCounter.swift b/Sources/AllInApp/AllIn/Components/AllcoinsCounter.swift index 8d2a444..8dd954a 100644 --- a/Sources/AllInApp/AllIn/Components/AllcoinsCounter.swift +++ b/Sources/AllInApp/AllIn/Components/AllcoinsCounter.swift @@ -8,14 +8,17 @@ import SwiftUI struct AllcoinsCounter: View { + var backgroundColor: Color = .white var foregroundColor: Color = AllInColors.primaryColor + @ObservedObject var appStateContainer = AppStateContainer.shared + var body: some View { HStack(alignment: .center) { Image("allcoinIcon") .resizable() .frame(width: 17, height: 17, alignment: .leading) - Text(String(AppStateContainer.shared.user?.nbCoins ?? 0)) + Text(String(appStateContainer.user?.nbCoins ?? 0)) .fontWeight(.black) .foregroundColor(foregroundColor) } diff --git a/Sources/AllInApp/AllIn/Components/BetCard.swift b/Sources/AllInApp/AllIn/Components/BetCard.swift index 4e4073d..fc439bc 100644 --- a/Sources/AllInApp/AllIn/Components/BetCard.swift +++ b/Sources/AllInApp/AllIn/Components/BetCard.swift @@ -15,7 +15,7 @@ struct BetCard: View { @State var showParticipate: Bool = false var body: some View { - VStack(spacing: 0){ + VStack(spacing: 0) { VStack(alignment: .leading,spacing: 2){ HStack{ Spacer() @@ -31,7 +31,9 @@ struct BetCard: View { .font(.system(size: 20)) .fontWeight(.bold) HStack{ - Text("Commence le").font(.system(size: 15)).foregroundColor(AllInColors.grey800Color) + Text("Commence le") + .font(.system(size: 15)) + .foregroundColor(AllInColors.grey800Color) TextCapsule(date: bet.endRegisterDate) Spacer() } @@ -44,13 +46,14 @@ struct BetCard: View { HStack{ Spacer() UsersPreview() - Text(String(bet.registered.count) + " joueurs en attente") + Text(bet.registered.count.description + " joueurs en attente") .font(.system(size: 15)) .foregroundColor(AllInColors.grey800Color) .fontWeight(.medium) Spacer() - }.padding(0) + } + .padding(0) ParticipateButton(isOpen: $showDetails, isParticapatedOpen: $showParticipate, bet: bet) .padding(.top, 5) } @@ -60,6 +63,7 @@ struct BetCard: View { .cornerRadius(20, corners: [.bottomLeft,.bottomRight]) .border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) } + .onTapGesture { showDetails.toggle() } diff --git a/Sources/AllInApp/AllIn/Components/BetLineLoading.swift b/Sources/AllInApp/AllIn/Components/BetLineLoading.swift index 73c5d49..2855892 100644 --- a/Sources/AllInApp/AllIn/Components/BetLineLoading.swift +++ b/Sources/AllInApp/AllIn/Components/BetLineLoading.swift @@ -23,17 +23,14 @@ struct BetLineLoading: View { return totalParticipations > 0 ? CGFloat(numberOfYes) / CGFloat(totalParticipations) : 0.0 } - - var yesParticipations: [Participation] { - return participations.filter { $0.response.uppercased() == "YES" } + participations.filter { $0.response.uppercased() == "YES" } } var noParticipations: [Participation] { - return participations.filter { $0.response.uppercased() == "NO" } + participations.filter { $0.response.uppercased() == "NO" } } - var body: some View { GeometryReader { geometry in VStack(alignment: .leading,spacing: 0){ @@ -53,16 +50,15 @@ struct BetLineLoading: View { HStack{ Spacer() Rectangle() - .frame(width: min(CGFloat(1-self.value)*geometry.size.width, geometry.size.width), height: 17) + .frame(width: min(CGFloat(1-self.value) * geometry.size.width, geometry.size.width), height: 17) .foregroundStyle(AllInColors.PinkBetGradiant).cornerRadius(999) } HStack(spacing: 0){ Rectangle() - .frame(width: min(CGFloat(self.value)*geometry.size.width, geometry.size.width), height: 17) + .frame(width: min(CGFloat(self.value) * geometry.size.width, geometry.size.width), height: 17) .foregroundStyle(AllInColors.BlueBetGradiant) .cornerRadius(999) - .animation(.linear) Image("loadingHeartIcon") .resizable() .frame(width: 29, height: 32) @@ -86,13 +82,13 @@ struct BetLineLoading: View { .foregroundColor(AllInColors.pink100) Image("pinkAllCoinIcon") .resizable() - .frame(width:10, height: 14) + .frame(width: 12, height: 12) } HStack(spacing: 5){ Image("bluePersonIcon") .resizable() - .frame(width:14, height: 12) + .frame(width: 12, height: 12) Text(yesParticipations.count.description) .font(.system(size: 15)) .fontWeight(.bold) @@ -104,13 +100,13 @@ struct BetLineLoading: View { .foregroundColor(AllInColors.pink100) Image("pinkPersonIcon") .resizable() - .frame(width:10, height: 14) + .frame(width: 12, height: 12) } HStack(spacing: 5){ Image("blueBadgeIcon") .resizable() - .frame(width:10, height: 14) + .frame(width: 12, height: 12) Text(yesParticipations.max(by: { $0.stake < $1.stake })?.stake.description ?? "0") .font(.system(size: 15)) .fontWeight(.bold) @@ -122,13 +118,13 @@ struct BetLineLoading: View { .foregroundColor(AllInColors.pink100) Image("pinkBadgeIcon") .resizable() - .frame(width:10, height: 14) + .frame(width: 12, height: 12) } HStack(spacing: 5){ Image("blueTrophyIcon") .resizable() - .frame(width:14, height: 13) + .frame(width: 12, height: 12) Text("1.2") .font(.system(size: 15)) .fontWeight(.bold) @@ -140,7 +136,7 @@ struct BetLineLoading: View { .foregroundColor(AllInColors.pink100) Image("pinkTrophyIcon") .resizable() - .frame(width:10, height: 14) + .frame(width:12, height: 12) } } diff --git a/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift b/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift index f7b301e..7825627 100644 --- a/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift +++ b/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift @@ -62,11 +62,10 @@ struct DropDownAnswerMenu: View { .padding([.leading, .trailing], 15) } }) - .frame(width: .infinity) .background(AllInColors.componentBackgroundColor) - .cornerRadius(10) + .cornerRadius(8) .overlay( - RoundedRectangle(cornerRadius: 10, style: .continuous) + RoundedRectangle(cornerRadius: 8, style: .continuous) .stroke(AllInColors.veryLightPurpleColor, lineWidth: 0.4) ) } diff --git a/Sources/AllInApp/AllIn/Components/ParticiationCell.swift b/Sources/AllInApp/AllIn/Components/ParticiationCell.swift index 735f808..5f0ae70 100644 --- a/Sources/AllInApp/AllIn/Components/ParticiationCell.swift +++ b/Sources/AllInApp/AllIn/Components/ParticiationCell.swift @@ -12,17 +12,23 @@ struct ParticiationCell: View { @State var participation: Participation? var body: some View { HStack(alignment: .center, spacing: 0){ - Circle().frame(width: 30, height: 30).foregroundColor(AllInColors.grey700Color).padding(.trailing, 5) + Circle() + .frame(width: 30, height: 30) + .foregroundColor(AllInColors.grey700Color) + .padding(.trailing, 7) Text(participation?.user.username ?? "Unknown") .font(.system(size: 15)) - .foregroundStyle(AllInColors.grey100Color) + .foregroundStyle(AllInColors.primaryTextColor) .fontWeight(.semibold) Spacer() Text(participation?.stake.description ?? "NaN") .font(.system(size: 18)) .foregroundStyle(AllInColors.lightPurpleColor) - .fontWeight(.bold).padding(.trailing, 5) - Image("PurpleAllCoin").resizable().frame(width: 11, height: 12) + .fontWeight(.bold) + .padding(.trailing, 8) + Image("PurpleAllCoin") + .resizable() + .frame(width: 11, height: 12) } } } diff --git a/Sources/AllInApp/AllIn/Components/ParticipateButton.swift b/Sources/AllInApp/AllIn/Components/ParticipateButton.swift index 44c1511..e1638db 100644 --- a/Sources/AllInApp/AllIn/Components/ParticipateButton.swift +++ b/Sources/AllInApp/AllIn/Components/ParticipateButton.swift @@ -66,6 +66,7 @@ struct ParticipateButton: View { .overlay( RoundedRectangle(cornerRadius: 12).stroke(AllInColors.delimiterGrey, lineWidth: 1) ) - }.disabled(isDisabled) + } + .disabled(isDisabled) } } diff --git a/Sources/AllInApp/AllIn/Components/ParticipationModal.swift b/Sources/AllInApp/AllIn/Components/ParticipationModal.swift index 781d0d7..78b3ee4 100644 --- a/Sources/AllInApp/AllIn/Components/ParticipationModal.swift +++ b/Sources/AllInApp/AllIn/Components/ParticipationModal.swift @@ -13,6 +13,13 @@ struct ParticipationModal: View { @Binding private var mise: String private var description: String var participationAddedCallback: (() -> Void)? + var possibleGain: Int { + if let stake = Float(mise), let selectedOption = options.first(where: { $0.0 == self.selectedOption }) { + return Int(round(stake * selectedOption.2)) + } else { + return 0 + } + } init(answer: Binding, mise: Binding, description: String, participationAddedCallback: (() -> Void)? = nil) { self._selectedOption = answer @@ -27,93 +34,101 @@ struct ParticipationModal: View { ] var body: some View { - VStack(alignment: .leading){ - HStack{ - Spacer() - Rectangle() - .foregroundStyle(AllInColors.grey800Color) - .frame(maxWidth: 80, maxHeight: 5) - .cornerRadius(999) - Spacer() - - }.padding(10) - HStack{ - Text("Faites vos paris") - .font(.system(size: 18)) - .foregroundColor(AllInColors.primaryTextColor) - .fontWeight(.semibold) - Spacer() - AllcoinsCounter(backgroundColor: AllInColors.purpleAccentColor, foregroundColor: .white) - } - .padding(.leading, 15) + GeometryReader { geometry in VStack(alignment: .leading){ - Text(description) - .font(.system(size: 13)) - .foregroundColor(AllInColors.primaryTextColor) - .fontWeight(.light) - - DropDownAnswerMenu(selectedOption: $selectedOption, options: options) - - TextField("",text: $mise, prompt: Text("Mise") - .foregroundColor(AllInColors.lightGrey300Color) - .font(.system(size: 14)) - .fontWeight(.bold)) - .padding() - .keyboardType(.numberPad) - .background( - RoundedRectangle(cornerRadius: 9) - .fill(AllInColors.lightGrey200Color) - .frame(height: 40) - ) - .frame(width: .infinity, height: 40) - .foregroundColor(.black) - .overlay( - RoundedRectangle(cornerRadius: 10, style: .continuous) - .stroke(AllInColors.delimiterGrey, lineWidth: 1) - ) - .padding(.bottom, 5) - - } - .padding(15) - Spacer() - VStack{ HStack{ - Text("Gains possibles") - .font(.system(size: 13)) + Spacer() + Rectangle() + .foregroundStyle(AllInColors.lightGrey300Color) + .frame(maxWidth: 80, maxHeight: 5) + .cornerRadius(999) + Spacer() + + } + .padding(10) + HStack{ + Text("Faites vos paris") + .font(.system(size: 18)) .foregroundColor(AllInColors.primaryTextColor) - .fontWeight(.regular) + .fontWeight(.semibold) Spacer() - Text("231") + AllcoinsCounter(backgroundColor: AllInColors.lightPurpleColor, foregroundColor: .white) + } + .padding(.leading, 15) + VStack(alignment: .leading){ + Text(description) .font(.system(size: 13)) .foregroundColor(AllInColors.primaryTextColor) .fontWeight(.light) + + DropDownAnswerMenu(selectedOption: $selectedOption, options: options) + + TextField("", text: $mise, prompt: Text("Mise") + .foregroundColor(AllInColors.lightGrey300Color) + .font(.system(size: 16)) + .fontWeight(.bold)) + .padding() + .keyboardType(.numberPad) + .background( + RoundedRectangle(cornerRadius: 9) + .fill(AllInColors.lightGrey200Color) + .frame(height: 40) + ) + .frame(height: 40) + .foregroundColor(.black) + .overlay( + RoundedRectangle(cornerRadius: 8, style: .continuous) + .stroke(AllInColors.delimiterGrey, lineWidth: 1) + ) + .padding(.bottom, 5) + } - .padding(.top, 10).padding(.bottom, 0) - Button { - participationAddedCallback?() - } label: { - Text("Miser") - .font(.system(size: 23)) - .foregroundColor(AllInColors.whiteColor) - .fontWeight(.bold) - .frame(maxWidth: .infinity) - .padding(.vertical, 3) + .padding(15) + Spacer() + VStack{ + HStack{ + Text("Gains possibles") + .font(.system(size: 13)) + .foregroundColor(AllInColors.primaryTextColor) + .fontWeight(.medium) + Spacer() + Text(possibleGain.description) + .font(.system(size: 13)) + .foregroundColor(AllInColors.primaryTextColor) + .fontWeight(.bold) + Image("allcoinIcon") + .resizable() + .frame(width: 11, height: 12) + + } + .padding(.top, 10) + .padding(.bottom, 0) + Button { + participationAddedCallback?() + } label: { + Text("Miser") + .font(.system(size: 23)) + .foregroundColor(AllInColors.whiteColor) + .fontWeight(.bold) + .frame(maxWidth: .infinity) + .padding(.vertical, 3) + } + .buttonStyle(.borderedProminent) + .tint(AllInColors.lightPurpleColor) + .disabled(checkAndSetError()) + .padding(.bottom, 5) } - .buttonStyle(.borderedProminent) - .tint(AllInColors.purpleAccentColor) - .disabled(checkAndSetError()) - + .padding(.horizontal, 10) + .background(AllInColors.whiteColor) + .border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) } - .padding(.horizontal, 10) - .background(AllInColors.whiteColor) - .border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) + .background(AllInColors.underComponentBackgroundColor) } - .background(AllInColors.underComponentBackgroundColor) } func checkAndSetError() -> Bool { if let stake = Int(mise) { - if stake <= AppStateContainer.shared.user?.nbCoins ?? 0 { + if stake <= AppStateContainer.shared.user?.nbCoins ?? 0 && stake > 0 { return false } else { return true diff --git a/Sources/AllInApp/AllIn/Components/RankingRow.swift b/Sources/AllInApp/AllIn/Components/RankingRow.swift index dec46d5..688e76a 100644 --- a/Sources/AllInApp/AllIn/Components/RankingRow.swift +++ b/Sources/AllInApp/AllIn/Components/RankingRow.swift @@ -16,7 +16,7 @@ struct RankingRow: View { var body: some View { HStack(){ - Text(String(number)) + Text(number.description) .textStyle(weight: .bold, color: AllInColors.lightPurpleColor, size: 18) .padding(.leading, 15) @@ -34,7 +34,7 @@ struct RankingRow: View { Image("allcoinIcon") .resizable() .frame(width: 17, height: 17, alignment: .leading) - Text(String(allCoins)) + Text(allCoins.description) .textStyle(weight: .black, color: AllInColors.lightPurpleColor, size: 16) .padding(.trailing, 15) } diff --git a/Sources/AllInApp/AllIn/Components/RecapBetCard.swift b/Sources/AllInApp/AllIn/Components/RecapBetCard.swift index b788b52..7d48284 100644 --- a/Sources/AllInApp/AllIn/Components/RecapBetCard.swift +++ b/Sources/AllInApp/AllIn/Components/RecapBetCard.swift @@ -13,6 +13,7 @@ struct RecapBetCard: View { @State private var isPressed = false @State var showDetails: Bool = false @State var showPartipated: Bool = false + var body: some View { VStack(spacing: 0){ VStack(alignment: .leading,spacing: 2){ @@ -92,30 +93,29 @@ struct RecapBetCard: View { .padding([.top,.bottom],5) .background(AllInColors.primaryGradient) .cornerRadius(8, corners: .allCorners) - - - }.padding([.bottom],10) - - - }.frame(width: .infinity) - .padding([.top,.bottom],8) - .padding([.leading,.trailing],15) - .background(AllInColors.underComponentBackgroundColor) - .cornerRadius(20, corners: [.bottomLeft,.bottomRight]) - .padding(.bottom,0).border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) - }.scaleEffect(longPressTap ? 0.97 : 1.0) - .animation(.easeInOut, value: longPressTap) - .onTapGesture { - showDetails.toggle() - }.fullScreenCover(isPresented: $showDetails) { - DetailsView(isModalPresented: $showDetails, isModalParticipated: $showPartipated,id: "1") + } + .padding([.bottom],10) } - .gesture( - LongPressGesture(minimumDuration: 0.5) - .updating($longPressTap) { value, state, _ in - state = value - } - ) + .frame(width: .infinity) + .padding([.top,.bottom],8) + .padding([.leading,.trailing],15) + .background(AllInColors.underComponentBackgroundColor) + .cornerRadius(20, corners: [.bottomLeft,.bottomRight]) + .padding(.bottom,0).border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) + } + .scaleEffect(longPressTap ? 0.97 : 1.0) + .animation(.easeInOut, value: longPressTap) + .onTapGesture { + showDetails.toggle() + }.fullScreenCover(isPresented: $showDetails) { + DetailsView(isModalPresented: $showDetails, isModalParticipated: $showPartipated,id: "1") + } + .gesture( + LongPressGesture(minimumDuration: 0.5) + .updating($longPressTap) { value, state, _ in + state = value + } + ) } } diff --git a/Sources/AllInApp/AllIn/Components/ReviewCard.swift b/Sources/AllInApp/AllIn/Components/ReviewCard.swift index 1730ff8..f9f42a6 100644 --- a/Sources/AllInApp/AllIn/Components/ReviewCard.swift +++ b/Sources/AllInApp/AllIn/Components/ReviewCard.swift @@ -18,7 +18,9 @@ struct ReviewCard: View { VStack(alignment: .leading,spacing: 2){ HStack{ Spacer() - Text("proposé par Lucas").font(.system(size: 10)).foregroundColor(AllInColors.grey800Color) + Text("proposé par Lucas") + .font(.system(size: 10)) + .foregroundColor(AllInColors.grey800Color) } Text("Etudes").font(.system(size: 15)).foregroundColor(AllInColors.grey800Color) @@ -32,7 +34,8 @@ struct ReviewCard: View { } .frame(width: .infinity) .padding(.all,15) - .background(AllInColors.componentBackgroundColor).cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0) + .background(AllInColors.componentBackgroundColor) + .cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0) VStack(alignment: .center,spacing:0){ HStack(){ @@ -54,10 +57,6 @@ struct ReviewCard: View { .frame(width: .infinity) .padding(.all,10) - - - - } .frame(width: .infinity) .padding(.all,2) diff --git a/Sources/AllInApp/AllIn/Components/TextCapsule.swift b/Sources/AllInApp/AllIn/Components/TextCapsule.swift index 11ec010..3cc6cee 100644 --- a/Sources/AllInApp/AllIn/Components/TextCapsule.swift +++ b/Sources/AllInApp/AllIn/Components/TextCapsule.swift @@ -36,7 +36,7 @@ struct TextCapsule: View { RoundedRectangle(cornerRadius: 20) .stroke(AllInColors.delimiterGrey, lineWidth: 1) ) - + Text(formattedTime) .font(.system(size: 15)) .foregroundColor(AllInColors.lightPurpleColor) @@ -49,6 +49,9 @@ struct TextCapsule: View { RoundedRectangle(cornerRadius: 20) .stroke(AllInColors.delimiterGrey, lineWidth: 1) ) + + Spacer() + } } } diff --git a/Sources/AllInApp/AllIn/Extensions/Extensions.swift b/Sources/AllInApp/AllIn/Extensions/Extensions.swift index a79953c..74732e0 100644 --- a/Sources/AllInApp/AllIn/Extensions/Extensions.swift +++ b/Sources/AllInApp/AllIn/Extensions/Extensions.swift @@ -83,42 +83,3 @@ extension View { } } } - -struct SlideInFromBottomTransition: ViewModifier { - var yOffset: CGFloat - - func body(content: Content) -> some View { - content - .offset(y: yOffset) - .animation(.easeInOut(duration: 0.3)) - } -} - -extension AnyTransition { - static func slideInFromBottom(yOffset: CGFloat) -> AnyTransition { - AnyTransition.modifier( - active: SlideInFromBottomTransition(yOffset: yOffset), - identity: SlideInFromBottomTransition(yOffset: 0) - ) - } -} - -struct SlideOutToBottomTransition: ViewModifier { - var yOffset: CGFloat - - func body(content: Content) -> some View { - content - .offset(y: yOffset) - .opacity(yOffset == 0 ? 1 : 0) - .animation(.easeInOut(duration: 0.3)) - } -} - -extension AnyTransition { - static func slideOutToBottom(yOffset: CGFloat) -> AnyTransition { - AnyTransition.modifier( - active: SlideOutToBottomTransition(yOffset: yOffset), - identity: SlideOutToBottomTransition(yOffset: 0) - ) - } -} diff --git a/Sources/AllInApp/AllIn/Views/DetailsView.swift b/Sources/AllInApp/AllIn/Views/DetailsView.swift index a67ed2a..3cec22b 100644 --- a/Sources/AllInApp/AllIn/Views/DetailsView.swift +++ b/Sources/AllInApp/AllIn/Views/DetailsView.swift @@ -25,7 +25,6 @@ struct DetailsView: View { case .orderedSame: return true } - } else { return true } @@ -37,15 +36,15 @@ struct DetailsView: View { switch currentDate.compare(endRegisterDate) { case .orderedAscending: - return ("En cours...", AllInColors.purpleAccentColor) + return ("En cours...", AllInColors.darkPurpleColor) case .orderedDescending: - return ("En attente...",AllInColors.pink100) + return ("En attente...", AllInColors.pink100) case .orderedSame: - return ("Fin des inscriptions...",AllInColors.grey50Color) + return ("Fin des inscriptions...", AllInColors.grey50Color) } } else { - return ("Statut indisponible", AllInColors.whiteColor) + return ("Statut indisponible", AllInColors.pink100) } } @@ -62,6 +61,7 @@ struct DetailsView: View { VStack(alignment: .center) { HStack{ Text(StatusValues.0) + .italic() .font(.system(size: 25)) .fontWeight(.bold).padding(.bottom, 10) .foregroundStyle(Color.black) @@ -78,15 +78,18 @@ struct DetailsView: View { } .padding(.horizontal, 15) .background(StatusValues.1) - .transition(.slideInFromBottom(yOffset:0)) VStack(spacing: 0) { - VStack(alignment: .leading,spacing: 5){ - HStack{ + VStack(alignment: .leading, spacing: 5) { + HStack(spacing: 3) { Spacer() - Text("proposé par " + (viewModel.betDetail?.bet.author.username ?? "Unknown").capitalized) + Text("proposé par") .font(.system(size: 10)) .foregroundColor(AllInColors.grey800Color) + Text((viewModel.betDetail?.bet.author.username ?? "Unknown").capitalized) + .font(.system(size: 10)) + .fontWeight(.semibold) + .foregroundColor(AllInColors.primaryTextColor) } Text(viewModel.betDetail?.bet.theme ?? "Not loaded") @@ -96,27 +99,34 @@ struct DetailsView: View { .font(.system(size: 20)) .fontWeight(.bold) .padding(.bottom, 10) - HStack{ - Text("Commence le") - .frame(maxWidth: 100) - .font(.system(size: 15)) - .foregroundColor(AllInColors.grey800Color) + HStack { + HStack { + Spacer() + Text("Commence le") + .font(.system(size: 15)) + .foregroundColor(AllInColors.grey800Color) + } + .frame(width: 105) + .padding(.trailing, 10) TextCapsule(date: viewModel.betDetail?.bet.endRegisterDate ?? Date()) Spacer() }.padding(.bottom, 10) - HStack{ - Text("Fini le") - .frame(maxWidth: 100) - .font(.system(size: 15)) - .foregroundColor(AllInColors.grey800Color) + HStack { + HStack { + Spacer() + Text("Prend fin le") + .font(.system(size: 15)) + .foregroundColor(AllInColors.grey800Color) + } + .frame(width: 105) + .padding(.trailing, 10) TextCapsule(date: viewModel.betDetail?.bet.endBetDate ?? Date()) Spacer() - } } - .frame(width: .infinity) - .padding(.all,15).padding(.vertical, 10) + .padding(.all, 15) + .padding(.vertical, 10) .background(AllInColors.componentBackgroundColor) .cornerRadius(20, corners: [.topLeft,.topRight]).padding(.bottom,0) @@ -136,8 +146,8 @@ struct DetailsView: View { ParticiationCell(participation: participation).padding(.horizontal, 10) } } - .padding(.bottom, 28) - + .padding(.bottom, geometry.safeAreaInsets.bottom + 28) + Spacer() } .frame(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, maxHeight: .infinity) @@ -146,15 +156,14 @@ struct DetailsView: View { .border(width: 1, edges: [.top], color: AllInColors.delimiterGrey) Spacer() - - } - .frame(maxWidth: .infinity, maxHeight: geometry.size.height*0.98) + .frame(maxWidth: .infinity, maxHeight: (geometry.size.height + geometry.safeAreaInsets.bottom) - 50) .background(AllInColors.componentBackgroundColor) - .cornerRadius(15) + .cornerRadius(15, corners: [.topLeft, .topRight]) ParticipateButton(isOpen: $isModalPresented, isParticapatedOpen: $isModalParticipated, bet: viewModel.betDetail?.bet) - .padding(10) + .padding(.bottom, geometry.safeAreaInsets.bottom + 5) + .padding(.horizontal, 10) } .sheet(isPresented: $isModalParticipated) { ParticipationModal(answer: $viewModel.answer, mise: $viewModel.mise, description: viewModel.betDetail?.bet.phrase ?? "Not loaded", participationAddedCallback: {