diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/SecondaryTextColor.colorset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/SecondaryTextColor.colorset/Contents.json new file mode 100644 index 0000000..a36bccc --- /dev/null +++ b/Sources/AllInApp/AllIn/Assets.xcassets/SecondaryTextColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x3C", + "green" : "0x3C", + "red" : "0x3C" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Sources/AllInApp/AllIn/Components/Menu.swift b/Sources/AllInApp/AllIn/Components/Menu.swift index c7ace88..f6ddada 100644 --- a/Sources/AllInApp/AllIn/Components/Menu.swift +++ b/Sources/AllInApp/AllIn/Components/Menu.swift @@ -12,6 +12,15 @@ struct Menu: View { @Inject var authService: IAuthService + let parameters: [(String, String, String, String)] = [ + ("videoGameImage", String(localized: "drawer_create_a_bet"), String(localized: "drawer_create_a_bet_subtitle"), "CreationBet"), + ("eyesImage", String(localized: "drawer_bet_history"), String(localized: "drawer_bet_history_subtitle"),"Historic"), + ("friendsImage", String(localized: "drawer_friends"), String(localized: "drawer_friends_subtitle"), "Friends"), + ("moneyImage", String(localized: "drawer_public_bets"), String(localized: "drawer_public_bets_subtitle"), "Bet"), + ("rankingImage", String(localized: "drawer_ranking"), String(localized: "drawer_ranking_subtitle"), "Ranking"), + ("eyesImage", String(localized: "drawer_current_bets"), String(localized: "drawer_current_bets_subtitle"), "Current") + ] + var body: some View { VStack(alignment: .leading, spacing: 10) { @@ -68,46 +77,13 @@ struct Menu: View { } .padding(.bottom, 15) - NavigationLink(destination: MainView(page: "CreationBet").navigationBarBackButtonHidden(true)) - { - ParameterMenu(image: "videoGameImage", title: String(localized: "drawer_create_a_bet"), description: String(localized: "drawer_create_a_bet_subtitle")) - .padding([.leading,.trailing], 13) - } - - NavigationLink(destination: MainView(page: "Historic") - .navigationBarBackButtonHidden(true)) - { - ParameterMenu(image: "eyesImage", title: String(localized: "drawer_bet_history"), description: String(localized: "drawer_bet_history_subtitle")) - .padding([.leading,.trailing], 13) - } - - NavigationLink(destination: MainView(page: "Friends") - .navigationBarBackButtonHidden(true)) - { - ParameterMenu(image: "friendsImage", title: String(localized: "drawer_friends"), description: String(localized: "drawer_friends_subtitle")) - .padding([.leading,.trailing], 13) - } - - VStack { - NavigationLink(destination: MainView(page: "Bet") - .navigationBarBackButtonHidden(true)) - { - ParameterMenu(image: "moneyImage", title: String(localized: "drawer_public_bets"), description: String(localized: "drawer_public_bets_subtitle")) - .padding([.leading,.trailing], 13) - } - NavigationLink(destination: MainView(page: "Ranking").navigationBarBackButtonHidden(true)) - { - ParameterMenu(image: "rankingImage", title: String(localized: "drawer_ranking"), description: String(localized: "drawer_ranking_subtitle")) - .padding([.leading,.trailing], 13) + ForEach(0.. ()) { - let url = URL(string: Config.allInApi + "/users/register")! + let url = URL(string: Config.allInApi + "users/register")! var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Content-Type") diff --git a/Sources/AllInApp/AllIn/Views/MainView.swift b/Sources/AllInApp/AllIn/Views/MainView.swift index eceb420..6d07610 100644 --- a/Sources/AllInApp/AllIn/Views/MainView.swift +++ b/Sources/AllInApp/AllIn/Views/MainView.swift @@ -48,6 +48,8 @@ struct MainView: View { CreationBetView(showMenu: self.$showMenu) case "Current": CurrentBetView(showMenu: self.$showMenu) + case "Profile": + ProfileView(showMenu: self.$showMenu) default: BetView(showMenu: self.$showMenu) } diff --git a/Sources/AllInApp/AllIn/Views/ProfileView.swift b/Sources/AllInApp/AllIn/Views/ProfileView.swift new file mode 100644 index 0000000..6fb658f --- /dev/null +++ b/Sources/AllInApp/AllIn/Views/ProfileView.swift @@ -0,0 +1,114 @@ +// +// ProfileView.swift +// AllIn +// +// Created by étudiant on 26/05/2024. +// + +import SwiftUI + +struct ProfileView: View { + + @Binding var showMenu: Bool + + let parameters: [(title: String, icon: String, backgroundColor: Color, itemColor: Color)] = [ + (title: "Changer de pseudo", icon: "person", backgroundColor: AllInColors.componentBackgroundColor, itemColor: AllInColors.secondaryTextColor), + (title: "Changer le mot de passe", icon: "lock", backgroundColor: AllInColors.componentBackgroundColor, itemColor: AllInColors.secondaryTextColor), + (title: "Supprimer le compte", icon: "trash", backgroundColor: AllInColors.componentBackgroundColor, itemColor: AllInColors.secondaryTextColor), + (title: "Déconnexion", icon: "xmark", backgroundColor: AllInColors.lightPurpleColor, itemColor: .white) + ] + + var body: some View { + GeometryReader { geometry in + VStack(alignment: .leading, spacing: 0) { + TopBar(showMenu: self.$showMenu) + + VStack(alignment: .leading) { + HStack { + Image("defaultUserImage") + .resizable() + .scaledToFit() + .frame(width: 80, height: 80) + .cornerRadius(180) + + VStack(alignment: .leading, spacing: 5) { + Text("Pseudo") + .fontWeight(.bold) + .font(.system(size: 20)) + + HStack(spacing: 15) { + VStack(){ + Text("114") + .fontWeight(.heavy) + .font(.system(size: 15)) + Text(String(localized: "drawer_bets")) + .fontWeight(.regular) + .font(.system(size: 12)) + .foregroundColor(AllInColors.grey600Color) + } + VStack(){ + Text("343") + .fontWeight(.heavy) + .font(.system(size: 15)) + Text(String(localized: "drawer_best_win")) + .fontWeight(.regular) + .font(.system(size: 12)) + .foregroundColor(AllInColors.grey600Color) + } + VStack(){ + Text("5") + .fontWeight(.heavy) + .font(.system(size: 15)) + Text(String(localized: "drawer_nb_friends")) + .fontWeight(.regular) + .font(.system(size: 12)) + .foregroundColor(AllInColors.grey600Color) + } + } + } + .padding(.leading, 10) + } + Text("Compte") + .fontWeight(.bold) + .font(.system(size: 16)) + .padding(.leading, 13) + .padding(.top, 35) + + VStack(spacing: 0) { + ForEach(0..