fix little stuff

clubs
Raz 1 year ago
parent 80b0e5aa81
commit 6256dc0b9d
  1. 5
      PadelClub/Views/Navigation/MainView.swift
  2. 2
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift
  3. 15
      PadelClub/Views/User/AccountView.swift
  4. 53
      PadelClub/Views/User/ChangePasswordView.swift
  5. 1
      PadelClub/Views/User/LoginView.swift

@ -69,16 +69,21 @@ struct MainView: View {
}
}
}
.toolbarBackground(.visible, for: .tabBar)
TournamentOrganizerView()
.tabItem(for: .tournamentOrganizer)
.toolbarBackground(.visible, for: .tabBar)
OngoingView()
.tabItem(for: .ongoing)
.badge(self.dataStore.runningMatches().count)
.toolbarBackground(.visible, for: .tabBar)
ToolboxView()
.tabItem(for: .toolbox)
.toolbarBackground(.visible, for: .tabBar)
UmpireView()
.tabItem(for: .umpire)
.badge(badgeText)
.toolbarBackground(.visible, for: .tabBar)
// PadelClubView()
// .tabItem(for: .padelClub)
}

@ -776,7 +776,7 @@ struct InscriptionManagerView: View {
}
.buttonBorderShape(.roundedRectangle)
.buttonStyle(.borderedProminent)
.foregroundStyle(.primary)
.foregroundStyle(self.filterMode == filterMode ? Color.white : Color.black)
.tint(self.filterMode == filterMode ? .master : .beige)
}

@ -15,14 +15,17 @@ struct AccountView: View {
var body: some View {
Form {
NavigationLink("Changer de mot de passe") {
ChangePasswordView()
Section {
NavigationLink("Changer de mot de passe") {
ChangePasswordView()
}
}
RowButtonView("Déconnexion", role: .destructive) {
DataStore.shared.disconnect()
handler()
Section {
RowButtonView("Déconnexion", role: .destructive) {
DataStore.shared.disconnect()
handler()
}
}
Section {
RowButtonView("Supprimer mon compte", role: .destructive, confirmationMessage: "Voulez-vous vraiment supprimer définitivement votre compte et ses données associées ?") {
DataStore.shared.deleteAccount()

@ -29,21 +29,15 @@ struct ChangePasswordView: View {
Form {
PasswordField("Old password", text: self.$oldPassword)
PasswordField("Password", text: self.$password1)
PasswordField("Password again", text: self.$password2)
PasswordField("Ancien mot de passe", text: self.$oldPassword)
PasswordField("Nouveau mot de passe", text: self.$password1)
PasswordField("Confirmer du nouveau mot de passe", text: self.$password2)
Section {
Button(action: {
self._changePassword()
}, label: {
if self.isLoading {
Text("Changer de mot de passe")
} else {
ProgressView()
}
})
.frame(maxWidth: .infinity)
RowButtonView("Changer de mot de passe", role: .destructive) {
await self._changePassword()
}
.disabled(isLoading)
} footer: {
if self.errorMessage.count > 0 {
Text(self.errorMessage).foregroundStyle(.logoRed)
@ -60,26 +54,25 @@ struct ChangePasswordView: View {
}
}
.navigationTitle("Changer de mot de passe")
.navigationBarTitleDisplayMode(.inline)
.toolbarBackground(.visible, for: .navigationBar)
}
fileprivate func _changePassword() {
Task {
do {
self.isLoading = true
let service = try StoreCenter.main.service()
_ = try await service.changePassword(
oldPassword: self.oldPassword,
password1: self.password1,
password2: self.password2)
self.isLoading = false
self.showForm = false
} catch {
Logger.error(error)
self.errorMessage = ErrorUtils.message(error: error)
self.isLoading = false
}
fileprivate func _changePassword() async {
do {
self.isLoading = true
let service = try StoreCenter.main.service()
_ = try await service.changePassword(
oldPassword: self.oldPassword,
password1: self.password1,
password2: self.password2)
self.isLoading = false
self.showForm = false
} catch {
Logger.error(error)
self.errorMessage = ErrorUtils.message(error: error)
self.isLoading = false
}
}
}

@ -114,7 +114,6 @@ struct LoginView: View {
focusedField = .password
}
PasswordField("Mot de passe", text: self.$password)
.textContentType(.init(rawValue: ""))
.submitLabel(.send)
.onSubmit(of: .text) {
if password.isEmpty == false && username.isEmpty == false {

Loading…
Cancel
Save