| 1 | import SwiftUI |
| 2 | |
| 3 | @main |
| 4 | struct ControlKitRunnerApp: App { |
| 5 | // MARK: - Internal |
| 6 | |
| 7 | var body: some Scene { |
| 8 | WindowGroup { |
| 9 | ControlKitShowcaseView() |
| 10 | } |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | private struct ControlKitShowcaseView: View { |
| 15 | // MARK: - Internal |
| 16 | |
| 17 | var body: some View { |
| 18 | ScrollView { |
| 19 | VStack(alignment: .leading, spacing: 12) { |
| 20 | HStack(spacing: 10) { |
| 21 | logo |
| 22 | VStack(alignment: .leading, spacing: 2) { |
| 23 | Text("ControlKit") |
| 24 | .font(.headline) |
| 25 | Text("watchOS") |
| 26 | .font(.caption2) |
| 27 | .foregroundStyle(.secondary) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | statusCard |
| 32 | informationCard |
| 33 | } |
| 34 | .padding(12) |
| 35 | } |
| 36 | .background(Color.controlKitGreen.ignoresSafeArea()) |
| 37 | .foregroundStyle(Color.controlKitCream) |
| 38 | } |
| 39 | |
| 40 | // MARK: - Private |
| 41 | |
| 42 | private var logo: some View { |
| 43 | Text("XC\nRS") |
| 44 | .font(.system(size: 14, weight: .black, design: .rounded)) |
| 45 | .multilineTextAlignment(.center) |
| 46 | .lineSpacing(-3) |
| 47 | .foregroundStyle(Color.controlKitGreen) |
| 48 | .frame(width: 40, height: 40) |
| 49 | .background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 10)) |
| 50 | } |
| 51 | |
| 52 | private var statusCard: some View { |
| 53 | VStack(alignment: .leading, spacing: 6) { |
| 54 | Label("Runner online", systemImage: "checkmark.circle.fill") |
| 55 | .font(.footnote) |
| 56 | .foregroundStyle(.green) |
| 57 | Text("Ready for ControlKit automation requests.") |
| 58 | .font(.caption2) |
| 59 | .foregroundStyle(Color.controlKitCream.opacity(0.78)) |
| 60 | } |
| 61 | .padding(12) |
| 62 | .frame(maxWidth: .infinity, alignment: .leading) |
| 63 | .background(.white.opacity(0.1), in: RoundedRectangle(cornerRadius: 14)) |
| 64 | } |
| 65 | |
| 66 | private var informationCard: some View { |
| 67 | VStack(alignment: .leading, spacing: 8) { |
| 68 | infoRow(title: "Project", value: "XCRSControlKit") |
| 69 | infoRow(title: "Creator", value: "smbCloud") |
| 70 | infoRow(title: "Purpose", value: "Companion automation runner") |
| 71 | } |
| 72 | .padding(12) |
| 73 | .frame(maxWidth: .infinity, alignment: .leading) |
| 74 | .background(.white.opacity(0.08), in: RoundedRectangle(cornerRadius: 14)) |
| 75 | } |
| 76 | |
| 77 | private func infoRow(title: String, value: String) -> some View { |
| 78 | VStack(alignment: .leading, spacing: 1) { |
| 79 | Text(title) |
| 80 | .font(.caption2) |
| 81 | .foregroundStyle(Color.controlKitCream.opacity(0.62)) |
| 82 | Text(value) |
| 83 | .font(.caption) |
| 84 | .fontWeight(.semibold) |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | private extension Color { |
| 90 | static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196) |
| 91 | static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925) |
| 92 | } |