| 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 | .defaultSize(width: 820, height: 620) |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | private struct ControlKitShowcaseView: View { |
| 16 | // MARK: - Internal |
| 17 | |
| 18 | var body: some View { |
| 19 | ScrollView { |
| 20 | VStack(alignment: .leading, spacing: 28) { |
| 21 | HStack(spacing: 18) { |
| 22 | logo |
| 23 | VStack(alignment: .leading, spacing: 4) { |
| 24 | Text("ControlKit") |
| 25 | .font(.system(size: 40, weight: .bold, design: .rounded)) |
| 26 | Text("Apple platform automation") |
| 27 | .font(.title3) |
| 28 | .foregroundStyle(.secondary) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | Text("A clean-room runner for reliable black-box testing across Apple platforms.") |
| 33 | .font(.title2.weight(.medium)) |
| 34 | .fixedSize(horizontal: false, vertical: true) |
| 35 | |
| 36 | statusCard |
| 37 | informationCard |
| 38 | |
| 39 | Link(destination: repositoryURL) { |
| 40 | Label("View project on GitHub", systemImage: "arrow.up.right") |
| 41 | .font(.headline) |
| 42 | .frame(maxWidth: .infinity) |
| 43 | } |
| 44 | .buttonStyle(.borderedProminent) |
| 45 | } |
| 46 | .padding(40) |
| 47 | .frame(maxWidth: 760, alignment: .leading) |
| 48 | } |
| 49 | .frame(minWidth: 640, minHeight: 480) |
| 50 | } |
| 51 | |
| 52 | // MARK: - Private |
| 53 | |
| 54 | private let repositoryURL = URL(string: "https://github.com/ondeinference/xcrs-controlkit")! |
| 55 | |
| 56 | private var logo: some View { |
| 57 | Text("XC\nRS") |
| 58 | .font(.system(size: 30, weight: .black, design: .rounded)) |
| 59 | .multilineTextAlignment(.center) |
| 60 | .lineSpacing(-8) |
| 61 | .foregroundStyle(Color.controlKitGreen) |
| 62 | .frame(width: 96, height: 96) |
| 63 | .background(Color.controlKitCream, in: RoundedRectangle(cornerRadius: 24)) |
| 64 | } |
| 65 | |
| 66 | private var statusCard: some View { |
| 67 | VStack(alignment: .leading, spacing: 14) { |
| 68 | Label("Runner online", systemImage: "checkmark.circle.fill") |
| 69 | .font(.headline) |
| 70 | .foregroundStyle(.green) |
| 71 | Text("The XCTest host is ready to receive ControlKit automation requests.") |
| 72 | .foregroundStyle(.secondary) |
| 73 | } |
| 74 | .padding(22) |
| 75 | .frame(maxWidth: .infinity, alignment: .leading) |
| 76 | .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20)) |
| 77 | } |
| 78 | |
| 79 | private var informationCard: some View { |
| 80 | VStack(alignment: .leading, spacing: 16) { |
| 81 | infoRow(title: "Project", value: "XCRSControlKit") |
| 82 | infoRow(title: "Creator", value: "smbCloud") |
| 83 | infoRow(title: "Platform", value: "macOS") |
| 84 | infoRow(title: "Purpose", value: "Native pointer and keyboard automation runner") |
| 85 | } |
| 86 | .padding(22) |
| 87 | .frame(maxWidth: .infinity, alignment: .leading) |
| 88 | .background(.thinMaterial, in: RoundedRectangle(cornerRadius: 20)) |
| 89 | } |
| 90 | |
| 91 | private func infoRow(title: String, value: String) -> some View { |
| 92 | HStack { |
| 93 | Text(title) |
| 94 | .foregroundStyle(.secondary) |
| 95 | Spacer() |
| 96 | Text(value) |
| 97 | .fontWeight(.semibold) |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | private extension Color { |
| 103 | static let controlKitGreen = Color(red: 0.106, green: 0.263, blue: 0.196) |
| 104 | static let controlKitCream = Color(red: 0.961, green: 0.953, blue: 0.925) |
| 105 | } |