Subscription tips improvements

multistore
Laurent 2 years ago
parent 1a2de6aa5d
commit f99893b0d5
  1. 38
      PadelClub/Assets.xcassets/beige.colorset/Contents.json
  2. 0
      PadelClub/Assets.xcassets/logoBackground.colorset/Contents.json
  3. 38
      PadelClub/Assets.xcassets/logoOrange.colorset/Contents.json
  4. 38
      PadelClub/Assets.xcassets/logoRed.colorset/Contents.json
  5. 38
      PadelClub/Assets.xcassets/logoYellow.colorset/Contents.json
  6. 2
      PadelClub/Extensions/Color+Extensions.swift
  7. 13
      PadelClub/Manager/Tips.swift
  8. 2
      PadelClub/Views/Navigation/Agenda/WelcomeView.swift
  9. 4
      PadelClub/Views/Planning/PlanningSettingsView.swift
  10. 59
      PadelClub/Views/Subscription/SubscriptionInfoView.swift
  11. 2
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.808",
"green" : "0.906",
"red" : "0.980"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.573",
"red" : "0.953"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.220",
"green" : "0.251",
"red" : "0.910"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.827",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -8,6 +8,7 @@
import SwiftUI import SwiftUI
extension Color { extension Color {
func variation(withHueOffset hueOffset: Double = 0, saturationFactor: Double = 0.4, brightnessFactor: Double = 0.8, opacity: Double = 0.5) -> Color { func variation(withHueOffset hueOffset: Double = 0, saturationFactor: Double = 0.4, brightnessFactor: Double = 0.8, opacity: Double = 0.5) -> Color {
var hue: CGFloat = 0 var hue: CGFloat = 0
var saturation: CGFloat = 0 var saturation: CGFloat = 0
@ -30,4 +31,5 @@ extension Color {
return Color(hue: Double(hue), saturation: Double(saturation), brightness: Double(brightness), opacity: Double(alpha)) return Color(hue: Double(hue), saturation: Double(saturation), brightness: Double(brightness), opacity: Double(alpha))
} }
} }

@ -337,9 +337,16 @@ struct NotFoundAreWalkOutTip: Tip {
struct TipStyleModifier: ViewModifier { struct TipStyleModifier: ViewModifier {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
var tint: Color? var tint: Color?
var background: Color?
func body(content: Content) -> some View { func body(content: Content) -> some View {
if let tint {
if let background {
content
.tint(.white)
.listRowInsets(EdgeInsets())
.tipBackground(background)
} else if let tint {
if colorScheme == .light { if colorScheme == .light {
content content
.tint(tint) .tint(tint)
@ -364,7 +371,7 @@ struct TipStyleModifier: ViewModifier {
} }
extension View { extension View {
func tipStyle(tint: Color?) -> some View { func tipStyle(tint: Color?, background: Color? = nil) -> some View {
modifier(TipStyleModifier(tint: tint)) modifier(TipStyleModifier(tint: tint, background: background))
} }
} }

@ -13,7 +13,7 @@ struct WelcomeView: View {
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.tint(.launchScreenBackground) .tint(.logoBackground)
.listRowBackground(Color.clear) .listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(.zero)) .listRowInsets(EdgeInsets(.zero))
} }

@ -39,9 +39,9 @@ struct PlanningSettingsView: View {
var body: some View { var body: some View {
@Bindable var tournament = tournament @Bindable var tournament = tournament
SubscriptionInfoView()
List { List {
SubscriptionInfoView()
Section { Section {
DatePicker(tournament.startDate.formatted(.dateTime.weekday()), selection: $tournament.startDate) DatePicker(tournament.startDate.formatted(.dateTime.weekday()), selection: $tournament.startDate)
LabeledContent { LabeledContent {

@ -10,57 +10,23 @@ import TipKit
struct SubscriptionInfoView: View { struct SubscriptionInfoView: View {
let payment: Tournament.TournamentPayment? = .free var payment: Tournament.TournamentPayment? = .free
init() {
self.payment = Guard.main.paymentForNewTournament()
}
var body: some View { var body: some View {
switch self.payment { switch self.payment {
case .free: case .free:
TipView(FreeTournamentTip()) TipView(FreeTournamentTip()).tipStyle(tint: nil, background: .blue.opacity(0.2))
case nil: case nil:
TipView(NoPaymentTip()) TipView(NoPaymentTip()).tipStyle(tint: nil, background: .logoRed)
default: default:
EmptyView() 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
}
} }
} }
@ -69,11 +35,20 @@ struct FreeTournamentTip: Tip {
var title: Text { 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 !") 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 !")
} }
var image: Image? {
Image(systemName: "gift.fill")
}
} }
struct NoPaymentTip: Tip { struct NoPaymentTip: Tip {
var title: Text { 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.") return Text("Vous ne disposez plus d'une offre vous permettant de convoquer les joueurs et de rentrer les résultats des matchs. Nous vous invitons à consulter les offres dans l'onglet JA.").foregroundStyle(.white)
}
var image: Image? {
Image(systemName: "exclamationmark.bubble.fill")
} }
} }

@ -300,7 +300,7 @@ struct InscriptionManagerView: View {
} }
} }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.tint(.launchScreenBackground) .tint(.logoBackground)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.padding(16) .padding(16)
} }

Loading…
Cancel
Save