fix: resolve ambiguous color references by removing ShapeStyle extension

The ShapeStyle where Self == Color extension duplicated Color statics,
causing 'ambiguous use' errors in foregroundStyle/stroke/tint/background
contexts. Removed the extension entirely and use explicit Color.xxx prefix
at all call sites instead.
This commit is contained in:
Schwifty 2026-03-22 19:40:51 +00:00
parent 3fbb44d22c
commit 09db3e8ec7
6 changed files with 14 additions and 24 deletions

View file

@ -4,16 +4,6 @@ import SwiftUI
/// Primary: #22B24B (Payfrit Green) /// Primary: #22B24B (Payfrit Green)
/// Dark: #1A8A3A /// Dark: #1A8A3A
// MARK: - ShapeStyle convenience (resolves ambiguous dot-syntax in foregroundStyle/background)
extension ShapeStyle where Self == Color {
static var warningOrange: Color { Color.warningOrange }
static var errorRed: Color { Color.errorRed }
static var successGreen: Color { Color.successGreen }
static var infoBlue: Color { Color.infoBlue }
static var payfritGreen: Color { Color.payfritGreen }
static var payfritGreenDark: Color { Color.payfritGreenDark }
}
extension Color { extension Color {
// MARK: - Brand // MARK: - Brand
static let payfritGreen = Color(red: 0x22/255.0, green: 0xB2/255.0, blue: 0x4B/255.0) static let payfritGreen = Color(red: 0x22/255.0, green: 0xB2/255.0, blue: 0x4B/255.0)

View file

@ -26,7 +26,7 @@ struct BusinessListView: View {
VStack(spacing: 12) { VStack(spacing: 12) {
Image(systemName: "exclamationmark.triangle") Image(systemName: "exclamationmark.triangle")
.font(.system(size: 48)) .font(.system(size: 48))
.foregroundStyle(.warningOrange) .foregroundStyle(Color.warningOrange)
Text("Error") Text("Error")
.font(.headline) .font(.headline)
Text(error) Text(error)

View file

@ -8,7 +8,7 @@ struct DevBanner: View {
.foregroundStyle(.white) .foregroundStyle(.white)
.padding(.horizontal, 12) .padding(.horizontal, 12)
.padding(.vertical, 4) .padding(.vertical, 4)
.background(.warningOrange, in: Capsule()) .background(Color.warningOrange, in: Capsule())
.padding(.top, 4) .padding(.top, 4)
} }
} }

View file

@ -20,7 +20,7 @@ struct LoginView: View {
// Logo // Logo
Image(systemName: "antenna.radiowaves.left.and.right") Image(systemName: "antenna.radiowaves.left.and.right")
.font(.system(size: 64)) .font(.system(size: 64))
.foregroundStyle(.payfritGreen) .foregroundStyle(Color.payfritGreen)
Text("Payfrit Beacon") Text("Payfrit Beacon")
.font(.title.bold()) .font(.title.bold())
@ -49,7 +49,7 @@ struct LoginView: View {
if let error = errorMessage { if let error = errorMessage {
Text(error) Text(error)
.font(.caption) .font(.caption)
.foregroundStyle(.errorRed) .foregroundStyle(Color.errorRed)
} }
Button(action: handleAction) { Button(action: handleAction) {

View file

@ -101,7 +101,7 @@ struct QRScannerView: View {
p.addLine(to: CGPoint(x: 0, y: 0)) p.addLine(to: CGPoint(x: 0, y: 0))
p.addLine(to: CGPoint(x: corner, y: 0)) p.addLine(to: CGPoint(x: corner, y: 0))
} }
.stroke(.payfritGreen, lineWidth: thickness) .stroke(Color.payfritGreen, lineWidth: thickness)
// Top-right // Top-right
Path { p in Path { p in
@ -109,7 +109,7 @@ struct QRScannerView: View {
p.addLine(to: CGPoint(x: w, y: 0)) p.addLine(to: CGPoint(x: w, y: 0))
p.addLine(to: CGPoint(x: w, y: corner)) p.addLine(to: CGPoint(x: w, y: corner))
} }
.stroke(.payfritGreen, lineWidth: thickness) .stroke(Color.payfritGreen, lineWidth: thickness)
// Bottom-left // Bottom-left
Path { p in Path { p in
@ -117,7 +117,7 @@ struct QRScannerView: View {
p.addLine(to: CGPoint(x: 0, y: h)) p.addLine(to: CGPoint(x: 0, y: h))
p.addLine(to: CGPoint(x: corner, y: h)) p.addLine(to: CGPoint(x: corner, y: h))
} }
.stroke(.payfritGreen, lineWidth: thickness) .stroke(Color.payfritGreen, lineWidth: thickness)
// Bottom-right // Bottom-right
Path { p in Path { p in
@ -125,7 +125,7 @@ struct QRScannerView: View {
p.addLine(to: CGPoint(x: w, y: h)) p.addLine(to: CGPoint(x: w, y: h))
p.addLine(to: CGPoint(x: w, y: h - corner)) p.addLine(to: CGPoint(x: w, y: h - corner))
} }
.stroke(.payfritGreen, lineWidth: thickness) .stroke(Color.payfritGreen, lineWidth: thickness)
} }
} }

View file

@ -174,7 +174,7 @@ struct ScanView: View {
VStack(spacing: 12) { VStack(spacing: 12) {
Image(systemName: "exclamationmark.triangle") Image(systemName: "exclamationmark.triangle")
.font(.system(size: 48)) .font(.system(size: 48))
.foregroundStyle(.warningOrange) .foregroundStyle(Color.warningOrange)
Text("Namespace Error") Text("Namespace Error")
.font(.headline) .font(.headline)
Text(errorMessage ?? "Failed to allocate beacon namespace") Text(errorMessage ?? "Failed to allocate beacon namespace")
@ -240,7 +240,7 @@ struct ScanView: View {
if bleManager.bluetoothState != .poweredOn { if bleManager.bluetoothState != .poweredOn {
Label("Bluetooth Off", systemImage: "bluetooth.slash") Label("Bluetooth Off", systemImage: "bluetooth.slash")
.font(.caption) .font(.caption)
.foregroundStyle(.errorRed) .foregroundStyle(Color.errorRed)
} }
} }
.padding(.horizontal) .padding(.horizontal)
@ -323,7 +323,7 @@ struct ScanView: View {
Image(systemName: "light.beacon.max") Image(systemName: "light.beacon.max")
.font(.system(size: 64)) .font(.system(size: 64))
.foregroundStyle(.payfritGreen) .foregroundStyle(Color.payfritGreen)
.modifier(PulseEffectModifier()) .modifier(PulseEffectModifier())
Text("Beacon is Flashing") Text("Beacon is Flashing")
@ -345,7 +345,7 @@ struct ScanView: View {
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
} }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.tint(.payfritGreen) .tint(Color.payfritGreen)
.controlSize(.large) .controlSize(.large)
.padding(.horizontal, 32) .padding(.horizontal, 32)
@ -379,7 +379,7 @@ struct ScanView: View {
Spacer() Spacer()
Image(systemName: "checkmark.circle.fill") Image(systemName: "checkmark.circle.fill")
.font(.system(size: 64)) .font(.system(size: 64))
.foregroundStyle(.successGreen) .foregroundStyle(Color.successGreen)
Text("Beacon Provisioned!") Text("Beacon Provisioned!")
.font(.title2.bold()) .font(.title2.bold())
Text(statusMessage) Text(statusMessage)
@ -400,7 +400,7 @@ struct ScanView: View {
Spacer() Spacer()
Image(systemName: "xmark.circle.fill") Image(systemName: "xmark.circle.fill")
.font(.system(size: 64)) .font(.system(size: 64))
.foregroundStyle(.errorRed) .foregroundStyle(Color.errorRed)
Text("Provisioning Failed") Text("Provisioning Failed")
.font(.title2.bold()) .font(.title2.bold())
Text(errorMessage ?? "Unknown error") Text(errorMessage ?? "Unknown error")