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: case .twoSetsSuperTie:
return 80 return 80
case .twoSetsDecisivePointSuperTie: case .twoSetsDecisivePointSuperTie:
return 75 return 70
case .twoSetsOfFourGames: case .twoSetsOfFourGames:
return 60 return 60
case .twoSetsOfFourGamesDecisivePoint: case .twoSetsOfFourGamesDecisivePoint:
@ -1142,11 +1142,11 @@ enum MatchFormat: Int, Hashable, Codable, CaseIterable {
case .nineGames: case .nineGames:
return 45 return 45
case .nineGamesDecisivePoint: case .nineGamesDecisivePoint:
return 35 return 40
case .megaTie: case .megaTie:
return 20 return 30
case .superTie: 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 }) 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 { var body: some View {
TabView(selection: selectedTabHandler) { TabView(selection: selectedTabHandler) {
ActivityView() ActivityView()
@ -61,10 +63,7 @@ struct MainView: View {
.tabItem(for: .toolbox) .tabItem(for: .toolbox)
UmpireView() UmpireView()
.tabItem(for: .umpire) .tabItem(for: .umpire)
// .badge( .badge(badgeText)
// Text("!")
// .font(.headline)
// )
// PadelClubView() // PadelClubView()
// .tabItem(for: .padelClub) // .tabItem(for: .padelClub)
} }

@ -56,25 +56,24 @@ struct UmpireView: View {
NavigationLink { NavigationLink {
MainUserView() MainUserView()
} label: {
LabeledContent {
if Store.main.userName() != nil {
Text(dataStore.user.username)
} else {
Image(systemName: "xmark.circle.fill")
.foregroundStyle(.logoRed)
}
} label: { } label: {
Label("Mon compte", systemImage: "person.fill") Label("Mon compte", systemImage: "person.fill")
} }
}
let currentPlayerData = dataStore.user.currentPlayerData() let currentPlayerData = dataStore.user.currentPlayerData()
Section { Section {
if let currentPlayerData { if let currentPlayerData {
//todo palmares //todo palmares
ImportedPlayerView(player: currentPlayerData) 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 { // NavigationLink {
// //
// } label: { // } label: {
@ -88,6 +87,25 @@ struct UmpireView: View {
} footer: { } footer: {
if dataStore.user.licenceId == nil { if dataStore.user.licenceId == nil {
Text("Si vous avez participé à un tournoi dans les 12 derniers mois, Padel Club peut vous retrouver.") 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 { if let _lastDataSourceDate {
LabeledContent { LabeledContent {
Image(systemName: "checkmark.circle.fill") Image(systemName: "checkmark.circle.fill")
.tint(.green) .foregroundStyle(.green)
} label: { } label: {
Text(_lastDataSourceDate.monthYearFormatted) Text(_lastDataSourceDate.monthYearFormatted)
Text("Classement mensuel utilisé") Text("Classement mensuel utilisé")

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

Loading…
Cancel
Save