multistore
Razmig Sarkissian 1 year ago
parent 2d06fec8de
commit a8ee8bbaff
  1. 8
      PadelClub/Utils/PadelRule.swift
  2. 7
      PadelClub/Views/Navigation/MainView.swift
  3. 40
      PadelClub/Views/Navigation/Umpire/UmpireView.swift
  4. 6
      PadelClub/Views/Tournament/Shared/TournamentCellView.swift

@ -1134,7 +1134,7 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable {
case .twoSetsSuperTie:
return 80
case .twoSetsDecisivePointSuperTie:
return 75
return 70
case .twoSetsOfFourGames:
return 60
case .twoSetsOfFourGamesDecisivePoint:
@ -1142,11 +1142,11 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable {
case .nineGames:
return 45
case .nineGamesDecisivePoint:
return 35
return 40
case .megaTie:
return 20
return 30
case .superTie:
return 15
return 25
}
}

@ -48,6 +48,8 @@ struct MainView: View {
dataStore.matches.filter({ $0.confirmed && $0.startDate != nil && $0.endDate == nil && $0.courtIndex != nil })
}
var badgeText: Text? = Store.main.userName() == nil ? Text("!").font(.headline) : nil
var body: some View {
TabView(selection: selectedTabHandler) {
ActivityView()
@ -61,10 +63,7 @@ struct MainView: View {
.tabItem(for: .toolbox)
UmpireView()
.tabItem(for: .umpire)
// .badge(
// Text("!")
// .font(.headline)
// )
.badge(badgeText)
// PadelClubView()
// .tabItem(for: .padelClub)
}

@ -56,25 +56,24 @@ struct UmpireView: View {
NavigationLink {
MainUserView()
} label: {
LabeledContent {
if Store.main.userName() != nil {
Text(dataStore.user.username)
} else {
Image(systemName: "xmark.circle.fill")
.foregroundStyle(.logoRed)
}
} label: {
Label("Mon compte", systemImage: "person.fill")
}
}
let currentPlayerData = dataStore.user.currentPlayerData()
Section {
if let currentPlayerData {
//todo palmares
ImportedPlayerView(player: currentPlayerData)
.contextMenu {
Button("Copier ma licence") {
UIPasteboard.general.string = currentPlayerData.formattedLicense()
}
Button("Supprimer ma fiche") {
dataStore.user.licenceId = nil
self.dataStore.saveUser()
}
}
// NavigationLink {
//
// } label: {
@ -88,6 +87,25 @@ struct UmpireView: View {
} footer: {
if dataStore.user.licenceId == nil {
Text("Si vous avez participé à un tournoi dans les 12 derniers mois, Padel Club peut vous retrouver.")
} else if let currentPlayerData {
Menu {
Button {
UIPasteboard.general.string = currentPlayerData.formattedLicense()
} label: {
Text("Copier ma licence")
Text(currentPlayerData.formattedLicense())
}
Button("Supprimer ma fiche") {
dataStore.user.licenceId = nil
self.dataStore.saveUser()
}
} label: {
Text("options")
.foregroundStyle(Color.master)
.underline()
}
}
}
@ -112,7 +130,7 @@ struct UmpireView: View {
if let _lastDataSourceDate {
LabeledContent {
Image(systemName: "checkmark.circle.fill")
.tint(.green)
.foregroundStyle(.green)
} label: {
Text(_lastDataSourceDate.monthYearFormatted)
Text("Classement mensuel utilisé")

@ -52,8 +52,14 @@ struct TournamentCellView: View {
// .frame(width: 2)
VStack(alignment: .leading, spacing: 0.0) {
if let tournament = tournament as? Tournament {
HStack {
Text(tournament.locationLabel(displayStyle))
.font(.caption)
Spacer()
if tournament.isPrivate {
Text("privé").foregroundStyle(.secondary)
}
}
} else {
Text(tournament.clubLabel())
.font(.caption)

Loading…
Cancel
Save