payfrit-food-ios/PayfritFood/Views/ProductTab/NOVABadge.swift
John Pinkyfloyd 71e7ec34f6 Initial commit: PayfritFood iOS app
- SwiftUI + async/await architecture
- Barcode scanning with AVFoundation
- Product display with score ring, NOVA badge, nutrition
- Alternatives with sort/filter
- Auth (login/register)
- Favorites & history
- Account management
- Dark theme
- Connected to food.payfrit.com API (Open Food Facts proxy)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-16 16:58:21 -07:00

48 lines
1.3 KiB
Swift

import SwiftUI
struct NOVABadge: View {
let novaGroup: Int
var body: some View {
VStack(spacing: 8) {
ZStack {
RoundedRectangle(cornerRadius: 12)
.fill(novaColor)
.frame(width: 80, height: 80)
VStack(spacing: 2) {
Text("NOVA")
.font(.caption2.bold())
.foregroundColor(.white.opacity(0.8))
Text("\(novaGroup)")
.font(.system(size: 36, weight: .bold, design: .rounded))
.foregroundColor(.white)
}
}
Text(novaLabel)
.font(.caption)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.frame(width: 100)
}
}
private var novaColor: Color {
switch novaGroup {
case 1: return .green
case 2: return .yellow
case 3: return .orange
default: return .red
}
}
private var novaLabel: String {
switch novaGroup {
case 1: return "Unprocessed"
case 2: return "Processed ingredients"
case 3: return "Processed"
default: return "Ultra-processed"
}
}
}