graphical changes

multistore
Laurent 2 years ago
parent bcd71ffa06
commit 532e58db80
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 8
      PadelClub/Data/Tournament.swift
  3. 6
      PadelClub/Views/GroupStage/GroupStageView.swift
  4. 2
      PadelClub/Views/Match/MatchSummaryView.swift
  5. 2
      PadelClub/Views/Planning/PlanningSettingsView.swift
  6. 2
      PadelClub/Views/Planning/PlanningView.swift
  7. 6
      PadelClub/Views/Planning/SchedulerView.swift
  8. 2
      PadelClub/Views/Shared/MatchFormatPickerView.swift
  9. 58
      PadelClub/Views/Subscription/OffersHeaderView.swift
  10. 82
      PadelClub/Views/Subscription/SubscriptionInfoView.swift
  11. 12
      PadelClub/Views/Tournament/Shared/DateBoxView.swift
  12. 25
      PadelClub/Views/Tournament/Shared/TournamentCellView.swift
  13. 2
      PadelClub/Views/Tournament/TournamentView.swift

@ -18,7 +18,7 @@
C45BAE442BCA753E002EEC8A /* Purchase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C45BAE432BCA753E002EEC8A /* Purchase.swift */; };
C49EF0192BD694290077B5AA /* PurchaseListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C49EF0182BD694290077B5AA /* PurchaseListView.swift */; };
C49EF01B2BD6A1E80077B5AA /* URLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = C49EF01A2BD6A1E80077B5AA /* URLs.swift */; };
C49EF0262BD80AE80077B5AA /* OffersHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C49EF0252BD80AE80077B5AA /* OffersHeaderView.swift */; };
C49EF0262BD80AE80077B5AA /* SubscriptionInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C49EF0252BD80AE80077B5AA /* SubscriptionInfoView.swift */; };
C4A47D5A2B6D383C00ADC637 /* Tournament.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A47D592B6D383C00ADC637 /* Tournament.swift */; };
C4A47D5E2B6D38EC00ADC637 /* DataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A47D5D2B6D38EC00ADC637 /* DataStore.swift */; };
C4A47D632B6D3D6500ADC637 /* Club.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A47D622B6D3D6500ADC637 /* Club.swift */; };
@ -320,7 +320,7 @@
C45BAE432BCA753E002EEC8A /* Purchase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Purchase.swift; sourceTree = "<group>"; };
C49EF0182BD694290077B5AA /* PurchaseListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchaseListView.swift; sourceTree = "<group>"; };
C49EF01A2BD6A1E80077B5AA /* URLs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLs.swift; sourceTree = "<group>"; };
C49EF0252BD80AE80077B5AA /* OffersHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OffersHeaderView.swift; sourceTree = "<group>"; };
C49EF0252BD80AE80077B5AA /* SubscriptionInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionInfoView.swift; sourceTree = "<group>"; };
C4A47D592B6D383C00ADC637 /* Tournament.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tournament.swift; sourceTree = "<group>"; };
C4A47D5D2B6D38EC00ADC637 /* DataStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStore.swift; sourceTree = "<group>"; };
C4A47D622B6D3D6500ADC637 /* Club.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Club.swift; sourceTree = "<group>"; };
@ -752,7 +752,7 @@
C4A47D8D2B7BBBEC00ADC637 /* StoreManager.swift */,
C4A47D8F2B7BBBEC00ADC637 /* StoreItem.swift */,
C49EF0182BD694290077B5AA /* PurchaseListView.swift */,
C49EF0252BD80AE80077B5AA /* OffersHeaderView.swift */,
C49EF0252BD80AE80077B5AA /* SubscriptionInfoView.swift */,
);
path = Subscription;
sourceTree = "<group>";
@ -1482,7 +1482,7 @@
FFCFC00E2BBC3D4600B82851 /* PointSelectionView.swift in Sources */,
FF089EB62BB00A3800F0AEC7 /* TeamRowView.swift in Sources */,
FF92680B2BCEE3E10080F940 /* ContactManager.swift in Sources */,
C49EF0262BD80AE80077B5AA /* OffersHeaderView.swift in Sources */,
C49EF0262BD80AE80077B5AA /* SubscriptionInfoView.swift in Sources */,
FFCFC00C2BBC3D1E00B82851 /* EditScoreView.swift in Sources */,
FF7091622B90F04300AB08DA /* TournamentOrganizerView.swift in Sources */,
FF92680D2BCEE5EA0080F940 /* NetworkMonitor.swift in Sources */,

@ -1160,3 +1160,11 @@ extension Tournament: TournamentBuildHolder {
federalTournamentAge
}
}
extension Tournament {
static func fake() -> Tournament {
return Tournament(event: "Roland Garros", creator: "", name: "Magic P100", startDate: Date(), endDate: Date(), creationDate: Date(), isPrivate: false, groupStageFormat: .nineGames, roundFormat: nil, loserRoundFormat: nil, groupStageSortMode: .snake, groupStageCount: 4, rankSourceDate: nil, dayDuration: 2, teamCount: 24, teamSorting: .rank, federalCategory: .men, federalLevelCategory: .p100, federalAgeCategory: .a45, groupStageCourtCount: nil, seedCount: 8, closedRegistrationDate: nil, groupStageAdditionalQualified: 0, courtCount: 4, prioritizeClubMembers: false, qualifiedPerGroupStage: 2, teamsPerGroupStage: 4, entryFee: nil)
}
}

@ -91,12 +91,12 @@ struct GroupStageView: View {
GroupStageTeamView(groupStage: groupStage, team: team)
} label: {
HStack(alignment: .center) {
VStack(alignment: .leading, spacing: 0) {
HStack {
VStack(alignment: .leading, spacing: 4.0) {
HStack(spacing: 6.0) {
Text("#\(groupStagePosition + 1)")
Text("Poids \(team.weight)")
}
.font(.caption)
.font(.footnote)
HStack {
if let teamName = team.name {
Text(teamName)

@ -20,10 +20,12 @@ struct MatchSummaryView: View {
}
var color: Color {
return Color(white: 0.9)
matchViewStyle == .plainStyle ? Color(uiColor: .tertiaryLabel) : Color(uiColor: .secondaryLabel)
}
var width: CGFloat {
// return 2.0
matchViewStyle == .plainStyle ? 1 : 2
}

@ -39,7 +39,7 @@ struct PlanningSettingsView: View {
var body: some View {
@Bindable var tournament = tournament
OffersHeaderView()
SubscriptionInfoView()
List {
Section {

@ -93,7 +93,7 @@ struct PlanningView: View {
LabeledContent {
Text(matches.count.formatted() + " match" + matches.count.pluralSuffix)
} label: {
Text(key.formatted(date: .omitted, time: .shortened)).font(.largeTitle)
Text(key.formatted(date: .omitted, time: .shortened)).font(.title).fontWeight(.semibold)
Text(Set(matches.compactMap { $0.roundTitle() }).joined(separator: ", "))
}
}

@ -68,14 +68,14 @@ struct SchedulerView: View {
.environment(tournament)
} label: {
LabeledContent {
Text(round.matchFormat.format).font(.largeTitle)
Text(round.matchFormat.format).font(.title2)
} label: {
if let startDate = round.getStartDate() {
HStack {
Text(startDate.formattedAsHourMinute()).font(.largeTitle)
Text(startDate.formattedAsHourMinute()).font(.title2).fontWeight(.semibold)
if let estimatedEndDate = round.estimatedEndDate(tournament.additionalEstimationDuration) {
Image(systemName: "arrowshape.forward.fill")
Text(estimatedEndDate.formattedAsHourMinute()).font(.largeTitle)
Text(estimatedEndDate.formattedAsHourMinute()).font(.title2).fontWeight(.semibold)
}
}
Text(startDate.formattedAsDate())

@ -38,7 +38,7 @@ struct MatchFormatPickerView: View {
Text("Durée").font(.caption)
}
HStack {
Text(matchFormat.format).font(.largeTitle)
Text(matchFormat.format).font(.title).fontWeight(.semibold)
Spacer()
VStack(alignment: .trailing) {
Text("~" + matchFormat.formattedEstimatedDuration(tournament.additionalEstimationDuration))

@ -1,58 +0,0 @@
//
// OffersHeaderView.swift
// PadelClub
//
// Created by Laurent Morvillier on 23/04/2024.
//
import SwiftUI
struct OffersHeaderView: View {
let payment: Tournament.TournamentPayment? = .free
var body: some View {
VStack {
if let text = self.text {
Text(text)
.multilineTextAlignment(.center)
.font(.callout)
.padding()
.foregroundColor(self.foregroundColor)
.frame(maxWidth: .infinity)
.background(self.backgroundColor)
}
}
}
var foregroundColor: Color {
switch self.payment {
case .free: return .blue
default: return .red
}
}
var backgroundColor: Color {
switch self.payment {
case .free: return Color(red: 0.9, green: 0.9, blue: 1.0)
default: return Color(red: 1.0, green: 0.9, blue: 0.9)
}
}
var text: String? {
switch self.payment {
case .free:
return "Nous vous offrons votre premier tournoi ! Convoquez les équipes, créez les poules, le tableau comme vous le souhaitez. \nEnregistrez les résultats de chaque équipes et diffusez les scores en temps réel sur les écrans de votre club !"
case nil:
return "Vous ne disposez pas d'une offre vous permettant de convoquer les joueurs ou de rentrer les résultats des matchs. Vous pouvez consulter les offres dans l'onglet JA."
default:
return nil
}
}
}
#Preview {
OffersHeaderView()
}

@ -0,0 +1,82 @@
//
// OffersHeaderView.swift
// PadelClub
//
// Created by Laurent Morvillier on 23/04/2024.
//
import SwiftUI
import TipKit
struct SubscriptionInfoView: View {
let payment: Tournament.TournamentPayment? = .free
var body: some View {
switch self.payment {
case .free:
TipView(FreeTournamentTip())
case nil:
TipView(NoPaymentTip())
default:
EmptyView()
}
// VStack {
// if let text = self.text {
// Text(text)
// .multilineTextAlignment(.center)
// .font(.callout)
// .padding()
// .foregroundColor(self.foregroundColor)
// .frame(maxWidth: .infinity)
// .background(self.backgroundColor)
// }
//
// }
}
var foregroundColor: Color {
switch self.payment {
case .free: return .blue
default: return .red
}
}
var backgroundColor: Color {
switch self.payment {
case .free: return Color(red: 0.9, green: 0.9, blue: 1.0)
default: return Color(red: 1.0, green: 0.9, blue: 0.9)
}
}
var text: String? {
switch self.payment {
case .free:
return "Nous vous offrons votre premier tournoi ! Convoquez les équipes, créez les poules, le tableau comme vous le souhaitez. \nEnregistrez les résultats de chaque équipes et diffusez les scores en temps réel sur les écrans de votre club !"
case nil:
return "Vous ne disposez pas d'une offre vous permettant de convoquer les joueurs ou de rentrer les résultats des matchs. Vous pouvez consulter les offres dans l'onglet JA."
default:
return nil
}
}
}
struct FreeTournamentTip: Tip {
var title: Text {
return Text("Nous vous offrons votre premier tournoi ! Convoquez les équipes, créez les poules, le tableau comme vous le souhaitez. \nEnregistrez les résultats de chaque équipes et diffusez les scores en temps réel sur les écrans de votre club !")
}
}
struct NoPaymentTip: Tip {
var title: Text {
return Text("Vous ne disposez pas d'une offre vous permettant de convoquer les joueurs ou de rentrer les résultats des matchs. Vous pouvez consulter les offres dans l'onglet JA.")
}
}
#Preview {
SubscriptionInfoView()
}

@ -12,21 +12,21 @@ struct DateBoxView: View {
var displayStyle: DisplayStyle = .wide
var body: some View {
VStack(alignment: .center, spacing: -2) {
Text(date.formatted(.dateTime.weekday(.abbreviated)))
.font(.caption2)
VStack(alignment: .center, spacing: 0.0) {
Text(date.formatted(.dateTime.weekday(.abbreviated)).uppercased())
HStack(alignment: .bottom) {
Text(date.formatted(.dateTime.day(.twoDigits)))
.font(displayStyle == .wide ? .title : .title3)
.monospacedDigit()
.padding(-2)
}
if displayStyle == .wide {
Text(date.formatted(.dateTime.month(.abbreviated)))
.font(.caption2)
Text(date.formatted(.dateTime.month(.abbreviated)).uppercased())
Text(date.formatted(.dateTime.year()))
.font(.caption2)
}
}
.font(.footnote)
.fontWeight(.semibold)
}
}

@ -12,7 +12,7 @@ struct TournamentCellView: View {
@Environment(NavigationViewModel.self) private var navigation
let tournament: FederalTournamentHolder
let color: Color = .black
// let color: Color = .black
var displayStyle: DisplayStyle = .wide
var event: Event? {
@ -27,27 +27,28 @@ struct TournamentCellView: View {
}
private func _buildView(_ build: any TournamentBuildHolder, existingTournament: Tournament?) -> some View {
HStack {
HStack(spacing: 16.0) {
DateBoxView(date: tournament.startDate, displayStyle: displayStyle == .wide ? .short : .wide)
Rectangle()
.fill(color)
.frame(width: 2)
VStack(alignment: .leading, spacing: -2) {
// Rectangle()
// .fill(Color(white: 0.8))
// .frame(width: 2)
VStack(alignment: .leading, spacing: 0.0) {
if let tournament = tournament as? Tournament {
Text(tournament.locationLabel(displayStyle))
.font(.caption2)
.font(.caption)
} else {
Text(tournament.clubLabel())
.font(.caption2)
.font(.caption)
}
HStack(alignment: .bottom) {
Text(build.level.localizedLabel())
.fontWeight(.semibold)
if displayStyle == .wide {
VStack(alignment: .leading, spacing: 0) {
Text(build.category.localizedLabel())
Text(build.age.localizedLabel())
}
.font(.caption2)
.font(.caption)
}
Spacer()
if let tournament = tournament as? Tournament, displayStyle == .wide {
@ -98,6 +99,10 @@ struct TournamentCellView: View {
}
}
}
.font(.caption2)
.font(.caption)
}
}
#Preview {
TournamentCellView(tournament: Tournament.fake())
}

@ -23,7 +23,7 @@ struct TournamentView: View {
var body: some View {
VStack(spacing: 0.0) {
OffersHeaderView()
SubscriptionInfoView()
List {
Section {
NavigationLink(value: Screen.inscription) {

Loading…
Cancel
Save