|
|
|
|
@ -18,7 +18,8 @@ struct TournamentCellView: View { |
|
|
|
|
var displayStyle: DisplayStyle = .wide |
|
|
|
|
var displayContext: DisplayContext = .edition |
|
|
|
|
@State var shouldTournamentBeOver: Bool = false |
|
|
|
|
|
|
|
|
|
@State private var inProgressBuild: (String, any TournamentBuildHolder)? = nil |
|
|
|
|
|
|
|
|
|
var event: Event? { |
|
|
|
|
guard let federalTournament = tournament as? FederalTournament else { return nil } |
|
|
|
|
return dataStore.events.first(where: { $0.tenupId == federalTournament.id.string }) |
|
|
|
|
@ -144,15 +145,20 @@ struct TournamentCellView: View { |
|
|
|
|
Text(teamCount.formatted()) |
|
|
|
|
} |
|
|
|
|
} else if let federalTournament = tournament as? FederalTournament, navigation.agendaDestination != .around { |
|
|
|
|
Button { |
|
|
|
|
_createOrShow(federalTournament: federalTournament, existingTournament: existingTournament, build: build) |
|
|
|
|
} label: { |
|
|
|
|
Image(systemName: existingTournament != nil ? "checkmark.circle.fill" : "square.and.arrow.down") |
|
|
|
|
.resizable() |
|
|
|
|
.scaledToFit() |
|
|
|
|
.frame(height: 28) |
|
|
|
|
.accessibilityLabel("importer ou ouvrir") |
|
|
|
|
.tint(existingTournament != nil ? Color.green : nil) |
|
|
|
|
|
|
|
|
|
if let inProgressBuild, build.age == inProgressBuild.1.age, build.level == inProgressBuild.1.level, build.category == inProgressBuild.1.category, inProgressBuild.0 == federalTournament.id { |
|
|
|
|
ProgressView() |
|
|
|
|
} else { |
|
|
|
|
Button { |
|
|
|
|
_createOrShow(federalTournament: federalTournament, existingTournament: existingTournament, build: build) |
|
|
|
|
} label: { |
|
|
|
|
Image(systemName: existingTournament != nil ? "checkmark.circle.fill" : "square.and.arrow.down") |
|
|
|
|
.resizable() |
|
|
|
|
.scaledToFit() |
|
|
|
|
.frame(height: 28) |
|
|
|
|
.accessibilityLabel("importer ou ouvrir") |
|
|
|
|
.tint(existingTournament != nil ? Color.green : nil) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -221,6 +227,8 @@ struct TournamentCellView: View { |
|
|
|
|
newTournament.umpireCustomMail = federalTournament.mailLabel() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inProgressBuild = (federalTournament.id, build) |
|
|
|
|
|
|
|
|
|
Task { |
|
|
|
|
do { |
|
|
|
|
let umpireData = try await NetworkFederalService.shared.getUmpireData(idTournament: federalTournament.id) |
|
|
|
|
@ -240,6 +248,10 @@ struct TournamentCellView: View { |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await MainActor.run { |
|
|
|
|
inProgressBuild = nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|