Files
boc/aamos-admin-upgrade/ios/AamosAdmin/Components/ModuleToggleRow.swift
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

95 lines
3.6 KiB
Swift

import SwiftUI
struct ModuleToggleRow: View {
let icon: String
let name: String
var description: String? = nil
@Binding var isEnabled: Bool
var iconColor: Color = Color(.systemBlue)
var body: some View {
HStack(spacing: 12) {
Image(systemName: icon)
.font(.system(size: 15, weight: .semibold))
.foregroundStyle(isEnabled ? iconColor : Color(.systemGray3))
.frame(width: 36, height: 36)
.background(
(isEnabled ? iconColor : Color(.systemGray3)).opacity(0.15)
)
.clipShape(RoundedRectangle(cornerRadius: 8))
.animation(.easeInOut(duration: 0.2), value: isEnabled)
VStack(alignment: .leading, spacing: 2) {
Text(name)
.font(.system(size: 15, weight: .medium))
.foregroundStyle(.primary)
if let description {
Text(description)
.font(.system(size: 12))
.foregroundStyle(.secondary)
.lineLimit(1)
}
}
Spacer(minLength: 8)
Toggle("", isOn: $isEnabled)
.labelsHidden()
.tint(iconColor)
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
.background(Color(.secondarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
.contentShape(RoundedRectangle(cornerRadius: 12))
.onTapGesture { isEnabled.toggle() }
}
}
// MARK: - Preview
private struct ModuleTogglePreview: View {
struct Module: Identifiable {
let id = UUID()
let icon: String
let name: String
let description: String
var enabled: Bool
let color: Color
}
@State private var modules: [Module] = [
Module(icon: "brain", name: "AI Core", description: "Neural inference engine", enabled: true, color: Color(.systemBlue)),
Module(icon: "antenna.radiowaves.left.and.right", name: "AAMOS Sync", description: "Real-time agent sync", enabled: true, color: Color(.systemGreen)),
Module(icon: "shield.lefthalf.filled", name: "Security Layer", description: "Threat monitoring", enabled: false, color: Color(.systemOrange)),
Module(icon: "chart.line.uptrend.xyaxis", name: "Analytics", description: "Usage telemetry", enabled: true, color: Color(.systemBlue)),
Module(icon: "bell.badge", name: "Notifications", description: "Push alerts", enabled: false, color: Color(.systemRed)),
Module(icon: "arrow.triangle.2.circlepath", name: "Auto-Restart", description: "Crash recovery daemon", enabled: true, color: Color(.systemGreen)),
]
var body: some View {
NavigationStack {
ScrollView {
LazyVStack(spacing: 8) {
ForEach($modules) { $module in
ModuleToggleRow(
icon: module.icon,
name: module.name,
description: module.description,
isEnabled: $module.enabled,
iconColor: module.color
)
}
}
.padding()
}
.background(Color(.systemBackground))
.navigationTitle("Modules")
.navigationBarTitleDisplayMode(.large)
}
}
}
#Preview { ModuleTogglePreview() }