From 5c1db042182e96cc1f00ebfd3e2b1faf1f4fcc6f Mon Sep 17 00:00:00 2001 From: "emre.kartal" Date: Tue, 26 Sep 2023 23:00:25 +0200 Subject: [PATCH] Correct error merge :bug: --- Sources/allin/allin.xcodeproj/project.pbxproj | 16 ++-- Sources/allin/allin/Screens/BetScreen.swift | 55 ++++++++++++++ Sources/allin/allin/Screens/HomeScreen.swift | 76 ++++++++++--------- Sources/allin/allin/Views/MenuView.swift | 4 +- 4 files changed, 105 insertions(+), 46 deletions(-) create mode 100644 Sources/allin/allin/Screens/BetScreen.swift diff --git a/Sources/allin/allin.xcodeproj/project.pbxproj b/Sources/allin/allin.xcodeproj/project.pbxproj index 84b8ff6..ff8efb4 100644 --- a/Sources/allin/allin.xcodeproj/project.pbxproj +++ b/Sources/allin/allin.xcodeproj/project.pbxproj @@ -24,12 +24,12 @@ EC46D7DF2ABCE0A20030AC04 /* ParameterMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC46D7DE2ABCE0A20030AC04 /* ParameterMenuView.swift */; }; EC50BF962ABF4D3300197685 /* SplashScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC50BF952ABF4D3300197685 /* SplashScreen.swift */; }; EC50BF982ABF541B00197685 /* WelcomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC50BF972ABF541B00197685 /* WelcomeScreen.swift */; }; + EC8601F52AC37919004262C8 /* HomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC8601F42AC37919004262C8 /* HomeScreen.swift */; }; EC87FCD62ABBA24000363986 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCD52ABBA24000363986 /* Extensions.swift */; }; EC87FCD92ABBA60900363986 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCD82ABBA60900363986 /* Colors.swift */; }; EC87FCDB2ABBA6AC00363986 /* TrendingBetCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */; }; - EC9A45B02ABDF4A800125D41 /* HomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC9A45AF2ABDF4A800125D41 /* HomeScreen.swift */; }; + EC9A45B02ABDF4A800125D41 /* BetScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC9A45AF2ABDF4A800125D41 /* BetScreen.swift */; }; ECDF624A2AC1CAFD00BA8213 /* RegisterScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDF62492AC1CAFD00BA8213 /* RegisterScreen.swift */; }; - ECDF624C2AC205E100BA8213 /* BetScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDF624B2AC205E100BA8213 /* BetScreen.swift */; }; ECFC54442AC0C39E00195760 /* LoginScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFC54432AC0C39E00195760 /* LoginScreen.swift */; }; /* End PBXBuildFile section */ @@ -72,12 +72,12 @@ EC46D7DE2ABCE0A20030AC04 /* ParameterMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ParameterMenuView.swift; path = allin/Views/ParameterMenuView.swift; sourceTree = SOURCE_ROOT; }; EC50BF952ABF4D3300197685 /* SplashScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SplashScreen.swift; path = allin/Screens/SplashScreen.swift; sourceTree = SOURCE_ROOT; }; EC50BF972ABF541B00197685 /* WelcomeScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WelcomeScreen.swift; path = allin/Screens/WelcomeScreen.swift; sourceTree = SOURCE_ROOT; }; + EC8601F42AC37919004262C8 /* HomeScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HomeScreen.swift; path = allin/Screens/HomeScreen.swift; sourceTree = SOURCE_ROOT; }; EC87FCD52ABBA24000363986 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = allin/Extensions/Extensions.swift; sourceTree = SOURCE_ROOT; }; EC87FCD82ABBA60900363986 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Colors.swift; path = allin/Ressources/Colors.swift; sourceTree = SOURCE_ROOT; }; EC87FCDA2ABBA6AC00363986 /* TrendingBetCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TrendingBetCard.swift; path = allin/Views/TrendingBetCard.swift; sourceTree = SOURCE_ROOT; }; - EC9A45AF2ABDF4A800125D41 /* HomeScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HomeScreen.swift; path = allin/Screens/HomeScreen.swift; sourceTree = SOURCE_ROOT; }; + EC9A45AF2ABDF4A800125D41 /* BetScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BetScreen.swift; path = allin/Screens/BetScreen.swift; sourceTree = SOURCE_ROOT; }; ECDF62492AC1CAFD00BA8213 /* RegisterScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RegisterScreen.swift; path = allin/Screens/RegisterScreen.swift; sourceTree = SOURCE_ROOT; }; - ECDF624B2AC205E100BA8213 /* BetScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BetScreen.swift; path = allin/Screens/BetScreen.swift; sourceTree = SOURCE_ROOT; }; ECFC54432AC0C39E00195760 /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LoginScreen.swift; path = allin/Screens/LoginScreen.swift; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -202,12 +202,12 @@ EC9A45AE2ABDF47A00125D41 /* Screens */ = { isa = PBXGroup; children = ( - EC9A45AF2ABDF4A800125D41 /* HomeScreen.swift */, + EC9A45AF2ABDF4A800125D41 /* BetScreen.swift */, EC50BF952ABF4D3300197685 /* SplashScreen.swift */, EC50BF972ABF541B00197685 /* WelcomeScreen.swift */, ECFC54432AC0C39E00195760 /* LoginScreen.swift */, ECDF62492AC1CAFD00BA8213 /* RegisterScreen.swift */, - ECDF624B2AC205E100BA8213 /* BetScreen.swift */, + EC8601F42AC37919004262C8 /* HomeScreen.swift */, ); path = Screens; sourceTree = ""; @@ -356,16 +356,16 @@ EC2C1EEB2AC08BE80091D57C /* BetCard.swift in Sources */, EC87FCD92ABBA60900363986 /* Colors.swift in Sources */, D98C4D662AB9D017007A6B4D /* ContentView.swift in Sources */, - ECDF624C2AC205E100BA8213 /* BetScreen.swift in Sources */, D92EC57C2ABADA2800CCD30E /* CoinCounterView.swift in Sources */, EC3737E42AC2F5FB00E6BDB5 /* ChoiceCapsule.swift in Sources */, EC2C1EED2AC093820091D57C /* TextCapsule.swift in Sources */, D98C4D8E2AB9D440007A6B4D /* TopBarView.swift in Sources */, EC50BF962ABF4D3300197685 /* SplashScreen.swift in Sources */, - EC9A45B02ABDF4A800125D41 /* HomeScreen.swift in Sources */, + EC9A45B02ABDF4A800125D41 /* BetScreen.swift in Sources */, EC46D7DF2ABCE0A20030AC04 /* ParameterMenuView.swift in Sources */, ECDF624A2AC1CAFD00BA8213 /* RegisterScreen.swift in Sources */, EC50BF982ABF541B00197685 /* WelcomeScreen.swift in Sources */, + EC8601F52AC37919004262C8 /* HomeScreen.swift in Sources */, D98C4D642AB9D017007A6B4D /* AllInApp.swift in Sources */, EC2C1EEF2AC098D30091D57C /* UsersPreview.swift in Sources */, EC87FCDB2ABBA6AC00363986 /* TrendingBetCard.swift in Sources */, diff --git a/Sources/allin/allin/Screens/BetScreen.swift b/Sources/allin/allin/Screens/BetScreen.swift new file mode 100644 index 0000000..bc5d4ee --- /dev/null +++ b/Sources/allin/allin/Screens/BetScreen.swift @@ -0,0 +1,55 @@ +// +// BetScreen.swift +// AllIn +// +// Created by étudiant on 22/09/2023. +// + +import SwiftUI + +struct Bet: View { + + @Binding var showMenu: Bool + + var body: some View { + VStack(alignment: .center, spacing: 0) { + TopBarView(showMenu: self.$showMenu) + ScrollView(showsIndicators: false){ + LazyVStack(alignment: .leading, spacing: 0, pinnedViews: [.sectionHeaders]) { + + TrendingBetCard().padding(.top,25).padding([.leading,.trailing],25) + + Section { + VStack(spacing: 20){ + BetCard() + BetCard() + BetCard() + }.padding([.leading,.trailing],25) + } header: { + ZStack{ + AllinColor.fadeInGradiantCard + ScrollView(.horizontal,showsIndicators: false){ + HStack{ + ChoiceCapsule() + ChoiceCapsule() + ChoiceCapsule() + ChoiceCapsule() + ChoiceCapsule() + ChoiceCapsule() + ChoiceCapsule() + }.padding(.leading,25).padding([.top,.bottom],15) + + } + } + + } + + } + } + + Spacer() + } + .edgesIgnoringSafeArea(.bottom).background(AllinColor.backgroundWhite) + } + +} diff --git a/Sources/allin/allin/Screens/HomeScreen.swift b/Sources/allin/allin/Screens/HomeScreen.swift index 95106d0..c44a6f9 100644 --- a/Sources/allin/allin/Screens/HomeScreen.swift +++ b/Sources/allin/allin/Screens/HomeScreen.swift @@ -2,54 +2,58 @@ // HomeScreen.swift // AllIn // -// Created by étudiant on 22/09/2023. +// Created by étudiant on 26/09/2023. // import SwiftUI struct Home: View { - @Binding var showMenu: Bool + @State var showMenu = false + var page: String var body: some View { - VStack(alignment: .center, spacing: 0) { - TopBarView(showMenu: self.$showMenu) - ScrollView(showsIndicators: false){ - LazyVStack(alignment: .leading, spacing: 0, pinnedViews: [.sectionHeaders]) { - - TrendingBetCard().padding(.top,25).padding([.leading,.trailing],25) - - Section { - VStack(spacing: 20){ - BetCard() - BetCard() - BetCard() - }.padding([.leading,.trailing],25) - } header: { - ZStack{ - AllinColor.fadeInGradiantCard - ScrollView(.horizontal,showsIndicators: false){ - HStack{ - ChoiceCapsule() - ChoiceCapsule() - ChoiceCapsule() - ChoiceCapsule() - ChoiceCapsule() - ChoiceCapsule() - ChoiceCapsule() - }.padding(.leading,25).padding([.top,.bottom],15) - - } - } + + let closeDrag = DragGesture() + .onEnded { + if $0.translation.width < -100 { + withAnimation{ + self.showMenu = false + } + } + } + let openDrag = DragGesture() + .onEnded { + if $0.translation.width > 100 { + withAnimation{ + self.showMenu = true + } + } + } + + GeometryReader { geometry in + ZStack(alignment: .leading) { + Group{ + switch page { + case "Bet": + Bet(showMenu: self.$showMenu) + default: + Bet(showMenu: self.$showMenu) } - + } + Bet(showMenu: self.$showMenu) + .frame(width: geometry.size.width, height: geometry.size.height) + .offset(x: self.showMenu ? geometry.size.width/1.21:0) + .gesture(openDrag) + + if self.showMenu { + MenuView() + .frame(width: geometry.size.width*0.83) + .transition(.move(edge: .leading)) } } - - Spacer() + .gesture(closeDrag) } - .edgesIgnoringSafeArea(.bottom).background(AllinColor.backgroundWhite) } - } diff --git a/Sources/allin/allin/Views/MenuView.swift b/Sources/allin/allin/Views/MenuView.swift index fb4e1e0..f31ec2f 100644 --- a/Sources/allin/allin/Views/MenuView.swift +++ b/Sources/allin/allin/Views/MenuView.swift @@ -12,7 +12,7 @@ struct MenuView: View { var body: some View { VStack(alignment: .leading, spacing: 10) { - NavigationLink(destination: Home(page: "CreationBet").navigationBarBackButtonHidden(true)) + NavigationLink(destination: Home(page: "Bet").navigationBarBackButtonHidden(true)) { ParameterMenuView(icon: "VideoGame", title: "CREER UN BET", description: "Créez un nouveau BET et faites participer vos amis.") .padding([.leading,.trailing], 13) @@ -26,7 +26,7 @@ struct MenuView: View { ParameterMenuView(icon: "Money", title: "BET EN COURS", description: "Gérez vos bets et récompensez les gagnants.") .padding([.leading,.trailing], 13) - + Spacer() Image("GearIcon") .resizable()