SharedComponents.swift
1 // 2 // SharedComponents.swift 3 // RacerTracer 4 // 5 // Created by Alexander Kunau on 29.09.25. 6 // 7 8 import SwiftUI 9 10 // MARK: - Shared SEO Recommendation Card (using existing TechnicalRecommendationCard style) 11 12 struct CommonSEORecommendationCard: View { 13 let recommendation: SEORecommendation 14 15 var body: some View { 16 VStack(alignment: .leading, spacing: 12) { 17 HStack { 18 Image(systemName: recommendation.priority.icon) 19 .foregroundColor(recommendation.priority.color) 20 21 VStack(alignment: .leading, spacing: 4) { 22 Text(recommendation.title) 23 .font(.subheadline) 24 .fontWeight(.semibold) 25 26 Text(recommendation.priority.description) 27 .font(.caption) 28 .padding(.horizontal, 8) 29 .padding(.vertical, 2) 30 .background(recommendation.priority.color.opacity(0.2)) 31 .foregroundColor(recommendation.priority.color) 32 .cornerRadius(4) 33 } 34 35 Spacer() 36 37 Text(recommendation.category) 38 .font(.caption) 39 .foregroundColor(.secondary) 40 } 41 42 Text(recommendation.description) 43 .font(.subheadline) 44 .foregroundColor(.secondary) 45 46 if let impact = recommendation.estimatedImpact { 47 HStack { 48 Text("Impact:") 49 .font(.caption) 50 .fontWeight(.medium) 51 52 Text(impact) 53 .font(.caption) 54 .foregroundColor(.secondary) 55 } 56 } 57 } 58 .padding(16) 59 .background(Color(NSColor.textBackgroundColor)) 60 .cornerRadius(8) 61 .overlay( 62 RoundedRectangle(cornerRadius: 8) 63 .strokeBorder(recommendation.priority.color.opacity(0.3), lineWidth: 1) 64 ) 65 } 66 } 67 68 // MARK: - Extensions for RecommendationPriority 69 70 extension RecommendationPriority { 71 var icon: String { 72 switch self { 73 case .low: return "info.circle" 74 case .medium: return "exclamationmark.circle" 75 case .high: return "exclamationmark.triangle" 76 case .critical: return "exclamationmark.octagon" 77 } 78 } 79 }